Ed25519
Ed25519 scheme implementation providing functionality for the FROST MPC protocol.
This class handles cryptographic operations using Ed25519 keys, including:
Key generation via multi-party computation (MPC)
Distributed signing of messages
Secret share refreshing
Key resharing
Key import/export
Key derivation
Example Usage
/// Server side creates a room for 3 parties using API_KEY
/// Creating a room UUID should always happen on the server side
val numParties = 3
val threshold = 2
val apiKey = "MY_API_KEY"
val keygenRoomUuid = createRoom(numParties, apiKey)
/// All parties call initKeygen to get key generation IDs
val keygenInitResult = initKeygen()
/// All parties receive keygenIds from other parties
val keygenIds = listOf("keygenId1", "keygenId2")
/// All parties join the keygen room
val keygenResult = keygen(
keygenRoomUuid,
numParties,
threshold,
keygenInitResult.keygenSecret,
keygenIds
)
/// Pick the derivation path for the public key you want to sign for
val derivationPath = intArrayOf(44, 60, 0, 0, 0)
/// Option 1: Derive public key using the secret share from keygenResult
val pubkey = derivePubkey(keygenResult.secretShare, derivationPath)
/// Option 2: Derive public key using Spub for more flexibility
val spub = getSpub(keygenResult.secretShare)
val pubkeyFromSpub = derivePubkeyFromSpub(spub, derivationPath)
/// To sign a message, create a signing room on the server side
val signingRoomUuid = createRoom(threshold, apiKey)
/// Your message in hex
val message = "deadbeef"
/// Threshold parties join the signing room
val signature = sign(signingRoomUuid, keygenResult.secretShare, message, derivationPath)
/// This signature can now be verified against pubkey
/// Refreshing the secret key material
val refreshRoomUuid = createRoom(numParties, apiKey)
/// All parties join the refresh room
val refreshResult = refresh(refreshRoomUuid, keygenResult.secretShare)
/// Note: refreshResult.pubkey == keygenResult.pubkey
/// Signing using the new secret key material
val signingRoomUuid2 = createRoom(threshold, apiKey)
val message2 = "deadbeefcafebabe"
val signature2 = sign(signingRoomUuid2, refreshResult.secretShare, message2, derivationPath)
/// This signature can now be verified against pubkeyFunctions
Creates a room for multi-party computation.
Derives a private key from an extended private key (Spriv).
Derives a public key from an Ed25519 secret share.
Derives a public key from an extended public key (Spub).
Exports a full Ed25519 private key.
Gets an export ID from an Ed25519 secret share.
Gets an extended public key (Spub) from an Ed25519 secret share.
Imports an Ed25519 private key (importer).
Imports an Ed25519 private key (recipient).
Initializes key generation for MPC protocols.
Generates Ed25519 keys using multi-party computation.
Exports a full Ed25519 private key offline.
Refreshes the Ed25519 secret share.
Reshares an Ed25519 key for a new party.
Reshares an Ed25519 key for a remaining party.
Signs a message using Ed25519 and multi-party computation.