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

Error Method importKey not implemented when calling IdentityManager - > importIdentity(...) on a different device #228

Closed
Muhammad-Altabba opened this issue Aug 31, 2020 · 3 comments

Comments

@Muhammad-Altabba
Copy link

Muhammad-Altabba commented Aug 31, 2020

[Edited]
Hello,

When calling IdentityManager - > exportIdentity and then IdentityManager - > importIdentity(...) on the same machine (having the same sqlite file and running nodejs) the method works. But when calling at on another machine with React Native it throws Method importKey not implemented.

Note: this issue emerged when trying to implement Identity export/import according to #202

I tried to manually import the Key first bust after successfully importing and exporting them, before the Identity import, and then importing the Identities, the same exception came.

I double-checked that the providers are set correctly. Actually, everything else other than this function works well.

However, bellow is the providers' setup code:


let KeyManagementSystem, SecretBox;
if (isNode) {  // For NodeJS (the test-cases run within Node)
  // Note: having the following block without 'eval' will cause the react native app to crash!
  //  Unclear why, even when the 'if' condition is false, react-native crash if there is no 'eval'!  
  eval('const libsodium = require("daf-libsodium");\
    KeyManagementSystem = libsodium.KeyManagementSystem;\
    SecretBox = libsodium.SecretBox;');
}
else { // For react-native
  const libsodium = require("daf-react-native-libsodium");
  KeyManagementSystem = libsodium.KeyManagementSystem;
  SecretBox = libsodium.SecretBox;
}

...

const kms = new KeyManagementSystem(keyStore)

...


const identityProviders = [
  new EthrDid.IdentityProvider({
    identityStore: new IdentityStore('rinkeby-ethr', dbConnection),
    kms,
    network: 'rinkeby',
    rpcUrl: 'https://rinkeby.infura.io/v3/' + infuraProjectId,
  }),
]

...


// Initializing the agent
export const agent = new Agent({
  dbConnection,
  didResolver,
  serviceControllers,
  identityProviders,
  actionHandler,
  messageHandler,
})

...

DAF version 5.6.5

What do you suggest?

Thanks,

@devrajsinghrawat
Copy link
Contributor

Hi @mirceanis .. We are still facing this issue while importing an identity. Could you please provide your insights on the same.

many thanks

@devrajsinghrawat
Copy link
Contributor

Hi Team,

We have further checked this issue and found the below

image

when we are using Node env that time it works caz it is going to daf-libsodium but in case of react-native it is directly trying method in daf-core

Is there any thing we are missing in case of react-native env.. ?

@mirceanis
Copy link
Member

fixed in #257

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

3 participants