set_recovery_key_request.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'dart:convert';
  2. class SetRecoveryKeyRequest {
  3. final String masterKeyEncryptedWithRecoveryKey;
  4. final String masterKeyDecryptionNonce;
  5. final String recoveryKeyEncryptedWithMasterKey;
  6. final String recoveryKeyDecryptionNonce;
  7. SetRecoveryKeyRequest(
  8. this.masterKeyEncryptedWithRecoveryKey,
  9. this.masterKeyDecryptionNonce,
  10. this.recoveryKeyEncryptedWithMasterKey,
  11. this.recoveryKeyDecryptionNonce,
  12. );
  13. Map<String, dynamic> toMap() {
  14. return {
  15. 'masterKeyEncryptedWithRecoveryKey': masterKeyEncryptedWithRecoveryKey,
  16. 'masterKeyDecryptionNonce': masterKeyDecryptionNonce,
  17. 'recoveryKeyEncryptedWithMasterKey': recoveryKeyEncryptedWithMasterKey,
  18. 'recoveryKeyDecryptionNonce': recoveryKeyDecryptionNonce,
  19. };
  20. }
  21. factory SetRecoveryKeyRequest.fromMap(Map<String, dynamic> map) {
  22. return SetRecoveryKeyRequest(
  23. map['masterKeyEncryptedWithRecoveryKey'],
  24. map['masterKeyDecryptionNonce'],
  25. map['recoveryKeyEncryptedWithMasterKey'],
  26. map['recoveryKeyDecryptionNonce'],
  27. );
  28. }
  29. String toJson() => json.encode(toMap());
  30. factory SetRecoveryKeyRequest.fromJson(String source) =>
  31. SetRecoveryKeyRequest.fromMap(json.decode(source));
  32. }