StateSignature
The result of {@see \Milpa\Live\Contracts\Security\StateSignerInterface::sign()} — a signature value plus the metadata needed to independently verify and expire it. Carries no reference to what was signed; the signer re-derives that binding at {@see \Milpa\Live\Contracts\Security\StateSignerInterface::verify()} time from the original payload and `$claims`, which is why `$claims` MUST round-trip byte-for-byte via {@see toAttributes()}/{@see fromAttributes()}.
StateSignature::__construct()
public function __construct(string $algorithm, string $value, int $issuedAt, int $expiresAt, string $nonce, array $claims = []):Parameters
| Name | Type | Description |
|---|---|---|
| $algorithm | string | The signing algorithm identifier (e.g. `'hmac-sha256'`); verification MUST reject a signature whose algorithm it does not implement. |
| $value | string | The signature/MAC value itself. |
| $issuedAt | int | Unix timestamp the signature was issued at. |
| $expiresAt | int | Unix timestamp after which the signature MUST be treated as invalid. |
| $nonce | string | A per-signature random value preventing signature reuse/replay across calls. |
| $claims | array<string, mixed> | Domain data bound into the signature (e.g. component id, kind); MUST match what the caller re-supplies as `$requiredClaims` on verify. |
StateSignature::toAttributes()
public function toAttributes(): arrayFlattens this signature into a string-keyed attribute map (the `sig-*` counterpart of {@see fromAttributes()}) suitable for embedding as XML/HTML element attributes, as the `Signed*Codec` decorators in this package do.
StateSignature::fromAttributes()
public static function fromAttributes(array $attributes): selfRebuilds a signature from the attribute map produced by {@see toAttributes()}. Missing attributes default to empty/zero rather than throw, so a tampered or partial attribute set still decodes into a signature — one that will then simply fail cryptographic verification rather than failing to parse.
Parameters
| Name | Type | Description |
|---|---|---|
| $attributes | array<string, mixed> |