Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
relayPairedControllers: this.relayPairedControllers,
accessoryBagURL: this.accessoryBagURL
};
for (var username in this.pairedClients) {
const pairingInformation = this.pairedClients[username];
//@ts-ignore
saved.pairedClients[username] = pairingInformation.publicKey.toString('hex');
// @ts-ignore
saved.pairedClientsPermission[username] = pairingInformation.permission;
}
var key = AccessoryInfo.persistKey(this.username);
storage.setItemSync(key, saved);
storage.persistSync();
}
save = () => {
var newCacheHash = crypto.createHash('sha1').update(JSON.stringify(this._cache)).digest('hex'); //calculate hash of new cache
if (newCacheHash != this._savedCacheHash) { //check if cache need to be saved and proceed accordingly
var saved = {
cache: this._cache
};
var key = IdentifierCache.persistKey(this.username);
storage.setItemSync(key, saved);
storage.persistSync();
this._savedCacheHash = newCacheHash; //update hash of saved cache for future use
}
}