Nonce.deserialize constructor

Nonce.deserialize(
  1. CborListValue<CborObject> cbor
)

Implementation

factory Nonce.deserialize(CborListValue cbor) {
  final int hasHash = cbor.elementAt<CborNumeric>(0).toInt();
  if (hasHash != 0 && hasHash != 1) {
    throw const ADAPluginException('Invalid Nonce cbor bytes.');
  }
  return Nonce(hasHash == 0 ? null : cbor.elementAtBytes(1));
}