forClient static method

CryptoConfig forClient(
  1. AtClient? atClient
)

The config atClient encrypts under — the app's if it named one, else the SDK's default for this release.

The era default is chosen from the client's PqPosture at construction and adopted by adoptEraDefault: CryptoConfig.legacy where configuresPqProviders is false, CryptoConfig.readsNskeyWritesLegacy where writesPqByDefault is false, and CryptoConfig.nskey otherwise. A client that was never given one falls back to CryptoConfig.legacy rather than assembling a set here, because building one needs the client and this is also called during construction.

Implementation

static CryptoConfig forClient(AtClient? atClient) {
  final named = namedFor(atClient);
  if (named != null) return named;
  if (atClient == null) return const CryptoConfig.legacy();
  return _eraDefaults.of(atClient) ?? const CryptoConfig.legacy();
}