Generate Credential
Overview
The generate_message_with_addresses_and_fields
function. This function takes a Credential
payload and returns a Value<Testnet3>
wrapped in Rust's Result
type.
Function Definition
Parameters:
payload: An instance of a
Credential
struct containing various fields like issuer, subject, date of birth (dob), nationality, and expiry.
Returns:
A Result
containing:
A
Value<Testnet3>
object, orAn error of type
anyhow::Error
if the operation fails.
Insertion to Map
The function employs an IndexMap
with an initial capacity of 3 to store key-value pairs. The function insert_to_map
is called multiple times to insert:
issuer
andsubject
as addresses.dob
,nationality
, andexpiry
as fields.
These are all inserted as Plaintext
types, and they are derived from the Credential
payload.
Attributes
Last updated