crypto property

CryptoConfig get crypto

Configures the crypto providers used for encrypted puts and reads.

The default, CryptoConfig.eraDefault, is whatever this SDK release encrypts with; assign one only to register a custom provider or to hold a named scheme deliberately.

⚠️ Assigning a config that registers a pqCryptoProviderIds provider is refused when posture configures none, and the check runs at assignment only — CryptoConfig.providers is held by reference.

Implementation

CryptoConfig get crypto => _crypto;
set crypto (CryptoConfig config)

Implementation

set crypto(CryptoConfig config) {
  if (!posture.configuresPqProviders) {
    final refused =
        config.providers.map((p) => p.id).where(pqCryptoProviderIds.contains);
    if (refused.isNotEmpty) {
      throw ArgumentError.value(
          refused.join(', '),
          'crypto',
          'this preference runs a posture that configures no post-quantum '
              'providers, and this config registers them. A client cannot '
              'both stand in for a build that predates these schemes and be '
              'given them. Name a posture that configures them, or a config '
              'that does not register them');
    }
  }
  _crypto = config;
}