TransactionData

class TransactionData<PayloadT : Any>(val type: TransactionType<PayloadT>, val serialized: ByteString, val hashAlgorithms: List<Algorithm>?, val payload: PayloadT)

An object that holds transaction data.

Transaction data is held in two representation: serialized and parsed. Serialized representation is raw sequence of bytes that reflects how transaction data is encoded in the verification protocol (transaction response includes hash of the serialized representation). Parsed representation includes transaction type that describes what kind of transaction this is, the list of hash algorithms that the verifier accepts for this transaction in the order of preference, and transaction payload which is transaction-type-specific data.

Parameters

type

type of the transaction data item

serialized

serialized representation of the transaction data

hashAlgorithms

accepted hash algorithm override list for this transaction data in the order of preference

payload

transaction payload

Constructors

Link copied to clipboard
constructor(type: TransactionType<PayloadT>, serialized: ByteString, hashAlgorithms: List<Algorithm>?, payload: PayloadT)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val serialized: ByteString
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun applyCbor(credential: Credential): Map<String, DataItem>?

Applies transaction in the context of ISO ISO/IEC 18013 presentment.

Link copied to clipboard
suspend fun applyJson(credential: Credential): JsonElement?

Applies transaction in the context of OpenID4VP presentment.

Link copied to clipboard
suspend fun computeHash(algorithm: Algorithm = Algorithm.SHA256): ByteString

Computes hash of the transaction data.

Link copied to clipboard

Creates equivalent transaction data for use in ISO ISO/IEC 18013 protocols.

Link copied to clipboard
suspend fun isApplicable(credential: Credential): Boolean

Determines if this transaction is applicable to the given credential.