pub struct AgentKey {
pub kid: String,
/* private fields */
}Expand description
A P-256 signing key: the agent’s key that L2 binds under cnf and that
signs L3a and L3b.
Fields§
§kid: StringThe key id the L2 mandate’s cnf.jwk.kid carries and every L3
header repeats. Chosen at generation; stable for the key’s life.
Implementations§
Source§impl AgentKey
impl AgentKey
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh key. The kid is the first 16 hex characters of
SHA-256 over the SEC1 compressed point, prefixed vik_.
Sourcepub fn from_secret(d: &[u8], kid: impl Into<String>) -> Result<Self, ViError>
pub fn from_secret(d: &[u8], kid: impl Into<String>) -> Result<Self, ViError>
Rebuild from the 32-byte private scalar and an explicit kid.
Sourcepub fn from_private_jwk(v: &Value) -> Result<Self, ViError>
pub fn from_private_jwk(v: &Value) -> Result<Self, ViError>
Import a private JWK (d present). Keeps the JWK’s kid when it has
one, else derives the same kid generate would.
Sourcepub fn secret_bytes(&self) -> [u8; 32]
pub fn secret_bytes(&self) -> [u8; 32]
The 32-byte private scalar, for sealing at rest.
Sourcepub fn public_jwk(&self) -> Jwk
pub fn public_jwk(&self) -> Jwk
The public JWK with this key’s kid, as a wallet binds it under cnf.
Sourcepub fn private_jwk(&self) -> Value
pub fn private_jwk(&self) -> Value
The private JWK (d included). For export to a wallet or HSM only.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentKey
impl RefUnwindSafe for AgentKey
impl Send for AgentKey
impl Sync for AgentKey
impl Unpin for AgentKey
impl UnsafeUnpin for AgentKey
impl UnwindSafe for AgentKey
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
Mutably borrows from an owned value. Read more