public static function generateKeys($seed = null, $hashKey = '')
    {
        # The keys are being generated from a seed.
        if ($seed !== null) {
            # Generate some repeatable hashes to create keys against for recovery
            $encrHash = Hash::hash($seed, $hashKey, Constants::BOX_SEEDBYTES);
            $signHash = Hash::hash($seed, $hashKey, Constants::SIGN_SEEDBYTES);

            # Build recoverable pre-seeded key pairs.
            $seeds = [
                'encr' => \Sodium\crypto_box_keypair($encrHash),
                'sign' => \Sodium\crypto_sign_keypair($signHash),
            ];
        } else {
            # Build un-recoverable key pairs.
            $seeds = [
                'encr' => \Sodium\crypto_box_keypair(),
                'sign' => \Sodium\crypto_sign_keypair(),
            ];
        }

        # Return the two generated key pairs to the client.
        return [
            'encr' => [
                'pri' => Helpers::bin2hex(\Sodium\crypto_box_secretkey($seeds['encr'])),
                'pub' => Helpers::bin2hex(\Sodium\crypto_box_publickey($seeds['encr'])),
            ],
            'sign' => [
                'pri' => Helpers::bin2hex(\Sodium\crypto_sign_secretkey($seeds['sign'])),
                'pub' => Helpers::bin2hex(\Sodium\crypto_sign_publickey($seeds['sign'])),
            ],
        ];
    }