@sparkvault/sdk-js 16.10.1 → 16.12.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/README.md +1 -0
- package/dist/errors.d.ts +8 -6
- package/dist/index.cjs +506 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +58 -8
- package/dist/index.mjs +506 -59
- package/dist/index.mjs.map +1 -1
- package/dist/products/identity/api.d.ts +24 -11
- package/dist/products/identity/index.d.ts +16 -8
- package/dist/products/identity/pending-signin.d.ts +19 -6
- package/dist/products/identity/renderer.d.ts +35 -4
- package/dist/products/identity/state.d.ts +5 -1
- package/dist/products/identity/types.d.ts +29 -0
- package/dist/products/identity/utils.d.ts +28 -1
- package/dist/products/identity/views/error.d.ts +12 -0
- package/dist/products/index.d.ts +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,6 +116,7 @@ app.post('/api/auth/login', async (req, res) => {
|
|
|
116
116
|
- A sign-in token lives 300 s. Its claims, and the full rule a verifier applies: [Identity API reference](https://sparkvault.com/api/docs/sdk-js/#identity-api-reference); in the monorepo, `docs/SDK.md` → Verifying a sign-in token.
|
|
117
117
|
- `signIn()` resolves only when the person signs in. Cancelling inside the sign-in window, or dismissing the SDK's dialog, rejects with `UserCancelledError` (`code` `user_cancelled`); a blocked or closed popup leaves the dialog open with Try again.
|
|
118
118
|
- An account that signs its people in with its own identity provider gets a "Continue with {name}" button on the sign-in page, first among its methods. `signIn({ method: 'federation' })` (or `attach(selector, { method: 'federation' })`) starts it directly. Such a sign-in's `identityType` is `federated`: key the person by the SVID, like every other.
|
|
119
|
+
- `signIn({ identityTypes: ['email', 'federated'] })` (and `attach(selector, { identityTypes })`, `signInWithFedcm({ identityTypes })`) limits the identity types the sign-in may produce to those it names, of `email`, `phone`, `social` and `federated` (`SigninIdentityType`). The sign-in page offers only the ways in that can give one, and Identity refuses any other sign-in with `IDENTITY_TYPE_NOT_ALLOWED`, whose message the page shows. It never chooses which of a person's identifiers the token carries: a sign-in carries what it would without the restriction, or is refused. A list that is empty or names anything else throws `ValidationError` before any window opens. Your backend still checks the token's `identity_type`: the restriction shapes the sign-in, it does not replace verification.
|
|
119
120
|
- **For typed callers:** `method?: 'federation'` is an option of `VerifyOptions` (so of `signIn()`'s `SignInOptions`) and of `attach()`'s `IdentityAttachOptions`. `VerifyResult.identityType` and `TokenClaims.identity_type` include `'federated'`, so a `switch` on them with no `default` (or a `never` check) must handle it. `TokenClaims.email` / `email_verified` are present only on a federated token whose provider asserted an address: an attribute, never a key. `VerifyOptions.signinRef` and `VerifyOptions.completesInWindow` are internal: SparkVault's sign-in pages set them, never a site, and `SignInOptions` leaves them out.
|
|
120
121
|
- To have SparkVault own sessions (refresh rotation, revocation, logout), run OIDC with a backend-for-frontend instead: [Quick Start (OIDC)](https://sparkvault.com/api/docs/products/identity/#quick-start-oidc).
|
|
121
122
|
|
package/dist/errors.d.ts
CHANGED
|
@@ -123,14 +123,16 @@ export declare class PopupBlockedError extends SparkVaultError {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* The popup opened but its window handle went dead before the page ever
|
|
126
|
-
* pinged back
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
126
|
+
* pinged back: the host page's Cross-Origin-Opener-Policy severed it (a host
|
|
127
|
+
* page serving `COOP: same-origin` detaches any cross-origin popup: the popup
|
|
128
|
+
* loses `window.opener`, the opener's handle reports `closed`). postMessage
|
|
129
|
+
* can never work in this state, so retrying the popup is futile. Identity
|
|
130
|
+
* sign-in falls back to the redirect flow (popup-launcher.ts); the help desk
|
|
131
|
+
* widget's sign-in, which has none, passes a message that tells the person
|
|
132
|
+
* what to do (help-desk/widget-identity.ts).
|
|
131
133
|
*/
|
|
132
134
|
export declare class PopupSeveredError extends SparkVaultError {
|
|
133
|
-
constructor();
|
|
135
|
+
constructor(message?: string);
|
|
134
136
|
}
|
|
135
137
|
/** What a failed SparkVault API response says about itself: its status, its error body, and the floor it names. */
|
|
136
138
|
export interface ApiFailure {
|