@zoreal/oauth2-js 0.1.13 → 0.1.15
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/README.md +3 -2
- package/dist/index.cjs +377 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +376 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,8 @@ interface PairingState {
|
|
|
53
53
|
* you and arrives through this callback.
|
|
54
54
|
*/
|
|
55
55
|
qrRefreshSeconds?: number;
|
|
56
|
+
/** What the dialog says the code is for, resolved once per login. */
|
|
57
|
+
intent?: LoginIntent;
|
|
56
58
|
/** True when the flow resolved to the app link (mobile) rather than a QR. */
|
|
57
59
|
appLink?: boolean;
|
|
58
60
|
/** Abandons this pairing: stops the poll. Wire it to your UI's cancel control. */
|
|
@@ -104,6 +106,12 @@ type ZorealTheme = 'auto' | 'light' | 'dark';
|
|
|
104
106
|
* own pairing UI want this.
|
|
105
107
|
*/
|
|
106
108
|
type PairingUI = 'modal' | 'none';
|
|
109
|
+
/**
|
|
110
|
+
* What the pairing dialog says it is for. Resolved from the request when not
|
|
111
|
+
* given: document scopes make it 'identify', an identifier-only request with
|
|
112
|
+
* a liveness capture makes it 'presence', and the rest is 'sign-in'.
|
|
113
|
+
*/
|
|
114
|
+
type LoginIntent = 'sign-in' | 'identify' | 'presence';
|
|
107
115
|
interface StartLoginOptions {
|
|
108
116
|
/** The asset token from the ZOREAL dashboard, ast_... */
|
|
109
117
|
clientId: string;
|
|
@@ -125,6 +133,12 @@ interface StartLoginOptions {
|
|
|
125
133
|
app_state?: string;
|
|
126
134
|
/** 'auto' renders a QR on desktop and an app link on mobile, which is what you want. */
|
|
127
135
|
display?: 'auto' | 'qr' | 'link';
|
|
136
|
+
/**
|
|
137
|
+
* What the dialog tells the holder they are scanning for. Set it when the
|
|
138
|
+
* scope does not say: a presence check that asks for a name is still not a
|
|
139
|
+
* sign-in. See LoginIntent for what is inferred when this is omitted.
|
|
140
|
+
*/
|
|
141
|
+
intent?: LoginIntent;
|
|
128
142
|
/** Sent to the provider so the pairing surface speaks the visitor's language. */
|
|
129
143
|
locale?: string;
|
|
130
144
|
/** Called on each pairing state change. Drive your UI from this. */
|
|
@@ -218,6 +232,8 @@ interface PairingModalOptions {
|
|
|
218
232
|
locale?: string;
|
|
219
233
|
theme?: ZorealTheme;
|
|
220
234
|
timeoutMs?: number;
|
|
235
|
+
/** Which title the dialog opens with. Defaults to the sign-in wording. */
|
|
236
|
+
intent?: LoginIntent;
|
|
221
237
|
}
|
|
222
238
|
interface PairingModalHandle {
|
|
223
239
|
/** Re-render from a new pairing state. */
|
|
@@ -289,7 +305,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
|
|
|
289
305
|
* auth-code mode leaves it to the RP backend.
|
|
290
306
|
*/
|
|
291
307
|
declare const WIRE_VERSION = 1;
|
|
292
|
-
declare const SDK_VERSION = "0.1.
|
|
308
|
+
declare const SDK_VERSION = "0.1.15";
|
|
293
309
|
declare const SDK_NAME = "@zoreal/oauth2-js";
|
|
294
310
|
declare const DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
295
311
|
/** Pending TTL is short. Poll gently; over-polling cancels the request. */
|
|
@@ -434,4 +450,12 @@ declare function generateState(): string;
|
|
|
434
450
|
*/
|
|
435
451
|
declare function unsafeClaims(idToken: string): Record<string, unknown>;
|
|
436
452
|
|
|
437
|
-
|
|
453
|
+
/**
|
|
454
|
+
* What the pairing dialog says it is for. An explicit intent wins. Otherwise
|
|
455
|
+
* a request for document attributes is an identification; a request for the
|
|
456
|
+
* identifier alone with a liveness capture is a presence check, since nothing
|
|
457
|
+
* is being logged into; everything else is a sign-in.
|
|
458
|
+
*/
|
|
459
|
+
declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
|
|
460
|
+
|
|
461
|
+
export { type AcrValue, type AuthCodeLoginOptions, type BrowserDirectLoginOptions, DEFAULT_ISSUER, DEFAULT_PAIRING_TIMEOUT_MS, DEFAULT_QR_REFRESH_SECONDS, type ErrorCode, FlowAbandonedError, type LoginHandle, type LoginIntent, type NonOAuthError, OAuthFlowError, POLL_INTERVAL_ENROLLING_MS, POLL_INTERVAL_MS, type PairCreated, type PairDisplay, type PairImmediate, type PairStartResponse, type PairStatusResponse, type PairingModalHandle, type PairingModalOptions, type PairingState, type PairingUI, SDK_NAME, SDK_VERSION, type SelectBy, type StartLoginOptions, type StartPairingParams, type TokenResponse, WIRE_VERSION, type ZorealCodeResponse, type ZorealCredentialResponse, type ZorealTheme, challengeS256, exchangeCode, generateState, generateVerifier, isMobileUserAgent, mountPairingModal, pollUntilApproved, resolveIntent, startLogin, startPairing, unsafeClaims };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ interface PairingState {
|
|
|
53
53
|
* you and arrives through this callback.
|
|
54
54
|
*/
|
|
55
55
|
qrRefreshSeconds?: number;
|
|
56
|
+
/** What the dialog says the code is for, resolved once per login. */
|
|
57
|
+
intent?: LoginIntent;
|
|
56
58
|
/** True when the flow resolved to the app link (mobile) rather than a QR. */
|
|
57
59
|
appLink?: boolean;
|
|
58
60
|
/** Abandons this pairing: stops the poll. Wire it to your UI's cancel control. */
|
|
@@ -104,6 +106,12 @@ type ZorealTheme = 'auto' | 'light' | 'dark';
|
|
|
104
106
|
* own pairing UI want this.
|
|
105
107
|
*/
|
|
106
108
|
type PairingUI = 'modal' | 'none';
|
|
109
|
+
/**
|
|
110
|
+
* What the pairing dialog says it is for. Resolved from the request when not
|
|
111
|
+
* given: document scopes make it 'identify', an identifier-only request with
|
|
112
|
+
* a liveness capture makes it 'presence', and the rest is 'sign-in'.
|
|
113
|
+
*/
|
|
114
|
+
type LoginIntent = 'sign-in' | 'identify' | 'presence';
|
|
107
115
|
interface StartLoginOptions {
|
|
108
116
|
/** The asset token from the ZOREAL dashboard, ast_... */
|
|
109
117
|
clientId: string;
|
|
@@ -125,6 +133,12 @@ interface StartLoginOptions {
|
|
|
125
133
|
app_state?: string;
|
|
126
134
|
/** 'auto' renders a QR on desktop and an app link on mobile, which is what you want. */
|
|
127
135
|
display?: 'auto' | 'qr' | 'link';
|
|
136
|
+
/**
|
|
137
|
+
* What the dialog tells the holder they are scanning for. Set it when the
|
|
138
|
+
* scope does not say: a presence check that asks for a name is still not a
|
|
139
|
+
* sign-in. See LoginIntent for what is inferred when this is omitted.
|
|
140
|
+
*/
|
|
141
|
+
intent?: LoginIntent;
|
|
128
142
|
/** Sent to the provider so the pairing surface speaks the visitor's language. */
|
|
129
143
|
locale?: string;
|
|
130
144
|
/** Called on each pairing state change. Drive your UI from this. */
|
|
@@ -218,6 +232,8 @@ interface PairingModalOptions {
|
|
|
218
232
|
locale?: string;
|
|
219
233
|
theme?: ZorealTheme;
|
|
220
234
|
timeoutMs?: number;
|
|
235
|
+
/** Which title the dialog opens with. Defaults to the sign-in wording. */
|
|
236
|
+
intent?: LoginIntent;
|
|
221
237
|
}
|
|
222
238
|
interface PairingModalHandle {
|
|
223
239
|
/** Re-render from a new pairing state. */
|
|
@@ -289,7 +305,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
|
|
|
289
305
|
* auth-code mode leaves it to the RP backend.
|
|
290
306
|
*/
|
|
291
307
|
declare const WIRE_VERSION = 1;
|
|
292
|
-
declare const SDK_VERSION = "0.1.
|
|
308
|
+
declare const SDK_VERSION = "0.1.15";
|
|
293
309
|
declare const SDK_NAME = "@zoreal/oauth2-js";
|
|
294
310
|
declare const DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
295
311
|
/** Pending TTL is short. Poll gently; over-polling cancels the request. */
|
|
@@ -434,4 +450,12 @@ declare function generateState(): string;
|
|
|
434
450
|
*/
|
|
435
451
|
declare function unsafeClaims(idToken: string): Record<string, unknown>;
|
|
436
452
|
|
|
437
|
-
|
|
453
|
+
/**
|
|
454
|
+
* What the pairing dialog says it is for. An explicit intent wins. Otherwise
|
|
455
|
+
* a request for document attributes is an identification; a request for the
|
|
456
|
+
* identifier alone with a liveness capture is a presence check, since nothing
|
|
457
|
+
* is being logged into; everything else is a sign-in.
|
|
458
|
+
*/
|
|
459
|
+
declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
|
|
460
|
+
|
|
461
|
+
export { type AcrValue, type AuthCodeLoginOptions, type BrowserDirectLoginOptions, DEFAULT_ISSUER, DEFAULT_PAIRING_TIMEOUT_MS, DEFAULT_QR_REFRESH_SECONDS, type ErrorCode, FlowAbandonedError, type LoginHandle, type LoginIntent, type NonOAuthError, OAuthFlowError, POLL_INTERVAL_ENROLLING_MS, POLL_INTERVAL_MS, type PairCreated, type PairDisplay, type PairImmediate, type PairStartResponse, type PairStatusResponse, type PairingModalHandle, type PairingModalOptions, type PairingState, type PairingUI, SDK_NAME, SDK_VERSION, type SelectBy, type StartLoginOptions, type StartPairingParams, type TokenResponse, WIRE_VERSION, type ZorealCodeResponse, type ZorealCredentialResponse, type ZorealTheme, challengeS256, exchangeCode, generateState, generateVerifier, isMobileUserAgent, mountPairingModal, pollUntilApproved, resolveIntent, startLogin, startPairing, unsafeClaims };
|