Skip to content

Commit

Permalink
Merge branch 'release-1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Luis Gutierrez Dos Santos committed Aug 6, 2020
2 parents f480e10 + 66d6332 commit 362938f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oat-sa/tao-core-sdk",
"version": "1.5.0",
"version": "1.6.0",
"displayName": "TAO Core SDK",
"description": "Core libraries of TAO",
"homepage": "https://github.com/oat-sa/tao-core-sdk-fe#readme",
Expand Down
14 changes: 6 additions & 8 deletions src/core/tokenStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ import store from 'core/store';
* @property {Number} receivedAt - Creation timestamp
*/

/**
* The default number of tokens to store
*/
const defaultConfig = {
maxSize: 6,
tokenTimeLimit: 1000 * 60 * 24
maxSize: 6, // Default number of tokens to store
tokenTimeLimit: 1000 * 60 * 24, // Default token TTL (24 minutes)
store: 'memory' // In memory storage is preferred by default over the indexeddb or localStorage implementations
};

/**
Expand All @@ -49,9 +47,9 @@ const defaultConfig = {
export default function tokenStoreFactory(options) {
const config = _.defaults(options || {}, defaultConfig);

// In memory storage
// For security reasons, this is preferred over the indexeddb or localStorage implementations
const getStore = () => store('tokenStore.tokens', store.backends.memory);
const getStoreBackend = () => store.backends[config.store] || store.backends[defaultConfig.store];

const getStore = () => store('tokenStore.tokens', getStoreBackend());

/**
* @typedef tokenStore
Expand Down

0 comments on commit 362938f

Please sign in to comment.