hyperledger / aries-askar

Secure storage designed for Hyperledger Aries agents.
Apache License 2.0
58 stars 44 forks source link

Ability to rename a profile and only export a specific profile #221

Open TimoGlastra opened 7 months ago

TimoGlastra commented 7 months ago

It would be useful if you can choose to export only a specific profile (or a subset of profiles) when calling copyTo.

In addition, I think it would also be nice if you can rename a profile. With Indy SDK import/export you could use a different wallet id after you had exported the wallet, and currently if you do export/import with Askar it will use the same profile name.

I don't think there's a way currently to update a profile name after it has been created

TimoGlastra commented 7 months ago

cc @genaris running into some issues currently with import/export after some updates to AskarWallet as we used to use the default profile after export/import, and the profile would be different from the wallet id.

I've updated the code to always provide a profile, but this means that now after export / import and using a different wallet_id it will fail. I do think always providing a profile is good, as especially with multi-tenancy switching the wallet_id could result in some weird issues

genaris commented 7 months ago

Yeah these would be nice features. Actually I also ran into this issue when I wanted to do a migration from SQLite to Postgres in AFJ and I was unable to specify a different wallet id.

The copyTo is currently store-oriented (it's actually calling askar_store_copy), so if we add a parameter where we can specify the profile to copy, I guess it should set the same profile name in the target store.

BTW I think there are also 'manual' ways of copying a certain profile contents. For instance, we can scan for all items from a profile without specifying any category, and set them into a new profile from either the same or a different store. Of course this is slower, but might be useful to do a complete dump of a profile into an arbitrary format we would like to use. It would need an update to JS wrapper as I think it is still getting category as a mandatory parameter.

jamshale commented 2 weeks ago

@esune I think this is the same problem preventing me from switching multitenant wallet types. There is a private copy_profile function that I think would do what I need. I could try and take this on if we need.