pub struct HolderKey { /* private fields */ }Expand description
Re-exported so a caller can name the holder key without also depending on
vta-sdk directly. A VTC client that has to reach past this crate for the
type its own method takes is a client with a seam in it.
The key a Trust Task proof is made with: the verification method the proof
will name, and the private key behind it.
Any DID that can name a key may sign. The verifier resolves the
verification method and checks the signature; the DID method is not the
authorization. did:key:z6Mk…#z6Mk…,
did:webvh:<scid>:example.com:glenn#key-0 and did:web:example.com#key-1
are all ordinary holders.
This type exists because the two cases differ in one way that a bare
(did, key) pair cannot express: a did:key contains its verification
method, and nothing else does. Deriving #key-0 from a did:webvh is not
possible — the document says what the keys are called — so the caller has
to name it, and a signer that takes only a DID silently cannot serve any
method but one. That is the shape the restriction had before this type:
not a policy anyone chose, but a helper that only knew how to build one
kind of identifier.
Implementations§
Source§impl HolderKey
impl HolderKey
Sourcepub fn new(
verification_method: impl Into<String>,
private_key_multibase: impl Into<String>,
) -> Result<HolderKey, TrustTaskSignError>
pub fn new( verification_method: impl Into<String>, private_key_multibase: impl Into<String>, ) -> Result<HolderKey, TrustTaskSignError>
A holder that names its own verification method — the general case.
verification_method must be a DID with a #fragment, e.g.
did:webvh:<scid>:example.com:glenn#key-0. Whether the key is in that
DID document, and whether the DID document is reachable, is the
verifier’s business; this only refuses what cannot identify a key at all.
Sourcepub fn from_did_key(
did: &str,
private_key_multibase: impl Into<String>,
) -> Result<HolderKey, TrustTaskSignError>
pub fn from_did_key( did: &str, private_key_multibase: impl Into<String>, ) -> Result<HolderKey, TrustTaskSignError>
A did:key holder, whose verification method is <did>#<multibase> and
so needs no naming.
Sourcepub fn verification_method(&self) -> &str
pub fn verification_method(&self) -> &str
The verification method the proof will name.
Sourcepub fn holder_did(&self) -> &str
pub fn holder_did(&self) -> &str
The holder DID — the verification method without its fragment. This is the DID a verifier recovers as the proven signer.
Trait Implementations§
impl Eq for HolderKey
impl StructuralPartialEq for HolderKey
Auto Trait Implementations§
impl Freeze for HolderKey
impl RefUnwindSafe for HolderKey
impl Send for HolderKey
impl Sync for HolderKey
impl Unpin for HolderKey
impl UnsafeUnpin for HolderKey
impl UnwindSafe for HolderKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.