storeCredential method
Stores a credential permanently.
What should be stored consists of three parts
- a signed credential
w3cCred
containing hashes of all attribute-values - a json structure
plaintextCred
containing hashes, salts and values per credential attribute - the
hdPath
to derive the key for the did the credential is issued for
Implementation
Future<void> storeCredential(
String? w3cCred, String? plaintextCred, String? hdPath,
{KeyType keyType = KeyType.secp256k1, String? credDid}) async {
String did;
if (credDid == null) {
did = await getDid(hdPath!, keyType);
} else {
did = credDid;
}
var tmp = Credential(hdPath!, w3cCred!, plaintextCred!);
await _credentialBox!.put(did, tmp);
}