serialize method

String serialize()

Converts the encryption result into Cryppo's serialization format for transfer over the wire.

Implementation

String serialize() {
  final encodedCipherText = base64Url.encode(cipherText);
  final serializedEncryptionArtefacts = encryptionArtefacts.serialize();
  var serializedString =
      '${strategy.encode()}.$encodedCipherText.$serializedEncryptionArtefacts';
  if (derivationArtefacts != null) {
    serializedString += '.${derivationArtefacts!.serialize()}';
  }
  return serializedString;
}