Table of Contents

Class Ed25519

Namespace
SodotSDK.Ed25519
Assembly
Unity.Temp.dll

Class providing the functionality for the Ed25519 protocol the implementing FROST MPC protocol.

public class Ed25519 : Scheme
Inheritance
MonoBehaviour
Ed25519
Inherited Members

Constructors

Ed25519(string)

Initializes a new instance of the Ed25519 class with the specified host URL.

public Ed25519(string hostUrl)

Parameters

hostUrl string

The host URL for the Ed25519 service.

Methods

DerivePrivateKeyFromSpriv(string, uint[])

Derives a private key from the spriv according to BIP-32 non-hardened using for a given BIP-32 non-hardened derivation path.

public Task<PrivateKey> DerivePrivateKeyFromSpriv(string spriv, uint[] derivationPath)

Parameters

spriv string

The SPRIV as a hex string.

derivationPath uint[]

The derivation path.

Returns

Task<PrivateKey>

The derived private key.

DerivePubkey(Ed25519SecretShare, uint[])

Derives a public key from a Ed25519SecretShare using the specified derivation path.

public Task<Ed25519PublicKey> DerivePubkey(Ed25519SecretShare secretShare, uint[] derivationPath)

Parameters

secretShare Ed25519SecretShare

The secret share.

derivationPath uint[]

The derivation path.

Returns

Task<Ed25519PublicKey>

The derived public key.

DerivePubkeyFromSpub(string, uint[])

Derives a public key from the given SPUB and derivation path.

public Task<Ed25519PublicKey> DerivePubkeyFromSpub(string xpub, uint[] derivationPath)

Parameters

xpub string

The SPUB as a hex string.

derivationPath uint[]

The derivation path.

Returns

Task<Ed25519PublicKey>

The derived public key.

ExportFullPrivateKey(Uuid, Ed25519SecretShare, KeygenId)

Exports the full private key to a single party by combining all of the secret shares.

public Task<string> ExportFullPrivateKey(Uuid uuid, Ed25519SecretShare secretShare, KeygenId keygenId)

Parameters

uuid Uuid

The room UUID.

secretShare Ed25519SecretShare

The secret share.

keygenId KeygenId

The export target keygen ID.

Returns

Task<string>

The exported private key as a hex string.

GetExportId(Ed25519SecretShare)

Gets the export ID from a secret share. The party that expects to receive the private key needs to call this function before ExportFullPrivateKey(Uuid, Ed25519SecretShare, KeygenId). It must then transmit the ID to threshold-1 parties, this can be done in an untrusted channel (as if the parties use different keys this will break) Once the parties have the exportID of the party they want to export the private key to, the party and the threshold-1 participants need to call exportFullPrivatekey with that ID.

public Task<KeygenId> GetExportId(Ed25519SecretShare secretShare)

Parameters

secretShare Ed25519SecretShare

The secret share.

Returns

Task<KeygenId>

The export ID as a KeygenId.

GetSpub(Ed25519SecretShare)

Gets the SPUB (base58 encoded extended public key) from the Ed25519SecretShare. Note that unlike ecdsa or bip340 there's no standardization for the extended public key format for Ed25519 so S stands for Sodot, and is a somewhat custom derivation scheme adapted for Ed25519. The Spub can be used either via third party libraries or via DerivePubkeyFromSpub(string, uint[])

public Task<Ed25519SecretShare> GetSpub(Ed25519SecretShare secretShare)

Parameters

secretShare Ed25519SecretShare

The secret share.

Returns

Task<Ed25519SecretShare>

The public key as an Ed25519SecretShare.

ImportPrivateKeyImporter(Uuid, ushort, string, KeygenSecret, KeygenId[], bool)

Imports a private key as an importer in the key generation process. WARNING: Private key import is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, due to a full private key being imported from a different system. Secret shares generated from imported private keys will always have the risk of the private key having been compromised in the past or in the future in case the private key is not deleted after the import operation. Importing a full private key, and sharing into a T-of-N sharing, the resultant key shares will be of the exact same public key as the full private key. This is the method that an importing party (meaning one the party in possesion of the private key) should use for receiving a key share in the new T-of-N quorum.

public Task<(Ed25519PublicKey, Ed25519SecretShare)> ImportPrivateKeyImporter(Uuid uuid, ushort threshold, string privateKeyHex, KeygenSecret keygenSecret, KeygenId[] keygenIds, bool isPrivateKeyRaw)

Parameters

uuid Uuid

The room UUID.

threshold ushort

The threshold value.

privateKeyHex string

The private key as a hex string.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

Array of keygen IDs.

isPrivateKeyRaw bool

Indicates if the private key is in raw format.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The public key and secret share.

ImportPrivateKeyRecipient(Uuid, ushort, KeygenSecret, KeygenId[])

