encryptionKey property

CommercioRSAPublicKey? get encryptionKey

Returns the PublicKey that should be used as the public encryption key when encrypting data that can later be read only by the owner of this Did Document.

Implementation

CommercioRSAPublicKey? get encryptionKey {
  final pubKey = publicKeys.firstWhere(
    (key) => key?.type == CommercioRSAKeyType.verification.value,
    orElse: () => null,
  );

  if (pubKey == null) {
    return null;
  }

  return CommercioRSAPublicKey(
    RSAKeyParser.parseFromPem(pubKey.publicKeyPem) as RSAPublicKey,
    keyType: CommercioRSAKeyType.verification,
  );
}