getPrivateKeyForConnectionDid method

Future<String?> getPrivateKeyForConnectionDid(
  1. String did
)

Returns the private key as hex-String associated with did.

Implementation

Future<String?> getPrivateKeyForConnectionDid(String did) async {
  if (did.startsWith('did:ethr') || did.startsWith('did:key:zQ3s')) {
    return _getPrivateKeyForConnectionDidEthr(did);
  } else if (did.startsWith('did:key:z6Mk')) {
    return _getPrivateKeyForConnectionDidEd(did);
  } else if (did.startsWith('did:key:z6LS')) {
    return _getPrivateKeyForConnectionDidX(did);
  } else if (did.startsWith('did:key:zDn')) {
    return _getPrivateKeyForPConnectionDid(did, getP256());
  } else if (did.startsWith('did:key:z82')) {
    return _getPrivateKeyForPConnectionDid(did, getP384());
  } else if (did.startsWith('did:key:z2J9')) {
    return _getPrivateKeyForPConnectionDid(did, getP521());
  } else {
    throw Exception('Unknown KeyType');
  }
}