@accounts/client
Advanced tools
Comparing version 0.20.0-alpha.1.cfb0004e to 0.20.0
@@ -19,3 +19,3 @@ "use strict"; | ||
function AccountsClient(options, transport) { | ||
this.options = tslib_1.__assign({}, defaultOptions, options); | ||
this.options = tslib_1.__assign(tslib_1.__assign({}, defaultOptions), options); | ||
this.storage = this.options.tokenStorage; | ||
@@ -22,0 +22,0 @@ if (!transport) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
exports.tokenStorageLocal = { | ||
setItem: function (key, value) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, localStorage.setItem(key, value)]; | ||
}); | ||
}); | ||
return localStorage.setItem(key, value); | ||
}, | ||
getItem: function (key) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, localStorage.getItem(key)]; | ||
}); | ||
}); | ||
return localStorage.getItem(key); | ||
}, | ||
removeItem: function (key) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, localStorage.removeItem(key)]; | ||
}); | ||
}); | ||
return localStorage.removeItem(key); | ||
}, | ||
}; | ||
//# sourceMappingURL=token-storage-local.js.map |
@@ -0,5 +1,7 @@ | ||
declare type ValueOrPromise<T> = T | Promise<T>; | ||
export interface TokenStorage { | ||
setItem(key: string, value: string): Promise<void>; | ||
getItem(key: string): Promise<string | null>; | ||
removeItem(key: string): Promise<void>; | ||
setItem(key: string, value: string): ValueOrPromise<void>; | ||
getItem(key: string): ValueOrPromise<string | null>; | ||
removeItem(key: string): ValueOrPromise<void>; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var jwtDecode = require("jwt-decode"); | ||
var tslib_1 = require("tslib"); | ||
var jwt_decode_1 = tslib_1.__importDefault(require("jwt-decode")); | ||
exports.isTokenExpired = function (token) { | ||
var currentTime = Date.now() / 1000; | ||
var decodedToken = jwtDecode(token); | ||
var decodedToken = jwt_decode_1.default(token); | ||
return decodedToken.exp < currentTime; | ||
}; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@accounts/client", | ||
"version": "0.20.0-alpha.1.cfb0004e", | ||
"version": "0.20.0", | ||
"description": "Fullstack authentication and accounts-management", | ||
@@ -46,5 +46,5 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "24.0.18", | ||
"@types/jest": "24.0.22", | ||
"@types/jwt-decode": "2.2.1", | ||
"@types/node": "12.7.4", | ||
"@types/node": "12.12.7", | ||
"jest": "24.9.0", | ||
@@ -57,6 +57,7 @@ "jest-localstorage-mock": "2.4.0", | ||
"dependencies": { | ||
"@accounts/types": "^0.20.0-alpha.1.cfb0004e", | ||
"@accounts/types": "^0.20.0", | ||
"jwt-decode": "2.2.0", | ||
"tslib": "1.10.0" | ||
} | ||
}, | ||
"gitHead": "68ff004f0ef63918b73006ec4a122f21e89cf661" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26192
27
416
Updated@accounts/types@^0.20.0