@forgerock/javascript-sdk
Advanced tools
Comparing version 4.3.0-beta.1 to 4.3.0
# Changelog | ||
## [4.3.0] - 2024-01-04 | ||
Features | ||
- Make a prefix to the storage keys configurable via the Config class | ||
- Added a QR Code utility class to determine if a step has a QR Code and handle QR Codes in SDK | ||
Fixes | ||
- Fix main and module fields in package.json being undefined | ||
## [4.2.0] - 2023-09-11 | ||
@@ -4,0 +15,0 @@ |
{ | ||
"name": "@forgerock/javascript-sdk", | ||
"version": "4.3.0-beta.1", | ||
"version": "4.3.0", | ||
"description": "ForgeRock JavaScript SDK", | ||
@@ -27,6 +27,6 @@ "author": "ForgeRock", | ||
}, | ||
"main": "./src/index.cjs", | ||
"module": "./src/index.js", | ||
"types": "./src/index.d.ts", | ||
"module": "./index.js", | ||
"main": "./index.cjs", | ||
"type": "module" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { DEFAULT_TIMEOUT, DEFAULT_OAUTH_THRESHOLD } from './constants.js'; | ||
import { DEFAULT_TIMEOUT, DEFAULT_OAUTH_THRESHOLD, PREFIX } from './constants.js'; | ||
export { DEFAULT_TIMEOUT } from './constants.js'; | ||
@@ -23,2 +23,3 @@ | ||
logLevel: options.logLevel || 'none', | ||
prefix: options.prefix || PREFIX, | ||
}; | ||
@@ -56,5 +57,3 @@ } | ||
} | ||
this.options = { | ||
...setDefaults(options), | ||
}; | ||
this.options = { ...setDefaults(options) }; | ||
} | ||
@@ -61,0 +60,0 @@ /** |
@@ -35,2 +35,3 @@ import type { ActionTypes } from './enums'; | ||
logger?: LoggerFunctions; | ||
prefix?: string; | ||
} | ||
@@ -37,0 +38,0 @@ type ConfigurablePaths = keyof CustomPathConfig; |
@@ -9,3 +9,3 @@ import type { StepOptions } from '../auth/interfaces'; | ||
declare abstract class FRAuth { | ||
static readonly previousStepKey: string; | ||
static get previousStepKey(): string; | ||
/** | ||
@@ -12,0 +12,0 @@ * Requests the next step in the authentication tree. |
@@ -0,1 +1,2 @@ | ||
import Config from '../config/index.js'; | ||
import Auth from '../auth/index.js'; | ||
@@ -6,3 +7,2 @@ import { CallbackType } from '../auth/enums.js'; | ||
import FRStep from './fr-step.js'; | ||
import { PREFIX } from '../config/constants.js'; | ||
@@ -22,2 +22,5 @@ /* | ||
class FRAuth { | ||
static get previousStepKey() { | ||
return `${Config.get().prefix}-PreviousStep`; | ||
} | ||
/** | ||
@@ -169,4 +172,3 @@ * Requests the next step in the authentication tree. | ||
} | ||
FRAuth.previousStepKey = `${PREFIX}-PreviousStep`; | ||
export { FRAuth as default }; |
import { fontNames, devicePlatforms, displayProps, browserProps, hardwareProps, platformProps, configurableCategories, delay } from './defaults.js'; | ||
import Collector from './collector.js'; | ||
import { PREFIX } from '../config/constants.js'; | ||
import { FRLogger } from '../util/logger.js'; | ||
import Config from '../config/index.js'; | ||
@@ -109,3 +109,3 @@ /* | ||
getIdentifier() { | ||
const storageKey = `${PREFIX}-DeviceID`; | ||
const storageKey = `${Config.get().prefix}-DeviceID`; | ||
if (!(typeof globalThis.crypto !== 'undefined' && globalThis.crypto.getRandomValues)) { | ||
@@ -112,0 +112,0 @@ FRLogger.warn('Cannot generate profile ID. Crypto and/or getRandomValues is not supported.'); |
import Config from '../config/index.js'; | ||
import { PREFIX } from '../config/constants.js'; | ||
import { FRLogger } from '../util/logger.js'; | ||
@@ -61,3 +60,3 @@ import OAuth2Client, { allowedErrors } from '../oauth2-client/index.js'; | ||
const { clientId, oauthThreshold } = Config.get(options); | ||
const storageKey = `${PREFIX}-${clientId}`; | ||
const storageKey = `${Config.get().prefix}-${clientId}`; | ||
/** | ||
@@ -64,0 +63,0 @@ * First, let's see if tokens exist locally |
@@ -1,2 +0,2 @@ | ||
import { PREFIX } from '../config/constants.js'; | ||
import Config from '../config/index.js'; | ||
@@ -20,3 +20,3 @@ /* | ||
static async get(clientId) { | ||
const tokenString = localStorage.getItem(`${PREFIX}-${clientId}`); | ||
const tokenString = localStorage.getItem(`${Config.get().prefix}-${clientId}`); | ||
// If there is no stored token, or the token is not an object, return null | ||
@@ -40,3 +40,3 @@ if (!tokenString) { | ||
const tokenString = JSON.stringify(tokens); | ||
localStorage.setItem(`${PREFIX}-${clientId}`, tokenString); | ||
localStorage.setItem(`${Config.get().prefix}-${clientId}`, tokenString); | ||
} | ||
@@ -47,3 +47,3 @@ /** | ||
static async remove(clientId) { | ||
localStorage.removeItem(`${PREFIX}-${clientId}`); | ||
localStorage.removeItem(`${Config.get().prefix}-${clientId}`); | ||
} | ||
@@ -50,0 +50,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { PREFIX } from '../config/constants.js'; | ||
import Config from '../config/index.js'; | ||
@@ -20,3 +20,3 @@ /* | ||
static async get(clientId) { | ||
const tokenString = sessionStorage.getItem(`${PREFIX}-${clientId}`); | ||
const tokenString = sessionStorage.getItem(`${Config.get().prefix}-${clientId}`); | ||
// If there is no stored token, or the token is not an object, return null | ||
@@ -40,3 +40,3 @@ if (!tokenString) { | ||
const tokenString = JSON.stringify(tokens); | ||
sessionStorage.setItem(`${PREFIX}-${clientId}`, tokenString); | ||
sessionStorage.setItem(`${Config.get().prefix}-${clientId}`, tokenString); | ||
} | ||
@@ -47,3 +47,3 @@ /** | ||
static async remove(clientId) { | ||
sessionStorage.removeItem(`${PREFIX}-${clientId}`); | ||
sessionStorage.removeItem(`${Config.get().prefix}-${clientId}`); | ||
} | ||
@@ -50,0 +50,0 @@ } |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
425819
11558
0