@zoreal/oauth2-react 0.2.12 → 0.2.13

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/index.d.cts CHANGED
@@ -56,11 +56,19 @@ interface PairingState {
56
56
  * has no QR.
57
57
  */
58
58
  qrRefreshSeconds?: number;
59
+ /** What the dialog says the code is for, resolved once per login. */
60
+ intent?: LoginIntent;
59
61
  /** True when the flow resolved to the app link (mobile) rather than a QR. */
60
62
  appLink?: boolean;
61
63
  /** Abandons this pairing: stops the poll. Wire it to your UI's cancel control. */
62
64
  cancel?: () => void;
63
65
  }
66
+ /**
67
+ * What the pairing dialog says it is for. Resolved from the request when not
68
+ * given: document scopes make it 'identify', an identifier-only request with
69
+ * a liveness capture makes it 'presence', and the rest is 'sign-in'.
70
+ */
71
+ type LoginIntent = 'sign-in' | 'identify' | 'presence';
64
72
  interface ZorealLoginRequestOptions {
65
73
  /** Defaults to 'openid'. Scopes that return personal data require flow: 'auth-code'. */
66
74
  scope?: string;
@@ -80,6 +88,12 @@ interface ZorealLoginRequestOptions {
80
88
  * 'auto' renders a QR on desktop and an app link on mobile, which is what you want.
81
89
  */
82
90
  display?: 'auto' | 'qr' | 'link';
91
+ /**
92
+ * What the dialog tells the holder they are scanning for. Set it when the
93
+ * scope does not say: a presence check that asks for a name is still not a
94
+ * sign-in. See LoginIntent for what is inferred when this is omitted.
95
+ */
96
+ intent?: LoginIntent;
83
97
  /** Called on each pairing state change. Drive your own UI from this if you render one. */
84
98
  onPairingStateChange?: (state: PairingState) => void;
85
99
  }
@@ -247,8 +261,10 @@ interface PairingModalProps {
247
261
  locale?: string;
248
262
  theme?: ZorealTheme;
249
263
  timeoutMs?: number;
264
+ /** Which title the dialog opens with. Defaults to the sign-in wording. */
265
+ intent?: LoginIntent;
250
266
  }
251
- declare function PairingModal({ state, qrUrl, onCancel, locale, theme, timeoutMs, }: PairingModalProps): react.ReactPortal | null;
267
+ declare function PairingModal({ state, qrUrl, onCancel, locale, theme, timeoutMs, intent, }: PairingModalProps): react.ReactPortal | null;
252
268
 
253
269
  declare function useZorealLogin(options: {
254
270
  flow?: 'browser-direct';
@@ -288,4 +304,12 @@ declare function zorealLogout(): void;
288
304
  declare function hasGrantedAllScopesZoreal(response: Pick<ZorealCodeResponse, 'scope'>, firstScope: string, ...restScopes: string[]): boolean;
289
305
  declare function hasGrantedAnyScopeZoreal(response: Pick<ZorealCodeResponse, 'scope'>, firstScope: string, ...restScopes: string[]): boolean;
290
306
 
291
- export { type AcrValue, type AuthCodeFlowOptions, type BrowserDirectFlowOptions, DEFAULT_PAIRING_TIMEOUT_MS, type ErrorCode, type NonOAuthError, PairingModal, type PairingModalProps, type PairingState, type PairingUI, type SelectBy, type UseZorealAutoLoginOptions, type ZorealButtonConfiguration, type ZorealCodeResponse, type ZorealCredentialResponse, ZorealLogin, type ZorealLoginProps, type ZorealLoginRequestOptions, type ZorealOAuthContextProps, ZorealOAuthProvider, type ZorealOAuthProviderProps, type ZorealTheme, hasGrantedAllScopesZoreal, hasGrantedAnyScopeZoreal, useZorealAutoLogin, useZorealLogin, useZorealOAuth, zorealLogout };
307
+ /**
308
+ * What the pairing dialog says it is for. An explicit intent wins. Otherwise
309
+ * a request for document attributes is an identification; a request for the
310
+ * identifier alone with a liveness capture is a presence check, since nothing
311
+ * is being logged into; everything else is a sign-in.
312
+ */
313
+ declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
314
+
315
+ export { type AcrValue, type AuthCodeFlowOptions, type BrowserDirectFlowOptions, DEFAULT_PAIRING_TIMEOUT_MS, type ErrorCode, type LoginIntent, type NonOAuthError, PairingModal, type PairingModalProps, type PairingState, type PairingUI, type SelectBy, type UseZorealAutoLoginOptions, type ZorealButtonConfiguration, type ZorealCodeResponse, type ZorealCredentialResponse, ZorealLogin, type ZorealLoginProps, type ZorealLoginRequestOptions, type ZorealOAuthContextProps, ZorealOAuthProvider, type ZorealOAuthProviderProps, type ZorealTheme, hasGrantedAllScopesZoreal, hasGrantedAnyScopeZoreal, resolveIntent, useZorealAutoLogin, useZorealLogin, useZorealOAuth, zorealLogout };
package/dist/index.d.ts CHANGED
@@ -56,11 +56,19 @@ interface PairingState {
56
56
  * has no QR.
57
57
  */
58
58
  qrRefreshSeconds?: number;
59
+ /** What the dialog says the code is for, resolved once per login. */
60
+ intent?: LoginIntent;
59
61
  /** True when the flow resolved to the app link (mobile) rather than a QR. */
60
62
  appLink?: boolean;
61
63
  /** Abandons this pairing: stops the poll. Wire it to your UI's cancel control. */
62
64
  cancel?: () => void;
63
65
  }
66
+ /**
67
+ * What the pairing dialog says it is for. Resolved from the request when not
68
+ * given: document scopes make it 'identify', an identifier-only request with
69
+ * a liveness capture makes it 'presence', and the rest is 'sign-in'.
70
+ */
71
+ type LoginIntent = 'sign-in' | 'identify' | 'presence';
64
72
  interface ZorealLoginRequestOptions {
65
73
  /** Defaults to 'openid'. Scopes that return personal data require flow: 'auth-code'. */
66
74
  scope?: string;
@@ -80,6 +88,12 @@ interface ZorealLoginRequestOptions {
80
88
  * 'auto' renders a QR on desktop and an app link on mobile, which is what you want.
81
89
  */
82
90
  display?: 'auto' | 'qr' | 'link';
91
+ /**
92
+ * What the dialog tells the holder they are scanning for. Set it when the
93
+ * scope does not say: a presence check that asks for a name is still not a
94
+ * sign-in. See LoginIntent for what is inferred when this is omitted.
95
+ */
96
+ intent?: LoginIntent;
83
97
  /** Called on each pairing state change. Drive your own UI from this if you render one. */
84
98
  onPairingStateChange?: (state: PairingState) => void;
85
99
  }
@@ -247,8 +261,10 @@ interface PairingModalProps {
247
261
  locale?: string;
248
262
  theme?: ZorealTheme;
249
263
  timeoutMs?: number;
264
+ /** Which title the dialog opens with. Defaults to the sign-in wording. */
265
+ intent?: LoginIntent;
250
266
  }
251
- declare function PairingModal({ state, qrUrl, onCancel, locale, theme, timeoutMs, }: PairingModalProps): react.ReactPortal | null;
267
+ declare function PairingModal({ state, qrUrl, onCancel, locale, theme, timeoutMs, intent, }: PairingModalProps): react.ReactPortal | null;
252
268
 
253
269
  declare function useZorealLogin(options: {
254
270
  flow?: 'browser-direct';
@@ -288,4 +304,12 @@ declare function zorealLogout(): void;
288
304
  declare function hasGrantedAllScopesZoreal(response: Pick<ZorealCodeResponse, 'scope'>, firstScope: string, ...restScopes: string[]): boolean;
289
305
  declare function hasGrantedAnyScopeZoreal(response: Pick<ZorealCodeResponse, 'scope'>, firstScope: string, ...restScopes: string[]): boolean;
290
306
 
291
- export { type AcrValue, type AuthCodeFlowOptions, type BrowserDirectFlowOptions, DEFAULT_PAIRING_TIMEOUT_MS, type ErrorCode, type NonOAuthError, PairingModal, type PairingModalProps, type PairingState, type PairingUI, type SelectBy, type UseZorealAutoLoginOptions, type ZorealButtonConfiguration, type ZorealCodeResponse, type ZorealCredentialResponse, ZorealLogin, type ZorealLoginProps, type ZorealLoginRequestOptions, type ZorealOAuthContextProps, ZorealOAuthProvider, type ZorealOAuthProviderProps, type ZorealTheme, hasGrantedAllScopesZoreal, hasGrantedAnyScopeZoreal, useZorealAutoLogin, useZorealLogin, useZorealOAuth, zorealLogout };
307
+ /**
308
+ * What the pairing dialog says it is for. An explicit intent wins. Otherwise
309
+ * a request for document attributes is an identification; a request for the
310
+ * identifier alone with a liveness capture is a presence check, since nothing
311
+ * is being logged into; everything else is a sign-in.
312
+ */
313
+ declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
314
+
315
+ export { type AcrValue, type AuthCodeFlowOptions, type BrowserDirectFlowOptions, DEFAULT_PAIRING_TIMEOUT_MS, type ErrorCode, type LoginIntent, type NonOAuthError, PairingModal, type PairingModalProps, type PairingState, type PairingUI, type SelectBy, type UseZorealAutoLoginOptions, type ZorealButtonConfiguration, type ZorealCodeResponse, type ZorealCredentialResponse, ZorealLogin, type ZorealLoginProps, type ZorealLoginRequestOptions, type ZorealOAuthContextProps, ZorealOAuthProvider, type ZorealOAuthProviderProps, type ZorealTheme, hasGrantedAllScopesZoreal, hasGrantedAnyScopeZoreal, resolveIntent, useZorealAutoLogin, useZorealLogin, useZorealOAuth, zorealLogout };