binary) < self::MIN_BYTES) { throw new \LogicException( sprintf('Value must have at least %d bytes', self::MIN_BYTES), 1651785134 ); } $this->b64 = StringUtility::base64urlEncode($this->binary); // drop microtime, second is the minimum date-interval $this->time = \DateTimeImmutable::createFromFormat( \DateTimeImmutable::RFC3339, ($time ?? new \DateTimeImmutable())->format(\DateTimeImmutable::RFC3339) ); } public function getSigningIdentifier(): SecretIdentifier { return new SecretIdentifier('nonce', StringUtility::base64urlEncode(md5($this->binary, true))); } public function getSigningSecret(): string { return $this->binary; } public function toHashSignedJwt(): string { $payload = [ 'nonce' => $this->b64, 'time' => $this->time->format(\DateTimeImmutable::RFC3339), ]; return self::encodeHashSignedJwt($payload, self::createSigningKeyFromEncryptionKey(Nonce::class)); } }