Skip to content

Commit 1fae8c4

Browse files
authored
docs: add JWK usage to README (#307)
1 parent feb0e82 commit 1fae8c4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ echo "Decode:\n" . print_r($decoded_array, true) . "\n";
115115
?>
116116
```
117117

118+
Using JWKs
119+
----------
120+
121+
```php
122+
// Set of keys. The "keys" key is required. For example, the JSON response to
123+
// this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
124+
$jwks = ['keys' => []];
125+
126+
// JWK::parseKeySet($jwks) returns an associative array of **kid** to private
127+
// key. Pass this as the second parameter to JWT::decode.
128+
JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm);
129+
```
130+
118131
Changelog
119132
---------
120133

0 commit comments

Comments
 (0)