Skip to main content

Crate canton_signer

Crate canton_signer 

Source
Expand description

Pluggable transaction signing for Canton’s interactive submission.

Interactive submission splits a command in two: the participant prepares a transaction and returns its hash, the party’s key signs that hash, and the signature comes back with an execute call. The participant never holds the key — which is the point, and which is why the signing step has to be somebody else’s.

Signer is that somebody. It is object-safe and its sign is async, so a hardware module or a cloud KMS fits behind it without this crate knowing anything about them:

ⓘ
let signer: Arc<dyn Signer> = Arc::new(my_kms_signer);
let prepared = client.prepare_submission(prepare).await?;
let executed = client.execute_submission(prepared.sign_with(&*signer).await?).await?;

The in-memory implementation, Ed25519Key, is behind the default ed25519 feature. Turn it off (default-features = false) to take only the trait.

§A key is not yet an identity

Canton addresses a key by a fingerprint it computes itself, and a signature carries that fingerprint in signed_by. It is not derivable from the key material here; a caller learns it from GenerateExternalPartyTopology, which also yields the party id built from it. So Ed25519Key holds key material and cannot sign for the ledger: Ed25519Key::into_signer takes the fingerprint and returns something that can. That ordering is the real one — you cannot sign as a party before the participant has told you which party you are.

§Security

Ed25519Key holds a private key in process memory and is meant for development, tests, and deployments where that is an accepted risk. It zeroes nothing on drop and offers no protection against a process that can read its own memory. Production keys belong in an HSM or KMS behind Signer.

Structs§

Ed25519Keyed25519
An Ed25519 key pair, before the participant has told it who it is.
Ed25519Signered25519
An Ed25519Key that knows which key Canton thinks it is.
PublicKey
A public key, in the shape the participant registers it in.
Signature
A signature over a hash the participant produced.

Enums§

KeyFormat
How a public key’s bytes are laid out.
KeySpec
Which curve or scheme a key belongs to.
SignatureFormat
How a signature’s bytes are laid out.
SigningAlgorithm
The algorithm a signature was produced with.

Traits§

Signer
Something that can sign a prepared transaction’s hash on a party’s behalf.