serialize method Null safety

String serialize()

Convert arteacts into Cryppo's artefact serialization format. Can be reloaded with DerivationArtefacts.fromSerialized

Implementation

String serialize() {
  final artefactPayload = BSON()
      .serialize({'i': iterations, 'iv': BsonBinary.from(salt), 'l': length});
  final serializedArtefacts = base64Url
      .encode([...utf8.encode(version), ...artefactPayload.byteList]);
  return '${strategy.encode()}.$serializedArtefacts';
}