             }
         }
 
+        let baseBundleIdentifier = AppInfo.baseBundleIdentifier
+        if !baseBundleIdentifier.isEmpty {
+            self.keychain = KeychainWrapper(serviceName: baseBundleIdentifier)
+        } else {
+            log.error("Unable to get the base bundle identifier. Keychain data will not be shared.")
+            self.keychain = KeychainWrapper.standard
+        }
+        
         let notificationCenter = NotificationCenter.default
         notificationCenter.addObserver(self, selector: #selector(BrowserProfile.onProfileDidFinishSyncing(_:)), name: NotificationProfileDidFinishSyncing, object: nil)
         notificationCenter.addObserver(self, selector: #selector(BrowserProfile.onPrivateDataClearedHistory(_:)), name: NotificationPrivateDataClearedHistory, object: nil)
-
-
-        let baseBundleIdentifier = AppInfo.baseBundleIdentifier
-        if !baseBundleIdentifier.isEmpty {
-            // TODO: Fix
-//            KeychainWrapper.standard.serviceName = baseBundleIdentifier
-        } else {
-            log.error("Unable to get the base bundle identifier. Keychain data will not be shared.")
-        }
 
         // If the profile dir doesn't exist yet, this is first run (for this profile).
         if !files.exists("") {

    fileprivate lazy var loginsKey: String? = {
        
        let key = "sqlcipher.key.logins.db"
        if KeychainWrapper.standard.hasValue(forKey: key) {
            return KeychainWrapper.standard.string(forKey: key)
        }
        
        let Length: UInt = 256
        let secret = Bytes.generateRandomBytes(Length).base64EncodedString
        KeychainWrapper.standard.set(secret, forKey: key)
        return secret
    }()



    func removeAccountMetadata() {
        self.prefs.removeObjectForKey(PrefsKeys.KeyLastRemoteTabSyncTime)
        self.keychain.removeObject(forKey: self.name + ".account")
    }

    func removeExistingAuthenticationInfo() {
        self.keychain.setAuthenticationInfo(nil)
    }
}
