Class: PublicKey 
The non-secret (public) part of an asymmetric key pair that is typically used to digitally verify or encrypt data.
Constructors 
new PublicKey() 
new PublicKey(
bytes):PublicKey
Creates a new public key from a byte array.
Throws when the byte array is not exactly 32 bytes long.
Parameters 
• bytes: Uint8Array
Returns 
Defined in 
web.d.ts:1702
Methods 
__getClassname() 
__getClassname():
string
Returns 
string
Defined in 
web.d.ts:1662
free() 
free():
void
Returns 
void
Defined in 
web.d.ts:1658
serialize() 
serialize():
Uint8Array
Serializes the public key to a byte array.
Returns 
Uint8Array
Defined in 
web.d.ts:1707
toAddress() 
toAddress():
Address
Gets the public key's address.
Returns 
Defined in 
web.d.ts:1725
toHex() 
toHex():
string
Formats the public key into a hex string.
Returns 
string
Defined in 
web.d.ts:1720
verify() 
verify(
signature,data):boolean
Verifies that a signature is valid for this public key and the provided data.
Parameters 
• signature: Signature
• data: Uint8Array
Returns 
boolean
Defined in 
web.d.ts:1675
derive() 
staticderive(private_key):PublicKey
Derives a public key from an existing private key.
Parameters 
• private_key: PrivateKey
Returns 
Defined in 
web.d.ts:1668
fromHex() 
staticfromHex(hex):PublicKey
Parses a public key from its hex representation.
Throws when the string is not valid hex format or when it represents less than 32 bytes.
Parameters 
• hex: string
Returns 
Defined in 
web.d.ts:1715
fromRaw() 
staticfromRaw(raw_bytes):PublicKey
Deserializes a public key from its raw representation.
Parameters 
• raw_bytes: Uint8Array
Returns 
Defined in 
web.d.ts:1695
fromSpki() 
staticfromSpki(spki_bytes):PublicKey
Deserializes a public key from its SPKI representation.
Parameters 
• spki_bytes: Uint8Array
Returns 
Defined in 
web.d.ts:1689
unserialize() 
staticunserialize(bytes):PublicKey
Deserializes a public key from a byte array.
Throws when the byte array contains less than 32 bytes.
Parameters 
• bytes: Uint8Array
Returns 
Defined in 
web.d.ts:1683