documentCryptoConfig function

BaseCryptoConfig<DecryptedDocumentDto, DocumentDto> documentCryptoConfig(
  1. Crypto crypto
)

Implementation

BaseCryptoConfig<DecryptedDocumentDto, DocumentDto> documentCryptoConfig(Crypto crypto) {
  return BaseCryptoConfig(crypto, (decryptedDocumentDto) async {
    return Tuple2(DocumentDto.fromJson(toJsonDeep(decryptedDocumentDto))!, Uint8List.fromList(json.encode({}).codeUnits));
  }, (encryptedDocumentDto, data) async {
    return DecryptedDocumentDto.fromJson(toJsonDeep(encryptedDocumentDto)..addAll(data != null ? json.decode(String.fromCharCodes(data)) : {}))!;
  });
}