initializeIssuer method

Future<String> initializeIssuer([
  1. KeyType keyType = KeyType.secp256k1
])

Generates and returns DID for the issuer.

Implementation

Future<String> initializeIssuer([KeyType keyType = KeyType.secp256k1]) async {
  if (keyType == KeyType.secp256k1) {
    var master = BIP32.fromSeed(_keyBox!.get('seed'));
    var key = master.derivePath('m/456/1/0');
    var issuerDid = _bip32KeyToDid(key);
    await _keyBox!.put('issuerDid', issuerDid);
    await _credentialBox!.put(issuerDid, Credential('m/456/1/0', '', ''));
    return issuerDid;
  } else if (keyType == KeyType.ed25519) {
    return await _initializeIssuerEdKey();
  } else {
    throw Exception('unknown keyType');
  }
}