Class PrivateKey
- Namespace
- Aptos
- Assembly
- Aptos.dll
public abstract class PrivateKey : Serializable
- Inheritance
-
PrivateKey
- Derived
- Inherited Members
Constructors
PrivateKey(PrivateKeyVariant)
protected PrivateKey(PrivateKeyVariant type)
Parameters
type
PrivateKeyVariant
Fields
AIP80_PREFIXES
The AIP-80 compliant prefixes for each private key type
public static readonly Dictionary<PrivateKeyVariant, string> AIP80_PREFIXES
Field Value
Remarks
Read about AIP-80: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md
Type
public PrivateKeyVariant Type
Field Value
Methods
FormatPrivateKey(byte[], PrivateKeyVariant)
Format a HexInput to an AIP-80 compliant string.
public static string FormatPrivateKey(byte[] privateKey, PrivateKeyVariant type)
Parameters
privateKey
byte[]The HexString or byte array format of the private key.
type
PrivateKeyVariantThe private key type
Returns
- string
AIP-80 compliant string.
Remarks
Read about AIP-80: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md
FormatPrivateKey(string, PrivateKeyVariant)
Format a HexInput to an AIP-80 compliant string.
public static string FormatPrivateKey(string privateKey, PrivateKeyVariant type)
Parameters
privateKey
stringThe HexString or byte array format of the private key.
type
PrivateKeyVariantThe private key type
Returns
- string
AIP-80 compliant string.
Remarks
Read about AIP-80: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md
ParseHexInput(byte[], PrivateKeyVariant)
Parse a HexInput that may be a HexString, byte array, or a AIP-80 compliant string to a Hex instance.
public static Hex ParseHexInput(byte[] value, PrivateKeyVariant type)
Parameters
value
byte[]A HexString, byte array, or AIP-80 compliant string.
type
PrivateKeyVariantThe private key type
Returns
- Hex
A Hex instance.
ParseHexInput(string, PrivateKeyVariant, bool?)
Parse a HexInput that may be a HexString, byte array, or a AIP-80 compliant string to a Hex instance.
public static Hex ParseHexInput(string value, PrivateKeyVariant type, bool? strict = null)
Parameters
value
stringA HexString, byte array, or AIP-80 compliant string.
type
PrivateKeyVariantThe private key type
strict
bool?If true, the value MUST be compliant with AIP-80. If false, the value MAY be compliant with AIP-80 and ignore warnings.
Returns
- Hex
A Hex instance.
PublicKey()
public abstract PublicKey PublicKey()
Returns
Sign(byte[])
public abstract PublicKeySignature Sign(byte[] message)
Parameters
message
byte[]
Returns
Sign(string)
public virtual PublicKeySignature Sign(string message)
Parameters
message
string
Returns
ToAIP80String()
public virtual string ToAIP80String()
Returns
ToByteArray()
public abstract byte[] ToByteArray()
Returns
- byte[]
ToHexString()
public virtual string ToHexString()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.