pub enum Algorithm {
Ed25519,
Secp256k1,
P256,
Bls12381Threshold,
}Expand description
Signing algorithm. One variant per supported (curve, hash) pair.
The enum is Copy because it is a small fixed tag; callers are
expected to pass it by value through trait and function signatures.
Variants§
Ed25519
Ed25519 (COSE -19). Default mkit signer algorithm.
Secp256k1
secp256k1 + SHA-256 (COSE -47, ES256K).
P256
P-256 + SHA-256 (COSE -7, ES256).
Bls12381Threshold
BLS12-381 M-of-N threshold (MinSig variant — signature in
G1, public key in G2). Used by the release-party flow; see
docs/SPEC-RELEASE-THRESHOLD.md. No COSE id is registered for
BLS threshold; Algorithm::cose_id returns a provisional
project-local negative integer (-256) chosen outside the IANA
reserved ranges. This value is NOT stable — it will be swapped
for the assigned id (in a patch release) if IANA ever registers
one, so do not persist it as a long-lived identifier. The stable
wire-level identifier is Algorithm::Bls12381Threshold = 5 in the mkit-rpc proto.
Feature-gated behind bls-threshold because the Signer
implementation pulls a sizeable dep tree (blst); the enum
variant lives or dies with the implementation it identifies.
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn cose_id(self) -> i32
pub fn cose_id(self) -> i32
COSE numeric identifier per IANA registry.
Ed25519—-19(fully-specifiedEdDSAw/ Ed25519)Secp256k1—-47(ES256K)P256—-7(ES256)
Sourcepub fn prefix(self) -> &'static str
pub fn prefix(self) -> &'static str
Short textual prefix used at the front of the canonical keyid.
<prefix>:<hex-pubkey> is the canonical keyid shape. See
docs/SPEC-ATTESTATIONS.md §6.3.
Sourcepub fn from_keyid(keyid: &str) -> Option<Self>
pub fn from_keyid(keyid: &str) -> Option<Self>
Parse the algorithm out of a "<prefix>:..." keyid string.
Accepts the canonical per-algorithm prefixes returned by
Self::prefix and, for backward compatibility with
attestations produced before the multi-algorithm split, the
legacy blake3: prefix (which maps to Ed25519).
Returns None if the keyid has no ':' separator or if the
prefix before the first ':' is unknown.
Trait Implementations§
impl Copy for Algorithm
impl Eq for Algorithm
Source§impl FromStr for Algorithm
FromStr parses the canonical prefix form ("ed25519",
"secp256k1", "p256"). Does NOT accept keyid strings with a
trailing ":hex" — use Algorithm::from_keyid for that.
impl FromStr for Algorithm
FromStr parses the canonical prefix form ("ed25519",
"secp256k1", "p256"). Does NOT accept keyid strings with a
trailing ":hex" — use Algorithm::from_keyid for that.
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnsafeUnpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more