Aptos Unity SDK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
Aptos.Accounts.PublicKey Class Reference

Represents a 32-byte public key. More...

Public Member Functions

 PublicKey (byte[] publicKey)
 Initializes the PublicKey object with a given byte array.
 
 PublicKey (string key)
 Initializes the PublicKey object with a given hexadecimal representation of public .
 
 PublicKey (ReadOnlySpan< byte > publicKey)
 Initialize the PublicKey object from the given string.
 
bool Verify (byte[] message, Signature signature)
 Verify a signed message using the current public key.
 
bool IsOnCurve ()
 Check if PubliKey is a valid on the Ed25519 curve.
 
void Serialize (Serialization serializer)
 Serialize public key.
 
override bool Equals (object obj)
 
override int GetHashCode ()
 Value used as a hash.
 
override string ToString ()
 ToString implementation return the key as a hex string.
 

Static Public Member Functions

static PublicKey Deserialize (Deserialization deserializer)
 
static bool operator== (PublicKey lhs, PublicKey rhs)
 Compares two public key objects.
 
static bool operator!= (PublicKey lhs, PublicKey rhs)
 Compares two public key objects for inequality.
 
static implicit operator string (PublicKey publicKey)
 Convert a PublicKey object to hex encoded string representatio public key.
 
static operator PublicKey (string publicKey)
 Convert Hex encoded string of a public key to PublicKey object.
 
static implicit operator byte[] (PublicKey publicKey)
 Convert a PublicKey object to a byte array representation of a public key.
 
static operator PublicKey (byte[] keyBytes)
 Convert byte array representation of a public key to a PublicKey object.
 

Static Public Attributes

const int KeyLength = 32
 Public key length.
 

Properties

string Key [get, set]
 The key as a hexadecimal string.
 
byte[] KeyBytes [get, set]
 The key in bytes.
 

Detailed Description

Represents a 32-byte public key.

Constructor & Destructor Documentation

◆ PublicKey() [1/3]

Aptos.Accounts.PublicKey.PublicKey ( byte[]  publicKey)
inline

Initializes the PublicKey object with a given byte array.

Parameters
publicKeyThe public key as byte array.

◆ PublicKey() [2/3]

Aptos.Accounts.PublicKey.PublicKey ( string  key)
inline

Initializes the PublicKey object with a given hexadecimal representation of public .

Parameters
keyThe public key as a hexadecimal string.
Example: 0x586e3c8d447d7679222e139033e3820235e33da5091e9b0bb8f1a112cf0c8ff5


◆ PublicKey() [3/3]

Aptos.Accounts.PublicKey.PublicKey ( ReadOnlySpan< byte >  publicKey)
inline

Initialize the PublicKey object from the given string.

Parameters
publicKeyThe public key as a byte array.

Member Function Documentation

◆ GetHashCode()

override int Aptos.Accounts.PublicKey.GetHashCode ( )

Value used as a hash.

Returns

◆ IsOnCurve()

bool Aptos.Accounts.PublicKey.IsOnCurve ( )

Check if PubliKey is a valid on the Ed25519 curve.

Returns
Returns true if public key is on the curve.

◆ operator byte[]()

static implicit Aptos.Accounts.PublicKey.operator byte[] ( PublicKey  publicKey)
static

Convert a PublicKey object to a byte array representation of a public key.

Parameters
publicKeyThe PublicKey object.
Returns
Public key as a byte array.

◆ operator PublicKey() [1/2]

static Aptos.Accounts.PublicKey.operator PublicKey ( byte[]  keyBytes)
explicitstatic

Convert byte array representation of a public key to a PublicKey object.

Parameters
keyBytesThe public key as a byte array.
Returns
PublicKey object.

◆ operator PublicKey() [2/2]

static Aptos.Accounts.PublicKey.operator PublicKey ( string  publicKey)
explicitstatic

Convert Hex encoded string of a public key to PublicKey object.

Parameters
publicKeyhex encoded string representing a public key.
Returns
PublicKey object.

◆ operator string()

static implicit Aptos.Accounts.PublicKey.operator string ( PublicKey  publicKey)
static

Convert a PublicKey object to hex encoded string representatio public key.

Parameters
publicKeyThe PublicKey object.
Returns
Hex encoded string representing the public key.

◆ operator!=()

static bool Aptos.Accounts.PublicKey.operator!= ( PublicKey  lhs,
PublicKey  rhs 
)
static

Compares two public key objects for inequality.

Parameters
lhs
rhs
Returns

◆ operator==()

static bool Aptos.Accounts.PublicKey.operator== ( PublicKey  lhs,
PublicKey  rhs 
)
inlinestatic

Compares two public key objects.

Parameters
lhs
rhs
Returns
True if public keys are equal. False is public keys are not equal.

◆ Serialize()

void Aptos.Accounts.PublicKey.Serialize ( Serialization  serializer)
inline

Serialize public key.

Parameters
serializerSerializer object

◆ ToString()

override string Aptos.Accounts.PublicKey.ToString ( )

ToString implementation return the key as a hex string.

Returns

◆ Verify()

bool Aptos.Accounts.PublicKey.Verify ( byte[]  message,
Signature  signature 
)
inline

Verify a signed message using the current public key.

Parameters
messageMessage that was signed.
signatureThe signature from the message.
Returns

The documentation for this class was generated from the following file: