Class DecryptResult

java.lang.Object
co.ankatech.ankasecure.sdk.model.DecryptResult

public final class DecryptResult extends Object
Immutable result returned by decryption operations.

Value object returned by decryption operations that provides both the decrypted plaintext data and metadata about the operation.

Used by:

Thread Safety

Instances are immutable and thread-safe. The decrypted data array is defensively copied to prevent external modification. Instances can be safely shared across threads without synchronization.

Usage Example


 DecryptResult result = sdk.decrypt(jweToken);

 // Access decrypted data (defensive copy)
 byte[] plaintext = result.getDecryptedData();

 // Access metadata
 DecryptResultMetadata meta = result.getMeta();
 Integer materialVersion = meta.getMaterialVersion();
 

Builder Pattern


 DecryptResult result = DecryptResult.builder()
     .decryptedData(plaintextBytes)
     .meta(metadata)
     .build();
 
Since:
3.0.0
See Also:
  • Method Details

    • getDecryptedData

      public byte[] getDecryptedData()
      Returns the raw decrypted bytes.

      Note: Returns a defensive copy of the internal array to preserve immutability. Modifications to the returned array will not affect this instance.

      Returns:
      a copy of the decrypted data (may be null)
    • getMeta

      public DecryptResultMetadata getMeta()
      Returns the full metadata returned by the service.
      Returns:
      the decryption metadata (may be null)
    • builder

      public static DecryptResult.Builder builder()
      Creates a new builder for constructing DecryptResult instances.
      Returns:
      a new Builder instance