Concepts
Encryption
The diagram below illustrates how data is encrypted when using the Datum SDK.
PrepareData
The prepareData method allows for a random secret to be generated and be encrypted with public key from owner.
Encryption in the Datum SDK should be considered proof of concept at this stage and is not ready for production use
const Datum = require('datum-sdk');
var datum = new Datum();
datum.initialize({
privateKey : identity.privateKey
});
var data = datum.prepareData('{"userId":1,"id":1,"title":"sunt aut facere repellat provident occaecati excepturi optio reprehenderit","body":"quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"}');
Result
{ id: '0xed85f90ebae04e7fd60ca4bb56cf4b1ae7afcba1f95b5a7c70342330bc0e84eb',
encryptedSecret: '0xf333af7967322043ef317d7e5bf828f804e981170b22e10f47f7a7255d6a799caa78b87e5de4c4ccceabd3379fb7ff94ea59089d5730f0d7a25bf709f89712090659ff95324b0e0559159ad17430307bfbe9366f2fe9a3f9cdbbc2857cd3f2a7f4add99c06a918f2f7430689e513e3f6376d8ef359bb29b30d8fa2ab3c31d87574',
encryptedData: 'VTJGc2RHVmtYMStsYTdUZVRVMnh4M0tIMkdSZFRCUEg1akZSVnpERURYTk5OUDNNYVFDMkdxRm1mTFFFUXBMVDNzbGZIU2R0N05ub0FPYmhxRU5OMG1zUmVyck0rUDZjcVluYVdUZmlFZlYveDNFYS94bUF1aXU1ZXNLMzdoSWhPSmMwZVc5aHVNWEt1V0p0TC9pNzhZM0xpYUM1eENOQ2N3RWswbFdqdWpUd3JITWZaRWRaWDA1cEhLcVNEZERlMXBnMXdFbHo5UFR6bytRSFVkQm1Rd1pjazVIT21QaXB2YmduUS9nM0ZIVzZCVXIreG1NZFlIVEV1TmNuMUwzMFFwZWFyNHVRU0xtWWw2OUZwbGlLRmQxNjBSK1ZkQm9ZeGhuL3lYZzVvMzdIaE11TFd0QUN1Z0UyUzBvRGYvUkFPclJBcTlxZmRPdlNKVUM2bFErbEVFNFNFOHRZMWREMmJ5V3JuTVB4WE9pWWZJNHVFaEJxblM2Y09kWmJVVEIwRE1sMEpLK3NqNUhWUG9sVnM1ZGtjTG1kVWxId2ZETDAxdlBDOFEzUVRWcz0=' }