verze-app / solana-php-sdk

Simple PHP SDK for Solana JSON RPC endpoints
MIT License
88 stars 45 forks source link

SodiumException secretkey should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes #32

Closed jjoek closed 2 years ago

jjoek commented 2 years ago

Trying to generate the secret key from the keypair and I get the above exception: See my code below

       if(file_exists($keypair)) {
            $keypair = file_get_contents($keypair, FALSE, NULL);

            dd(Keypair::fromSecretKey($keypair));
        }

After running this, I get that sodium exception.

Screenshot 2022-03-04 at 11 16 27 PM
jjoek commented 2 years ago

Got it, needed to pass in the $keypair as an array and thus only needed to json_decode() my keypair