Class KeyPair
KeyPair represents public (and secret) keys of the account. Currently KeyPair only supports ed25519 but in a future this class can be abstraction layer for other public-key signature systems.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: stellar-dotnet-sdk.dll
Syntax
public class KeyPair : object, IAccountId
Constructors
KeyPair(Byte[])
Creates a new Keypair object from public key.
Declaration
public KeyPair(byte[] publicKey)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | publicKey |
KeyPair(Byte[], Byte[], Byte[])
Creates a new Keypair instance from secret. This can either be secret key or secret seed depending on underlying public-key signature system. Currently Keypair only supports ed25519.
Declaration
public KeyPair(byte[] publicKey, byte[] privateKey, byte[] seed)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | publicKey | |
System.Byte[] | privateKey | |
System.Byte[] | seed |
Properties
AccountId
AccountId
Declaration
public string AccountId { get; }
Property Value
System.String
|
Implements
Address
Address
Declaration
public string Address { get; }
Property Value
System.String
|
Implements
IsMuxedAccount
Declaration
public bool IsMuxedAccount { get; }
Property Value
System.Boolean
|
Implements
MuxedAccount
XDR MuxedAccount
Declaration
public MuxedAccount MuxedAccount { get; }
Property Value
stellar_dotnet_sdk.xdr.MuxedAccount
|
Implements
PrivateKey
The private key.
Declaration
public byte[] PrivateKey { get; }
Property Value
System.Byte[]
|
PublicKey
The public key.
Declaration
public byte[] PublicKey { get; }
Property Value
System.Byte[]
|
Implements
SecretSeed
SecretSeed
Declaration
public string SecretSeed { get; }
Property Value
System.String
|
SeedBytes
The bytes of the Secret Seed
Declaration
public byte[] SeedBytes { get; }
Property Value
System.Byte[]
|
SignatureHint
XDR Signature Hint
Declaration
public SignatureHint SignatureHint { get; }
Property Value
stellar_dotnet_sdk.xdr.SignatureHint
|
SigningKey
XdrPublicKey
XDR Public Key
Declaration
public PublicKey XdrPublicKey { get; }
Property Value
stellar_dotnet_sdk.xdr.PublicKey
|
XdrSignerKey
XDR Signer Key
Declaration
public SignerKey XdrSignerKey { get; }
Property Value
stellar_dotnet_sdk.xdr.SignerKey
|
Methods
CanSign()
Returns true if this Keypair is capable of signing
Declaration
public bool CanSign()
Returns
System.Boolean
|
Equals(KeyPair)
Declaration
public bool Equals(KeyPair other)
Parameters
Type | Name | Description |
---|---|---|
KeyPair | other |
Returns
System.Boolean
|
FromAccountId(String)
Creates a new Stellar KeyPair from a strkey encoded Stellar account ID.
Declaration
public static KeyPair FromAccountId(string accountId)
Parameters
Type | Name | Description |
---|---|---|
System.String | accountId | accountId The strkey encoded Stellar account ID. |
Returns
KeyPair |
FromBIP39Seed(Byte[], UInt32)
Declaration
public static KeyPair FromBIP39Seed(byte[] seedBytes, uint accountIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | seedBytes | |
System.UInt32 | accountIndex |
Returns
KeyPair
|
FromBIP39Seed(String, UInt32)
Declaration
public static KeyPair FromBIP39Seed(string seed, uint accountIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | seed | |
System.UInt32 | accountIndex |
Returns
KeyPair
|
FromPublicKey(Byte[])
Creates a new Stellar keypair from a 32 byte address.
Declaration
public static KeyPair FromPublicKey(byte[] publicKey)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | publicKey | publicKey The 32 byte public key. |
Returns
KeyPair |
FromSecretSeed(Byte[])
Creates a new Stellar keypair from a raw 32 byte secret seed.
Declaration
public static KeyPair FromSecretSeed(byte[] seed)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | seed | seed The 32 byte secret seed. |
Returns
KeyPair |
FromSecretSeed(String)
Creates a new Stellar KeyPair from a strkey encoded Stellar secret seed.
Declaration
public static KeyPair FromSecretSeed(string seed)
Parameters
Type | Name | Description |
---|---|---|
System.String | seed | eed Char array containing strkey encoded Stellar secret seed. |
Returns
KeyPair |
FromXdrPublicKey(PublicKey)
Returns a KeyPair from a Public Key
Declaration
public static KeyPair FromXdrPublicKey(PublicKey publicKey)
Parameters
Type | Name | Description |
---|---|---|
stellar_dotnet_sdk.xdr.PublicKey | publicKey |
Returns
KeyPair |
FromXdrSignerKey(SignerKey)
Returns a KeyPair from an XDR SignerKey
Declaration
public static KeyPair FromXdrSignerKey(SignerKey signerKey)
Parameters
Type | Name | Description |
---|---|---|
stellar_dotnet_sdk.xdr.SignerKey | signerKey |
Returns
KeyPair |
Random()
Generates a random Stellar keypair.
Declaration
public static KeyPair Random()
Returns
KeyPair
a random Stellar keypair |
Sign(Byte[])
Sign the provided data with the keypair's private key.
Declaration
public byte[] Sign(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to sign. |
Returns
System.Byte[]
signed bytes, null if the private key for this keypair is null. |
SignDecorated(Byte[])
Sign a message and return an XDR Decorated Signature
Declaration
public DecoratedSignature SignDecorated(byte[] message)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | message |
Returns
stellar_dotnet_sdk.xdr.DecoratedSignature
stellar_dotnet_sdk.xdr.DecoratedSignature |
SignPayloadDecorated(Byte[])
Sign the provided payload data for payload signer where the input is the data being signed.
Declaration
public DecoratedSignature SignPayloadDecorated(byte[] signerPayload)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | signerPayload |
Returns
stellar_dotnet_sdk.xdr.DecoratedSignature
stellar_dotnet_sdk.xdr.DecoratedSignature |
Verify(Byte[], Signature)
Verify the provided data and signature match this keypair's public key.
Declaration
public bool Verify(byte[] data, Signature signature)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data that was signed. |
stellar_dotnet_sdk.xdr.Signature | signature | The signature. |
Returns
System.Boolean
True if they match, false otherwise. |
Verify(Byte[], Byte[])
Verify the provided data and signature match this keypair's public key.
Declaration
public bool Verify(byte[] data, byte[] signature)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data that was signed. |
System.Byte[] | signature | The signature. |
Returns
System.Boolean
True if they match, false otherwise. |