react-native-quick-crypto
react-native-quick-crypto copied to clipboard
🐛 Ed generateKeyPair missing return for Promise?
What's happening?
On https://github.com/margelo/react-native-quick-crypto/blob/main/packages/react-native-quick-crypto/src/ed.ts Is return Promise missing on line 19?
Reproducible Code
var ed1 = new Ed('ed25519', {});
var p = await ed1.generateKeyPair();
const priv = ed1.getPrivateKey();
console.log(priv);
Relevant log output
[Error: EdKeyPair.getPrivateKey(...): Keypair not initialized]
Device
ios real device, latest ios, xcode and expo
QuickCrypto Version
- beta 9
Can you reproduce this issue in the QuickCrypto Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
- [x] I am using Expo
- [x] I have read the Troubleshooting Guide
- [x] I agree to follow this project's Code of Conduct
- [x] I searched for similar issues in this repository and found none.
@xgiovio I'm not sure why you got that error in the getPrivateKey() result, but Ed.generateKeyPair() has the return type of Promise<void>, meaning it will not return anything once resolved. The keys are stored in the class. You can get them via getPublicKey() and getPrivateKey(), as your code does. The tests are passing for all versions of 1.0.0-beta.x, so this might be a local issue.