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

Importing the wallet using askar in react native fails #1526

Closed
ghost opened this issue Jul 26, 2023 · 6 comments
Closed

Importing the wallet using askar in react native fails #1526

ghost opened this issue Jul 26, 2023 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 26, 2023

When using the Askar wallet in React Native import wallet fails with the following error

ERROR  ERROR: Error importing wallet 'newWalletId': Error decrypting profile key
Caused by: AEAD decryption error {
  "error": {
    "name": "Error",
    "stack": "Error: Error decrypting profile key\nCaused by: AEAD decryption error\n    at construct (native)\n    at Wrapper (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.testexport&modulesOnly=false&runModule=true:27130:64)\n    at construct (native)\n    at _createSuperInternal (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.testexport&modulesOnly=false&runModule=true:253087:406)\n    at call (native)\n    at AriesAskarError (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.testexport&modulesOnly=false&runModule=true:253102:26)\n    at _cb (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.testexport&modulesOnly=false&runModule=true:256038:109)",
    "message": "Error decrypting profile key\nCaused by: AEAD decryption error",
    "code": 4
  },
  "errorMessage": "Error decrypting profile key\nCaused by: AEAD decryption error"
}

Observation while debugging the error was:

  • If we use the old walletConfig while importing wallet and old walletKey as backupkey then importing wallet is completed successfully
  • The same feature works perfectly in the askar tests here in - Askar-e2e-test

I have created a repo that reproduces this error here - Askar-Walllet-React-Native

@ghost ghost changed the title Importing the wallet using aries askar wallet in react native fails Importing the wallet using askar in react native fails Jul 26, 2023
@berendsliedrecht
Copy link
Contributor

You have to explicitly migrate the structure of the wallet from Indy sdk to askar. https://aries.js.org/guides/0.4/updating/update-indy-sdk-to-askar

@ghost
Copy link
Author

ghost commented Jul 27, 2023

@berendsliedrecht While exporting the wallet also I am using the Askar wallet only.

@berendsliedrecht
Copy link
Contributor

@berendsliedrecht While exporting the wallet also I am using the Askar wallet only.

Ah, my bad. I am not too familiar with the exporting mechanism but from the error I assume that one of the keys you used is incorrect.

@ghost
Copy link
Author

ghost commented Aug 1, 2023

@berendsliedrecht Yes, the error is being shown as the key is incorrect but I am using the same backup key still it is showing the same I have created a repo for the same here. @genaris Can you also please check this. ?

@genaris
Copy link
Contributor

genaris commented Aug 2, 2023

@sairanjitAW thank you very much to generate a repo to easily reproduce the issue!

It seems it's a problem with Aries Askar wrapper for React Native. Store rekey is not calling the right method, so the key is in fact never changed. I opened a PR in aries-askar to fix it.

For the time being you can use a patched version that I added as a PR for your repo.

@ghost
Copy link
Author

ghost commented Aug 2, 2023

Thank You @genaris for the fix

@ghost ghost closed this as completed Aug 14, 2023
This issue was closed.
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

No branches or pull requests

2 participants