@block-auth.io/core 0.15.1 → 0.17.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/index.cjs +426 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -49
- package/dist/index.d.ts +55 -49
- package/dist/index.js +426 -109
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -75,6 +75,53 @@ declare function createDeletionService(deps: DeletionServiceDeps): {
|
|
|
75
75
|
resetHandlingState: () => void;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
type BlockAuthUserRole = {
|
|
79
|
+
slug: string;
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
82
|
+
type BlockAuthUserProfile = {
|
|
83
|
+
roles?: BlockAuthUserRole[];
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
declare const getUserRoles: (user?: BlockAuthUserProfile | null) => BlockAuthUserRole[];
|
|
87
|
+
/** Human-readable role names (primary API for client apps). */
|
|
88
|
+
declare const getUserRoleNames: (user?: BlockAuthUserProfile | null) => string[];
|
|
89
|
+
/** Technical role slugs (advanced / internal identification). */
|
|
90
|
+
declare const getUserRoleSlugs: (user?: BlockAuthUserProfile | null) => string[];
|
|
91
|
+
declare const hasRole: (user: BlockAuthUserProfile | null | undefined, roleName: string) => boolean;
|
|
92
|
+
declare const hasRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlug: string) => boolean;
|
|
93
|
+
declare const hasAnyRole: (user: BlockAuthUserProfile | null | undefined, roleNames: string[]) => boolean;
|
|
94
|
+
declare const hasAnyRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlugs: string[]) => boolean;
|
|
95
|
+
|
|
96
|
+
interface PopupLoginOptions {
|
|
97
|
+
apiKey: string;
|
|
98
|
+
wsUrl?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A code the page hands to its own backend instead of redeeming it: the
|
|
102
|
+
* backend redeems it at POST /api/auth/token with its apiSecret plus this
|
|
103
|
+
* codeVerifier and redirectUri, so the address comes from BlockAuth, not from
|
|
104
|
+
* the browser.
|
|
105
|
+
*/
|
|
106
|
+
interface PopupAuthCode {
|
|
107
|
+
code: string;
|
|
108
|
+
codeVerifier: string;
|
|
109
|
+
redirectUri: string;
|
|
110
|
+
}
|
|
111
|
+
interface NoncedPopupAuthCode extends PopupAuthCode {
|
|
112
|
+
nonce: string;
|
|
113
|
+
}
|
|
114
|
+
interface PopupLoginResult {
|
|
115
|
+
address: string;
|
|
116
|
+
did: string;
|
|
117
|
+
signedNonce: number;
|
|
118
|
+
signedAt: string;
|
|
119
|
+
signedExpiredAt: string;
|
|
120
|
+
roles: BlockAuthUserRole[];
|
|
121
|
+
idToken?: string;
|
|
122
|
+
renewToken?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
78
125
|
/**
|
|
79
126
|
* This class allow you to use WebSocket API
|
|
80
127
|
* for Block-Auth service
|
|
@@ -392,24 +439,6 @@ declare class RpcClient {
|
|
|
392
439
|
constructor();
|
|
393
440
|
}
|
|
394
441
|
|
|
395
|
-
type BlockAuthUserRole = {
|
|
396
|
-
slug: string;
|
|
397
|
-
name: string;
|
|
398
|
-
};
|
|
399
|
-
type BlockAuthUserProfile = {
|
|
400
|
-
roles?: BlockAuthUserRole[];
|
|
401
|
-
[key: string]: unknown;
|
|
402
|
-
};
|
|
403
|
-
declare const getUserRoles: (user?: BlockAuthUserProfile | null) => BlockAuthUserRole[];
|
|
404
|
-
/** Human-readable role names (primary API for client apps). */
|
|
405
|
-
declare const getUserRoleNames: (user?: BlockAuthUserProfile | null) => string[];
|
|
406
|
-
/** Technical role slugs (advanced / internal identification). */
|
|
407
|
-
declare const getUserRoleSlugs: (user?: BlockAuthUserProfile | null) => string[];
|
|
408
|
-
declare const hasRole: (user: BlockAuthUserProfile | null | undefined, roleName: string) => boolean;
|
|
409
|
-
declare const hasRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlug: string) => boolean;
|
|
410
|
-
declare const hasAnyRole: (user: BlockAuthUserProfile | null | undefined, roleNames: string[]) => boolean;
|
|
411
|
-
declare const hasAnyRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlugs: string[]) => boolean;
|
|
412
|
-
|
|
413
442
|
/**
|
|
414
443
|
* This class allow you to authenticate with your BlockAuth
|
|
415
444
|
* wallet and get the data from your user and/or tenant.
|
|
@@ -739,28 +768,8 @@ type Locale = 'en' | 'es';
|
|
|
739
768
|
declare const $locale: nanostores.WritableAtom<Locale>;
|
|
740
769
|
declare const setLocale: (l: Locale) => void;
|
|
741
770
|
|
|
742
|
-
interface
|
|
743
|
-
|
|
744
|
-
wsUrl?: string;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* A code the page hands to its own backend instead of redeeming it: the
|
|
748
|
-
* backend redeems it at POST /api/auth/token with its apiSecret plus this
|
|
749
|
-
* codeVerifier and redirectUri, so the address comes from BlockAuth, not from
|
|
750
|
-
* the browser.
|
|
751
|
-
*/
|
|
752
|
-
interface PopupAuthCode {
|
|
753
|
-
code: string;
|
|
754
|
-
codeVerifier: string;
|
|
755
|
-
redirectUri: string;
|
|
756
|
-
}
|
|
757
|
-
interface PopupLoginResult {
|
|
758
|
-
address: string;
|
|
759
|
-
did: string;
|
|
760
|
-
signedNonce: number;
|
|
761
|
-
signedAt: string;
|
|
762
|
-
signedExpiredAt: string;
|
|
763
|
-
roles: BlockAuthUserRole[];
|
|
771
|
+
interface RedirectLoginOptions {
|
|
772
|
+
returnTo?: string;
|
|
764
773
|
}
|
|
765
774
|
|
|
766
775
|
type GoogleFlow = 'auth-code' | 'implicit';
|
|
@@ -1222,7 +1231,10 @@ declare function createBlockAuthClient(config: BlockAuthClientConfig): {
|
|
|
1222
1231
|
};
|
|
1223
1232
|
connectBlockAuth: () => void;
|
|
1224
1233
|
loginWithPopup: () => Promise<PopupLoginResult>;
|
|
1225
|
-
|
|
1234
|
+
loginWithRedirect: (options?: RedirectLoginOptions) => Promise<void>;
|
|
1235
|
+
handleRedirectCallback: () => Promise<PopupLoginResult | null>;
|
|
1236
|
+
getIdToken: () => Promise<string | null>;
|
|
1237
|
+
authorizeWithPopup: () => Promise<NoncedPopupAuthCode>;
|
|
1226
1238
|
rememberHostedLogin: (user: HostedLoginUser, options?: {
|
|
1227
1239
|
ownsAuthCode?: boolean;
|
|
1228
1240
|
}) => void;
|
|
@@ -2158,11 +2170,6 @@ declare const getUTCDateString: (date?: Date | string | number) => string;
|
|
|
2158
2170
|
* Formats a number of seconds into a human-readable "Hh Mm" / "Mm" string.
|
|
2159
2171
|
*/
|
|
2160
2172
|
declare const secsToText: (secs?: number) => string;
|
|
2161
|
-
/**
|
|
2162
|
-
* Best-effort retrieval of the caller's public IP. Returns a placeholder
|
|
2163
|
-
* on failure.
|
|
2164
|
-
*/
|
|
2165
|
-
declare const getIp: () => Promise<string | undefined>;
|
|
2166
2173
|
/**
|
|
2167
2174
|
* Normalizes a URL to use the https scheme.
|
|
2168
2175
|
*/
|
|
@@ -2181,14 +2188,13 @@ type index_UiConfig = UiConfig;
|
|
|
2181
2188
|
declare const index_browserBase: typeof browserBase;
|
|
2182
2189
|
declare const index_cleanUrl: typeof cleanUrl;
|
|
2183
2190
|
declare const index_getExtensionStoreUrl: typeof getExtensionStoreUrl;
|
|
2184
|
-
declare const index_getIp: typeof getIp;
|
|
2185
2191
|
declare const index_getUTCDateString: typeof getUTCDateString;
|
|
2186
2192
|
declare const index_imgUrlByService: typeof imgUrlByService;
|
|
2187
2193
|
declare const index_isFirefox: typeof isFirefox;
|
|
2188
2194
|
declare const index_isValidImgUrl: typeof isValidImgUrl;
|
|
2189
2195
|
declare const index_secsToText: typeof secsToText;
|
|
2190
2196
|
declare namespace index {
|
|
2191
|
-
export { index_BLOCKAUTH_STORAGE_KEYS as BLOCKAUTH_STORAGE_KEYS, type index_ExternalServiceConfig as ExternalServiceConfig, type index_SessionConfig as SessionConfig, type index_SetSessionParams as SetSessionParams, type index_UiConfig as UiConfig, index_browserBase as browserBase, index_cleanUrl as cleanUrl, index_getExtensionStoreUrl as getExtensionStoreUrl,
|
|
2197
|
+
export { index_BLOCKAUTH_STORAGE_KEYS as BLOCKAUTH_STORAGE_KEYS, type index_ExternalServiceConfig as ExternalServiceConfig, type index_SessionConfig as SessionConfig, type index_SetSessionParams as SetSessionParams, type index_UiConfig as UiConfig, index_browserBase as browserBase, index_cleanUrl as cleanUrl, index_getExtensionStoreUrl as getExtensionStoreUrl, index_getUTCDateString as getUTCDateString, index_imgUrlByService as imgUrlByService, index_isFirefox as isFirefox, index_isValidImgUrl as isValidImgUrl, index_secsToText as secsToText };
|
|
2192
2198
|
}
|
|
2193
2199
|
|
|
2194
2200
|
/**
|
|
@@ -2236,4 +2242,4 @@ declare function resetExtensionSyncModuleState(): void;
|
|
|
2236
2242
|
*/
|
|
2237
2243
|
declare function startExtensionSync(): () => void;
|
|
2238
2244
|
|
|
2239
|
-
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, AccountLinkError, type AccountLinkErrorReason, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
|
|
2245
|
+
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, AccountLinkError, type AccountLinkErrorReason, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RedirectLoginOptions, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,53 @@ declare function createDeletionService(deps: DeletionServiceDeps): {
|
|
|
75
75
|
resetHandlingState: () => void;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
type BlockAuthUserRole = {
|
|
79
|
+
slug: string;
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
82
|
+
type BlockAuthUserProfile = {
|
|
83
|
+
roles?: BlockAuthUserRole[];
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
declare const getUserRoles: (user?: BlockAuthUserProfile | null) => BlockAuthUserRole[];
|
|
87
|
+
/** Human-readable role names (primary API for client apps). */
|
|
88
|
+
declare const getUserRoleNames: (user?: BlockAuthUserProfile | null) => string[];
|
|
89
|
+
/** Technical role slugs (advanced / internal identification). */
|
|
90
|
+
declare const getUserRoleSlugs: (user?: BlockAuthUserProfile | null) => string[];
|
|
91
|
+
declare const hasRole: (user: BlockAuthUserProfile | null | undefined, roleName: string) => boolean;
|
|
92
|
+
declare const hasRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlug: string) => boolean;
|
|
93
|
+
declare const hasAnyRole: (user: BlockAuthUserProfile | null | undefined, roleNames: string[]) => boolean;
|
|
94
|
+
declare const hasAnyRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlugs: string[]) => boolean;
|
|
95
|
+
|
|
96
|
+
interface PopupLoginOptions {
|
|
97
|
+
apiKey: string;
|
|
98
|
+
wsUrl?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A code the page hands to its own backend instead of redeeming it: the
|
|
102
|
+
* backend redeems it at POST /api/auth/token with its apiSecret plus this
|
|
103
|
+
* codeVerifier and redirectUri, so the address comes from BlockAuth, not from
|
|
104
|
+
* the browser.
|
|
105
|
+
*/
|
|
106
|
+
interface PopupAuthCode {
|
|
107
|
+
code: string;
|
|
108
|
+
codeVerifier: string;
|
|
109
|
+
redirectUri: string;
|
|
110
|
+
}
|
|
111
|
+
interface NoncedPopupAuthCode extends PopupAuthCode {
|
|
112
|
+
nonce: string;
|
|
113
|
+
}
|
|
114
|
+
interface PopupLoginResult {
|
|
115
|
+
address: string;
|
|
116
|
+
did: string;
|
|
117
|
+
signedNonce: number;
|
|
118
|
+
signedAt: string;
|
|
119
|
+
signedExpiredAt: string;
|
|
120
|
+
roles: BlockAuthUserRole[];
|
|
121
|
+
idToken?: string;
|
|
122
|
+
renewToken?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
78
125
|
/**
|
|
79
126
|
* This class allow you to use WebSocket API
|
|
80
127
|
* for Block-Auth service
|
|
@@ -392,24 +439,6 @@ declare class RpcClient {
|
|
|
392
439
|
constructor();
|
|
393
440
|
}
|
|
394
441
|
|
|
395
|
-
type BlockAuthUserRole = {
|
|
396
|
-
slug: string;
|
|
397
|
-
name: string;
|
|
398
|
-
};
|
|
399
|
-
type BlockAuthUserProfile = {
|
|
400
|
-
roles?: BlockAuthUserRole[];
|
|
401
|
-
[key: string]: unknown;
|
|
402
|
-
};
|
|
403
|
-
declare const getUserRoles: (user?: BlockAuthUserProfile | null) => BlockAuthUserRole[];
|
|
404
|
-
/** Human-readable role names (primary API for client apps). */
|
|
405
|
-
declare const getUserRoleNames: (user?: BlockAuthUserProfile | null) => string[];
|
|
406
|
-
/** Technical role slugs (advanced / internal identification). */
|
|
407
|
-
declare const getUserRoleSlugs: (user?: BlockAuthUserProfile | null) => string[];
|
|
408
|
-
declare const hasRole: (user: BlockAuthUserProfile | null | undefined, roleName: string) => boolean;
|
|
409
|
-
declare const hasRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlug: string) => boolean;
|
|
410
|
-
declare const hasAnyRole: (user: BlockAuthUserProfile | null | undefined, roleNames: string[]) => boolean;
|
|
411
|
-
declare const hasAnyRoleBySlug: (user: BlockAuthUserProfile | null | undefined, roleSlugs: string[]) => boolean;
|
|
412
|
-
|
|
413
442
|
/**
|
|
414
443
|
* This class allow you to authenticate with your BlockAuth
|
|
415
444
|
* wallet and get the data from your user and/or tenant.
|
|
@@ -739,28 +768,8 @@ type Locale = 'en' | 'es';
|
|
|
739
768
|
declare const $locale: nanostores.WritableAtom<Locale>;
|
|
740
769
|
declare const setLocale: (l: Locale) => void;
|
|
741
770
|
|
|
742
|
-
interface
|
|
743
|
-
|
|
744
|
-
wsUrl?: string;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* A code the page hands to its own backend instead of redeeming it: the
|
|
748
|
-
* backend redeems it at POST /api/auth/token with its apiSecret plus this
|
|
749
|
-
* codeVerifier and redirectUri, so the address comes from BlockAuth, not from
|
|
750
|
-
* the browser.
|
|
751
|
-
*/
|
|
752
|
-
interface PopupAuthCode {
|
|
753
|
-
code: string;
|
|
754
|
-
codeVerifier: string;
|
|
755
|
-
redirectUri: string;
|
|
756
|
-
}
|
|
757
|
-
interface PopupLoginResult {
|
|
758
|
-
address: string;
|
|
759
|
-
did: string;
|
|
760
|
-
signedNonce: number;
|
|
761
|
-
signedAt: string;
|
|
762
|
-
signedExpiredAt: string;
|
|
763
|
-
roles: BlockAuthUserRole[];
|
|
771
|
+
interface RedirectLoginOptions {
|
|
772
|
+
returnTo?: string;
|
|
764
773
|
}
|
|
765
774
|
|
|
766
775
|
type GoogleFlow = 'auth-code' | 'implicit';
|
|
@@ -1222,7 +1231,10 @@ declare function createBlockAuthClient(config: BlockAuthClientConfig): {
|
|
|
1222
1231
|
};
|
|
1223
1232
|
connectBlockAuth: () => void;
|
|
1224
1233
|
loginWithPopup: () => Promise<PopupLoginResult>;
|
|
1225
|
-
|
|
1234
|
+
loginWithRedirect: (options?: RedirectLoginOptions) => Promise<void>;
|
|
1235
|
+
handleRedirectCallback: () => Promise<PopupLoginResult | null>;
|
|
1236
|
+
getIdToken: () => Promise<string | null>;
|
|
1237
|
+
authorizeWithPopup: () => Promise<NoncedPopupAuthCode>;
|
|
1226
1238
|
rememberHostedLogin: (user: HostedLoginUser, options?: {
|
|
1227
1239
|
ownsAuthCode?: boolean;
|
|
1228
1240
|
}) => void;
|
|
@@ -2158,11 +2170,6 @@ declare const getUTCDateString: (date?: Date | string | number) => string;
|
|
|
2158
2170
|
* Formats a number of seconds into a human-readable "Hh Mm" / "Mm" string.
|
|
2159
2171
|
*/
|
|
2160
2172
|
declare const secsToText: (secs?: number) => string;
|
|
2161
|
-
/**
|
|
2162
|
-
* Best-effort retrieval of the caller's public IP. Returns a placeholder
|
|
2163
|
-
* on failure.
|
|
2164
|
-
*/
|
|
2165
|
-
declare const getIp: () => Promise<string | undefined>;
|
|
2166
2173
|
/**
|
|
2167
2174
|
* Normalizes a URL to use the https scheme.
|
|
2168
2175
|
*/
|
|
@@ -2181,14 +2188,13 @@ type index_UiConfig = UiConfig;
|
|
|
2181
2188
|
declare const index_browserBase: typeof browserBase;
|
|
2182
2189
|
declare const index_cleanUrl: typeof cleanUrl;
|
|
2183
2190
|
declare const index_getExtensionStoreUrl: typeof getExtensionStoreUrl;
|
|
2184
|
-
declare const index_getIp: typeof getIp;
|
|
2185
2191
|
declare const index_getUTCDateString: typeof getUTCDateString;
|
|
2186
2192
|
declare const index_imgUrlByService: typeof imgUrlByService;
|
|
2187
2193
|
declare const index_isFirefox: typeof isFirefox;
|
|
2188
2194
|
declare const index_isValidImgUrl: typeof isValidImgUrl;
|
|
2189
2195
|
declare const index_secsToText: typeof secsToText;
|
|
2190
2196
|
declare namespace index {
|
|
2191
|
-
export { index_BLOCKAUTH_STORAGE_KEYS as BLOCKAUTH_STORAGE_KEYS, type index_ExternalServiceConfig as ExternalServiceConfig, type index_SessionConfig as SessionConfig, type index_SetSessionParams as SetSessionParams, type index_UiConfig as UiConfig, index_browserBase as browserBase, index_cleanUrl as cleanUrl, index_getExtensionStoreUrl as getExtensionStoreUrl,
|
|
2197
|
+
export { index_BLOCKAUTH_STORAGE_KEYS as BLOCKAUTH_STORAGE_KEYS, type index_ExternalServiceConfig as ExternalServiceConfig, type index_SessionConfig as SessionConfig, type index_SetSessionParams as SetSessionParams, type index_UiConfig as UiConfig, index_browserBase as browserBase, index_cleanUrl as cleanUrl, index_getExtensionStoreUrl as getExtensionStoreUrl, index_getUTCDateString as getUTCDateString, index_imgUrlByService as imgUrlByService, index_isFirefox as isFirefox, index_isValidImgUrl as isValidImgUrl, index_secsToText as secsToText };
|
|
2192
2198
|
}
|
|
2193
2199
|
|
|
2194
2200
|
/**
|
|
@@ -2236,4 +2242,4 @@ declare function resetExtensionSyncModuleState(): void;
|
|
|
2236
2242
|
*/
|
|
2237
2243
|
declare function startExtensionSync(): () => void;
|
|
2238
2244
|
|
|
2239
|
-
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, AccountLinkError, type AccountLinkErrorReason, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
|
|
2245
|
+
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, AccountLinkError, type AccountLinkErrorReason, type AuthRuntime, type AuthRuntimeCallbacks, type BlockAuthClient, type BlockAuthClientConfig, BlockAuthProvider, type BlockAuthProviderOptions, type BlockAuthUserProfile, type BlockAuthUserRole, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, type DeletionServiceDeps, EMPTY_SOLICITED_DATA_FORM, type EvmOptions, type EvmWallet, type ExtensionState, type HostedLoginUser, type Locale, type LoginPopupResult, type ModalName, type OpenLoginPopupOptions, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, type PhoneCountry, type PhoneCountryCode, type PhoneDraft, type PhoneParts, type PopupAuthCode, type PopupLoginOptions, type PopupLoginResult, type RedirectLoginOptions, type RestoreResult, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, type SolanaWallet, type SolicitedAcceptParams, type SolicitedDataForm, type SolicitedEmailChoice, type SolicitedField, type SolicitedParam, TEXTS, type TextKey, type TxnDataEmail, type TxnDataMode, type TxnDataParam, type TxnDataRequest, type TxnDataStatus, type TxnRequest, type UiState, type UserProfileProvider, type UserState, type WalletKind, type WalletState, type Web3SignupState, WsClient, type WsState, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, index$1 as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, index as utils };
|