of static method

PqForgeCipherSuite of(
  1. Map<String, Object?> metadata
)

The suite recorded in metadata; absent means AES-256-GCM.

Throws PqForgeException for a malformed or unknown marker (untrusted container input).

Implementation

static PqForgeCipherSuite of(Map<String, Object?> metadata) {
  final raw = metadata[metadataKey];
  if (raw == null) return PqForgeCipherSuite.aes256Gcm;
  if (raw is! String) {
    throw const PqForgeException('Malformed aeadSuite metadata entry');
  }
  try {
    return PqForgeCipherSuite.byId(raw);
  } on ArgumentError {
    throw PqForgeException('Unsupported aeadSuite: $raw');
  }
}