StableLib / stablelib

A stable library of useful TypeScript/JavaScript code
https://www.stablelib.com
Other
173 stars 35 forks source link

Please support 256-bit secret keys in Ed25519 #45

Closed maurictg closed 3 years ago

maurictg commented 3 years ago

When I'm using the function ed25519.extractPublicKeyFromSecretKey() with a 32-byte secret key I get the following error: Error: ed25519: secret key must be 64 bytes

I want to exchange private keys with other libraries in other languages (like libsodium, NSec.Cryptography etc) and they all use 32-byte s private keys. However, signed messages with the 64-bytes secret key in the stablelib ed25519 library, verified with one of the mentioned libraries above works fine.

Can you please add support for (importing) 256-bits/32-bytes keys?

dchest commented 3 years ago

Use generateKeyPairFromSeed where seed is the 32-byte private key from other library.

maurictg commented 3 years ago

Great, that works fine!