ChannelEncrypter
class ChannelEncrypter (View source)
Encrypts Mercure updates end to end, so the hub never sees their content.
Properties
| protected JWEBuilder|null | $jweBuilder | The JWE builder, built on first use and reused across updates. |
|
| protected CompactSerializer|null | $serializer | The compact JWE serializer. |
Methods
__construct(string $key)
Create a new Mercure channel encrypter.
string
encrypt(string $plaintext, string $channel)
Encrypt the given plaintext for the given channel, as a compact JWE.
string
channelKey(string $channel)
Derive the AES-256-GCM key of the given channel.
array{kty: string, k: string, alg: string, use: string}
channelJwk(string $channel)
Build the JSON Web Key sharing the given channel's key with an authorized subscriber.
Details
__construct(string $key)
Create a new Mercure channel encrypter.
string
encrypt(string $plaintext, string $channel)
Encrypt the given plaintext for the given channel, as a compact JWE.
string
channelKey(string $channel)
Derive the AES-256-GCM key of the given channel.
array{kty: string, k: string, alg: string, use: string}
channelJwk(string $channel)
Build the JSON Web Key sharing the given channel's key with an authorized subscriber.