Trait jj_lib::signing::SigningBackend

source ·
pub trait SigningBackend:
    Debug
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn can_read(&self, signature: &[u8]) -> bool;
    fn sign(&self, data: &[u8], key: Option<&str>) -> SignResult<Vec<u8>>;
    fn verify(&self, data: &[u8], signature: &[u8]) -> SignResult<Verification>;
}
Expand description

The backend for signing and verifying cryptographic signatures.

This allows using different signers, such as GPG or SSH, or different versions of them.

Required Methods§

source

fn name(&self) -> &str

Name of the backend, used in the config and for display.

source

fn can_read(&self, signature: &[u8]) -> bool

Check if the signature can be read and verified by this backend.

Should check the signature format, usually just looks at the prefix.

source

fn sign(&self, data: &[u8], key: Option<&str>) -> SignResult<Vec<u8>>

Create a signature for arbitrary data.

The key parameter is what jj sign receives as key argument, or what is configured in the signing.key config.

source

fn verify(&self, data: &[u8], signature: &[u8]) -> SignResult<Verification>

Verify a signature. Should be reflexive with sign:

verify(data, sign(data)?)?.status == SigStatus::Good

Implementors§