JWKSet
in package
implements
Countable, IteratorAggregate, JsonSerializable
Table of Contents
Interfaces
- Countable
- IteratorAggregate
- JsonSerializable
Properties
- $keys : array<string|int, mixed>
Methods
- __construct() : mixed
- all() : array<string|int, JWK>
- Returns an array of keys stored in the key set.
- count() : int
- Returns the number of keys in the key set.
- createFromJson() : JWKSet
- Creates a JWKSet object using the given Json string.
- createFromKeyData() : JWKSet
- Creates a JWKSet object using the given values.
- get() : JWK
- Returns the key with the given index. Throws an exception if the index is not present in the key store.
- has() : bool
- Returns true if the key set contains a key with the given index.
- jsonSerialize() : array<string|int, mixed>
- Returns the values to be serialized.
- selectKey() : JWK|null
- Try to find a key that fits on the selected requirements.
- with() : JWKSet
- Add key to store in the key set.
- without() : JWKSet
- Remove key from the key set.
- canKeyBeUsedFor() : bool|int
- canKeyBeUsedWithAlgorithm() : bool|int
- convertKeyOpsToKeyUse() : string
- doesKeySatisfyRestrictions() : bool
Properties
$keys
private
array<string|int, mixed>
$keys
= []
Methods
__construct()
public
__construct(array<string|int, JWK> $keys) : mixed
Parameters
- $keys : array<string|int, JWK>
Tags
all()
Returns an array of keys stored in the key set.
public
all() : array<string|int, JWK>
Return values
array<string|int, JWK>count()
Returns the number of keys in the key set.
public
count([int $mode = COUNT_NORMAL ]) : int
Parameters
- $mode : int = COUNT_NORMAL
Return values
intcreateFromJson()
Creates a JWKSet object using the given Json string.
public
static createFromJson(string $json) : JWKSet
Parameters
- $json : string
Tags
Return values
JWKSetcreateFromKeyData()
Creates a JWKSet object using the given values.
public
static createFromKeyData(array<string|int, mixed> $data) : JWKSet
Parameters
- $data : array<string|int, mixed>
Tags
Return values
JWKSetget()
Returns the key with the given index. Throws an exception if the index is not present in the key store.
public
get(int|string $index) : JWK
Parameters
- $index : int|string
Tags
Return values
JWKhas()
Returns true if the key set contains a key with the given index.
public
has(int|string $index) : bool
Parameters
- $index : int|string
Return values
booljsonSerialize()
Returns the values to be serialized.
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>selectKey()
Try to find a key that fits on the selected requirements.
public
selectKey(string $type[, null|Algorithm $algorithm = null ][, array<string|int, mixed> $restrictions = [] ]) : JWK|null
Returns null if not found.
Parameters
- $type : string
-
Must be 'sig' (signature) or 'enc' (encryption)
- $algorithm : null|Algorithm = null
-
Specifies the algorithm to be used
- $restrictions : array<string|int, mixed> = []
-
More restrictions such as 'kid' or 'kty'
Tags
Return values
JWK|nullwith()
Add key to store in the key set.
public
with(JWK $jwk) : JWKSet
This method is immutable and will return a new object.
Parameters
- $jwk : JWK
Return values
JWKSetwithout()
Remove key from the key set.
public
without(int|string $key) : JWKSet
This method is immutable and will return a new object.
Parameters
- $key : int|string
-
Key to remove from the key set
Return values
JWKSetcanKeyBeUsedFor()
private
canKeyBeUsedFor(string $type, JWK $key) : bool|int
Parameters
- $type : string
- $key : JWK
Tags
Return values
bool|intcanKeyBeUsedWithAlgorithm()
private
canKeyBeUsedWithAlgorithm(Algorithm|null $algorithm, JWK $key) : bool|int
Parameters
Return values
bool|intconvertKeyOpsToKeyUse()
private
static convertKeyOpsToKeyUse(array<string|int, mixed> $key_ops) : string
Parameters
- $key_ops : array<string|int, mixed>
Tags
Return values
stringdoesKeySatisfyRestrictions()
private
doesKeySatisfyRestrictions(array<string|int, mixed> $restrictions, JWK $key) : bool
Parameters
- $restrictions : array<string|int, mixed>
- $key : JWK