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 negotiated – exact hybrid algorithm selected
by the crypto‑engine (e.g.
ML‑KEM‑768+A128GCM). - 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.
- Since:
- 3.0.0
- Author:
- ANKATech Solutions Inc.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns 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
- 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 not resolvable (e.g. utility mode) — never 0
-
setMaterialVersion
- Parameters:
materialVersion- the key-material version that performed the operation
-
getAlgorithmUsed
- Returns:
- algorithm negotiated by the crypto‑engine
-
setAlgorithmUsed
- Parameters:
algorithmUsed- algorithm negotiated by the crypto‑engine
-
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()
-