Published
Edited
Oct 19, 2018
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tkit.display
Insert cell
Insert cell
Log = tkit.history.display
Insert cell
Insert cell
{while(true) {yield tkit.data; await tkit.watch()}}
Insert cell
Insert cell
decryptLog ={
while(true) {
yield tkit.back.queue.map(entry => {
return {[moment(entry.time).format('HH:mm:ss.SSS')]: Encrypt.getEncryptor().decrypt(entry.data)}});
await tkit.back.watch();
}
}
Insert cell
class Encrypt extends dmt.Tool {
// Tool constructor parameters:
// settings object may (or may not) contain initial values
// reference to toolkit being instantiated
constructor(settings, toolkit) {
super(settings, toolkit);
this.profile({
package: ['v0.3.0',
`Dropbox - gets file name list`,
Encrypt.toString()],
declare: ['queue', 'maxlen'],
methods: ['async filesListFolder()'],
resolve: ['log']
});


// Peek at data - allowed to return data modified
// when a get data called decrypt, when a set data called encrypt
this.toolkit.eyes.addPeekFn(this.decryption, this.encryption);

if (settings._encrypt) {Object.assign(this, settings._encrypt)}
}

// ----
// Getter and Setter overrides

// ----
// Methods

// Since 'this' not provided on peek calls
// and the toolkit can not see the encryptor in the imported Encrypt module
// and since want to use the same encryptor for all toolkit
// (thus all using the same encryption phrase)
// need to assign at class level - ie: static
static getEncryptor() {return encryptor}

decryption(data) {console.log('decrypt'); return Encrypt.getEncryptor().decrypt(data)}
encryption(data) {console.log('encrypt'); return Encrypt.getEncryptor().encrypt(data)}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more