@thunderid/javascript 1.4.0 → 1.5.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/dist/DefaultCrypto.d.ts.map +1 -1
- package/dist/IsomorphicCrypto.d.ts +8 -0
- package/dist/IsomorphicCrypto.d.ts.map +1 -1
- package/dist/StorageManager.d.ts.map +1 -1
- package/dist/ThunderIDJavaScriptClient.d.ts +19 -1
- package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
- package/dist/cjs/index.cjs +176 -28
- package/dist/constants/OIDCRequestConstants.d.ts +5 -0
- package/dist/constants/OIDCRequestConstants.d.ts.map +1 -1
- package/dist/edge/index.js +176 -31
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +176 -31
- package/dist/models/backend.d.ts +72 -0
- package/dist/models/backend.d.ts.map +1 -0
- package/dist/models/client.d.ts +2 -2
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +15 -0
- package/dist/models/config.d.ts.map +1 -1
- package/dist/utils/AuthenticationHelper.d.ts +1 -1
- package/dist/utils/AuthenticationHelper.d.ts.map +1 -1
- package/dist/utils/base64Encode.d.ts +1 -1
- package/dist/utils/base64Encode.d.ts.map +1 -1
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts +2 -1
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts.map +1 -1
- package/dist/utils/getOAuthErrorMessage.d.ts +17 -0
- package/dist/utils/getOAuthErrorMessage.d.ts.map +1 -0
- package/dist/utils/resolveBackendEndpoints.d.ts +27 -0
- package/dist/utils/resolveBackendEndpoints.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationHelper.d.ts","sourceRoot":"","sources":["../../src/utils/AuthenticationHelper.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAA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
1
1
|
/**
|
|
2
2
|
* Encodes a string to standard base64 using `jose` (already a package dependency).
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
4
|
+
* jose's `base64url.encode` is environment-agnostic (browser, Node.js, Deno, Bun,
|
|
5
5
|
* edge/service-worker runtimes). It produces base64url output, which is then
|
|
6
6
|
* converted to standard base64 by restoring the `+`/`/` characters and adding
|
|
7
7
|
* `=` padding.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64Encode.d.ts","sourceRoot":"","sources":["../../src/utils/base64Encode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base64Encode.d.ts","sourceRoot":"","sources":["../../src/utils/base64Encode.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAMrC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { ExtendedAuthorizeRequestUrlParams } from '../models/oauth-request';
|
|
|
5
5
|
* This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,
|
|
6
6
|
* and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.
|
|
7
7
|
*
|
|
8
|
-
* @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and
|
|
8
|
+
* @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, prompt, and randomState (a value generated from random bytes that makes the `state` unique to this request).
|
|
9
9
|
* @param pkceOptions - PKCE options, including the PKCE key for state correlation.
|
|
10
10
|
* @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).
|
|
11
11
|
* @returns A Map of key-value pairs representing the authorization request URL parameters.
|
|
@@ -34,6 +34,7 @@ declare const getAuthorizeRequestUrlParams: (options: {
|
|
|
34
34
|
codeChallengeMethod?: string;
|
|
35
35
|
instanceId?: string;
|
|
36
36
|
prompt?: string;
|
|
37
|
+
randomState?: string;
|
|
37
38
|
redirectUri: string;
|
|
38
39
|
responseMode?: string;
|
|
39
40
|
scopes?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAuthorizeRequestUrlParams.d.ts","sourceRoot":"","sources":["../../src/utils/getAuthorizeRequestUrlParams.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iCAAiC,EAAC,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,4BAA4B,GAChC,SAAS;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iCAAiC,EACrC,aAAa;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,EAC1B,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KACtD,GAAG,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getAuthorizeRequestUrlParams.d.ts","sourceRoot":"","sources":["../../src/utils/getAuthorizeRequestUrlParams.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iCAAiC,EAAC,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,4BAA4B,GAChC,SAAS;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iCAAiC,EACrC,aAAa;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,EAC1B,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KACtD,GAAG,CAAC,MAAM,EAAE,MAAM,CAoEpB,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a readable message from the body of an OAuth 2.0 error response (RFC 6749 section 5.2).
|
|
3
|
+
*
|
|
4
|
+
* Only the `error` and `error_description` members are read, so nothing else in the body, such as
|
|
5
|
+
* a token, can end up in the message.
|
|
6
|
+
*
|
|
7
|
+
* @param body - The parsed response body, or its raw text.
|
|
8
|
+
* @param fallback - The message to use when the body carries neither member.
|
|
9
|
+
* @returns `"<error>: <error_description>"`, whichever of the two is present, or `fallback`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* getOAuthErrorMessage({error: 'invalid_grant', error_description: 'The code has expired.'}, 'Failed');
|
|
13
|
+
* // Returns: "invalid_grant: The code has expired."
|
|
14
|
+
*/
|
|
15
|
+
declare const getOAuthErrorMessage: (body: unknown, fallback: string) => string;
|
|
16
|
+
export default getOAuthErrorMessage;
|
|
17
|
+
//# sourceMappingURL=getOAuthErrorMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOAuthErrorMessage.d.ts","sourceRoot":"","sources":["../../src/utils/getOAuthErrorMessage.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,oBAAoB,GAAI,MAAM,OAAO,EAAE,UAAU,MAAM,KAAG,MAqB/D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BackendEndpoints, ResolvedBackendEndpoints } from '../models/backend';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal shape of the config needed to resolve the backend endpoints.
|
|
4
|
+
*/
|
|
5
|
+
export interface BackendEndpointConfig {
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
endpoints?: {
|
|
8
|
+
backend?: BackendEndpoints;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the backend endpoints from `endpoints.backend`, or returns `undefined` when it is not set
|
|
13
|
+
* and sign-in does not run on a backend.
|
|
14
|
+
*
|
|
15
|
+
* @param config - The client config.
|
|
16
|
+
* @param origin - The app's origin, used as the API base when `baseUrl` is not set.
|
|
17
|
+
* @returns The resolved endpoints, or `undefined` when `endpoints.backend` is not set.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* resolveBackendEndpoints({endpoints: {backend: {signIn: '/auth/signin'}}}, window.location.origin);
|
|
22
|
+
* // {signIn: '/auth/signin', session: '/api/auth/session', ..., apiBaseUrl: 'https://...'}
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const resolveBackendEndpoints: (config: BackendEndpointConfig | undefined, origin: string) => ResolvedBackendEndpoints | undefined;
|
|
26
|
+
export default resolveBackendEndpoints;
|
|
27
|
+
//# sourceMappingURL=resolveBackendEndpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBackendEndpoints.d.ts","sourceRoot":"","sources":["../../src/utils/resolveBackendEndpoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAI7E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE;QAAC,OAAO,CAAC,EAAE,gBAAgB,CAAA;KAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,uBAAuB,GAC3B,QAAQ,qBAAqB,GAAG,SAAS,EACzC,QAAQ,MAAM,KACb,wBAAwB,GAAG,SAuB7B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|