SealedBox constructor

SealedBox(
  1. AsymmetricKey key
)

Implementation

factory SealedBox(AsymmetricKey key) {
  if (key is AsymmetricPrivateKey) {
    final pub = key.publicKey;
    return SealedBox._fromKeyPair(key, pub);
  } else if (key is AsymmetricPublicKey) {
    return SealedBox._fromKeyPair(null, key);
  } else {
    throw Exception(
        'SealedBox must be created from a PublicKey or a PrivateKey');
  }
}