storeExchangeHistoryEntry method

Future<void> storeExchangeHistoryEntry(
  1. String credentialDid,
  2. DateTime timestamp,
  3. String action,
  4. String otherParty, [
  5. List<String>? shownAttributes,
])

Put a new Entry to Exchange history of a credential identified by credentialDid.

Implementation

Future<void> storeExchangeHistoryEntry(String credentialDid,
    DateTime timestamp, String action, String otherParty,
    [List<String>? shownAttributes]) async {
  List<ExchangeHistoryEntry>? existingHistoryEntries =
      getExchangeHistoryEntriesForCredential(credentialDid);
  var tmp = ExchangeHistoryEntry(
      timestamp, action, otherParty, shownAttributes ?? []);
  if (existingHistoryEntries == null) {
    await _exchangeHistory!.put(credentialDid, [tmp]);
  } else {
    await _exchangeHistory!
        .put(credentialDid, [tmp] + existingHistoryEntries);
  }
}