@sparkvault/sdk-js 16.10.1 → 16.11.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 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 — the signature of a Cross-Origin-Opener-Policy severance
127
- * (a host page serving `COOP: same-origin` detaches any cross-origin popup:
128
- * the popup loses `window.opener`, the opener's handle reports `closed`).
129
- * postMessage can never work in this state, so retrying the popup is futile;
130
- * callers should fall back to the redirect flow.
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 {