[Solved] Easy development of JS-SDK?

Ok, so first of all this
const KS = Ae.Keystore.dump('test','pwd',skey) return Promise and you need to wait until it resolves
Exm:

Ae.Keystore.dump('test','pwd',skey).then(keystore => {
   Ae.Keystore.recover('pwd', KS).then(keypair => console.log(keypair))
})

Oh, No. …I run it like this,

Ae.Keystore.dump('LiuWallet','mima',secretKey).then(keystore => {
 Ae.Keystore.recover('mima', keystore).then(keypair => console.log(keypair))
})

I got it again.

3336373331306630393665653261633938653266396530663830373631613835623365336461613932373464333932663630316337326238306636376638613065313434393666366563356233323034353236646133383535653665613962613938656565316662613366643765373663323862326637373536373930333433

This is not me.

Ae.Keystore.dump('LiuWallet','mima',secretKey).then(keystore => {
 Ae.Keystore.recover('mima', keystore)
    .then(keypair => console.log(Buffer.from(keypair, 'hex').toString())
 )
})

Just convert it to hex
Also you can look into test cases: https://github.com/aeternity/aepp-sdk-js/blob/develop/test/unit/keystore.js#L55

This PR will resolve your problem: feat(Keystore): Allow to store secret as hex or buffer by nduchak · Pull Request #939 · aeternity/aepp-sdk-js · GitHub.
After merge you should not need to do additional transformation
Thanks for feedback

My JavaScript foundation is poor. I can’t execute
Buffer.from(keypair, 'hex').toString()
in the browser.

edit:

OK,I’ve converted it, but it’s a bit of a hassle. Is there a simple way?eg. Encapsulated hex method.

    function hex2str(hex) {
    //code
    }

please let us know if the issue is resolved ??

@LiuShao.chain Hey,
Yes, this way introduced in this PR and already merged to develop.

Thank you @nduchak.chain . I’ve solved most of the problems

2 Likes

Thanks for the response..

1 Like

Hi @nduchak.chain

Ae.HdWallet.generateSaveHDWallet(str_Words,0);

It reports an error in IE and works fine in chrome.