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

feat: support aries-askar #1063

Closed
wants to merge 2 commits into from
Closed

Conversation

xprazak2
Copy link
Contributor

No description provided.

pub async fn create_key(
&self,
name: &str,
alg: KeyAlg,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need our own type for alg should this method become a part of public interface.


let local_key = key_entry.load_local_key()?;

let did_bytes = &local_key.to_public_bytes()?[0..16];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_and_store_my_did from BaseWallet always derives did from verkey, but it might be nice to allow did to be passed in here as an argument.

use super::*;

#[tokio::test]
#[cfg_attr(not(feature = "askar_tests"), ignore)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not run tests yet since they will require additional setup.

async fn test_should_open_askar_wallet() {
let uri = "postgres://postgres:postgres@localhost/askar";

AskarWallet::open(uri, Some(StoreKeyMethod::Unprotected), None.into(), None)
Copy link
Contributor Author

@xprazak2 xprazak2 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure the wallet is created first for this test. And for the following one as well.

@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (37019db) 0.05% compared to head (8ad85b8) 0.05%.
Report is 2 commits behind head on main.

❗ Current head 8ad85b8 differs from pull request most recent head ce14d17. Consider uploading reports for the commit ce14d17 to get more accurate results

Files Patch % Lines
aries/aries_vcx_core/src/errors/mapping_askar.rs 0.00% 12 Missing ⚠️
aries/aries_vcx_core/src/wallet2/mod.rs 0.00% 7 Missing ⚠️
aries/aries_vcx/src/errors/mapping_others.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1063      +/-   ##
========================================
- Coverage   0.05%   0.05%   -0.01%     
========================================
  Files        471     473       +2     
  Lines      24009   24032      +23     
  Branches    4306    4303       -3     
========================================
  Hits          13      13              
- Misses     23995   24018      +23     
  Partials       1       1              
Flag Coverage Δ
unittests-aries-vcx 0.05% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately the fact that a particular wallet implementation is being used should not be visible to the rest of the codebase.
We should rather reuse existing wallet errors - those might not be covering all of our needs, so we could tweak them, rename them, extend them as need - but the general approach should be to for example use WalletCreate error type regardless underlying wallet implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the current types seem to be quite tied to the Indy wallet implementation, so it seems like they will need changes.

@@ -11,9 +11,12 @@ credx = ["dep:indy-credx"]
vdr_proxy_ledger = ["credx", "dep:indy-vdr-proxy-client"]
# Feature flag to allow legacy proof verification
legacy_proof = []
askar_tests = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not only tests, but anything Askar related in the codebase should be behind a feature flag. Given the implementation must stay hidden behind the BaseWallet trait, the rest of the codebase should not know of Askar's existence.
You might be aware of this, but keeping that constraint will "reviewlessly" assure these desired properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example having it feature flagged from get go would probably naturally lead you to not create Askar* specific error kinds. It might be somewhat restrictive while POCing, but ultimately will guide you toward the optimal design/integration with the rest of the codebase

Comment on lines 128 to 132
&self,
xtype: &str,
id: &str,
value: &str,
tags: Option<HashMap<String, String>>,
Copy link
Contributor

@Patrik-Stas Patrik-Stas Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness sake just remind of what we mentioned on the community call earlier.

The BaseWallet method signatures were catered for the particular vdrtools based wallet implementation. We didn't try to over-generalize for the future at the time we designed BaseWallet.
So probably you'll find it desirable to redesign BaseWallet trait - you can draw inspiration from this POC #1042 which didn't meant to add support for Askar in particular, but I guess even more ambitiously tried to enable arbitrary wallet implementation in the future. That might or might not been too long shot.

@xprazak2 xprazak2 force-pushed the askar-wallet branch 4 times, most recently from 8ad85b8 to 0d05eee Compare November 27, 2023 14:32
@xprazak2
Copy link
Contributor Author

xprazak2 commented Nov 27, 2023

I added an implementation of Wallet trait from #1071. It is incomplete and very rough but it illustrates the trait usage.

@xprazak2
Copy link
Contributor Author

xprazak2 commented Dec 6, 2023

Closing in favor of #1085

@xprazak2 xprazak2 closed this Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants