Package co.ankatech.ankasecure.sdk.model
Class DecryptResultMetadata
java.lang.Object
co.ankatech.ankasecure.sdk.model.DecryptResultMetadata
DecryptResultMetadata
Value object returned by file decryption operations
(decryptFile
and
decryptFileStream).
It encapsulates:
- Key metadata – the key requested by the caller and the key-material version that performed the operation under that Stable KID.
- Algorithm used – the catalogue algorithm of the key
that decrypted (e.g.
ML-KEM-768orX25519+ML-KEM-768). - Warnings – non‑fatal conditions (usage threshold near, sunset scheduled, etc.) returned by the platform.
Thread‑safety: the class is a simple data carrier with no internal synchronisation. Treat instances as immutable once returned by the SDK and refrain from mutating them across threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanServer-supplied and unrendered: display it throughInertText.text(String).Server-supplied and unrendered: display it throughInertText.text(String).Returns structured warnings encountered during the decryption operation.inthashCode()voidsetAlgorithmUsed(String algorithmUsed) voidsetKeyRequested(String keyRequested) voidsetMaterialVersion(Integer materialVersion) voidsetWarnings(List<CryptoWarning> warnings) toString()
-
Constructor Details
-
DecryptResultMetadata
public DecryptResultMetadata()
-
-
Method Details
-
getKeyRequested
Server-supplied and unrendered: display it through
InertText.text(String).- Returns:
- the key ID originally requested by the client
-
setKeyRequested
- Parameters:
keyRequested- the key ID originally requested by the client
-
getMaterialVersion
- Returns:
- the key-material version (ank_kv) that performed the operation
under the requested Stable KID;
nullwhen the key has no resolvable material version — never 0
-
setMaterialVersion
- Parameters:
materialVersion- the key-material version that performed the operation
-
getAlgorithmUsed
Server-supplied and unrendered: display it through
InertText.text(String).- Returns:
- catalogue algorithm of the key that decrypted
-
setAlgorithmUsed
- Parameters:
algorithmUsed- catalogue algorithm of the key that decrypted
-
getWarnings
Returns structured warnings encountered during the decryption operation.Warnings are type-safe instances allowing pattern matching:
DecryptResult result = sdk.decrypt(jweToken); DecryptResultMetadata meta = result.getMeta(); if (meta.getWarnings() != null && !meta.getWarnings().isEmpty()) { for (CryptoWarning warning : meta.getWarnings()) { switch (warning) { case KeyExpirationWarning kew when kew.daysRemaining() <= 7 -> logger.error("CRITICAL: Key {} expires in {} days", meta.getKeyRequested(), kew.daysRemaining()); case UsageLimitWarning ulw -> logger.warn("Usage limit approaching: {}", ulw.message()); case GenericWarning gw -> logger.info("Warning: {}", gw.rawMessage()); } } }- Returns:
- list of structured warnings (null if no warnings, never empty if non-null)
-
setWarnings
- Parameters:
warnings- list of non‑fatal warnings produced by the platform
-
toString
-
equals
-
hashCode
public int hashCode()
-