Record Class KeyedSecret
java.lang.Object
java.lang.Record
org.apache.juneau.rest.server.mcp.v20260728.KeyedSecret
- Record Components:
keyId- An opaque, operator-chosen short identifier forkey(e.g."2026-08-a"). Must not benull or blank, and is length-bounded so a sealed token's cleartextkeyIdwire segment (seeAeadRequestStateCodec's versioned wire format) stays bounded.key- The key material. Must not benull . The AEAD codec is AES-GCM-specific by design, so non-AES key material fails at cipher-init time inAeadRequestStateCodec, not here.
A key paired with the identifier an operator chose for it, as returned by
KeyProvider.currentKey()
and resolved by KeyProvider.resolveKey(String).
Never log key. Mirrors RequestStateCodec's "never log" contract for the sealed token:
this record holds the actual sealing key, so toString() deliberately redacts key rather than
relying on the record's auto-generated form, which would print whatever a custom/HSM SecretKey impl's
own toString() legally chooses to include.
- Since:
- 10.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionKeyedSecret(String keyId, SecretKey key) Compact constructor — validateskeyIdis non-null/non-blank/length-bounded andkeyis non-null. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.keyId()Returns the value of thekeyIdrecord component.toString()Redactskeyso key material never reaches logs via this record'stoString().
-
Constructor Details
-
KeyedSecret
Compact constructor — validateskeyIdis non-null/non-blank/length-bounded andkeyis non-null.
-
-
Method Details
-
toString
Redactskeyso key material never reaches logs via this record'stoString(). -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
keyId
Returns the value of thekeyIdrecord component.- Returns:
- the value of the
keyIdrecord component
-
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-