Default auth params version value, SFJS 0.3.6

This commit is contained in:
Mo Bitar
2018-07-23 08:45:04 -05:00
parent cd3d5891c1
commit e4da258d46
4 changed files with 15 additions and 21 deletions

View File

@@ -49,21 +49,6 @@ class AuthManager extends SFAuthManager {
}
}
async protocolVersion() {
var authParams = await this.getAuthParams();
if(authParams && authParams.version) {
return authParams.version;
}
var keys = await this.keys();
if(keys && keys.ak) {
// If there's no version stored, and there's an ak, it has to be 002. Newer versions would have thier version stored in authParams.
return "002";
} else {
return "001";
}
}
async getAuthParamsForEmail(url, email, extraParams) {
return super.getAuthParamsForEmail(url, email, extraParams);
}

View File

@@ -23,7 +23,17 @@ angular.module('app')
}
this.passcodeAuthParams = function() {
return JSON.parse(storageManager.getItemSync("offlineParams", StorageManager.Fixed));
var authParams = JSON.parse(storageManager.getItemSync("offlineParams", StorageManager.Fixed));
if(authParams && !authParams.version) {
var keys = this.keys();
if(keys && keys.ak) {
// If there's no version stored, and there's an ak, it has to be 002. Newer versions would have thier version stored in authParams.
authParams.version = "002";
} else {
authParams.version = "001";
}
}
return authParams;
}
this.unlock = function(passcode, callback) {
@@ -58,7 +68,6 @@ angular.module('app')
// Encrypting will initially clear localStorage
this.encryptLocalStorage(keys, authParams);
// After it's cleared, it's safe to write to it
storageManager.setItem("offlineParams", JSON.stringify(authParams), StorageManager.Fixed);
callback(true);

6
package-lock.json generated
View File

@@ -9353,9 +9353,9 @@
"dev": true
},
"standard-file-js": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.5.tgz",
"integrity": "sha512-wJY0uBHxf9Af2wEqpwPwiiCTOky4qRSqUNLIP9kfkJfgavvWJ+oQA/fI65om2vuW+ZBmoaLHRgfzGXAaWA56+w==",
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.6.tgz",
"integrity": "sha512-GhowAiZBWXxwjVJMUbq4I6ovFB2l3jSE5lLgJ56Md5l/AKlNuJwDJdoTuOfUE+FTw0Lv+P37Uk3O5FaduuiO7g==",
"dev": true
},
"statuses": {

View File

@@ -37,7 +37,7 @@
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"sn-stylekit": "1.0.15",
"standard-file-js": "0.3.5",
"standard-file-js": "0.3.6",
"sn-models": "0.1.1",
"connect": "^3.6.6",
"mocha": "^5.2.0",