Closed Icehunter closed 12 months ago
It looks like the example was a little off, unless this is wrong but:
const priv = ed448.utils.randomPrivateKey();
const pub = x448.getPublicKey(priv);
x448.getSharedSecret(priv, pub);
That works, if using x448 to get the public and ed448 to get private.
ed448 and x448 keys are NOT interchangeable
const priv = x448.utils.randomPrivateKey();
const pub = x448.getPublicKey(priv);
x448.getSharedSecret(priv, pub);
x448.getPublicKey(priv);
Makes much more sense thank you!
Here's an example in codesandbox:
https://codesandbox.io/s/morning-currying-59ptsd?file=/src/App.tsx
I've also tried this in node v18 and v20 with the same issue running with ts-node.
Perhaps I'm doing something incorrect?
My use case:
Users have pub/priv keys generated by this library -> convereted to hex -> encryped -> stored.
After that they use ECDH to save and exchange data.