validateEncoding function

CryptoEncodingValidation validateEncoding([
  1. CryptoEncodeOptions? opts
])

Implementation

CryptoEncodingValidation validateEncoding([CryptoEncodeOptions? opts]) {
  final type = opts?.type ?? TYPE_0;
  if (type == TYPE_1) {
    if (opts?.senderPublicKey == null) {
      throw WCException("missing sender public key");
    }
    if (opts?.receiverPublicKey == null) {
      throw WCException("missing receiver public key");
    }
  }
  return CryptoEncodingValidation(
    type: type,
    senderPublicKey: opts?.senderPublicKey,
    receiverPublicKey: opts?.receiverPublicKey,
  );
}