Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SecretsResolver to KMS #126

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ jobs:
verify-wasm:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
node: [ 14, 16 ]
os: [ macos-latest, ubuntu-latest ]
node: [ 16, 18, 20, 22 ]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
Expand Down
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@ sha2 = '0.9'
bs58 = "0.4.0"
varint = "0.9.0"
lazy_static = { version = "1.4.0", optional = true }
askar-crypto = { version = "0.2", features = ['std'] }

[dependencies.serde]
version = '1.0'
features = ['derive']

[dependencies.askar-crypto]
version = '0.2'
features = ['std']
git = 'https://github.com/hyperledger/aries-askar'
rev = '4f29d43d584c4a1f1f982c4511824421aeccd2db'

[dependencies.uuid]
version = "0.8"
features = ["v4"]
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ let msg = Message::build(

// --- Pack encrypted and authenticated message ---
let did_resolver = ExampleDIDResolver::new(vec![ALICE_DID_DOC.clone(), BOB_DID_DOC.clone()]);
let secrets_resolver = ExampleSecretsResolver::new(ALICE_SECRETS.clone());
let kms = ExampleKMS::new(ALICE_SECRETS.clone());

let (msg, metadata) = msg
.pack_encrypted(
BOB_DID,
Some(ALICE_DID),
None,
&did_resolver,
&secrets_resolver,
&kms,
&PackEncryptedOptions::default(),
)
.await
Expand All @@ -123,12 +123,12 @@ println!("Sending message \n{}\n", msg);

// --- Unpacking message ---
let did_resolver = ExampleDIDResolver::new(vec![ALICE_DID_DOC.clone(), BOB_DID_DOC.clone()]);
let secrets_resolver = ExampleSecretsResolver::new(BOB_SECRETS.clone());
let kms = ExampleSecretsResolver::new(BOB_SECRETS.clone());

let (msg, metadata) = Message::unpack(
&msg,
&did_resolver,
&secrets_resolver,
&kms,
&UnpackOptions::default(),
)
.await
Expand All @@ -147,7 +147,7 @@ let (msg, metadata) = msg
None, // Keep sender as None here
None,
&did_resolver,
&secrets_resolver,
&kms,
&PackEncryptedOptions::default(),
)
.await
Expand All @@ -163,7 +163,7 @@ let (msg, metadata) = msg
Some(ALICE_DID),
Some(ALICE_DID), // Provide information about signer here
&did_resolver,
&secrets_resolver,
&kms,
&PackEncryptedOptions::default(),
)
.await
Expand Down Expand Up @@ -194,15 +194,15 @@ let msg = Message::build(
.finalize();

let (msg, metadata) = msg
.pack_signed(ALICE_DID, &did_resolver, &secrets_resolver)
.pack_signed(ALICE_DID, &did_resolver, &kms)
.await
.expect("Unable pack_signed");

// BOB
let (msg, metadata) = Message::unpack(
&msg,
&did_resolver,
&secrets_resolver,
&kms,
&UnpackOptions::default(),
)
.await
Expand Down Expand Up @@ -237,7 +237,7 @@ let msg = msg
let (msg, metadata) = Message::unpack(
&msg,
&did_resolver,
&secrets_resolver,
&kms,
&UnpackOptions::default(),
)
.await
Expand Down
Loading
Loading