@zoreal/oauth2-js 0.1.18 → 0.1.20
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 +1 -1
- package/dist/index.cjs +258 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +257 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -211,6 +211,17 @@ interface LoginHandle<T> {
|
|
|
211
211
|
|
|
212
212
|
declare function startLogin(options: BrowserDirectLoginOptions): LoginHandle<ZorealCredentialResponse>;
|
|
213
213
|
declare function startLogin(options: AuthCodeLoginOptions): LoginHandle<ZorealCodeResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Finishes a same-device sign-in on the page the ZOREAL ID app reopened.
|
|
216
|
+
*
|
|
217
|
+
* Call it on every page load where `startLogin` can be called. It answers
|
|
218
|
+
* null at once when this page load is not a return; otherwise it takes the
|
|
219
|
+
* flow saved before the tap, polls the pairing named in the fragment, and
|
|
220
|
+
* resolves the way `startLogin` would have: an ID token in browser-direct
|
|
221
|
+
* mode, the code and the verifier in auth-code mode. The fragment is removed
|
|
222
|
+
* from the address bar as it is read.
|
|
223
|
+
*/
|
|
224
|
+
declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issuer' | 'onState'>): LoginHandle<ZorealCredentialResponse | ZorealCodeResponse> | null;
|
|
214
225
|
|
|
215
226
|
/**
|
|
216
227
|
* The pairing modal, in plain DOM.
|
|
@@ -310,7 +321,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
|
|
|
310
321
|
* auth-code mode leaves it to the RP backend.
|
|
311
322
|
*/
|
|
312
323
|
declare const WIRE_VERSION = 1;
|
|
313
|
-
declare const SDK_VERSION = "0.1.
|
|
324
|
+
declare const SDK_VERSION = "0.1.20";
|
|
314
325
|
declare const SDK_NAME = "@zoreal/oauth2-js";
|
|
315
326
|
declare const DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
316
327
|
/** Pending TTL is short. Poll gently; over-polling cancels the request. */
|
|
@@ -413,11 +424,6 @@ interface StartPairingParams {
|
|
|
413
424
|
display?: PairDisplay;
|
|
414
425
|
}
|
|
415
426
|
declare function startPairing(issuer: string, params: StartPairingParams, signal?: AbortSignal): Promise<PairStartResponse>;
|
|
416
|
-
/**
|
|
417
|
-
* Polls until the request resolves. Returns the authorization code.
|
|
418
|
-
* Throws FlowAbandonedError for the human outcomes (denied, expired,
|
|
419
|
-
* enrolment abandoned) and OAuthFlowError for protocol ones.
|
|
420
|
-
*/
|
|
421
427
|
declare function pollUntilApproved(issuer: string, requestId: string, onState?: (state: PairingState) => void, signal?: AbortSignal, options?: {
|
|
422
428
|
/**
|
|
423
429
|
* Same-device navigation only. The page starts polling while the
|
|
@@ -471,4 +477,4 @@ declare function unsafeClaims(idToken: string): Record<string, unknown>;
|
|
|
471
477
|
*/
|
|
472
478
|
declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
|
|
473
479
|
|
|
474
|
-
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 };
|
|
480
|
+
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
|
@@ -211,6 +211,17 @@ interface LoginHandle<T> {
|
|
|
211
211
|
|
|
212
212
|
declare function startLogin(options: BrowserDirectLoginOptions): LoginHandle<ZorealCredentialResponse>;
|
|
213
213
|
declare function startLogin(options: AuthCodeLoginOptions): LoginHandle<ZorealCodeResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Finishes a same-device sign-in on the page the ZOREAL ID app reopened.
|
|
216
|
+
*
|
|
217
|
+
* Call it on every page load where `startLogin` can be called. It answers
|
|
218
|
+
* null at once when this page load is not a return; otherwise it takes the
|
|
219
|
+
* flow saved before the tap, polls the pairing named in the fragment, and
|
|
220
|
+
* resolves the way `startLogin` would have: an ID token in browser-direct
|
|
221
|
+
* mode, the code and the verifier in auth-code mode. The fragment is removed
|
|
222
|
+
* from the address bar as it is read.
|
|
223
|
+
*/
|
|
224
|
+
declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issuer' | 'onState'>): LoginHandle<ZorealCredentialResponse | ZorealCodeResponse> | null;
|
|
214
225
|
|
|
215
226
|
/**
|
|
216
227
|
* The pairing modal, in plain DOM.
|
|
@@ -310,7 +321,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
|
|
|
310
321
|
* auth-code mode leaves it to the RP backend.
|
|
311
322
|
*/
|
|
312
323
|
declare const WIRE_VERSION = 1;
|
|
313
|
-
declare const SDK_VERSION = "0.1.
|
|
324
|
+
declare const SDK_VERSION = "0.1.20";
|
|
314
325
|
declare const SDK_NAME = "@zoreal/oauth2-js";
|
|
315
326
|
declare const DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
316
327
|
/** Pending TTL is short. Poll gently; over-polling cancels the request. */
|
|
@@ -413,11 +424,6 @@ interface StartPairingParams {
|
|
|
413
424
|
display?: PairDisplay;
|
|
414
425
|
}
|
|
415
426
|
declare function startPairing(issuer: string, params: StartPairingParams, signal?: AbortSignal): Promise<PairStartResponse>;
|
|
416
|
-
/**
|
|
417
|
-
* Polls until the request resolves. Returns the authorization code.
|
|
418
|
-
* Throws FlowAbandonedError for the human outcomes (denied, expired,
|
|
419
|
-
* enrolment abandoned) and OAuthFlowError for protocol ones.
|
|
420
|
-
*/
|
|
421
427
|
declare function pollUntilApproved(issuer: string, requestId: string, onState?: (state: PairingState) => void, signal?: AbortSignal, options?: {
|
|
422
428
|
/**
|
|
423
429
|
* Same-device navigation only. The page starts polling while the
|
|
@@ -471,4 +477,4 @@ declare function unsafeClaims(idToken: string): Record<string, unknown>;
|
|
|
471
477
|
*/
|
|
472
478
|
declare function resolveIntent(intent: LoginIntent | undefined, scope: string | undefined, acrValues: string | readonly string[] | undefined): LoginIntent;
|
|
473
479
|
|
|
474
|
-
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 };
|
|
480
|
+
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 };
|