安装composerrequirewhereof/signature支持加密方式alg实现方式key参数ES384openssl数组包含publicKey和privateKeyES256openssl数组包含publicKey和privateKeyHS256hash_hmac字符串HS384hash_hmac字符串HS512hash_hmac字符串RS256openssl数组包含publicKey和privateKeyRS384openssl数组包含publicKey和privateKeyRS512openssl数组包含publicKey和privateKeyEdDSAsodium_crypto字符Stringexceptioncapturewhereof\Signature\Exceptions\SignatureInvalidExceptionsignatureisincorrectwhereof\Signature\Exceptions\BeforeValidExceptionsignaturecanonlybeusedafteracertainpointintimewhereof\Signature\Exceptions\ExpiredExceptionsignatureinvalidationExample$time=time();$payload=['iss'=>'github.com',//Issuer'iat'=>$time,//Issuingtime'nbf'=>$time,//Effectiveafterthesignatureisgenerated'exp'=>$time+7200,//Expirationtime'data'=>['id'=>88,'username'=>'whereof'],];$jwt=new\whereof\Signature\Jwt(\whereof\Signature\Support\KeyHelper::key());$token=$jwt->encode($payload);$data=$jwt->encode($token);ExamplewithRS256(openssl)$jwt=new\whereof\Signature\Jwt(\whereof\Signature\Support\KeyHelper::RS256(),'RS256'));$jwt=new\whereof\Signature\Jwt(\whereof\Signature\Support\KeyHelper::RS256Pem(),'RS256'));$token=$jwt->encode($payload);$data=$jwt->decode($token);ExamplewithEdDSA(libsodiumandEd25519signature)$jwt=new\whereof\Signature\Jwt(\whereof\Signature\Support\KeyHelper::EdDSA(),'EdDSA'));$token=$jwt->encode($payload);$data=$jwt->decode($token);
