@synqauth/js 0.3.0 → 0.4.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/{api-BGeXhXo6.js → api-D2jDzTRO.js} +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +25 -2
- package/dist/{management-C4LYIC3S.d.ts → management-BN4KI1ZH.d.ts} +14454 -8013
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
|
@@ -480,7 +480,7 @@ var SignInFlow = class {
|
|
|
480
480
|
const superseded = () => ({
|
|
481
481
|
status: "retry",
|
|
482
482
|
problem: "work_required",
|
|
483
|
-
message: "
|
|
483
|
+
message: "A newer request replaced this one. Tap Email me a code again."
|
|
484
484
|
});
|
|
485
485
|
const initial = { ...this.#state };
|
|
486
486
|
let answer = await this.#send(fields, initial);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SignInFlowStep, B as
|
|
1
|
+
import { A as SignInFlowStep, B as SignInEnding, C as browserLocalStorage, D as PasskeyRequestOptionsJSON, E as PasskeyAssertionJSON, F as ChallengeMethod, H as TestAccount, I as ChallengeProblem, L as DeniedReason, M as StartSignInOptions, N as CHALLENGE_METHODS, O as SavedSignIn, P as CHALLENGE_PROBLEMS, R as RedirectReason, S as SynqStorage, T as memoryStorage, V as LinkedAccount, _ as SessionEvent, a as Problem, b as SynqClientOptions, c as SynqError, d as ERROR_CODES, f as SynqErrorCode, g as Session, h as ServerSignInOptions, i as OAuthErrorCode, j as SignInStepResult, k as SignInFlow, l as isSynqError, m as IdTokenClaims, n as operations$1, o as SynqAnyErrorCode, p as AuthorizationUrlOptions, r as paths$1, s as SynqClientErrorCode, t as components$1, u as problemError, v as SignOutOptions, w as browserSessionStorage, x as createSynqClient, y as SynqClient, z as SIGN_IN_ENDINGS } from "./management-BN4KI1ZH.js";
|
|
2
2
|
//#region src/generated/account.d.ts
|
|
3
3
|
interface paths {
|
|
4
4
|
readonly "/v1/api-keys": {
|
|
@@ -567,6 +567,11 @@ interface components {
|
|
|
567
567
|
* @description When it was added
|
|
568
568
|
*/
|
|
569
569
|
readonly created_at: string;
|
|
570
|
+
/**
|
|
571
|
+
* @description For an account at a provider: the email address the provider gave for it at their last sign-in with it (Google’s, Apple’s, Microsoft’s…), where it gave one. For showing people which account it is only: it changes, and never identifies anyone
|
|
572
|
+
* @example ada@example.com
|
|
573
|
+
*/
|
|
574
|
+
readonly email?: string;
|
|
570
575
|
/**
|
|
571
576
|
* @description Their handle there, without the @, as the provider showed it at their last sign-in with it: GitHub’s, X’s, Discord’s, Telegram’s and Matrica’s username. Null where the provider has none. For showing people only: it changes, and never identifies anyone
|
|
572
577
|
* @example ada
|
|
@@ -1737,6 +1742,7 @@ interface operations {
|
|
|
1737
1742
|
* "provider": "google",
|
|
1738
1743
|
* "subject": "string",
|
|
1739
1744
|
* "handle": "ada",
|
|
1745
|
+
* "email": "ada@example.com",
|
|
1740
1746
|
* "password": true,
|
|
1741
1747
|
* "provider_user_id": "987654321",
|
|
1742
1748
|
* "scopes": [
|
|
@@ -3689,6 +3695,10 @@ export declare function createAccountClient(options: AccountClientOptions): Acco
|
|
|
3689
3695
|
*/
|
|
3690
3696
|
export declare function walletConflict(error: unknown): AccountWalletConflict | undefined;
|
|
3691
3697
|
//#endregion
|
|
3698
|
+
//#region src/sign-in-endings.d.ts
|
|
3699
|
+
/** Which ending a callback's `error_description` names, or undefined for one Synq didn't write. */
|
|
3700
|
+
export declare function signInEndingOf(description: string | null | undefined): SignInEnding | undefined;
|
|
3701
|
+
//#endregion
|
|
3692
3702
|
//#region src/sign-in-methods.d.ts
|
|
3693
3703
|
/** What kind of way in a method is. More may come: compare with the ones you handle. */
|
|
3694
3704
|
type SignInMethodKind = 'wallet' | 'provider' | 'email' | 'password' | 'passkey' | (string & Record<never, never>);
|
|
@@ -3874,4 +3884,4 @@ export declare function avatarSvg(seed: string, options?: AvatarOptions & {
|
|
|
3874
3884
|
id?: string;
|
|
3875
3885
|
}): string;
|
|
3876
3886
|
//#endregion
|
|
3877
|
-
export { type AccountApiKey, type AccountApiKeyCreate, type AccountClient, type AccountClientOptions, type components as AccountComponents, type AccountConsent, type AccountIdentity, type AccountKeyableApi, type AccountLinkRequest, type AccountLinkableMethod, type AccountNewApiKey, type operations as AccountOperations, type AccountPasskey, type AccountPasskeyLinkRequest, type paths as AccountPaths, type AccountPictureUpload, type AccountProfile, type AccountProfileUpdate, type AccountResult, type AccountSession, type AccountSignIn, type AccountUsernameAvailability, type AccountWallet, type AccountWalletConflict, type AccountWalletUpdate, type AuthorizationUrlOptions, type AvatarInfo, type AvatarOptions, type AvatarParts, type AvatarPerson, type AvatarStyle, CHALLENGE_METHODS, CHALLENGE_PROBLEMS, type ChallengeMethod, type ChallengeProblem, type ChangeOptions, type DeniedReason, ERROR_CODES, type EmailWorkChallenge, type EmailWorkOptions, type EmbeddedBrowser, type IdTokenClaims, type LinkMethod, type LinkedAccount, type components$1 as ManagementComponents, type operations$1 as ManagementOperations, type paths$1 as ManagementPaths, type OAuthErrorCode, type PasskeyAssertionJSON, type PasskeyRequestOptionsJSON, type PictureUploadOptions, type Problem, type ReadOptions, type RedirectReason, type SavedSignIn, type ServerSignInOptions, type Session, type SessionEvent, SignInFlow, type SignInFlowStep, type SignInMethodInfo, type SignInMethodKind, type SignInMethodList, type SignInStepResult, type SignOutOptions, type StartSignInOptions, type SynqAnyErrorCode, type SynqClient, type SynqClientErrorCode, type SynqClientOptions, SynqError, type SynqErrorCode, type SynqStorage, type TestAccount, browserLocalStorage, browserSessionStorage, createSynqClient, isSynqError, memoryStorage, problemError };
|
|
3887
|
+
export { type AccountApiKey, type AccountApiKeyCreate, type AccountClient, type AccountClientOptions, type components as AccountComponents, type AccountConsent, type AccountIdentity, type AccountKeyableApi, type AccountLinkRequest, type AccountLinkableMethod, type AccountNewApiKey, type operations as AccountOperations, type AccountPasskey, type AccountPasskeyLinkRequest, type paths as AccountPaths, type AccountPictureUpload, type AccountProfile, type AccountProfileUpdate, type AccountResult, type AccountSession, type AccountSignIn, type AccountUsernameAvailability, type AccountWallet, type AccountWalletConflict, type AccountWalletUpdate, type AuthorizationUrlOptions, type AvatarInfo, type AvatarOptions, type AvatarParts, type AvatarPerson, type AvatarStyle, CHALLENGE_METHODS, CHALLENGE_PROBLEMS, type ChallengeMethod, type ChallengeProblem, type ChangeOptions, type DeniedReason, ERROR_CODES, type EmailWorkChallenge, type EmailWorkOptions, type EmbeddedBrowser, type IdTokenClaims, type LinkMethod, type LinkedAccount, type components$1 as ManagementComponents, type operations$1 as ManagementOperations, type paths$1 as ManagementPaths, type OAuthErrorCode, type PasskeyAssertionJSON, type PasskeyRequestOptionsJSON, type PictureUploadOptions, type Problem, type ReadOptions, type RedirectReason, SIGN_IN_ENDINGS, type SavedSignIn, type ServerSignInOptions, type Session, type SessionEvent, type SignInEnding, SignInFlow, type SignInFlowStep, type SignInMethodInfo, type SignInMethodKind, type SignInMethodList, type SignInStepResult, type SignOutOptions, type StartSignInOptions, type SynqAnyErrorCode, type SynqClient, type SynqClientErrorCode, type SynqClientOptions, SynqError, type SynqErrorCode, type SynqStorage, type TestAccount, browserLocalStorage, browserSessionStorage, createSynqClient, isSynqError, memoryStorage, problemError };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as readSavedSignIn, c as SynqError, d as toSynqError, i as newSignIn, l as isSynqError, n as secureUrl, r as SignInFlow, s as solveEmailWork, t as createApiClient, u as problemError } from "./api-
|
|
1
|
+
import { a as readSavedSignIn, c as SynqError, d as toSynqError, i as newSignIn, l as isSynqError, n as secureUrl, r as SignInFlow, s as solveEmailWork, t as createApiClient, u as problemError } from "./api-D2jDzTRO.js";
|
|
2
2
|
import * as oauth from "oauth4webapi";
|
|
3
3
|
//#region src/storage.ts
|
|
4
4
|
/**
|
|
@@ -762,6 +762,27 @@ const CHALLENGE_PROBLEMS = [
|
|
|
762
762
|
"locked",
|
|
763
763
|
"limited"
|
|
764
764
|
];
|
|
765
|
+
/**
|
|
766
|
+
* Why a hosted sign-in went back to the app with `access_denied` or
|
|
767
|
+
* `unmet_authentication_requirements`, each with the exact
|
|
768
|
+
* `error_description` the issuer sends for it: read the reason from it.
|
|
769
|
+
*/
|
|
770
|
+
const SIGN_IN_ENDINGS = {
|
|
771
|
+
cancelled: "the user cancelled the sign-in",
|
|
772
|
+
consent_denied: "the user denied the request",
|
|
773
|
+
token_gate_refused: "the user does not hold the tokens this app requires",
|
|
774
|
+
token_gate_unavailable: "the user's tokens could not be checked",
|
|
775
|
+
method_not_offered: "wallets can't sign in here",
|
|
776
|
+
passkey_required: "the user did not sign in with a passkey, which the app requires",
|
|
777
|
+
level_not_met: "the sign-in did not reach the level the app requires"
|
|
778
|
+
};
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/sign-in-endings.ts
|
|
781
|
+
const BY_DESCRIPTION = new Map(Object.entries(SIGN_IN_ENDINGS).map(([ending, words]) => [words, ending]));
|
|
782
|
+
/** Which ending a callback's `error_description` names, or undefined for one Synq didn't write. */
|
|
783
|
+
function signInEndingOf(description) {
|
|
784
|
+
return description ? BY_DESCRIPTION.get(description) : void 0;
|
|
785
|
+
}
|
|
765
786
|
//#endregion
|
|
766
787
|
//#region src/sign-in-methods.ts
|
|
767
788
|
/** Where the issuer lists an app's sign-in methods. */
|
|
@@ -890,6 +911,8 @@ const ERROR_CODES = {
|
|
|
890
911
|
scope_unavailable: 422,
|
|
891
912
|
scope_needs_own_app: 422,
|
|
892
913
|
token_gates_unavailable: 409,
|
|
914
|
+
discord_unavailable: 409,
|
|
915
|
+
telegram_unavailable: 409,
|
|
893
916
|
passkey_rejected: 400,
|
|
894
917
|
email_undeliverable: 422,
|
|
895
918
|
email_domain_unavailable: 409,
|
|
@@ -1135,4 +1158,4 @@ function avatarSvg(seed, options = {}) {
|
|
|
1135
1158
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="${id}g" gradientTransform="rotate(${parts.angle} .5 .5)"><stop offset="0" stop-color="${parts.from}"/><stop offset="1" stop-color="${parts.to}"/></linearGradient><radialGradient id="${id}h"><stop offset="0" stop-color="#fff" stop-opacity=".3"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient></defs><rect width="64" height="64" fill="url(#${id}g)"/><circle cx="${parts.highlight.x}" cy="${parts.highlight.y}" r="26" fill="url(#${id}h)"/>${text}</svg>`;
|
|
1136
1159
|
}
|
|
1137
1160
|
//#endregion
|
|
1138
|
-
export { CHALLENGE_METHODS, CHALLENGE_PROBLEMS, ERROR_CODES, SignInFlow, SynqError, accountApiUrl, avatarOf, avatarParts, avatarSvg, browserLocalStorage, browserSessionStorage, createAccountClient, createSynqClient, cyrb128, defaultPick, embeddedBrowser, initialsOf, isSynqError, linkSignIn, memoryStorage, problemError, readMethodList, signInMethods, signInMethodsUrl, solveEmailWork, walletConflict };
|
|
1161
|
+
export { CHALLENGE_METHODS, CHALLENGE_PROBLEMS, ERROR_CODES, SIGN_IN_ENDINGS, SignInFlow, SynqError, accountApiUrl, avatarOf, avatarParts, avatarSvg, browserLocalStorage, browserSessionStorage, createAccountClient, createSynqClient, cyrb128, defaultPick, embeddedBrowser, initialsOf, isSynqError, linkSignIn, memoryStorage, problemError, readMethodList, signInEndingOf, signInMethods, signInMethodsUrl, solveEmailWork, walletConflict };
|