From 18ddfe6cf083dbb81891b31cffa6df406be3d905 Mon Sep 17 00:00:00 2001 From: Edward Lee Date: Thu, 4 Jun 2009 17:04:51 -0700 Subject: [PATCH] PubKeyManager_getDefaultKey: async + async/yield -> sync. --- services/sync/modules/base_records/crypto.js | 4 ++-- services/sync/modules/base_records/keys.js | 9 ++------- services/sync/modules/engines.js | 2 +- services/sync/modules/service.js | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/services/sync/modules/base_records/crypto.js b/services/sync/modules/base_records/crypto.js index 7cf71d650471..7f1dfc2faedc 100644 --- a/services/sync/modules/base_records/crypto.js +++ b/services/sync/modules/base_records/crypto.js @@ -80,7 +80,7 @@ CryptoWrapper.prototype = { return; } - let pubkey = yield PubKeys.getDefaultKey(self.cb); + let pubkey = PubKeys.getDefaultKey(); let privkey = PrivKeys.get(pubkey.privateKeyUri); let meta = CryptoMetas.get(this.encryption); @@ -105,7 +105,7 @@ CryptoWrapper.prototype = { return; } - let pubkey = yield PubKeys.getDefaultKey(self.cb); + let pubkey = PubKeys.getDefaultKey(); let privkey = PrivKeys.get(pubkey.privateKeyUri); let meta = CryptoMetas.get(this.encryption); diff --git a/services/sync/modules/base_records/keys.js b/services/sync/modules/base_records/keys.js index 1c3f9e89f596..b18ba4b35dd2 100644 --- a/services/sync/modules/base_records/keys.js +++ b/services/sync/modules/base_records/keys.js @@ -149,13 +149,8 @@ PubKeyManager.prototype = { get defaultKeyUri() this._defaultKeyUri, set defaultKeyUri(value) { this._defaultKeyUri = value; }, - getDefaultKey: function KeyMgr_getDefaultKey(onComplete) { - let fn = function KeyMgr__getDefaultKey() { - let self = yield; - let ret = this.get(this.defaultKeyUri); - self.done(ret); - }; - fn.async(this, onComplete); + getDefaultKey: function PubKeyManager_getDefaultKey() { + return this.get(this.defaultKeyUri); }, createKeypair: function KeyMgr_createKeypair(passphrase, pubkeyUri, privkeyUri) { diff --git a/services/sync/modules/engines.js b/services/sync/modules/engines.js index 48a3fc8faefa..bdcc1586eaf9 100644 --- a/services/sync/modules/engines.js +++ b/services/sync/modules/engines.js @@ -304,7 +304,7 @@ SyncEngine.prototype = { let meta = CryptoMetas.get(this.cryptoMetaURL); if (!meta) { let symkey = Svc.Crypto.generateRandomKey(); - let pubkey = yield PubKeys.getDefaultKey(self.cb); + let pubkey = PubKeys.getDefaultKey(); meta = new CryptoMeta(this.cryptoMetaURL); meta.generateIV(); yield meta.addUnwrappedKey(self.cb, pubkey, symkey); diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 5e31ccfe9979..3d8ded63eb94 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -712,7 +712,7 @@ WeaveSvc.prototype = { } let needKeys = true; - let pubkey = yield PubKeys.getDefaultKey(self.cb); + let pubkey = PubKeys.getDefaultKey(); if (!pubkey) this._log.debug("Could not get public key"); else if (pubkey.keyData == null)