Class Ed25519
Class providing the functionality for the Ed25519 protocol the implementing FROST MPC protocol.
public class Ed25519 : Scheme
- Inheritance
-
MonoBehaviourEd25519
- Inherited Members
Constructors
Ed25519(string)
Initializes a new instance of the Ed25519 class with the specified host URL.
public Ed25519(string hostUrl)
Parameters
hostUrlstringThe 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
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
secretShareEd25519SecretShareThe secret share.
derivationPathuint[]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
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
uuidUuidThe room UUID.
secretShareEd25519SecretShareThe secret share.
keygenIdKeygenIdThe export target keygen ID.
Returns
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
secretShareEd25519SecretShareThe secret share.
Returns
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
secretShareEd25519SecretShareThe 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
uuidUuidThe room UUID.
thresholdushortThe threshold value.
privateKeyHexstringThe private key as a hex string.
keygenSecretKeygenSecretA KeygenSecret returned from InitKeygen.
keygenIdsKeygenId[]Array of keygen IDs.
isPrivateKeyRawboolIndicates 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
uuidUuidThe room UUID.
thresholdushortThe threshold value.
keygenSecretKeygenSecretA KeygenSecret returned from InitKeygen.
keygenIdsKeygenId[]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
uuidUuidThe room UUID.
numPartiesushortNumber of parties.
thresholdushortThreshold value.
keygenSecretKeygenSecretA KeygenSecret returned from InitKeygen.
keygenIdsKeygenId[]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
secretSharesEd25519SecretShare[]The array of secret shares.
Returns
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
uuidUuidThe room UUID.
secretShareEd25519SecretShareThe 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
uuidUuidThe room UUID.
newThresholdushortThe new threshold value.
keygenSecretKeygenSecretA KeygenSecret returned from InitKeygen.
keygenIdsKeygenId[]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
uuidUuidThe room UUID.
newThresholdushortThe new threshold value.
secretShareEd25519SecretShareThe secret share.
keygenIdsKeygenId[]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
uuidUuidThe room UUID.
secretShareEd25519SecretShareThe secret share.
msgbyte[]The message to be signed.
derivationPathuint[]The derivation path for the key material.
Returns
- Task<Ed25519Signature>
The Ed25519 signature.