diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 23:08:33 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 23:08:33 -0800 |
commit | 388d4c004146865161e2661fb63c705e7f097f3a (patch) | |
tree | 40ad5f05fd805b779b95fc27780cb143fafe88bf /adenosine-pds/src/crypto.rs | |
parent | 31d427f7342a58308501ba7e1f74751393299cf1 (diff) | |
download | adenosine-388d4c004146865161e2661fb63c705e7f097f3a.tar.gz adenosine-388d4c004146865161e2661fb63c705e7f097f3a.zip |
pds: refactor to use typed identifiers a lot more
Diffstat (limited to 'adenosine-pds/src/crypto.rs')
-rw-r--r-- | adenosine-pds/src/crypto.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/adenosine-pds/src/crypto.rs b/adenosine-pds/src/crypto.rs index 07119b1..d1a864e 100644 --- a/adenosine-pds/src/crypto.rs +++ b/adenosine-pds/src/crypto.rs @@ -1,4 +1,5 @@ use crate::P256KeyMaterial; +use adenosine_cli::identifiers::Did; use anyhow::{anyhow, ensure, Result}; use p256::ecdsa::signature::{Signer, Verifier}; use std::str::FromStr; @@ -62,7 +63,7 @@ impl KeyPair { } /// This is currently just an un-validated token; we don't actually verify these. - pub fn ucan(&self, did: &str) -> Result<String> { + pub fn ucan(&self, did: &Did) -> Result<String> { let key_material = self.ucan_keymaterial(); let rt = tokio::runtime::Builder::new_current_thread() .enable_all() @@ -81,10 +82,10 @@ impl KeyPair { } } -async fn build_ucan(key_material: P256KeyMaterial, did: &str) -> Result<String> { +async fn build_ucan(key_material: P256KeyMaterial, did: &Did) -> Result<String> { let token_string = UcanBuilder::default() .issued_by(&key_material) - .for_audience(did) + .for_audience(&did.to_string()) .with_nonce() .with_lifetime(60 * 60 * 24 * 90) .build()? |