signMessage

suspend fun signMessage(message: ByteArray): ByteArray

Signs an arbitrary binary message according to SEP-53.

The message is prefixed with "Stellar Signed Message:\n", hashed with SHA-256, and the resulting digest is signed with this keypair's Ed25519 private key.

Return

A 64-byte Ed25519 signature.

Parameters

message

The raw bytes of the message to sign.

See also

Throws

if this keypair does not contain a private key. Use canSign to check before calling this method.


suspend fun signMessage(message: String): ByteArray

Signs an arbitrary UTF-8 string message according to SEP-53.

The message is encoded to UTF-8 bytes, prefixed with "Stellar Signed Message:\n", hashed with SHA-256, and the resulting digest is signed with this keypair's Ed25519 private key.

Return

A 64-byte Ed25519 signature.

Parameters

message

The string message to sign (will be UTF-8 encoded).

See also

Throws

if this keypair does not contain a private key. Use canSign to check before calling this method.