toJson method

Map<String, dynamic> toJson()

Converts this object to a JSON-serializable map.

Binary data is encoded as base64 strings for safe transmission over JSON.

Example:

final json = saltedKey.toJson();
final jsonString = jsonEncode(json); // Serialize to JSON string

Implementation

Map<String, dynamic> toJson() => {
  'key': base64.encode(key),
  'salt': base64.encode(salt),
};