CoseServerKey.hmac constructor

CoseServerKey.hmac(
  1. CoseAlg alg,
  2. Uint8List secret
)

The shared secret of a COSE_Mac0 server, for alg (an HMAC algorithm); throws ArgumentError otherwise.

Implementation

factory CoseServerKey.hmac(CoseAlg alg, Uint8List secret) {
  if (!alg.isHmac) {
    throw ArgumentError.value(alg, 'alg', 'must be an HMAC algorithm');
  }
  return CoseServerKey._(alg, Uint8List.fromList(secret));
}