- Added JsonWebToken encoder
This commit is contained in:
1 parent
c4e4db7a45
commit
e63ea439d6
3 files changed
+43
-5
No files matched your search
@@ -8,10 +8,9 @@ class JsonWebTokenDecoder
|
||||
|
||||
protected array $payload;
|
||||
|
||||
protected JsonWebTokenAlgorithmEnum $algrithm;
|
||||
|
||||
public function __construct(
|
||||
public string $encoded
|
||||
public string $encoded,
|
||||
public string $secretKey,
|
||||
) {}
|
||||
|
||||
protected function parse() : bool
|
||||
@@ -42,7 +41,7 @@ class JsonWebTokenDecoder
|
||||
}
|
||||
}
|
||||
|
||||
JsonWebTokenValidate::validateSignature($this->header['alg'], getenv('LEAN_RANDOM'), $encodedHeader, $encodedPayload, $signature);
|
||||
JsonWebTokenValidate::validateSignature($this->header['alg'], $this->secretKey, $encodedHeader, $encodedPayload, $signature);
|
||||
}
|
||||
catch(\Throwable $t) {
|
||||
throw new JsonWebTokenDecodingError($t->getMessage(), $t->getCode(), $t);
|
||||
|
||||
Reference in new issue
Block a user