@zoreal/oauth2-js 0.1.19 → 0.1.21

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
@@ -139,6 +139,13 @@ interface StartLoginOptions {
139
139
  * sign-in. See LoginIntent for what is inferred when this is omitted.
140
140
  */
141
141
  intent?: LoginIntent;
142
+ /**
143
+ * The control the person used to start this login, held busy with the
144
+ * pairing modal's light round it until the login ends, and let go on
145
+ * every outcome. Pass the button from your click handler. Nothing else is
146
+ * needed: no wrapper, no busy state of your own.
147
+ */
148
+ control?: HTMLElement;
142
149
  /** Sent to the provider so the pairing surface speaks the visitor's language. */
143
150
  locale?: string;
144
151
  /** Called on each pairing state change. Drive your UI from this. */
@@ -211,6 +218,17 @@ interface LoginHandle<T> {
211
218
 
212
219
  declare function startLogin(options: BrowserDirectLoginOptions): LoginHandle<ZorealCredentialResponse>;
213
220
  declare function startLogin(options: AuthCodeLoginOptions): LoginHandle<ZorealCodeResponse>;
221
+ /**
222
+ * Finishes a same-device sign-in on the page the ZOREAL ID app reopened.
223
+ *
224
+ * Call it on every page load where `startLogin` can be called. It answers
225
+ * null at once when this page load is not a return; otherwise it takes the
226
+ * flow saved before the tap, polls the pairing named in the fragment, and
227
+ * resolves the way `startLogin` would have: an ID token in browser-direct
228
+ * mode, the code and the verifier in auth-code mode. The fragment is removed
229
+ * from the address bar as it is read.
230
+ */
231
+ declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issuer' | 'onState' | 'control'>): LoginHandle<ZorealCredentialResponse | ZorealCodeResponse> | null;
214
232
 
215
233
  /**
216
234
  * The pairing modal, in plain DOM.
@@ -310,7 +328,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
310
328
  * auth-code mode leaves it to the RP backend.
311
329
  */
312
330
  declare const WIRE_VERSION = 1;
313
- declare const SDK_VERSION = "0.1.19";
331
+ declare const SDK_VERSION = "0.1.21";
314
332
  declare const SDK_NAME = "@zoreal/oauth2-js";
315
333
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
316
334
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
@@ -466,4 +484,4 @@ declare function unsafeClaims(idToken: string): Record<string, unknown>;
466
484
  */
467
485
  declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
468
486
 
469
- 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 };
487
+ 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, resumeLogin, startLogin, startPairing, unsafeClaims };
package/dist/index.d.ts CHANGED
@@ -139,6 +139,13 @@ interface StartLoginOptions {
139
139
  * sign-in. See LoginIntent for what is inferred when this is omitted.
140
140
  */
141
141
  intent?: LoginIntent;
142
+ /**
143
+ * The control the person used to start this login, held busy with the
144
+ * pairing modal's light round it until the login ends, and let go on
145
+ * every outcome. Pass the button from your click handler. Nothing else is
146
+ * needed: no wrapper, no busy state of your own.
147
+ */
148
+ control?: HTMLElement;
142
149
  /** Sent to the provider so the pairing surface speaks the visitor's language. */
143
150
  locale?: string;
144
151
  /** Called on each pairing state change. Drive your UI from this. */
@@ -211,6 +218,17 @@ interface LoginHandle<T> {
211
218
 
212
219
  declare function startLogin(options: BrowserDirectLoginOptions): LoginHandle<ZorealCredentialResponse>;
213
220
  declare function startLogin(options: AuthCodeLoginOptions): LoginHandle<ZorealCodeResponse>;
221
+ /**
222
+ * Finishes a same-device sign-in on the page the ZOREAL ID app reopened.
223
+ *
224
+ * Call it on every page load where `startLogin` can be called. It answers
225
+ * null at once when this page load is not a return; otherwise it takes the
226
+ * flow saved before the tap, polls the pairing named in the fragment, and
227
+ * resolves the way `startLogin` would have: an ID token in browser-direct
228
+ * mode, the code and the verifier in auth-code mode. The fragment is removed
229
+ * from the address bar as it is read.
230
+ */
231
+ declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issuer' | 'onState' | 'control'>): LoginHandle<ZorealCredentialResponse | ZorealCodeResponse> | null;
214
232
 
215
233
  /**
216
234
  * The pairing modal, in plain DOM.
@@ -310,7 +328,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
310
328
  * auth-code mode leaves it to the RP backend.
311
329
  */
312
330
  declare const WIRE_VERSION = 1;
313
- declare const SDK_VERSION = "0.1.19";
331
+ declare const SDK_VERSION = "0.1.21";
314
332
  declare const SDK_NAME = "@zoreal/oauth2-js";
315
333
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
316
334
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
@@ -466,4 +484,4 @@ declare function unsafeClaims(idToken: string): Record<string, unknown>;
466
484
  */
467
485
  declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
468
486
 
469
- 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 };
487
+ 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, resumeLogin, startLogin, startPairing, unsafeClaims };