Class SecretValue
java.lang.Object
codes.grow.packages.awssecretsmanager.secrets.SecretValue
A secret value that never prints itself (SPEC section 3).
toString() returns
SecretValue([REDACTED]) and JSON serialisation "[REDACTED]".-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Overwrites the bytes with zeros; the value is unusable afterwards.<T> Tjson(com.fasterxml.jackson.core.type.TypeReference<T> type) Decodes the value as JSON into a generic type.<T> TDecodes the value as JSON.com.fasterxml.jackson.databind.JsonNodejsonNode()Parses the value as a JSON tree.static SecretValueWraps UTF-8 text.static SecretValueWraps UTF-8 text with a version.static SecretValueWraps a copy of raw bytes.reveal()Returns the value as UTF-8 text.byte[]Returns a copy of the raw bytes.booleansameAs(SecretValue other) Returns whether both hold the same bytes and version (constant-time byte comparison).sha256()Returns the SHA-256 of the value (hex), used to detect changes without a version.toString()version()Returns the opaque version (KV version, AWS VersionId, ...).
-
Method Details
-
of
Wraps UTF-8 text.- Parameters:
value- text- Returns:
- a new value without version
-
of
Wraps UTF-8 text with a version.- Parameters:
value- textversion- opaque version, may be null- Returns:
- a new value
-
ofBytes
Wraps a copy of raw bytes.- Parameters:
value- bytesversion- opaque version, may be null- Returns:
- a new value
-
reveal
Returns the value as UTF-8 text.- Returns:
- the text
- Throws:
ValidationException- when the bytes are not valid UTF-8
-
revealBytes
public byte[] revealBytes()Returns a copy of the raw bytes.- Returns:
- the bytes
-
json
Decodes the value as JSON.- Type Parameters:
T- target type- Parameters:
type- target class (JsonNode.classorObject.classfor any JSON)- Returns:
- the decoded value
- Throws:
ValidationException- when the value is not JSON
-
json
public <T> T json(com.fasterxml.jackson.core.type.TypeReference<T> type) Decodes the value as JSON into a generic type.- Type Parameters:
T- target type- Parameters:
type- target type reference- Returns:
- the decoded value
- Throws:
ValidationException- when the value is not JSON
-
jsonNode
public com.fasterxml.jackson.databind.JsonNode jsonNode()Parses the value as a JSON tree.- Returns:
- the tree
- Throws:
ValidationException- when the value is not JSON
-
version
Returns the opaque version (KV version, AWS VersionId, ...).- Returns:
- the version, or empty
-
sha256
Returns the SHA-256 of the value (hex), used to detect changes without a version.- Returns:
- lower-case hex digest
-
sameAs
Returns whether both hold the same bytes and version (constant-time byte comparison).- Parameters:
other- another value- Returns:
- true when equal
-
clear
public void clear()Overwrites the bytes with zeros; the value is unusable afterwards. -
toString
-