toJson method

Map<String, dynamic> toJson()

Serializa para Map<String, dynamic>. Nunca inclui chave.

envelope.toJson();
// {'version': 2, 'algorithm': 'chacha20-poly1305', 'ciphertext': '...', ...}

Implementation

Map<String, dynamic> toJson() => {
      'version': version,
      'algorithm': algorithm.value,
      'ciphertext': base64.encode(ciphertext),
      'nonce': base64.encode(nonce),
      'tag': base64.encode(tag),
      'aad': base64.encode(aad),
    };