storeConnection method

Future<void> storeConnection(
  1. String otherDid,
  2. String name,
  3. String? hdPath, {
  4. KeyType keyType = KeyType.secp256k1,
  5. String? comDid,
})

Stores a Connection permanently.

What should be stored consists of three parts

  • the did of the communication partner otherDid
  • the name of the connection / the username used in this connection.
  • the hdPath to derive the key for the did of the communication

Implementation

Future<void> storeConnection(String otherDid, String name, String? hdPath,
    {KeyType keyType = KeyType.secp256k1, String? comDid}) async {
  String did;
  if (comDid == null) {
    did = await getDid(hdPath!, keyType);
  } else {
    did = comDid;
  }
  var tmp = Connection(hdPath!, otherDid, name);
  await _connection!.put(did, tmp);
}