Closed pascaldevink closed 6 years ago
D'oh. I made a documentation error.
- $privateKey = new AsymmetricSecretKey(sodium_crypto_sign_keypair());
- $publicKey = $privateKey->getPublicKey();
+ $keypair = sodium_crypto_sign_keypair();
+ $privateKey = new AsymmetricSecretKey(sodium_crypto_sign_secretkey($keypair));
+ $publicKey = new AsymmetricPublicKey(sodium_crypto_sign_publickey($keypair));
In hindsight, I should probably make this function tolerate entire keypairs though.
Thanks for that! That works 💯
https://github.com/paragonie/past/commit/ed20dd31506eb956e7c058218b5e6ca78692d706 allows 96-byte keys.
Following along with the usage documentation here: https://github.com/paragonie/past/tree/master/docs/02-PHP-Library, I've ran into the following exception when executing the first block of code:
This is the code I'm using:
I'm running this on macOS with PHP 7.1. I ran it with both libsodium and gmp installed and uninstalled, but got the same exception.
Did anything change in the implementation and is the documentation not up-to-date, or is there something else going on?