@strivacity/sdk-core 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/flows/BaseFlow.cjs +1 -1
- package/dist/flows/BaseFlow.cjs.map +1 -1
- package/dist/flows/BaseFlow.d.ts +14 -6
- package/dist/flows/BaseFlow.mjs +1 -1
- package/dist/flows/BaseFlow.mjs.map +1 -1
- package/dist/flows/NativeFlow.cjs +1 -1
- package/dist/flows/NativeFlow.cjs.map +1 -1
- package/dist/flows/NativeFlow.d.ts +6 -2
- package/dist/flows/NativeFlow.mjs +1 -1
- package/dist/flows/NativeFlow.mjs.map +1 -1
- package/dist/flows/PopupFlow.cjs +1 -1
- package/dist/flows/PopupFlow.cjs.map +1 -1
- package/dist/flows/PopupFlow.d.ts +8 -2
- package/dist/flows/PopupFlow.mjs +1 -1
- package/dist/flows/PopupFlow.mjs.map +1 -1
- package/dist/flows/RedirectFlow.cjs +1 -1
- package/dist/flows/RedirectFlow.cjs.map +1 -1
- package/dist/flows/RedirectFlow.d.ts +8 -2
- package/dist/flows/RedirectFlow.mjs +1 -1
- package/dist/flows/RedirectFlow.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/storages/LocalStorage.cjs +1 -1
- package/dist/storages/LocalStorage.cjs.map +1 -1
- package/dist/storages/LocalStorage.mjs +1 -1
- package/dist/storages/LocalStorage.mjs.map +1 -1
- package/dist/storages/SessionStorage.cjs +1 -1
- package/dist/storages/SessionStorage.cjs.map +1 -1
- package/dist/storages/SessionStorage.mjs +1 -1
- package/dist/storages/SessionStorage.mjs.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +28 -1
- package/dist/types.mjs +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/HttpClient.cjs +1 -1
- package/dist/utils/HttpClient.cjs.map +1 -1
- package/dist/utils/HttpClient.d.ts +1 -1
- package/dist/utils/HttpClient.mjs +1 -1
- package/dist/utils/HttpClient.mjs.map +1 -1
- package/dist/utils/Logging.cjs +2 -0
- package/dist/utils/Logging.cjs.map +1 -0
- package/dist/utils/Logging.d.ts +8 -0
- package/dist/utils/Logging.mjs +2 -0
- package/dist/utils/Logging.mjs.map +1 -0
- package/dist/utils/Metadata.cjs +1 -1
- package/dist/utils/Metadata.cjs.map +1 -1
- package/dist/utils/Metadata.mjs +1 -1
- package/dist/utils/Metadata.mjs.map +1 -1
- package/dist/utils/NativeFlowHandler.cjs +1 -1
- package/dist/utils/NativeFlowHandler.cjs.map +1 -1
- package/dist/utils/NativeFlowHandler.d.ts +7 -0
- package/dist/utils/NativeFlowHandler.mjs +1 -1
- package/dist/utils/NativeFlowHandler.mjs.map +1 -1
- package/dist/utils/Session.cjs +1 -1
- package/dist/utils/Session.cjs.map +1 -1
- package/dist/utils/Session.mjs +1 -1
- package/dist/utils/Session.mjs.map +1 -1
- package/dist/utils/State.cjs +1 -1
- package/dist/utils/State.cjs.map +1 -1
- package/dist/utils/State.mjs +1 -1
- package/dist/utils/State.mjs.map +1 -1
- package/dist/utils/base64Url.cjs.map +1 -1
- package/dist/utils/base64Url.mjs.map +1 -1
- package/dist/utils/credentials.cjs +1 -1
- package/dist/utils/credentials.cjs.map +1 -1
- package/dist/utils/credentials.mjs +1 -1
- package/dist/utils/credentials.mjs.map +1 -1
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/handlers.cjs +1 -1
- package/dist/utils/handlers.cjs.map +1 -1
- package/dist/utils/handlers.mjs +1 -1
- package/dist/utils/handlers.mjs.map +1 -1
- package/dist/utils/object.cjs.map +1 -1
- package/dist/utils/object.mjs.map +1 -1
- package/package.json +5 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{redirectUrlHandler as
|
|
1
|
+
import{redirectUrlHandler as c,redirectCallbackHandler as d}from"../utils/handlers.mjs";import{NativeFlowHandler as h}from"../utils/NativeFlowHandler.mjs";import{BaseFlow as p}from"./BaseFlow.mjs";import"../utils/State.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/errors.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class P extends p{constructor(r,e,t,i){r.urlHandler||(r.urlHandler=c),r.callbackHandler||(r.callbackHandler=d),super(r,e,t,i)}login(r={}){return this.dispatchEvent("loginInitiated",[]),new h(this,r)}register(r={}){return r.prompt="create",this.login(r)}async entry(r){r||(r=globalThis.window?.location.href);const e=new URL(r);e.searchParams.append("sdk","web"),e.searchParams.append("client_id",this.options.clientId),e.searchParams.append("redirect_uri",this.options.redirectUri);const t=await this.httpClient.request(`${this.options.issuer}/provider/flow/entry?${e.searchParams.toString()}`);if(!t.ok){if(t.status===400){const o=await t.json();let n="Entry request failed with status 400";typeof o=="object"&&(o.error?n=`${o.error}: ${o.error_description}`:o.errorKey&&(n=o.errorKey));const l=new Error(n);throw this.logging?.error("Entry request error",l),l}const s=new Error(`Entry request failed with status ${t.status}`);throw this.logging?.error("Entry request error",s),s}let i;try{i=new URL(await t.text())}catch{i=new URL(t.url)}const a=i.searchParams.get("session_id");if(!a){const s=new Error("Session ID not found in entry response");throw this.logging?.error("Entry response error",s),s}return a}async handleCallback(r){if(typeof this.options.callbackHandler!="function"){const e=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",e),e}r||(r=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(r,this.options.responseMode||"fragment"))}}export{P as NativeFlow};
|
|
2
2
|
//# sourceMappingURL=NativeFlow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeFlow.mjs","sources":["../../src/flows/NativeFlow.ts"],"sourcesContent":["import type { SDKOptions, NativeParams, SDKStorage, SDKHttpClient } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { NativeFlowHandler } from '../utils/NativeFlowHandler';\nimport { BaseFlow } from './BaseFlow';\n\nexport class NativeFlow extends BaseFlow<SDKOptions, NativeParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient);\n\t}\n\n\t/**\n\t * Initiates the login process via native UI.\n\t * @param {NativeParams} [params={}] Optional parameters for native configuration.\n\t * @returns {NativeFlowHandler} Returns with a native login handler.\n\t */\n\tlogin(params: NativeParams = {}): NativeFlowHandler {\n\t\tthis.dispatchEvent('loginInitiated', []);\n\n\t\treturn new NativeFlowHandler(this, params);\n\t}\n\n\t/**\n\t * Initiates the registration process via native UI.\n\t * @param {NativeParams} [params={}] Optional parameters for native configuration.\n\t * @returns {NativeFlowHandler} Returns with a native login handler.\n\t */\n\tregister(params: NativeParams = {}): NativeFlowHandler {\n\t\tparams.prompt = 'create';\n\n\t\treturn this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<string>} A promise that resolves to the session ID.\n\t */\n\tasync entry(url?: string): Promise<string> {\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\t\tentryUrl.searchParams.append('sdk', 'web');\n\t\tentryUrl.searchParams.append('client_id', this.options.clientId);\n\t\tentryUrl.searchParams.append('redirect_uri', this.options.redirectUri);\n\n\t\tconst response = await this.httpClient.request<string | Record<string, string>>(\n\t\t\t`${this.options.issuer}/provider/flow/entry?${entryUrl.searchParams.toString()}`,\n\t\t);\n\n\t\tif (!response.ok) {\n\t\t\tif (response.status === 400) {\n\t\t\t\tconst data = await response.json();\n\t\t\t\tlet message = 'Entry request failed with status 400';\n\n\t\t\t\tif (typeof data === 'object') {\n\t\t\t\t\tif (data.error) {\n\t\t\t\t\t\tmessage = `${data.error}: ${data.error_description}`;\n\t\t\t\t\t} else if (data.errorKey) {\n\t\t\t\t\t\tmessage = data.errorKey;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\
|
|
1
|
+
{"version":3,"file":"NativeFlow.mjs","sources":["../../src/flows/NativeFlow.ts"],"sourcesContent":["import type { SDKOptions, NativeParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { NativeFlowHandler } from '../utils/NativeFlowHandler';\nimport { BaseFlow } from './BaseFlow';\n\nexport class NativeFlow extends BaseFlow<SDKOptions, NativeParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via native UI.\n\t * @param {NativeParams} [params={}] Optional parameters for native configuration.\n\t * @returns {NativeFlowHandler} Returns with a native login handler.\n\t */\n\tlogin(params: NativeParams = {}): NativeFlowHandler {\n\t\tthis.dispatchEvent('loginInitiated', []);\n\n\t\treturn new NativeFlowHandler(this, params);\n\t}\n\n\t/**\n\t * Initiates the registration process via native UI.\n\t * @param {NativeParams} [params={}] Optional parameters for native configuration.\n\t * @returns {NativeFlowHandler} Returns with a native login handler.\n\t */\n\tregister(params: NativeParams = {}): NativeFlowHandler {\n\t\tparams.prompt = 'create';\n\n\t\treturn this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<string>} A promise that resolves to the session ID.\n\t *\n\t * @throws {Error} Throws an error if the entry request fails or session ID is not found.\n\t */\n\tasync entry(url?: string): Promise<string> {\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\t\tentryUrl.searchParams.append('sdk', 'web');\n\t\tentryUrl.searchParams.append('client_id', this.options.clientId);\n\t\tentryUrl.searchParams.append('redirect_uri', this.options.redirectUri);\n\n\t\tconst response = await this.httpClient.request<string | Record<string, string>>(\n\t\t\t`${this.options.issuer}/provider/flow/entry?${entryUrl.searchParams.toString()}`,\n\t\t);\n\n\t\tif (!response.ok) {\n\t\t\tif (response.status === 400) {\n\t\t\t\tconst data = await response.json();\n\t\t\t\tlet message = 'Entry request failed with status 400';\n\n\t\t\t\tif (typeof data === 'object') {\n\t\t\t\t\tif (data.error) {\n\t\t\t\t\t\tmessage = `${data.error}: ${data.error_description}`;\n\t\t\t\t\t} else if (data.errorKey) {\n\t\t\t\t\t\tmessage = data.errorKey;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst error = new Error(message);\n\t\t\t\tthis.logging?.error('Entry request error', error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tconst error = new Error(`Entry request failed with status ${response.status}`);\n\t\t\tthis.logging?.error('Entry request error', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tlet uri: URL;\n\n\t\ttry {\n\t\t\turi = new URL(await response.text());\n\t\t} catch {\n\t\t\turi = new URL(response.url);\n\t\t}\n\n\t\tconst sessionId = uri.searchParams.get('session_id');\n\n\t\tif (!sessionId) {\n\t\t\tconst error = new Error('Session ID not found in entry response');\n\t\t\tthis.logging?.error('Entry response error', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn sessionId;\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["NativeFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","NativeFlowHandler","url","entryUrl","response","data","message","error","uri","sessionId"],"mappings":"qaAKO,MAAMA,UAAmBC,CAAmC,CAClE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CAOA,MAAMG,EAAuB,GAAuB,CACnD,YAAK,cAAc,iBAAkB,EAAE,EAEhC,IAAIC,EAAkB,KAAMD,CAAM,CAC1C,CAOA,SAASA,EAAuB,GAAuB,CACtD,OAAAA,EAAO,OAAS,SAET,KAAK,MAAMA,CAAM,CACzB,CASA,MAAM,MAAME,EAA+B,CACrCA,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAC5BC,EAAS,aAAa,OAAO,MAAO,KAAK,EACzCA,EAAS,aAAa,OAAO,YAAa,KAAK,QAAQ,QAAQ,EAC/DA,EAAS,aAAa,OAAO,eAAgB,KAAK,QAAQ,WAAW,EAErE,MAAMC,EAAW,MAAM,KAAK,WAAW,QACtC,GAAG,KAAK,QAAQ,MAAM,wBAAwBD,EAAS,aAAa,UAAU,EAAA,EAG/E,GAAI,CAACC,EAAS,GAAI,CACjB,GAAIA,EAAS,SAAW,IAAK,CAC5B,MAAMC,EAAO,MAAMD,EAAS,KAAA,EAC5B,IAAIE,EAAU,uCAEV,OAAOD,GAAS,WACfA,EAAK,MACRC,EAAU,GAAGD,EAAK,KAAK,KAAKA,EAAK,iBAAiB,GACxCA,EAAK,WACfC,EAAUD,EAAK,WAIjB,MAAME,EAAQ,IAAI,MAAMD,CAAO,EAC/B,WAAK,SAAS,MAAM,sBAAuBC,CAAK,EAC1CA,CACP,CAEA,MAAMA,EAAQ,IAAI,MAAM,oCAAoCH,EAAS,MAAM,EAAE,EAC7E,WAAK,SAAS,MAAM,sBAAuBG,CAAK,EAC1CA,CACP,CAEA,IAAIC,EAEJ,GAAI,CACHA,EAAM,IAAI,IAAI,MAAMJ,EAAS,MAAM,CACpC,MAAQ,CACPI,EAAM,IAAI,IAAIJ,EAAS,GAAG,CAC3B,CAEA,MAAMK,EAAYD,EAAI,aAAa,IAAI,YAAY,EAEnD,GAAI,CAACC,EAAW,CACf,MAAMF,EAAQ,IAAI,MAAM,wCAAwC,EAChE,WAAK,SAAS,MAAM,uBAAwBA,CAAK,EAC3CA,CACP,CAEA,OAAOE,CACR,CASA,MAAM,eAAeP,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMK,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKL,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
|
package/dist/flows/PopupFlow.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../utils/handlers.cjs"),a=require("../utils/State.cjs"),s=require("./BaseFlow.cjs");require("../utils/crypto.cjs");require("../utils/base64Url.cjs");require("../utils/date.cjs");require("../utils/jwt.cjs");require("../utils/Metadata.cjs");require("../utils/Session.cjs");class l extends s.BaseFlow{constructor(e,t,r,i){e.urlHandler||(e.urlHandler=o.popupUrlHandler),e.callbackHandler||(e.callbackHandler=o.popupCallbackHandler),super(e,t,r,i)}async login(e={}){if(typeof this.options.urlHandler!="function"){const n=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",n),n}const t=await a.State.create(),r=await this.getAuthorizationUrl(e);r.searchParams.append("state",t.id),r.searchParams.append("code_challenge",t.codeChallenge),r.searchParams.append("nonce",t.nonce),r.searchParams.append("display","popup"),await this.storage.set(`sty.${t.id}`,JSON.stringify(t)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login");const i=await this.options.urlHandler(r.toString(),e);await this.tokenExchange(i)}async register(e={}){e.prompt="create",await this.login(e)}async entry(e){if(typeof this.options.urlHandler!="function"){const r=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",r),r}e||(e=globalThis.window?.location.href);const t=new URL(e);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${t.searchParams.toString()}`)}async handleCallback(){if(typeof this.options.callbackHandler!="function"){const e=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",e),e}await this.options.callbackHandler(this.options.responseMode||"fragment")}}exports.PopupFlow=l;
|
|
2
2
|
//# sourceMappingURL=PopupFlow.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupFlow.cjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\
|
|
1
|
+
{"version":3,"file":"PopupFlow.cjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"gXAQO,MAAMA,UAAkBC,EAAAA,QAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,iBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,sBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { SDKOptions, PopupParams, SDKStorage, SDKHttpClient } from '../types';
|
|
1
|
+
import { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';
|
|
2
2
|
import { BaseFlow } from './BaseFlow';
|
|
3
3
|
/**
|
|
4
4
|
* Implements the Popup flow for authentication using a popup window.
|
|
5
5
|
*/
|
|
6
6
|
export declare class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {
|
|
7
|
-
constructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient);
|
|
7
|
+
constructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging);
|
|
8
8
|
/**
|
|
9
9
|
* Initiates the login process via a popup window.
|
|
10
10
|
* @param {PopupParams} [params={}] Optional parameters for popup window configuration.
|
|
11
11
|
* @returns {Promise<void>} A promise that resolves when the login process completes.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} Throws an error if URL handler is not defined.
|
|
12
14
|
*/
|
|
13
15
|
login(params?: PopupParams): Promise<void>;
|
|
14
16
|
/**
|
|
@@ -21,10 +23,14 @@ export declare class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {
|
|
|
21
23
|
* Initiates the entry process via a popup window.
|
|
22
24
|
* @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.
|
|
23
25
|
* @returns {Promise<void>} A promise that resolves when the entry process completes.
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} Throws an error if URL handler is not defined.
|
|
24
28
|
*/
|
|
25
29
|
entry(url?: string): Promise<void>;
|
|
26
30
|
/**
|
|
27
31
|
* Handles the callback after login or registration via a popup window.
|
|
32
|
+
*
|
|
33
|
+
* @throws {Error} Throws an error if callback handler is not defined.
|
|
28
34
|
*/
|
|
29
35
|
handleCallback(): Promise<void>;
|
|
30
36
|
}
|
package/dist/flows/PopupFlow.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{popupUrlHandler as
|
|
1
|
+
import{popupUrlHandler as n,popupCallbackHandler as a}from"../utils/handlers.mjs";import{State as s}from"../utils/State.mjs";import{BaseFlow as l}from"./BaseFlow.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class y extends l{constructor(r,i,t,o){r.urlHandler||(r.urlHandler=n),r.callbackHandler||(r.callbackHandler=a),super(r,i,t,o)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const i=await s.create(),t=await this.getAuthorizationUrl(r);t.searchParams.append("state",i.id),t.searchParams.append("code_challenge",i.codeChallenge),t.searchParams.append("nonce",i.nonce),t.searchParams.append("display","popup"),await this.storage.set(`sty.${i.id}`,JSON.stringify(i)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login");const o=await this.options.urlHandler(t.toString(),r);await this.tokenExchange(o)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href);const i=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${i.searchParams.toString()}`)}async handleCallback(){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}await this.options.callbackHandler(this.options.responseMode||"fragment")}}export{y as PopupFlow};
|
|
2
2
|
//# sourceMappingURL=PopupFlow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupFlow.mjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\
|
|
1
|
+
{"version":3,"file":"PopupFlow.mjs","sources":["../../src/flows/PopupFlow.ts"],"sourcesContent":["import type { SDKOptions, PopupParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { popupCallbackHandler, popupUrlHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Popup flow for authentication using a popup window.\n */\nexport class PopupFlow extends BaseFlow<SDKOptions, PopupParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = popupUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = popupCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: PopupParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\t\turl.searchParams.append('display', 'popup');\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tconst data = (await this.options.urlHandler(url.toString(), params)) as Record<string, string>;\n\n\t\tawait this.tokenExchange(data);\n\t}\n\n\t/**\n\t * Initiates the registration process via a popup window.\n\t * @param {PopupParams} [params={}] Optional parameters for popup window configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: PopupParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a popup window.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a popup window.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.options.callbackHandler(this.options.responseMode || 'fragment');\n\t}\n}\n"],"names":["PopupFlow","BaseFlow","options","storage","httpClient","logging","popupUrlHandler","popupCallbackHandler","params","error","state","State","url","data","entryUrl"],"mappings":"gVAQO,MAAMA,UAAkBC,CAAkC,CAChE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAsB,GAAmB,CACpD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAC5CE,EAAI,aAAa,OAAO,UAAW,OAAO,EAE1C,MAAM,KAAK,QAAQ,IAAI,OAAOF,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAMG,EAAQ,MAAM,KAAK,QAAQ,WAAWD,EAAI,SAAA,EAAYJ,CAAM,EAElE,MAAM,KAAK,cAAcK,CAAI,CAC9B,CAOA,MAAM,SAASL,EAAsB,GAAmB,CACvDA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAME,EAAW,IAAI,IAAIF,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBE,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CAOA,MAAM,gBAAgC,CACrC,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAML,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAM,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,cAAgB,UAAU,CAC3E,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../utils/handlers.cjs"),o=require("../utils/State.cjs"),a=require("./BaseFlow.cjs");require("../utils/crypto.cjs");require("../utils/base64Url.cjs");require("../utils/date.cjs");require("../utils/jwt.cjs");require("../utils/Metadata.cjs");require("../utils/Session.cjs");class s extends a.BaseFlow{constructor(e,r,t,i){e.urlHandler||(e.urlHandler=n.redirectUrlHandler),e.callbackHandler||(e.callbackHandler=n.redirectCallbackHandler),super(e,r,t,i)}async login(e={}){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}const r=await o.State.create(),t=await this.getAuthorizationUrl(e);t.searchParams.append("state",r.id),t.searchParams.append("code_challenge",r.codeChallenge),t.searchParams.append("nonce",r.nonce),await this.storage.set(`sty.${r.id}`,JSON.stringify(r)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(t.toString(),e)}async register(e={}){e.prompt="create",await this.login(e)}async entry(e){if(typeof this.options.urlHandler!="function"){const t=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",t),t}e||(e=globalThis.window?.location.href);const r=new URL(e);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${r.searchParams.toString()}`)}async handleCallback(e){if(typeof this.options.callbackHandler!="function"){const r=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",r),r}e||(e=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(e,this.options.responseMode||"fragment"))}}exports.RedirectFlow=s;
|
|
2
2
|
//# sourceMappingURL=RedirectFlow.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectFlow.cjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\
|
|
1
|
+
{"version":3,"file":"RedirectFlow.cjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"gXAQO,MAAMA,UAAqBC,EAAAA,QAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,EAAAA,oBAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,EAAAA,yBAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAAA,MAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient } from '../types';
|
|
1
|
+
import { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';
|
|
2
2
|
import { BaseFlow } from './BaseFlow';
|
|
3
3
|
/**
|
|
4
4
|
* Implements the Redirect flow for authentication using a full-page redirect.
|
|
5
5
|
*/
|
|
6
6
|
export declare class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {
|
|
7
|
-
constructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient);
|
|
7
|
+
constructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging);
|
|
8
8
|
/**
|
|
9
9
|
* Initiates the login process via a redirect.
|
|
10
10
|
* @param {RedirectParams} [params={}] Optional parameters for redirect configuration.
|
|
11
11
|
* @returns {Promise<void>} A promise that resolves when the login process completes.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} Throws an error if URL handler is not defined.
|
|
12
14
|
*/
|
|
13
15
|
login(params?: RedirectParams): Promise<void>;
|
|
14
16
|
/**
|
|
@@ -21,12 +23,16 @@ export declare class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {
|
|
|
21
23
|
* Initiates the entry process via a redirect.
|
|
22
24
|
* @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.
|
|
23
25
|
* @returns {Promise<void>} A promise that resolves when the entry process completes.
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} Throws an error if URL handler is not defined.
|
|
24
28
|
*/
|
|
25
29
|
entry(url?: string): Promise<void>;
|
|
26
30
|
/**
|
|
27
31
|
* Handles the callback after login or registration via a redirect.
|
|
28
32
|
* @param {string} [url] The URL to handle the callback from. Defaults to the current window location.
|
|
29
33
|
* @returns {Promise<void>} A promise that resolves when the callback is handled.
|
|
34
|
+
*
|
|
35
|
+
* @throws {Error} Throws an error if callback handler is not defined.
|
|
30
36
|
*/
|
|
31
37
|
handleCallback(url?: string): Promise<void>;
|
|
32
38
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{redirectUrlHandler as
|
|
1
|
+
import{redirectUrlHandler as o,redirectCallbackHandler as n}from"../utils/handlers.mjs";import{State as a}from"../utils/State.mjs";import{BaseFlow as s}from"./BaseFlow.mjs";import"../utils/crypto.mjs";import"../utils/base64Url.mjs";import"../utils/date.mjs";import"../utils/jwt.mjs";import"../utils/Metadata.mjs";import"../utils/Session.mjs";class H extends s{constructor(r,t,i,e){r.urlHandler||(r.urlHandler=o),r.callbackHandler||(r.callbackHandler=n),super(r,t,i,e)}async login(r={}){if(typeof this.options.urlHandler!="function"){const e=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",e),e}const t=await a.create(),i=await this.getAuthorizationUrl(r);i.searchParams.append("state",t.id),i.searchParams.append("code_challenge",t.codeChallenge),i.searchParams.append("nonce",t.nonce),await this.storage.set(`sty.${t.id}`,JSON.stringify(t)),this.dispatchEvent("loginInitiated",[]),this.logging?.debug("Attempting to redirect for login"),await this.options.urlHandler(i.toString(),r)}async register(r={}){r.prompt="create",await this.login(r)}async entry(r){if(typeof this.options.urlHandler!="function"){const i=new Error("Missing option: urlHandler");throw this.logging?.error("Required option missing",i),i}r||(r=globalThis.window?.location.href);const t=new URL(r);this.logging?.debug("Attempting to redirect for entry"),await this.options.urlHandler(`${this.options.issuer}/provider/entry?${t.searchParams.toString()}`)}async handleCallback(r){if(typeof this.options.callbackHandler!="function"){const t=new Error("Missing option: callbackHandler");throw this.logging?.error("Required option missing",t),t}r||(r=globalThis.window?.location.href),await this.tokenExchange(await this.options.callbackHandler(r,this.options.responseMode||"fragment"))}}export{H as RedirectFlow};
|
|
2
2
|
//# sourceMappingURL=RedirectFlow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectFlow.mjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\
|
|
1
|
+
{"version":3,"file":"RedirectFlow.mjs","sources":["../../src/flows/RedirectFlow.ts"],"sourcesContent":["import type { SDKOptions, RedirectParams, SDKStorage, SDKHttpClient, SDKLogging } from '../types';\nimport { redirectUrlHandler, redirectCallbackHandler } from '../utils/handlers';\nimport { State } from '../utils/State';\nimport { BaseFlow } from './BaseFlow';\n\n/**\n * Implements the Redirect flow for authentication using a full-page redirect.\n */\nexport class RedirectFlow extends BaseFlow<SDKOptions, RedirectParams> {\n\tconstructor(options: SDKOptions, storage: SDKStorage, httpClient: SDKHttpClient, logging?: SDKLogging) {\n\t\tif (!options.urlHandler) {\n\t\t\toptions.urlHandler = redirectUrlHandler;\n\t\t}\n\t\tif (!options.callbackHandler) {\n\t\t\toptions.callbackHandler = redirectCallbackHandler;\n\t\t}\n\n\t\tsuper(options, storage, httpClient, logging);\n\t}\n\n\t/**\n\t * Initiates the login process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the login process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync login(params: RedirectParams = {}): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst state = await State.create();\n\t\tconst url = await this.getAuthorizationUrl(params);\n\n\t\turl.searchParams.append('state', state.id);\n\t\turl.searchParams.append('code_challenge', state.codeChallenge);\n\t\turl.searchParams.append('nonce', state.nonce);\n\n\t\tawait this.storage.set(`sty.${state.id}`, JSON.stringify(state));\n\n\t\tthis.dispatchEvent('loginInitiated', []);\n\t\tthis.logging?.debug('Attempting to redirect for login');\n\n\t\tawait this.options.urlHandler(url.toString(), params);\n\t}\n\n\t/**\n\t * Initiates the registration process via a redirect.\n\t * @param {RedirectParams} [params={}] Optional parameters for redirect configuration.\n\t * @returns {Promise<void>} A promise that resolves when the registration process completes.\n\t */\n\tasync register(params: RedirectParams = {}): Promise<void> {\n\t\tparams.prompt = 'create';\n\n\t\tawait this.login(params);\n\t}\n\n\t/**\n\t * Initiates the entry process via a redirect.\n\t * @param {string} url Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Promise<void>} A promise that resolves when the entry process completes.\n\t *\n\t * @throws {Error} Throws an error if URL handler is not defined.\n\t */\n\tasync entry(url?: string): Promise<void> {\n\t\tif (typeof this.options.urlHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: urlHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tconst entryUrl = new URL(url);\n\n\t\tthis.logging?.debug('Attempting to redirect for entry');\n\n\t\tawait this.options.urlHandler(`${this.options.issuer}/provider/entry?${entryUrl.searchParams.toString()}`);\n\t}\n\n\t/**\n\t * Handles the callback after login or registration via a redirect.\n\t * @param {string} [url] The URL to handle the callback from. Defaults to the current window location.\n\t * @returns {Promise<void>} A promise that resolves when the callback is handled.\n\t *\n\t * @throws {Error} Throws an error if callback handler is not defined.\n\t */\n\tasync handleCallback(url?: string): Promise<void> {\n\t\tif (typeof this.options.callbackHandler !== 'function') {\n\t\t\tconst error = new Error('Missing option: callbackHandler');\n\t\t\tthis.logging?.error('Required option missing', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!url) {\n\t\t\turl = globalThis.window?.location.href;\n\t\t}\n\n\t\tawait this.tokenExchange((await this.options.callbackHandler(url, this.options.responseMode || 'fragment')) as Record<string, string>);\n\t}\n}\n"],"names":["RedirectFlow","BaseFlow","options","storage","httpClient","logging","redirectUrlHandler","redirectCallbackHandler","params","error","state","State","url","entryUrl"],"mappings":"sVAQO,MAAMA,UAAqBC,CAAqC,CACtE,YAAYC,EAAqBC,EAAqBC,EAA2BC,EAAsB,CACjGH,EAAQ,aACZA,EAAQ,WAAaI,GAEjBJ,EAAQ,kBACZA,EAAQ,gBAAkBK,GAG3B,MAAML,EAASC,EAASC,EAAYC,CAAO,CAC5C,CASA,MAAM,MAAMG,EAAyB,GAAmB,CACvD,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMC,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEA,MAAMC,EAAQ,MAAMC,EAAM,OAAA,EACpBC,EAAM,MAAM,KAAK,oBAAoBJ,CAAM,EAEjDI,EAAI,aAAa,OAAO,QAASF,EAAM,EAAE,EACzCE,EAAI,aAAa,OAAO,iBAAkBF,EAAM,aAAa,EAC7DE,EAAI,aAAa,OAAO,QAASF,EAAM,KAAK,EAE5C,MAAM,KAAK,QAAQ,IAAI,OAAOA,EAAM,EAAE,GAAI,KAAK,UAAUA,CAAK,CAAC,EAE/D,KAAK,cAAc,iBAAkB,EAAE,EACvC,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAWE,EAAI,SAAA,EAAYJ,CAAM,CACrD,CAOA,MAAM,SAASA,EAAyB,GAAmB,CAC1DA,EAAO,OAAS,SAEhB,MAAM,KAAK,MAAMA,CAAM,CACxB,CASA,MAAM,MAAMI,EAA6B,CACxC,GAAI,OAAO,KAAK,QAAQ,YAAe,WAAY,CAClD,MAAMH,EAAQ,IAAI,MAAM,4BAA4B,EACpD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAMC,EAAW,IAAI,IAAID,CAAG,EAE5B,KAAK,SAAS,MAAM,kCAAkC,EAEtD,MAAM,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,MAAM,mBAAmBC,EAAS,aAAa,SAAA,CAAU,EAAE,CAC1G,CASA,MAAM,eAAeD,EAA6B,CACjD,GAAI,OAAO,KAAK,QAAQ,iBAAoB,WAAY,CACvD,MAAMH,EAAQ,IAAI,MAAM,iCAAiC,EACzD,WAAK,SAAS,MAAM,0BAA2BA,CAAK,EAC9CA,CACP,CAEKG,IACJA,EAAM,WAAW,QAAQ,SAAS,MAGnC,MAAM,KAAK,cAAe,MAAM,KAAK,QAAQ,gBAAgBA,EAAK,KAAK,QAAQ,cAAgB,UAAU,CAA4B,CACtI,CACD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./flows/RedirectFlow.cjs"),g=require("./flows/PopupFlow.cjs"),s=require("./flows/NativeFlow.cjs"),a=require("./storages/LocalStorage.cjs"),c=require("./utils/HttpClient.cjs"),q=require("./utils/errors.cjs"),l=require("./types.cjs");require("./utils/handlers.cjs");require("./utils/State.cjs");require("./utils/crypto.cjs");require("./utils/base64Url.cjs");require("./utils/date.cjs");require("./flows/BaseFlow.cjs");require("./utils/jwt.cjs");require("./utils/Metadata.cjs");require("./utils/Session.cjs");require("./utils/NativeFlowHandler.cjs");function w(e){const o=e.storage||a.LocalStorage,n=e.httpClient||c.HttpClient,i=new o,t=new n;let r;return e.logging&&(r=new e.logging,t.logging=r),e.mode==="popup"?new g.PopupFlow(e,i,t,r):e.mode==="native"?new s.NativeFlow(e,i,t,r):new u.RedirectFlow(e,i,t,r)}exports.FallbackError=q.FallbackError;exports.SDKHttpClient=l.SDKHttpClient;exports.SDKLogging=l.SDKLogging;exports.SDKStorage=l.SDKStorage;exports.initFlow=w;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","RedirectFlow"],"mappings":"ooBAqBO,SAASA,EAASC,EAAyG,CACjI,MAAMC,EAAeD,EAAQ,SAAWE,EAAAA,aAClCC,EAAkBH,EAAQ,YAAcI,EAAAA,WAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAAA,UAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAAA,WAAWT,EAASK,EAASC,EAAYC,CAAO,EAEpD,IAAIG,EAAAA,aAAaV,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PopupFlow } from './flows/PopupFlow';
|
|
|
4
4
|
import { NativeFlow } from './flows/NativeFlow';
|
|
5
5
|
export * from './utils/errors';
|
|
6
6
|
export type * from './types';
|
|
7
|
-
export { SDKStorage, SDKHttpClient } from './types';
|
|
7
|
+
export { SDKStorage, SDKLogging, SDKHttpClient } from './types';
|
|
8
8
|
/**
|
|
9
9
|
* Initializes an authentication flow based on the specified mode.
|
|
10
10
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{RedirectFlow as
|
|
1
|
+
import{RedirectFlow as l}from"./flows/RedirectFlow.mjs";import{PopupFlow as g}from"./flows/PopupFlow.mjs";import{NativeFlow as p}from"./flows/NativeFlow.mjs";import{LocalStorage as n}from"./storages/LocalStorage.mjs";import{HttpClient as a}from"./utils/HttpClient.mjs";import{FallbackError as E}from"./utils/errors.mjs";import{SDKHttpClient as P,SDKLogging as R,SDKStorage as j}from"./types.mjs";import"./utils/handlers.mjs";import"./utils/State.mjs";import"./utils/crypto.mjs";import"./utils/base64Url.mjs";import"./utils/date.mjs";import"./flows/BaseFlow.mjs";import"./utils/jwt.mjs";import"./utils/Metadata.mjs";import"./utils/Session.mjs";import"./utils/NativeFlowHandler.mjs";function L(t){const i=t.storage||n,m=t.httpClient||a,e=new i,o=new m;let r;return t.logging&&(r=new t.logging,o.logging=r),t.mode==="popup"?new g(t,e,o,r):t.mode==="native"?new p(t,e,o,r):new l(t,e,o,r)}export{E as FallbackError,P as SDKHttpClient,R as SDKLogging,j as SDKStorage,L as initFlow};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options,
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { SDKOptions } from './types';\nimport { RedirectFlow } from './flows/RedirectFlow';\nimport { PopupFlow } from './flows/PopupFlow';\nimport { NativeFlow } from './flows/NativeFlow';\nimport { LocalStorage } from './storages/LocalStorage';\nimport { HttpClient } from './utils/HttpClient';\n\nexport * from './utils/errors';\nexport type * from './types';\nexport { SDKStorage, SDKLogging, SDKHttpClient } from './types';\n\n/**\n * Initializes an authentication flow based on the specified mode.\n *\n * @param {SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }} options - The SDK options, including an optional mode. The default storage class is `LocalStorage`.\n * @returns {PopupFlow | RedirectFlow | NativeFlow} A new instance of either PopupFlow, RedirectFlow, or NativeFlow based on the mode.\n */\nexport function initFlow(options: SDKOptions & { mode: 'popup' }): PopupFlow;\nexport function initFlow(options: SDKOptions & { mode: 'redirect' }): RedirectFlow;\nexport function initFlow(options: SDKOptions & { mode: 'native' }): NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow;\nexport function initFlow(options: SDKOptions & { mode?: 'popup' | 'redirect' | 'native' }): PopupFlow | RedirectFlow | NativeFlow {\n\tconst StorageClass = options.storage || LocalStorage;\n\tconst HttpClientClass = options.httpClient || HttpClient;\n\n\tconst storage = new StorageClass();\n\tconst httpClient = new HttpClientClass();\n\tlet logging;\n\n\tif (options.logging) {\n\t\tlogging = new options.logging();\n\t\thttpClient.logging = logging;\n\t}\n\n\tif (options.mode === 'popup') {\n\t\treturn new PopupFlow(options, storage, httpClient, logging);\n\t} else if (options.mode === 'native') {\n\t\treturn new NativeFlow(options, storage, httpClient, logging);\n\t} else {\n\t\treturn new RedirectFlow(options, storage, httpClient, logging);\n\t}\n}\n"],"names":["initFlow","options","StorageClass","LocalStorage","HttpClientClass","HttpClient","storage","httpClient","logging","PopupFlow","NativeFlow","RedirectFlow"],"mappings":"yqBAqBO,SAASA,EAASC,EAAyG,CACjI,MAAMC,EAAeD,EAAQ,SAAWE,EAClCC,EAAkBH,EAAQ,YAAcI,EAExCC,EAAU,IAAIJ,EACdK,EAAa,IAAIH,EACvB,IAAII,EAOJ,OALIP,EAAQ,UACXO,EAAU,IAAIP,EAAQ,QACtBM,EAAW,QAAUC,GAGlBP,EAAQ,OAAS,QACb,IAAIQ,EAAUR,EAASK,EAASC,EAAYC,CAAO,EAChDP,EAAQ,OAAS,SACpB,IAAIS,EAAWT,EAASK,EAASC,EAAYC,CAAO,EAEpD,IAAIG,EAAaV,EAASK,EAASC,EAAYC,CAAO,CAE/D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class a{async get(e){return await Promise.resolve(globalThis?.window?.localStorage?.getItem(e))}async delete(e){await Promise.resolve(globalThis?.window?.localStorage.removeItem(e))}async set(e,o){await Promise.resolve(globalThis?.window?.localStorage.setItem(e,o))}}exports.LocalStorage=a;
|
|
2
2
|
//# sourceMappingURL=LocalStorage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.cjs","sources":["../../src/storages/LocalStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements local storage operations using the browser's `localStorage`.\n */\nexport class LocalStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from local storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn await Promise.resolve(globalThis?.window?.localStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from local storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in local storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.setItem(key, value));\n\t}\n}\n"],"names":["LocalStorage","key","
|
|
1
|
+
{"version":3,"file":"LocalStorage.cjs","sources":["../../src/storages/LocalStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements local storage operations using the browser's `localStorage`.\n */\nexport class LocalStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from local storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn await Promise.resolve(globalThis?.window?.localStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from local storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in local storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.setItem(key, value));\n\t}\n}\n"],"names":["LocalStorage","key","value"],"mappings":"gFAKO,MAAMA,CAAmC,CAM/C,MAAM,IAAIC,EAAqC,CAC9C,OAAO,MAAM,QAAQ,QAAQ,YAAY,QAAQ,cAAc,QAAQA,CAAG,CAAC,CAC5E,CAMA,MAAM,OAAOA,EAA4B,CACxC,MAAM,QAAQ,QAAQ,YAAY,QAAQ,aAAa,WAAWA,CAAG,CAAC,CACvE,CAOA,MAAM,IAAIA,EAAaC,EAA8B,CACpD,MAAM,QAAQ,QAAQ,YAAY,QAAQ,aAAa,QAAQD,EAAKC,CAAK,CAAC,CAC3E,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l{async get(e){return await Promise.resolve(globalThis?.window?.localStorage?.getItem(e))}async delete(e){await Promise.resolve(globalThis?.window?.localStorage.removeItem(e))}async set(e,o){await Promise.resolve(globalThis?.window?.localStorage.setItem(e,o))}}export{l as LocalStorage};
|
|
2
2
|
//# sourceMappingURL=LocalStorage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorage.mjs","sources":["../../src/storages/LocalStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements local storage operations using the browser's `localStorage`.\n */\nexport class LocalStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from local storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn await Promise.resolve(globalThis?.window?.localStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from local storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in local storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.setItem(key, value));\n\t}\n}\n"],"names":["LocalStorage","key","
|
|
1
|
+
{"version":3,"file":"LocalStorage.mjs","sources":["../../src/storages/LocalStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements local storage operations using the browser's `localStorage`.\n */\nexport class LocalStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from local storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn await Promise.resolve(globalThis?.window?.localStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from local storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in local storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.localStorage.setItem(key, value));\n\t}\n}\n"],"names":["LocalStorage","key","value"],"mappings":"AAKO,MAAMA,CAAmC,CAM/C,MAAM,IAAIC,EAAqC,CAC9C,OAAO,MAAM,QAAQ,QAAQ,YAAY,QAAQ,cAAc,QAAQA,CAAG,CAAC,CAC5E,CAMA,MAAM,OAAOA,EAA4B,CACxC,MAAM,QAAQ,QAAQ,YAAY,QAAQ,aAAa,WAAWA,CAAG,CAAC,CACvE,CAOA,MAAM,IAAIA,EAAaC,EAA8B,CACpD,MAAM,QAAQ,QAAQ,YAAY,QAAQ,aAAa,QAAQD,EAAKC,CAAK,CAAC,CAC3E,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class o{async get(e){return Promise.resolve(globalThis?.window?.sessionStorage?.getItem(e))}async delete(e){await Promise.resolve(globalThis?.window?.sessionStorage.removeItem(e))}async set(e,s){await Promise.resolve(globalThis?.window?.sessionStorage.setItem(e,s))}}exports.SessionStorage=o;
|
|
2
2
|
//# sourceMappingURL=SessionStorage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.cjs","sources":["../../src/storages/SessionStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements session storage operations using the browser's `sessionStorage`.\n */\nexport class SessionStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from session storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn Promise.resolve(globalThis?.window?.sessionStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from session storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in session storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.setItem(key, value));\n\t}\n}\n"],"names":["SessionStorage","key","
|
|
1
|
+
{"version":3,"file":"SessionStorage.cjs","sources":["../../src/storages/SessionStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements session storage operations using the browser's `sessionStorage`.\n */\nexport class SessionStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from session storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn Promise.resolve(globalThis?.window?.sessionStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from session storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in session storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.setItem(key, value));\n\t}\n}\n"],"names":["SessionStorage","key","value"],"mappings":"gFAKO,MAAMA,CAAqC,CAMjD,MAAM,IAAIC,EAAqC,CAC9C,OAAO,QAAQ,QAAQ,YAAY,QAAQ,gBAAgB,QAAQA,CAAG,CAAC,CACxE,CAMA,MAAM,OAAOA,EAA4B,CACxC,MAAM,QAAQ,QAAQ,YAAY,QAAQ,eAAe,WAAWA,CAAG,CAAC,CACzE,CAOA,MAAM,IAAIA,EAAaC,EAA8B,CACpD,MAAM,QAAQ,QAAQ,YAAY,QAAQ,eAAe,QAAQD,EAAKC,CAAK,CAAC,CAC7E,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class
|
|
1
|
+
class t{async get(e){return Promise.resolve(globalThis?.window?.sessionStorage?.getItem(e))}async delete(e){await Promise.resolve(globalThis?.window?.sessionStorage.removeItem(e))}async set(e,s){await Promise.resolve(globalThis?.window?.sessionStorage.setItem(e,s))}}export{t as SessionStorage};
|
|
2
2
|
//# sourceMappingURL=SessionStorage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.mjs","sources":["../../src/storages/SessionStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements session storage operations using the browser's `sessionStorage`.\n */\nexport class SessionStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from session storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn Promise.resolve(globalThis?.window?.sessionStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from session storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in session storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.setItem(key, value));\n\t}\n}\n"],"names":["SessionStorage","key","
|
|
1
|
+
{"version":3,"file":"SessionStorage.mjs","sources":["../../src/storages/SessionStorage.ts"],"sourcesContent":["import type { SDKStorage } from '../types';\n\n/**\n * Implements session storage operations using the browser's `sessionStorage`.\n */\nexport class SessionStorage implements SDKStorage {\n\t/**\n\t * Retrieves a value from session storage by key.\n\t * @param {string} key The key to retrieve the value for.\n\t * @returns {string | null} The value associated with the key, or null if not found.\n\t */\n\tasync get(key: string): Promise<string | null> {\n\t\treturn Promise.resolve(globalThis?.window?.sessionStorage?.getItem(key));\n\t}\n\n\t/**\n\t * Deletes a key-value pair from session storage.\n\t * @param {string} key The key to delete.\n\t */\n\tasync delete(key: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.removeItem(key));\n\t}\n\n\t/**\n\t * Sets a key-value pair in session storage.\n\t * @param {string} key The key to set.\n\t * @param {string} value The value to associate with the key.\n\t */\n\tasync set(key: string, value: string): Promise<void> {\n\t\tawait Promise.resolve(globalThis?.window?.sessionStorage.setItem(key, value));\n\t}\n}\n"],"names":["SessionStorage","key","value"],"mappings":"AAKO,MAAMA,CAAqC,CAMjD,MAAM,IAAIC,EAAqC,CAC9C,OAAO,QAAQ,QAAQ,YAAY,QAAQ,gBAAgB,QAAQA,CAAG,CAAC,CACxE,CAMA,MAAM,OAAOA,EAA4B,CACxC,MAAM,QAAQ,QAAQ,YAAY,QAAQ,eAAe,WAAWA,CAAG,CAAC,CACzE,CAOA,MAAM,IAAIA,EAAaC,EAA8B,CACpD,MAAM,QAAQ,QAAQ,YAAY,QAAQ,eAAe,QAAQD,EAAKC,CAAK,CAAC,CAC7E,CACD"}
|
package/dist/types.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["code","id_token"],o=["query","fragment"],s=["none"],n=["authorization_code","refresh_token"],i=["RS256"],p=["public"],c=["none","login","create"],r=["redirect","popup"];class a{}class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["code","id_token"],o=["query","fragment"],s=["none"],n=["authorization_code","refresh_token"],i=["RS256"],p=["public"],c=["none","login","create"],r=["redirect","popup"];class L{}class a{xEventId}class g{logging}exports.AlgorithmTypeList=i;exports.FallbackModeTypeList=r;exports.GrantTypeList=n;exports.PromptTypeList=c;exports.ResponseModeList=o;exports.ResponseTypeList=e;exports.SDKHttpClient=g;exports.SDKLogging=a;exports.SDKStorage=L;exports.SubjectTypeList=p;exports.TokenEndpointAuthMethodList=s;
|
|
2
2
|
//# sourceMappingURL=types.cjs.map
|