toJson method
Encrypts the private key using the secret specified earlier and returns a json representation of its data as a v3-wallet file.
Implementation
String toJson() {
final ciphertextBytes = _encryptPrivateKey();
final map = {
'crypto': {
'cipher': 'aes-128-ctr',
'cipherparams': {'iv': bytesToHex(_iv)},
'ciphertext': bytesToHex(ciphertextBytes),
'kdf': _derivator.name,
'kdfparams': _derivator.encode(),
'mac': _generateMac(_derivator.deriveKey(_password), ciphertextBytes),
},
'id': uuid,
'version': 3,
};
return json.encode(map);
}