pub struct CompositeKeyResolver { /* private fields */ }Expand description
Resolvers tried in order: the first answer other than
Unsupported is the answer, an error included.
§Examples
use identity_kit::jose::Jwk;
use identity_kit::methods::DidKey;
use identity_kit::resolver::{CompositeKeyResolver, JwkResolver, KeyReference, KeyResolver as _, KeyRole, Resolver};
let resolver = CompositeKeyResolver::new()
.with(Resolver::builder().with(DidKey::default()).build())
.with(JwkResolver);
// RFC 8037 Appendix A.2.
let key: Jwk = serde_json::from_str(
r#"{"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}"#,
)?;
let resolved = resolver.resolve_key(&KeyReference::Jwk(Box::new(key.clone())), KeyRole::Issuer).await?;
assert_eq!(resolved, key);Implementations§
Source§impl CompositeKeyResolver
impl CompositeKeyResolver
Sourcepub fn with(self, resolver: impl KeyResolver + 'static) -> Self
pub fn with(self, resolver: impl KeyResolver + 'static) -> Self
This resolver trying resolver after the ones added before.
This resolver trying the shared resolver after the ones added before.
Trait Implementations§
Source§impl Clone for CompositeKeyResolver
impl Clone for CompositeKeyResolver
Source§impl Debug for CompositeKeyResolver
impl Debug for CompositeKeyResolver
Source§impl Default for CompositeKeyResolver
impl Default for CompositeKeyResolver
Source§impl KeyResolver for CompositeKeyResolver
impl KeyResolver for CompositeKeyResolver
Source§fn resolve_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 KeyReference,
role: KeyRole,
) -> Pin<Box<dyn Future<Output = Result<Jwk, KeyResolutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 KeyReference,
role: KeyRole,
) -> Pin<Box<dyn Future<Output = Result<Jwk, KeyResolutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for CompositeKeyResolver
impl !UnwindSafe for CompositeKeyResolver
impl Freeze for CompositeKeyResolver
impl Send for CompositeKeyResolver
impl Sync for CompositeKeyResolver
impl Unpin for CompositeKeyResolver
impl UnsafeUnpin for CompositeKeyResolver
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