Nonce.deserialize constructor

Nonce.deserialize(
  1. CborListValue cbor
)

Implementation

factory Nonce.deserialize(CborListValue cbor) {
  final int hasHash = cbor.getIndex(0);
  if (hasHash != 0 && hasHash != 1) {
    throw const MessageException("Invalid Nonce cbor bytes.");
  }
  return Nonce(hasHash == 0 ? null : cbor.getIndex(1));
}