diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-19 17:46:17 -0400 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-24 10:35:38 +0200 |
commit | 9258382b0dda205f7f1aa390f9cc58c5df33d092 (patch) | |
tree | 7f379cf84b36fc8123f18d6cba576a6355fae4e6 /toolkit/identity/IdentityStore.jsm | |
parent | b6a703907e7e349213fac466d5665e91966cbcaa (diff) | |
download | UXP-9258382b0dda205f7f1aa390f9cc58c5df33d092.tar UXP-9258382b0dda205f7f1aa390f9cc58c5df33d092.tar.gz UXP-9258382b0dda205f7f1aa390f9cc58c5df33d092.tar.lz UXP-9258382b0dda205f7f1aa390f9cc58c5df33d092.tar.xz UXP-9258382b0dda205f7f1aa390f9cc58c5df33d092.zip |
Issue #576 - Remove IdentityService and ContextualIdentityService
Diffstat (limited to 'toolkit/identity/IdentityStore.jsm')
-rw-r--r-- | toolkit/identity/IdentityStore.jsm | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/toolkit/identity/IdentityStore.jsm b/toolkit/identity/IdentityStore.jsm deleted file mode 100644 index 1827a839e..000000000 --- a/toolkit/identity/IdentityStore.jsm +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const Cu = Components.utils; -const Ci = Components.interfaces; -const Cc = Components.classes; -const Cr = Components.results; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -this.EXPORTED_SYMBOLS = ["IdentityStore"]; - -// the data store for IDService -// written as a separate thing so it can easily be mocked -function IDServiceStore() { - this.reset(); -} - -// Note: eventually these methods may be async, but we haven no need for this -// for now, since we're not storing to disk. -IDServiceStore.prototype = { - addIdentity: function addIdentity(aEmail, aKeyPair, aCert) { - this._identities[aEmail] = {keyPair: aKeyPair, cert: aCert}; - }, - fetchIdentity: function fetchIdentity(aEmail) { - return aEmail in this._identities ? this._identities[aEmail] : null; - }, - removeIdentity: function removeIdentity(aEmail) { - let data = this._identities[aEmail]; - delete this._identities[aEmail]; - return data; - }, - getIdentities: function getIdentities() { - // XXX - should clone? - return this._identities; - }, - clearCert: function clearCert(aEmail) { - // XXX - should remove key from store? - this._identities[aEmail].cert = null; - this._identities[aEmail].keyPair = null; - }, - - /** - * set the login state for a given origin - * - * @param aOrigin - * (string) a web origin - * - * @param aState - * (boolean) whether or not the user is logged in - * - * @param aEmail - * (email) the email address the user is logged in with, - * or, if not logged in, the default email for that origin. - */ - setLoginState: function setLoginState(aOrigin, aState, aEmail) { - if (aState && !aEmail) { - throw "isLoggedIn cannot be set to true without an email"; - } - return this._loginStates[aOrigin] = {isLoggedIn: aState, email: aEmail}; - }, - getLoginState: function getLoginState(aOrigin) { - return aOrigin in this._loginStates ? this._loginStates[aOrigin] : null; - }, - clearLoginState: function clearLoginState(aOrigin) { - delete this._loginStates[aOrigin]; - }, - - reset: function Store_reset() { - // _identities associates emails with keypairs and certificates - this._identities = {}; - - // _loginStates associates. remote origins with a login status and - // the email the user has chosen as his or her identity when logging - // into that origin. - this._loginStates = {}; - }, - - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIObserver]), - - observe: function observe(aSubject, aTopic, aData) { - switch (aTopic) { - case "quit-application-granted": - Services.obs.removeObserver(this, "quit-application-granted"); - this.reset(); - break; - } - }, -}; - -this.IdentityStore = new IDServiceStore(); |