@sparkvault/sdk-js 9.0.1 → 9.1.1
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 +20 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/dist/notify/types.d.ts +4 -2
- package/dist/products/identity/index.d.ts +8 -6
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -497,14 +497,16 @@ declare class IdentityModule {
|
|
|
497
497
|
* Decode an identity token's claims WITHOUT verifying its signature.
|
|
498
498
|
*
|
|
499
499
|
* This is an UNVERIFIED, client-side decode: it parses the JWT payload and
|
|
500
|
-
* sanity-checks structure, `exp`, `iss`, `aud`, and the header `alg` (
|
|
501
|
-
*
|
|
502
|
-
* cannot masquerade as valid). It does NOT verify the
|
|
503
|
-
* result MUST NOT be trusted for any authorization decision.
|
|
500
|
+
* sanity-checks structure, `exp`, `iss`, `aud`, and the header `alg` (accepting
|
|
501
|
+
* only the algorithms the Identity server signs with, so an unsigned or
|
|
502
|
+
* algorithm-confused token cannot masquerade as valid). It does NOT verify the
|
|
503
|
+
* signature, so its result MUST NOT be trusted for any authorization decision.
|
|
504
504
|
*
|
|
505
505
|
* To trust a token (e.g. before keying records by `claims.svid`), verify the
|
|
506
|
-
*
|
|
507
|
-
* (`https://auth.sparkvault.com/{account_id}/.well-known/jwks.json`)
|
|
506
|
+
* signature server-side against the Identity JWKS endpoint
|
|
507
|
+
* (`https://auth.sparkvault.com/{account_id}/.well-known/jwks.json`), which
|
|
508
|
+
* publishes the EdDSA and RS256 keys and selects the verifying key by `kid`.
|
|
509
|
+
* See docs/SDK.md.
|
|
508
510
|
*/
|
|
509
511
|
decodeToken(token: string): TokenClaims;
|
|
510
512
|
/**
|
|
@@ -644,8 +646,10 @@ interface NotificationRow {
|
|
|
644
646
|
created_at: number;
|
|
645
647
|
title: string;
|
|
646
648
|
/**
|
|
647
|
-
* The
|
|
648
|
-
*
|
|
649
|
+
* The row's visible cleartext line, shown natively: a plaintext send's inline
|
|
650
|
+
* body, or a SEALED send's non-secret `instructions`. A sealed row can and
|
|
651
|
+
* normally should carry one — it is the readable line above the reveal. Never
|
|
652
|
+
* the sealed content itself. Absent when the sender set neither.
|
|
649
653
|
*/
|
|
650
654
|
body?: string;
|
|
651
655
|
category: string;
|
package/dist/index.mjs
CHANGED
|
@@ -8569,6 +8569,11 @@ function attachClickHandler(selector, onClick) {
|
|
|
8569
8569
|
* sv.products.identity.attach('.login-btn');
|
|
8570
8570
|
*/
|
|
8571
8571
|
const PORTAL_SECTIONS = ['home', 'identity', 'security', 'sessions', 'sites'];
|
|
8572
|
+
// The exact algorithms the Identity server signs identity tokens with: EdDSA by
|
|
8573
|
+
// default, RS256 when a client opts in via `id_token_signed_response_alg`. The
|
|
8574
|
+
// unverified client-side decode gates on this set so an unsigned (`none`) or
|
|
8575
|
+
// algorithm-confused token cannot masquerade as valid.
|
|
8576
|
+
const ACCEPTED_TOKEN_ALGS = ['EdDSA', 'RS256'];
|
|
8572
8577
|
// A sign-in is "pending" from popup open until its result arrives; a marker
|
|
8573
8578
|
// that outlives a lost result (a mobile opener-tab discard clears the message
|
|
8574
8579
|
// listener but not sessionStorage) is what lets the next load self-heal.
|
|
@@ -8969,14 +8974,16 @@ class IdentityModule {
|
|
|
8969
8974
|
* Decode an identity token's claims WITHOUT verifying its signature.
|
|
8970
8975
|
*
|
|
8971
8976
|
* This is an UNVERIFIED, client-side decode: it parses the JWT payload and
|
|
8972
|
-
* sanity-checks structure, `exp`, `iss`, `aud`, and the header `alg` (
|
|
8973
|
-
*
|
|
8974
|
-
* cannot masquerade as valid). It does NOT verify the
|
|
8975
|
-
* result MUST NOT be trusted for any authorization decision.
|
|
8977
|
+
* sanity-checks structure, `exp`, `iss`, `aud`, and the header `alg` (accepting
|
|
8978
|
+
* only the algorithms the Identity server signs with, so an unsigned or
|
|
8979
|
+
* algorithm-confused token cannot masquerade as valid). It does NOT verify the
|
|
8980
|
+
* signature, so its result MUST NOT be trusted for any authorization decision.
|
|
8976
8981
|
*
|
|
8977
8982
|
* To trust a token (e.g. before keying records by `claims.svid`), verify the
|
|
8978
|
-
*
|
|
8979
|
-
* (`https://auth.sparkvault.com/{account_id}/.well-known/jwks.json`)
|
|
8983
|
+
* signature server-side against the Identity JWKS endpoint
|
|
8984
|
+
* (`https://auth.sparkvault.com/{account_id}/.well-known/jwks.json`), which
|
|
8985
|
+
* publishes the EdDSA and RS256 keys and selects the verifying key by `kid`.
|
|
8986
|
+
* See docs/SDK.md.
|
|
8980
8987
|
*/
|
|
8981
8988
|
decodeToken(token) {
|
|
8982
8989
|
if (!token || typeof token !== 'string') {
|
|
@@ -8991,10 +8998,12 @@ class IdentityModule {
|
|
|
8991
8998
|
if (typeof header !== 'object' || header === null) {
|
|
8992
8999
|
throw new ValidationError('Invalid token header');
|
|
8993
9000
|
}
|
|
8994
|
-
//
|
|
8995
|
-
//
|
|
8996
|
-
//
|
|
8997
|
-
|
|
9001
|
+
// Accept exactly the algorithms the Identity server signs with; reject
|
|
9002
|
+
// everything else — `none` (unsigned), a symmetric or algorithm-confused
|
|
9003
|
+
// token, or an absent alg — none of which could pass the server-side JWKS
|
|
9004
|
+
// verification the host performs before trusting the token.
|
|
9005
|
+
const alg = header.alg;
|
|
9006
|
+
if (typeof alg !== 'string' || !ACCEPTED_TOKEN_ALGS.includes(alg)) {
|
|
8998
9007
|
throw new ValidationError('Unsupported token algorithm');
|
|
8999
9008
|
}
|
|
9000
9009
|
const payload = JSON.parse(base64urlToString(payloadB64));
|
|
@@ -14752,7 +14761,7 @@ class SparkVault {
|
|
|
14752
14761
|
}
|
|
14753
14762
|
/** Get the SDK version */
|
|
14754
14763
|
static get version() {
|
|
14755
|
-
return '9.
|
|
14764
|
+
return '9.1.1';
|
|
14756
14765
|
}
|
|
14757
14766
|
}
|
|
14758
14767
|
if (typeof window !== 'undefined') {
|