Imports a private key as a recipient in the key generation process. WARNING: Private key import is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, due to a full private key being imported from a different system. Secret shares generated from imported private keys will always have the risk of the private key having been compromised in the past or in the future in case the private key is not deleted after the import operation. Importing a full private key, and sharing into a T-of-N sharing, the resultant key shares will be of the exact same public key as the full private key. This is the method that a new party (meaning one that does not currently have the private key) should use for receiving a key share in the new T-of-N quorum. The method takes the same input parameters as keygen since for a new party joining the quorum the import operation is very similar to a keygen operation.

public Task<(Ed25519PublicKey, Ed25519SecretShare)> ImportPrivateKeyRecipient(Uuid uuid, ushort threshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

threshold ushort

The threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

Array of keygen IDs.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The public key and secret share.

Keygen(Uuid, ushort, ushort, KeygenSecret, KeygenId[])

Starts a distributed key generation for Ed25519.

public Task<(Ed25519PublicKey, Ed25519SecretShare)> Keygen(Uuid uuid, ushort numParties, ushort threshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

numParties ushort

Number of parties.

threshold ushort

Threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

Array of keygen IDs.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The public key and secret share.

OfflineExportFullPrivateKey(Ed25519SecretShare[])

Receives as input an array of Ed25519SecretShare and locally computes the full private key (spriv). The main use case for this function is in an offline recovery setting where keygen results are collected manually and used to recover the full private key on an air-gapped server/device.

public Task<string> OfflineExportFullPrivateKey(Ed25519SecretShare[] secretShares)

Parameters

secretShares Ed25519SecretShare[]

The array of secret shares.

Returns

Task<string>

The exported private key as a hex string.

Refresh(Uuid, Ed25519SecretShare)

Refreshes the key pair by generating a new public key and secret share. Be careful to delete the Ed25519SecretShare given as input before it is certain that all devices have properly stored the fresh Ed25519SecretShare that is output. Note that the new Ed25519SecretShares may only be used with each other, attempting to use older Ed25519SecretShares with newer ones for signing will result in failure. The motivation for using refresh is to enhance security by switching the secret key material frequently, this means that an adversary will need to compromise multiple devices at the same time in order to compromise the private key.

public Task<(Ed25519PublicKey, Ed25519SecretShare)> Refresh(Uuid uuid, Ed25519SecretShare secretShare)

Parameters

uuid Uuid

The room UUID.

secretShare Ed25519SecretShare

The secret share to refresh.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The new public key and secret share.

ReshareNewParty(Uuid, ushort, KeygenSecret, KeygenId[])

Reshares the secret share to a new party with a new threshold. WARNING: Key resharing is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, as incorrect usage might lead to the detriment of the private key security. To use the feature correctly, developers using this feature must make sure that at least n - t + 1 parties of the t-of-n signing quorum delete their current shares before using the resharing of the private key. Also, after resharing, the resharing operation must not be considered complete until such deletion has occurred. Since deleting a share cannot be guaranteed cryptographically, it must be guaranteed by the software architecture (hence, by the developers using the SDK).

public Task<(Ed25519PublicKey, Ed25519SecretShare)> ReshareNewParty(Uuid uuid, ushort newThreshold, KeygenSecret keygenSecret, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

newThreshold ushort

The new threshold value.

keygenSecret KeygenSecret

A KeygenSecret returned from InitKeygen.

keygenIds KeygenId[]

Array of keygen IDs.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The public key and secret share.

ReshareRemainingParty(Uuid, ushort, Ed25519SecretShare, KeygenId[])

Reshares the secret share to a new party with a new threshold. WARNING: Key resharing is an advanced feature of the SDK. We strongly advise consulting with the Sodot team before using it, as incorrect usage might lead to the detriment of the private key security. To use the feature correctly, developers using this feature must make sure that at least n - t + 1 parties of the t-of-n signing quorum delete their current shares before using the resharing of the private key. Also, after resharing, the resharing operation must not be considered complete until such deletion has occurred. Since deleting a share cannot be guaranteed cryptographically, it must be guaranteed by the software architecture (hence, by the developers using the SDK).

public Task<(Ed25519PublicKey, Ed25519SecretShare)> ReshareRemainingParty(Uuid uuid, ushort newThreshold, Ed25519SecretShare secretShare, KeygenId[] keygenIds)

Parameters

uuid Uuid

The room UUID.

newThreshold ushort

The new threshold value.

secretShare Ed25519SecretShare

The secret share.

keygenIds KeygenId[]

Array of keygen IDs.

Returns

Task<(Ed25519PublicKey, Ed25519SecretShare)>

The public key and secret share.

Sign(Uuid, Ed25519SecretShare, byte[], uint[])

Signs a message with the Ed25519SecretShare.Notice that unlike ECDSA, in Ed25519 there's no need to hash the message before signing it.

public Task<Ed25519Signature> Sign(Uuid uuid, Ed25519SecretShare secretShare, byte[] msg, uint[] derivationPath)

Parameters

uuid Uuid

The room UUID.

secretShare Ed25519SecretShare

The secret share.

msg byte[]

The message to be signed.

derivationPath uint[]

The derivation path for the key material.

Returns

Task<Ed25519Signature>

The Ed25519 signature.