toJson method
Encrypts the private key using the secret specified earlier and returns a json representation of its data
Implementation
String toJson() {
final derivedKey = _derivator.deriveKey(_password);
final cipherTextBytes = _encryptPrivateKey(derivedKey);
final map = {
'crypto': {
'cipher': 'aes-256-ctr',
'cipherParams': {'iv': Base58Encoder.instance.encode(_iv)},
'cipherText':
Base58Encoder.instance.encode(Uint8List.fromList(cipherTextBytes)),
'kdf': _derivator.name,
'kdfparams': _derivator.encode(),
'mac': _getMac(derivedKey, cipherTextBytes),
},
'id': uuid,
'version': 1
};
return json.encode(map);
}