ensureSupportPubKeyMode static method
BuBytes
ensureSupportPubKeyMode({
- required CryptoKeyEncoding mode,
- required BuBytes? onModeBytes(
- CryptoKeyEncoding mode
- required CryptoKeyType type,
Calls onModeBytes and throws a clear error if mode isn't supported
for type.
Implementation
static BuBytes ensureSupportPubKeyMode({
required CryptoKeyEncoding mode,
required BuBytes? Function(CryptoKeyEncoding mode) onModeBytes,
required CryptoKeyType type,
}) {
final keyBytes = onModeBytes(mode);
if (keyBytes == null) {
throw CoreErrors.cryptoFailed(
"CryptoKeysUtils.ensureSupportedPubKeyMode",
reason:
"${type.name} does not support the ${mode.name} public key encoding.",
);
}
return keyBytes;
}