Spatium SDK > signEddsaMessage
signEddsaMessage
suspend fun signEddsaMessage(driver: ProtocolKotlin, secretId: String, syncSessionId: String, signSessionId: String, message: String): EddsaSignature
Generate distributed EDDSA signature for a given message
This method requires an already performed synchronisation procedure and does not store anythig in the permanent storage. Messages of a length, different from 32 bytes are padded/truncated according to EDDSA algorithm.
Return
EDDSA signature in standard format
- SeeAlso:
SpatiumProtocol/signEddsaMessage(secretId:syncSessionId:signSessionId:message:)
Example
// Assume an already performed synchronisation procedure and established connection
// Generate random session ID for a new signing session
val signSessionId = UUID.randomUUID().toString()
// Message to be signed
val message = "7hJ9yN2OdIQo2kJu0arZgw2EKnMX5FGtQ6jlCWuLXCM="
// Generate a EDDSA signature
val signature = signEddsaMessage(secretId: String, syncSessionId: String, signSessionId: String, message: String)
// Verify the resulting signature against a compound public key
println(
mapOf(
"curve" to EcdsaCurve.secp256k1,
"publicKey" to publicKey,
"message" to message,
"signature" to mapOf(
"r" to signature.r,
"s" to signature.s,
"recovery" to signature.recovery
)
)
)
Parameters
androidJvm
driver | ProtocolKotlin implementation |
secretId | ID (UUID) of a secret used for synchronisation |
syncSessionId | ID (UUID) of a corresponding synchronisation procedure |
signSessionId | ID (UUID) of this signing procedure |
message | message (32 bytes, base64 encoded) to be signed |