resolve static method

PqForgeProfile resolve(
  1. String name,
  2. PqKemAlgorithm kem,
  3. PqSignatureAlgorithm? signature
)

Resolves name to a built-in profile, or reconstructs a custom profile (e.g. a decoupled --kem/--sig composition) from the algorithms a serialized envelope carries alongside the name.

Implementation

static PqForgeProfile resolve(
  String name,
  PqKemAlgorithm kem,
  PqSignatureAlgorithm? signature,
) {
  try {
    return byName(name);
  } on PqForgeException {
    return PqForgeProfile(
      name: name,
      kem: kem,
      signature: signature ?? PqSignatureAlgorithm.mlDsa65,
      slhDsa: switch (kem) {
        PqKemAlgorithm.mlKem512 => PqSlhDsaAlgorithm.shake128f,
        PqKemAlgorithm.mlKem768 => PqSlhDsaAlgorithm.shake192f,
        PqKemAlgorithm.mlKem1024 => PqSlhDsaAlgorithm.shake256f,
      },
    );
  }
}