Represents a 64-byte extended private key. An extended private key is a requirement from Choas.NaCl.
More...
|
| PrivateKey (byte[] privateKey) |
| Initializes the PrivateKey object with a 64 byte array that represents the expanded private key from seed.
For example, using: Ed25519.ExpandedPrivateKeyFromSeed(seed) .
This constructor is expected to be called from the Account constructor.
Note: To create a private key from a 32-byte string see PrivateKey(string key)
|
|
| PrivateKey (string key) |
| Initializes the PrivateKey object with a 64 character (32-byte) ASCII representation of a private key.
Note: The undelying cryptographic library (Chaos.NaCL) uses an extended private key (64 byte) for fast computation.
This hex string is used as a seed to create an extended private key when KeyBytes is requested.
|
|
| PrivateKey (ReadOnlySpan< byte > privateKey) |
| Initialize the PrivateKey object from the given string.
|
|
PublicKey | PublicKey () |
| Derives public key from the private key bytes.
|
|
Signature | Sign (byte[] message) |
| Sign a message using the extended private key.
|
|
void | Serialize (Serialization serializer) |
| Serialize private key.
|
|
override bool | Equals (object obj) |
|
override int | GetHashCode () |
|
override string | ToString () |
|
|
const int | ExtendedKeyLength = 64 |
| Extended private key length.
|
|
const int | KeyLength = 32 |
| Private key length.
|
|
|
string | Key [get, set] |
| The key as a 32-byte hexadecimal string (64 characters).
|
|
byte[] | KeyBytes [get, set] |
| The 32-byte private key in bytes. Checks if we have the 32-byte private key or 64-byte extended key, otherwise uses the string representation to create both.
|
|
Represents a 64-byte extended private key. An extended private key is a requirement from Choas.NaCl.
Note that the hexadecimal string representation is of the 32-byte private key on it's own.
◆ PrivateKey() [1/3]
Aptos.Accounts.PrivateKey.PrivateKey |
( |
byte[] |
privateKey | ) |
|
|
inline |
Initializes the PrivateKey object with a 64 byte array that represents the expanded private key from seed.
For example, using: Ed25519.ExpandedPrivateKeyFromSeed(seed)
.
This constructor is expected to be called from the Account constructor.
Note: To create a private key from a 32-byte string see PrivateKey(string key)
- Parameters
-
privateKey | 64-byte array representation of the private key. |
◆ PrivateKey() [2/3]
Aptos.Accounts.PrivateKey.PrivateKey |
( |
string |
key | ) |
|
|
inline |
Initializes the PrivateKey object with a 64 character (32-byte) ASCII representation of a private key.
Note: The undelying cryptographic library (Chaos.NaCL) uses an extended private key (64 byte) for fast computation.
This hex string is used as a seed to create an extended private key when KeyBytes is requested.
- Parameters
-
key | The private key as an ASCII encoded string.
Example: 0x64f57603b58af16907c18a866123286e1cbce89790613558dc1775abb3fc5c8c |
◆ PrivateKey() [3/3]
Aptos.Accounts.PrivateKey.PrivateKey |
( |
ReadOnlySpan< byte > |
privateKey | ) |
|
|
inline |
Initialize the PrivateKey object from the given string.
- Parameters
-
key | The private key as a hex encoded byte array. |
◆ FromHex()
static PrivateKey Aptos.Accounts.PrivateKey.FromHex |
( |
string |
key | ) |
|
|
inlinestatic |
Create a private key from a string literal. Conforms to the standard Python and Typescript Aptos SDK.
- Parameters
-
key | The private key as an ASCII encoded string. |
- Returns
- Private key object.
◆ operator string()
static implicit Aptos.Accounts.PrivateKey.operator string |
( |
PrivateKey |
privateKey | ) |
|
|
static |
Convert a PrivateKey object to hexadecimal string representation of private key.
- Parameters
-
privateKey | The PrivateKey object. |
- Returns
- Hexadecimal string representing the private key.
◆ operator==()
Compartor for two private keys.
- Parameters
-
lhs | First private key in comparison.. |
rhs | Second private key in comparison. |
- Returns
◆ PublicKey()
PublicKey Aptos.Accounts.PrivateKey.PublicKey |
( |
| ) |
|
|
inline |
Derives public key from the private key bytes.
- Returns
- PublicKey object.
◆ Serialize()
void Aptos.Accounts.PrivateKey.Serialize |
( |
Serialization |
serializer | ) |
|
|
inline |
Serialize private key.
- Parameters
-
serializer | Serializer object |
◆ Sign()
Signature Aptos.Accounts.PrivateKey.Sign |
( |
byte[] |
message | ) |
|
|
inline |
Sign a message using the extended private key.
- Parameters
-
message | The message to sign, represented in bytes. |
- Returns
- The signature generated for the message as an object
The documentation for this class was generated from the following file:
- Aptos.Accounts/PrivateKey.cs