TransactionData

class TransactionData<PayloadT : Any>(val type: TransactionType<PayloadT>, val payload: PayloadT, val protocol: TransactionProtocol, val rawBytes: ByteString, val hashAlgorithms: List<Algorithm>? = null)

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. 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, and transaction payload which is transaction-type-specific data.

Parameters

type

type of the transaction data item

payload

transaction payload

protocol

protocol context in which the transaction data was received

rawBytes

raw sequence of bytes representing the transaction data in the request

hashAlgorithms

accepted hash algorithm override list for this transaction data

Constructors

Link copied to clipboard
constructor(type: TransactionType<PayloadT>, payload: PayloadT, protocol: TransactionProtocol, rawBytes: ByteString, hashAlgorithms: List<Algorithm>? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val rawBytes: ByteString
Link copied to clipboard

Functions

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

Computes hash of the transaction data.

Link copied to clipboard
suspend fun generateMdocResponseElements(credential: Credential, userInput: TransactionUserInput?, docRequestId: Int? = null): Map<String, DataItem>

Generates device-signed data elements for an Mdoc credential.

Link copied to clipboard
suspend fun generateSdJwtResponseClaims(credential: Credential, userInput: TransactionUserInput?, docRequestId: Int? = null): Map<String, JsonElement>

Generates Key Binding JWT claims for an SD-JWT credential.

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

Determines if this transaction is applicable to the given credential.

Link copied to clipboard

Creates equivalent transaction data for use in ISO 18013-5 protocols.

Link copied to clipboard
suspend fun verifyMdocResponse(responseElements: Map<String, DataItem>)

Verifies transaction response returned in an Mdoc presentation.

Link copied to clipboard
suspend fun verifySdJwtResponse(responseClaims: Map<String, JsonElement>)

Verifies transaction response returned in an SD-JWT presentation.