serialize function

String serialize({
  1. required Uint8List type,
  2. required Uint8List sealed,
  3. required Uint8List iv,
  4. Uint8List? senderPublicKey,
})

Implementation

String serialize({
  required Uint8List type,
  required Uint8List sealed,
  required Uint8List iv,
  Uint8List? senderPublicKey,
}) {
  if (decodeTypeByte(type) == TYPE_1) {
    if (senderPublicKey == null) {
      throw WCException("Missing sender public key for type 1 envelope");
    }
    return base64Encode([...type, ...senderPublicKey, ...iv, ...sealed]);
  }
  // default to type 0 envelope
  return base64Encode([...type, ...iv, ...sealed]);
}