@sparkvault/sdk-mobile 12.2.4 → 13.0.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/account.d.ts +1 -1
- package/dist/account.js +1 -1
- package/dist/account.test-d.d.ts +1 -1
- package/dist/account.test-d.js +1 -1
- package/dist/app-sdk/phone.d.ts +1 -1
- package/dist/app-sdk/phone.js +3 -3
- package/dist/app-sdk/phone.js.map +1 -1
- package/dist/app-sdk/platform-domains.d.ts +13 -2
- package/dist/app-sdk/platform-domains.js +13 -2
- package/dist/app-sdk/platform-domains.js.map +1 -1
- package/dist/app-sdk/upload-publication.d.ts +5 -5
- package/dist/app-sdk/upload-publication.js +5 -5
- package/dist/app-sdk/vat-refusal.d.ts +3 -3
- package/dist/app-sdk/vat-refusal.js +3 -3
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/entropy.d.ts +1 -1
- package/dist/entropy.test-d.d.ts +1 -1
- package/dist/entropy.test-d.js +1 -1
- package/dist/errors.d.ts +7 -7
- package/dist/errors.js +7 -7
- package/dist/errors.js.map +1 -1
- package/dist/ingots.d.ts +4 -4
- package/dist/ingots.js +8 -8
- package/dist/ingots.js.map +1 -1
- package/dist/notify.d.ts +11 -11
- package/dist/notify.js +4 -4
- package/dist/notify.test-d.d.ts +3 -3
- package/dist/notify.test-d.js +2 -2
- package/dist/tus.d.ts +2 -2
- package/dist/tus.js +4 -4
- package/dist/tus.js.map +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/users.d.ts +5 -5
- package/dist/users.js +5 -5
- package/dist/vaults.d.ts +2 -2
- package/dist/vaults.js +2 -2
- package/dist/vaults.test-d.d.ts +1 -1
- package/dist/vaults.test-d.js +1 -1
- package/package.json +1 -1
- package/src/account.test-d.ts +1 -1
- package/src/account.ts +1 -1
- package/src/app-sdk/phone.js +3 -3
- package/src/app-sdk/platform-domains.js +14 -2
- package/src/app-sdk/upload-publication.js +5 -5
- package/src/app-sdk/vat-refusal.js +3 -3
- package/src/config.ts +1 -1
- package/src/entropy.test-d.ts +1 -1
- package/src/entropy.ts +1 -1
- package/src/errors.ts +7 -7
- package/src/ingots.ts +8 -8
- package/src/notify.test-d.ts +4 -4
- package/src/notify.ts +11 -11
- package/src/tus.ts +5 -5
- package/src/types.ts +9 -9
- package/src/users.ts +5 -5
- package/src/vaults.test-d.ts +1 -1
- package/src/vaults.ts +2 -2
package/dist/users.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { apiPath } from './request-path.js';
|
|
2
2
|
import { validateResourceId } from './validation.js';
|
|
3
3
|
/**
|
|
4
|
-
* Organization team client (member admins only
|
|
4
|
+
* Organization team client (member admins only; the API gates these on the
|
|
5
5
|
* admin role and returns 403 otherwise).
|
|
6
6
|
*
|
|
7
7
|
* Licensing is a billing action (licenses are prepaid: assigning or upgrading
|
|
8
8
|
* one charges the rest of the current billing period at once), so the only
|
|
9
9
|
* seat-affecting operation exposed here is `invite`, which defaults new members
|
|
10
10
|
* to `unlicensed` and never charges. Assigning or changing a paid license is
|
|
11
|
-
* intentionally absent
|
|
11
|
+
* intentionally absent: clients route that to the web dashboard so native
|
|
12
12
|
* apps never initiate an out-of-band purchase.
|
|
13
13
|
*/
|
|
14
14
|
export class MobileUsersClient {
|
|
@@ -36,10 +36,10 @@ export class MobileUsersClient {
|
|
|
36
36
|
* Remove a member: their DVAKs, API keys and sign-in sessions are revoked
|
|
37
37
|
* now, and an access token already issued stays valid until it expires,
|
|
38
38
|
* within the hour. A license they held stays paid until the end of the
|
|
39
|
-
* billing period
|
|
39
|
+
* billing period (nothing is refunded) and is not renewed; until then it
|
|
40
40
|
* can be given to someone else at no charge. `wind_down` is true when this
|
|
41
|
-
* removal ends the subscription
|
|
42
|
-
* it was not already set to end: it ends at the period end.
|
|
41
|
+
* removal ends the subscription (theirs was the last license it renews, and
|
|
42
|
+
* it was not already set to end): it ends at the period end.
|
|
43
43
|
*/
|
|
44
44
|
async remove(userId) {
|
|
45
45
|
validateResourceId(userId, 'user ID', 'userId');
|
package/dist/vaults.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class MobileVaultsClient {
|
|
|
10
10
|
}): Promise<ListVaultsResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* Every vault on the account, newest first. Follows next_cursor at the
|
|
13
|
-
* largest page size until the server reports no more
|
|
13
|
+
* largest page size until the server reports no more; a page the server
|
|
14
14
|
* filtered down to nothing still carries a cursor. A failed page fails the
|
|
15
15
|
* listing: a vault picker must never show a silently partial account.
|
|
16
16
|
*/
|
|
@@ -26,7 +26,7 @@ export declare class MobileVaultsClient {
|
|
|
26
26
|
*
|
|
27
27
|
* The name is sent base64(UTF-8) as `X-Confirm-Name-B64` so that vaults named
|
|
28
28
|
* with any Unicode (emoji, CJK, the U+202F in macOS-style names) are
|
|
29
|
-
* deletable
|
|
29
|
+
* deletable: a raw header value throws before the request is sent for
|
|
30
30
|
* non-latin1 characters.
|
|
31
31
|
*/
|
|
32
32
|
delete(vaultId: string, name: string): Promise<ScheduleVaultDeletionResponse>;
|
package/dist/vaults.js
CHANGED
|
@@ -19,7 +19,7 @@ export class MobileVaultsClient {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Every vault on the account, newest first. Follows next_cursor at the
|
|
22
|
-
* largest page size until the server reports no more
|
|
22
|
+
* largest page size until the server reports no more; a page the server
|
|
23
23
|
* filtered down to nothing still carries a cursor. A failed page fails the
|
|
24
24
|
* listing: a vault picker must never show a silently partial account.
|
|
25
25
|
*/
|
|
@@ -56,7 +56,7 @@ export class MobileVaultsClient {
|
|
|
56
56
|
*
|
|
57
57
|
* The name is sent base64(UTF-8) as `X-Confirm-Name-B64` so that vaults named
|
|
58
58
|
* with any Unicode (emoji, CJK, the U+202F in macOS-style names) are
|
|
59
|
-
* deletable
|
|
59
|
+
* deletable: a raw header value throws before the request is sent for
|
|
60
60
|
* non-latin1 characters.
|
|
61
61
|
*/
|
|
62
62
|
async delete(vaultId, name) {
|
package/dist/vaults.test-d.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vault and folder wire-contract assertions
|
|
2
|
+
* Vault and folder wire-contract assertions, COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
4
|
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
5
|
* the server: the transpiler strips them and every assertion passes. `tsc
|
package/dist/vaults.test-d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vault and folder wire-contract assertions
|
|
2
|
+
* Vault and folder wire-contract assertions, COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
4
|
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
5
|
* the server: the transpiler strips them and every assertion passes. `tsc
|
package/package.json
CHANGED
package/src/account.test-d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core session wire-contract assertions
|
|
2
|
+
* Core session wire-contract assertions, COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
4
|
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
5
|
* the server: the transpiler strips them and every assertion passes. `tsc
|
package/src/account.ts
CHANGED
|
@@ -119,7 +119,7 @@ export class MobileAccountClient {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Update organization settings (member admins only). Sends a JSON body
|
|
122
|
+
* Update organization settings (member admins only). Sends a JSON body; the
|
|
123
123
|
* logo-upload variant of PUT /account is web-only. The PUT answers with the
|
|
124
124
|
* account as it now stands (the same projection GET /account serves), which
|
|
125
125
|
* refreshes the cache as is: a read right after the write could land on a
|
package/src/app-sdk/phone.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* script, and the invisible formatting marks a contacts app wraps a number in.
|
|
23
23
|
* The separators and marks are dropped. Anything else is refused, never
|
|
24
24
|
* dropped: stripping it would fold part of the text into the number and deliver
|
|
25
|
-
* to someone else's line
|
|
25
|
+
* to someone else's line. A letter or a dial-control character (',' and ';'
|
|
26
26
|
* pause, '#' and '*' are keypad tones) carries an extension ("x2", ",89"), a
|
|
27
27
|
* digit of another script ('٧', '7') is a digit the ASCII read would silently
|
|
28
28
|
* lose, and a '+' after a digit declares nothing.
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
/** A '+' before any digit: the caller declared the country code. */
|
|
37
37
|
const DECLARED_COUNTRY_CODE = /^\D*\+/;
|
|
38
38
|
|
|
39
|
-
/** E.164 digits once a country code is declared: 8
|
|
39
|
+
/** E.164 digits once a country code is declared: 8 to 15, never a leading 0. */
|
|
40
40
|
const E164_DIGITS = /^[1-9]\d{7,14}$/;
|
|
41
41
|
|
|
42
42
|
/** A canonical E.164 value. */
|
|
@@ -84,7 +84,7 @@ export function parsePhone(raw) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Whether a value is already a canonical E.164 phone number
|
|
87
|
+
* Whether a value is already a canonical E.164 phone number: exactly the
|
|
88
88
|
* values parsePhone returns unchanged.
|
|
89
89
|
*
|
|
90
90
|
* @param {unknown} value
|
|
@@ -36,12 +36,24 @@ export const SPARKVAULT_FILES_HOST = 'files.sv';
|
|
|
36
36
|
/**
|
|
37
37
|
* The help-desk domain: each organization's help desk lives at a host under
|
|
38
38
|
* it, and every custom help-desk domain points its CNAME at it. The whole
|
|
39
|
-
* subtree is reserved
|
|
40
|
-
* domain
|
|
39
|
+
* subtree is reserved (no organization claims a name in it as its own
|
|
40
|
+
* domain), but none of its hosts is owned: a tenant's help-desk host is never
|
|
41
41
|
* trusted the way a platform host is (isSparkVaultOwnedHostname).
|
|
42
42
|
*/
|
|
43
43
|
export const SPARKVAULT_HELP_DESK_DOMAIN = 'help.sv';
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The Help Desk sign-in host (`https://signin.help.sv`): the one fixed host of
|
|
47
|
+
* the window Help Desk's own sign-in opens (`/{desk_id}/{challenge_id}`) and
|
|
48
|
+
* of the one redirect URI its Identity client registers (`/callback`). Its
|
|
49
|
+
* label is a reserved organization handle (organization-handle.js), so no desk
|
|
50
|
+
* can hold it, and the help.sv Worker serves the portal's shell on it as on
|
|
51
|
+
* every host of the domain. Like every host under the help-desk domain it is
|
|
52
|
+
* reserved and not owned (isSparkVaultOwnedHostname). Core takes the window's
|
|
53
|
+
* steps only from exactly this origin.
|
|
54
|
+
*/
|
|
55
|
+
export const SPARKVAULT_HELP_DESK_SIGN_IN_HOST = `signin.${SPARKVAULT_HELP_DESK_DOMAIN}`;
|
|
56
|
+
|
|
45
57
|
/**
|
|
46
58
|
* Notify's mail domain: each organization's Notify mail goes from a host under
|
|
47
59
|
* it, as its help desk's goes from one under the help-desk domain. On the web
|
|
@@ -65,9 +65,9 @@ export function givenUpUploadId({ created, uploadId }) {
|
|
|
65
65
|
/**
|
|
66
66
|
* Whether a value is a content version: the identity of one publication of an
|
|
67
67
|
* ingot (a non-empty string, the upload id its activation stamped), or null
|
|
68
|
-
* for content published without one. A transfer token that records one
|
|
68
|
+
* for content published without one. A transfer token that records one (a
|
|
69
69
|
* read-modify-write replacement's base, the publication a reusable decrypt
|
|
70
|
-
* token serves
|
|
70
|
+
* token serves) records exactly this, and a record holding anything else is
|
|
71
71
|
* malformed.
|
|
72
72
|
*
|
|
73
73
|
* @param {*} value
|
|
@@ -113,8 +113,8 @@ export const TRANSFER_REFERENCE_ISTK_CHARS = 24;
|
|
|
113
113
|
/**
|
|
114
114
|
* The ledger reference of an upload's transfer charge,
|
|
115
115
|
* `forge_ingot_transfer_upload_<first 24 ISTK chars>`: every charge of one
|
|
116
|
-
* upload carries it
|
|
117
|
-
* publishes, Forge's cancel
|
|
116
|
+
* upload carries it (Core's activation, Core's charge of an upload that never
|
|
117
|
+
* publishes, Forge's cancel), so whichever lands first is the upload's one
|
|
118
118
|
* ledger row and the others are duplicates.
|
|
119
119
|
*
|
|
120
120
|
* @param {string} istk - The upload's ISTK, as its session carries it
|
|
@@ -149,7 +149,7 @@ export const TRANSFER_CHARGE_CATEGORIES = Object.freeze({
|
|
|
149
149
|
* The codes Core's activation refuses an upload with, which Forge's refusal
|
|
150
150
|
* map reads (the status is Core's):
|
|
151
151
|
* - UPLOAD_CONTRACT_MISMATCH (409): a finalize or session from another
|
|
152
|
-
* publication contract than Core's, a mixed deployment that converges
|
|
152
|
+
* publication contract than Core's, a mixed deployment that converges, so the
|
|
153
153
|
* upload is kept and its finalize tried again.
|
|
154
154
|
* - UPLOAD_PROTOCOL_RETIRED (410): a session from a contract Core no longer
|
|
155
155
|
* publishes, which never can be.
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* refusal carries, and the one reading of it clients share.
|
|
8
8
|
*
|
|
9
9
|
* 401 VAT_INVALID no token, or a malformed, unknown or swept one, or one a
|
|
10
|
-
* since-revoked DVAK minted
|
|
11
|
-
* 403 VAT_EXPIRED the token outlived its TTL
|
|
12
|
-
* 403 VAT_READ_ONLY a View Only token on a write
|
|
10
|
+
* since-revoked DVAK minted: unseal again
|
|
11
|
+
* 403 VAT_EXPIRED the token outlived its TTL: unseal again, retry as-is
|
|
12
|
+
* 403 VAT_READ_ONLY a View Only token on a write: no unseal fixes it
|
|
13
13
|
*
|
|
14
14
|
* A 403 with no reason is a token for another vault or account, which no
|
|
15
15
|
* unseal of this vault fixes; a 401 with no reason is the login itself, never
|
package/src/config.ts
CHANGED
|
@@ -133,7 +133,7 @@ function defaultFetch(
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// `timeoutMs` is inert to the platform fetch, so it has to become an abort
|
|
136
|
-
// signal here or every request runs unbounded
|
|
136
|
+
// signal here or every request runs unbounded, the worst failure mode on a
|
|
137
137
|
// mobile network. A caller-supplied signal still aborts the request too.
|
|
138
138
|
const controller = new AbortController();
|
|
139
139
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
package/src/entropy.test-d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Entropy wire-contract assertions
|
|
2
|
+
* Entropy wire-contract assertions, COMPILE-TIME ONLY (see notify.test-d.ts for
|
|
3
3
|
* why these live in `src` under a `.test-d.ts` name).
|
|
4
4
|
*
|
|
5
5
|
* The endpoint answers a `bytes` request with a number array and every other
|
package/src/entropy.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type EntropyFormat =
|
|
|
17
17
|
| 'bytes';
|
|
18
18
|
|
|
19
19
|
export interface GenerateEntropyOptions {
|
|
20
|
-
/** Number of random bytes: 1
|
|
20
|
+
/** Number of random bytes: 1 to 1024, or 1 to 512 for alphanumeric, alphanumeric-mixed and password. */
|
|
21
21
|
bytes: number;
|
|
22
22
|
/** Output format. Defaults to base64. */
|
|
23
23
|
format?: EntropyFormat;
|
package/src/errors.ts
CHANGED
|
@@ -140,7 +140,7 @@ export class SparkVaultTimeoutError extends SparkVaultMobileError {
|
|
|
140
140
|
/**
|
|
141
141
|
* Thrown when a download is requested against an ingot whose upload Forge has
|
|
142
142
|
* not activated yet (status `uploading`). Transient by nature, but retrying
|
|
143
|
-
* immediately will not help
|
|
143
|
+
* immediately will not help: callers should back off until the ingot becomes
|
|
144
144
|
* active.
|
|
145
145
|
*/
|
|
146
146
|
export class IngotNotReadyError extends SparkVaultMobileError {
|
|
@@ -344,7 +344,7 @@ export class BackgroundTransferError extends Error {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/**
|
|
347
|
-
* True for a connectivity failure
|
|
347
|
+
* True for a connectivity failure: no usable HTTP response reached the
|
|
348
348
|
* client (offline, DNS failure, timeout, or a tus transfer that died on the
|
|
349
349
|
* wire). Distinct from an HTTP error response, which carries a status code.
|
|
350
350
|
*/
|
|
@@ -386,10 +386,10 @@ export function isAuthError(err: unknown): boolean {
|
|
|
386
386
|
* The reason the API refused the vault access token, or null when the error
|
|
387
387
|
* is not a VAT refusal:
|
|
388
388
|
* - `VAT_INVALID` (401): no, a malformed, unknown or swept token, or one a
|
|
389
|
-
* since-revoked DVAK minted
|
|
390
|
-
* - `VAT_EXPIRED` (403): the token outlived its TTL
|
|
389
|
+
* since-revoked DVAK minted; unseal again. Never the login.
|
|
390
|
+
* - `VAT_EXPIRED` (403): the token outlived its TTL; unseal again and
|
|
391
391
|
* retry the same request as-is.
|
|
392
|
-
* - `VAT_READ_ONLY` (403): a View Only token on a write
|
|
392
|
+
* - `VAT_READ_ONLY` (403): a View Only token on a write; no unseal fixes it.
|
|
393
393
|
* A 403 with no reason is a token for another vault or account; a 401 with no
|
|
394
394
|
* reason is the login itself.
|
|
395
395
|
*/
|
|
@@ -412,7 +412,7 @@ export function isVatExpiredError(err: unknown): err is SparkVaultMobileError {
|
|
|
412
412
|
/**
|
|
413
413
|
* True when the vault access token is valid but read-only (403
|
|
414
414
|
* `VAT_READ_ONLY`): the session was unsealed with a read-only access level, so
|
|
415
|
-
* a write cannot succeed by retrying or by re-unsealing the same way
|
|
415
|
+
* a write cannot succeed by retrying or by re-unsealing the same way; the
|
|
416
416
|
* caller needs write access to the vault.
|
|
417
417
|
*/
|
|
418
418
|
export function isReadOnlyVaultError(err: unknown): err is SparkVaultMobileError {
|
|
@@ -430,7 +430,7 @@ export function isNotFoundError(err: unknown): err is SparkVaultMobileError {
|
|
|
430
430
|
return err instanceof SparkVaultMobileError && !(err instanceof TusUploadError) && err.statusCode === 404;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
/** True for a 429 rate-limit response
|
|
433
|
+
/** True for a 429 rate-limit response: retry after a cooldown, never immediately. */
|
|
434
434
|
export function isRateLimitError(err: unknown): boolean {
|
|
435
435
|
return (
|
|
436
436
|
err instanceof SparkVaultMobileError &&
|
package/src/ingots.ts
CHANGED
|
@@ -421,8 +421,8 @@ interface IngotAuditLogsResponse {
|
|
|
421
421
|
/**
|
|
422
422
|
* The API reports a download against a still-processing ingot as a generic
|
|
423
423
|
* VALIDATION_ERROR whose message is the only stable signal
|
|
424
|
-
* (`"Ingot not ready: status is <status>"`). Translating that here
|
|
425
|
-
* single seam with the server
|
|
424
|
+
* (`"Ingot not ready: status is <status>"`). Translating that here (the
|
|
425
|
+
* single seam with the server) is what lets every consumer branch on
|
|
426
426
|
* `instanceof IngotNotReadyError` instead of message substrings.
|
|
427
427
|
*/
|
|
428
428
|
function toTypedDownloadError(err: unknown): unknown {
|
|
@@ -590,7 +590,7 @@ export class MobileIngotsClient {
|
|
|
590
590
|
/**
|
|
591
591
|
* Continue an interrupted upload from the tus session `uploadFromUri`
|
|
592
592
|
* handed to `onSessionCreated`. No ingot is created: the record already
|
|
593
|
-
* exists from the original call, and the session is bound to it
|
|
593
|
+
* exists from the original call, and the session is bound to it; Forge is
|
|
594
594
|
* asked (HEAD) where the transfer stands and only the missing bytes are
|
|
595
595
|
* sent, then the ingot is verified active exactly as a fresh upload is.
|
|
596
596
|
*
|
|
@@ -639,9 +639,9 @@ export class MobileIngotsClient {
|
|
|
639
639
|
|
|
640
640
|
/**
|
|
641
641
|
* Where a persisted tus session stands on Forge, or `null` when Forge no
|
|
642
|
-
* longer has it. Lets a caller reconcile sessions on relaunch
|
|
642
|
+
* longer has it. Lets a caller reconcile sessions on relaunch (a session
|
|
643
643
|
* at `offset === length` only needs its ingot verified, a lost one needs a
|
|
644
|
-
* fresh `uploadFromUri`
|
|
644
|
+
* fresh `uploadFromUri`) without spending an upload slot to find out.
|
|
645
645
|
* An `uploadUrl` that is not an upload session on an allowed transfer host
|
|
646
646
|
* is refused (SparkVaultValidationError) before the ISTK is sent anywhere.
|
|
647
647
|
*/
|
|
@@ -826,7 +826,7 @@ export class MobileIngotsClient {
|
|
|
826
826
|
}
|
|
827
827
|
|
|
828
828
|
/**
|
|
829
|
-
* Batch content-HMAC existence check
|
|
829
|
+
* Batch content-HMAC existence check: the pre-upload dedup handshake.
|
|
830
830
|
* Returns which of the supplied vault-keyed HMACs already exist on active
|
|
831
831
|
* ingots in the vault, so callers can skip transferring those bytes.
|
|
832
832
|
*/
|
|
@@ -1069,7 +1069,7 @@ export class MobileIngotsClient {
|
|
|
1069
1069
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1070
1070
|
this.ensureNotAborted(abortSignal);
|
|
1071
1071
|
try {
|
|
1072
|
-
// Fresh signed URL on every attempt
|
|
1072
|
+
// Fresh signed URL on every attempt: server URLs are short-lived,
|
|
1073
1073
|
// and retrying with a stale URL would just fail again.
|
|
1074
1074
|
const { downloadUrl } = await this.createDownloadLink({ vaultId, ingotId, vat,
|
|
1075
1075
|
...(options.countAsActivity === undefined ? {} : { countAsActivity: options.countAsActivity }) });
|
|
@@ -1290,7 +1290,7 @@ export class MobileIngotsClient {
|
|
|
1290
1290
|
if (expectedSizeBytes !== undefined && expectedSizeBytes > 0) {
|
|
1291
1291
|
if (sizeBytes !== expectedSizeBytes) {
|
|
1292
1292
|
await this.deleteFileIfPresent(fileDownloader, filePath);
|
|
1293
|
-
// Deterministic server-content mismatch
|
|
1293
|
+
// Deterministic server-content mismatch: retrying the same ingot will
|
|
1294
1294
|
// yield the same bytes, so this must surface as a non-retryable validation
|
|
1295
1295
|
// failure rather than a transient transport error.
|
|
1296
1296
|
throw new SparkVaultValidationError('Download failed - file size did not match expected ingot size', {
|
package/src/notify.test-d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Notify wire-contract assertions
|
|
2
|
+
* Notify wire-contract assertions, COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
4
|
* `NotificationRow` has no runtime, so a unit test can never see how a field is
|
|
5
5
|
* typed: the transpiler strips it and every assertion passes. This file is the
|
|
6
|
-
* gate for that instead
|
|
6
|
+
* gate for that instead: `tsc --noEmit` (`pnpm typecheck`, which CI runs on
|
|
7
7
|
* every push and again on every SDK publish) refuses to compile the moment a
|
|
8
8
|
* member below stops being typed as stated there; the statements mirror
|
|
9
9
|
* `apps/api/src/notify/inbox.js` (`projectRow`) and the feed's `from`
|
|
@@ -27,7 +27,7 @@ import type { NotificationRow } from './notify.js';
|
|
|
27
27
|
type Assert<T extends true> = T;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Invariant type equality
|
|
30
|
+
* Invariant type equality: `A` and `B` must be the SAME type, not merely mutually
|
|
31
31
|
* assignable. Assignability would accept an optional member where the wire always
|
|
32
32
|
* carries one, which is the precise drift these assertions exist to catch.
|
|
33
33
|
*/
|
|
@@ -44,7 +44,7 @@ export type NotifyWireContract = [
|
|
|
44
44
|
// on the wire: typing it optional would let a client read a spent sealed row's
|
|
45
45
|
// instructions as a plaintext message.
|
|
46
46
|
Assert<Equals<NotificationRow['sealed'], boolean>>,
|
|
47
|
-
// `locked` is whether the row carries its pointer
|
|
47
|
+
// `locked` is whether the row carries its pointer, always present.
|
|
48
48
|
Assert<Equals<NotificationRow['locked'], boolean>>,
|
|
49
49
|
// The pointer is carried only while its grant still opens and is absent on a
|
|
50
50
|
// cleartext row, so it is optional in both directions and must be guarded
|
package/src/notify.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface NotificationRow {
|
|
|
41
41
|
/**
|
|
42
42
|
* The row's visible cleartext line, shown natively: a plaintext send's inline
|
|
43
43
|
* body, or a SEALED send's non-secret `instructions`. A sealed row can and
|
|
44
|
-
* normally should carry one
|
|
44
|
+
* normally should carry one: it is the readable line above the reveal. Never
|
|
45
45
|
* the sealed content itself. Absent when the sender set neither.
|
|
46
46
|
*/
|
|
47
47
|
body?: string;
|
|
@@ -51,7 +51,7 @@ export interface NotificationRow {
|
|
|
51
51
|
read_at: number | null;
|
|
52
52
|
archived_at: number | null;
|
|
53
53
|
/**
|
|
54
|
-
* The grant to open. Present only while a live reveal stands behind it
|
|
54
|
+
* The grant to open. Present only while a live reveal stands behind it, meaning a
|
|
55
55
|
* SEALED (secure) send whose grant still opens: not yet opened (on a send that
|
|
56
56
|
* asks for an answer, not yet answered), not expired, not gone and not
|
|
57
57
|
* recalled. A cleartext send delivers its content inline in the channel and
|
|
@@ -73,7 +73,7 @@ export interface NotificationRow {
|
|
|
73
73
|
*/
|
|
74
74
|
sealed: boolean;
|
|
75
75
|
/**
|
|
76
|
-
* True only when there is a secure part left to reveal
|
|
76
|
+
* True only when there is a secure part left to reveal, exactly when
|
|
77
77
|
* `sparklink_code` is present. `false` does NOT mean "cleartext row": a
|
|
78
78
|
* `sealed` row whose reveal no longer opens (opened, answered, expired or
|
|
79
79
|
* gone) is unlocked too, and so is a recalled one, with nothing behind it.
|
|
@@ -103,7 +103,7 @@ export interface ListNotificationsResponse {
|
|
|
103
103
|
/**
|
|
104
104
|
* Next-page cursor, or null on the last page. A page can be SHORT of `limit`
|
|
105
105
|
* yet still carry a non-null cursor (the state/sender filter is applied after
|
|
106
|
-
* the key query)
|
|
106
|
+
* the key query), so follow the cursor; never treat a short page as the end.
|
|
107
107
|
*/
|
|
108
108
|
cursor: string | null;
|
|
109
109
|
}
|
|
@@ -127,7 +127,7 @@ export interface MarkNotificationStateResponse {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* States a BULK drain can apply. `archived` is per-row only
|
|
130
|
+
* States a BULK drain can apply. `archived` is per-row only: it has no GSI for
|
|
131
131
|
* the server to page over, so the bulk endpoint rejects it.
|
|
132
132
|
*/
|
|
133
133
|
export type NotificationBulkMarkState = 'seen' | 'read';
|
|
@@ -139,7 +139,7 @@ export interface MarkAllNotificationsStateOptions {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export interface MarkAllNotificationsStateResponse {
|
|
142
|
-
/** Rows marked by THIS page
|
|
142
|
+
/** Rows marked by THIS page; the server marks one bounded page per call. */
|
|
143
143
|
updated: number;
|
|
144
144
|
/** Cursor for the next page, or null once the inbox is drained. */
|
|
145
145
|
cursor: string | null;
|
|
@@ -150,7 +150,7 @@ export interface MarkAllReadResult {
|
|
|
150
150
|
updated: number;
|
|
151
151
|
/**
|
|
152
152
|
* True when the drain reached the end of the inbox (the server returned a null
|
|
153
|
-
* cursor). False when it stopped at the page bound with rows still unmarked
|
|
153
|
+
* cursor). False when it stopped at the page bound with rows still unmarked:
|
|
154
154
|
* call again to continue. Without this a truncated drain is indistinguishable
|
|
155
155
|
* from a completed one.
|
|
156
156
|
*/
|
|
@@ -202,7 +202,7 @@ export class MobileNotifyClient {
|
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
204
|
* Apply a terminal display state to one of the caller's own rows (idempotent).
|
|
205
|
-
* `createdAt` MUST be the row's own `created_at
|
|
205
|
+
* `createdAt` MUST be the row's own `created_at`; the id alone is insufficient.
|
|
206
206
|
*/
|
|
207
207
|
async markState(
|
|
208
208
|
notificationId: string,
|
|
@@ -218,7 +218,7 @@ export class MobileNotifyClient {
|
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* Bulk-mark ONE bounded page of the caller's inbox and return the server's
|
|
221
|
-
* payload verbatim. `cursor` comes back non-null while rows remain
|
|
221
|
+
* payload verbatim. `cursor` comes back non-null while rows remain: thread it
|
|
222
222
|
* into the next call. `archived` is per-row only (no GSI to page over), so the
|
|
223
223
|
* bulk states are `seen` and `read`.
|
|
224
224
|
*
|
|
@@ -243,10 +243,10 @@ export class MobileNotifyClient {
|
|
|
243
243
|
* clears the unseen marker too, so the badge zeroes with it. Idempotent.
|
|
244
244
|
*
|
|
245
245
|
* `complete` is false when the loop stopped at the page bound with rows still
|
|
246
|
-
* unmarked
|
|
246
|
+
* unmarked: an inbox deeper than the bound finishes on a second call. Without
|
|
247
247
|
* it a truncated drain looks exactly like a finished one.
|
|
248
248
|
*
|
|
249
|
-
* An error mid-drain propagates
|
|
249
|
+
* An error mid-drain propagates: the pages already marked stay marked, and a
|
|
250
250
|
* re-run picks up the remainder.
|
|
251
251
|
*/
|
|
252
252
|
async markAllRead(): Promise<MarkAllReadResult> {
|
package/src/tus.ts
CHANGED
|
@@ -239,7 +239,7 @@ export function isCancelledTransfer(err: unknown, signal: AbortSignal | undefine
|
|
|
239
239
|
* verbatim (convertRequestBody passes plain objects through; RCTNetworking.mm /
|
|
240
240
|
* NetworkingModule.kt decode the `base64` key natively), so handing the string
|
|
241
241
|
* straight to XHR skips both JS-thread char-loops that a Uint8Array round-trip
|
|
242
|
-
* would cost
|
|
242
|
+
* would cost: the pure-JS base64 decode AND React Native's re-encode of
|
|
243
243
|
* ArrayBuffer bodies back to base64. On Hermes those two passes block the JS
|
|
244
244
|
* thread for seconds per chunk, which starves touch handling for the whole
|
|
245
245
|
* upload session. A fileReader that reads the bytes into JS pays one encode
|
|
@@ -1458,7 +1458,7 @@ export class MobileTusUploader {
|
|
|
1458
1458
|
|
|
1459
1459
|
/**
|
|
1460
1460
|
* Where a persisted session stands, or `null` when Forge no longer has it
|
|
1461
|
-
* (404/410
|
|
1461
|
+
* (404/410: expired or terminated), from one HEAD and no retry. Any other
|
|
1462
1462
|
* failure throws with `sessionLost` false (a 5xx or a timeout says nothing
|
|
1463
1463
|
* against the session), carrying the answer's `retryAfterMs`; a final
|
|
1464
1464
|
* refusal Core decided on the HEAD's re-drive (`UPLOAD_POOL_FULL` or
|
|
@@ -1523,7 +1523,7 @@ export class MobileTusUploader {
|
|
|
1523
1523
|
|
|
1524
1524
|
/**
|
|
1525
1525
|
* Best-effort tus termination after a cancelled upload. Fire-and-forget so
|
|
1526
|
-
* cancel UX stays instant and the cancellation error still propagates
|
|
1526
|
+
* cancel UX stays instant and the cancellation error still propagates; a
|
|
1527
1527
|
* failed DELETE only means the orphaned session waits for server-side
|
|
1528
1528
|
* expiry. Deliberately NOT bound to the (already aborted) upload signal,
|
|
1529
1529
|
* which would kill the DELETE before it left the device.
|
|
@@ -1591,11 +1591,11 @@ export class MobileTusUploader {
|
|
|
1591
1591
|
length: number
|
|
1592
1592
|
): Promise<TusChunk> {
|
|
1593
1593
|
// Keep the chunk in the base64 form the fileReader returned (see
|
|
1594
|
-
// TusChunk)
|
|
1594
|
+
// TusChunk): decoding it here would burn seconds of JS-thread time per
|
|
1595
1595
|
// upload for bytes that are re-encoded before they ever leave the device.
|
|
1596
1596
|
const base64 = await fileReader.readAsBase64(fileUri, { position, length });
|
|
1597
1597
|
|
|
1598
|
-
// Fail fast on non-canonical base64 (line wraps, trailing newline
|
|
1598
|
+
// Fail fast on non-canonical base64 (line wraps, trailing newline,
|
|
1599
1599
|
// anything not a multiple of 4 chars): the string goes verbatim to the
|
|
1600
1600
|
// native networking layer, where iOS's strict decoder would otherwise
|
|
1601
1601
|
// turn a malformed fileReader result into an uncatchable native crash.
|
package/src/types.ts
CHANGED
|
@@ -133,7 +133,7 @@ export interface ListMembersResponse {
|
|
|
133
133
|
export interface InviteMemberRequest {
|
|
134
134
|
email: string;
|
|
135
135
|
role: 'admin' | 'user';
|
|
136
|
-
/** Defaults to `unlicensed` server-side
|
|
136
|
+
/** Defaults to `unlicensed` server-side; licensing a seat is a billing action handled on web. */
|
|
137
137
|
seat_type?: SeatType;
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -204,7 +204,7 @@ export interface SubscriptionIdentityStatus {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* GET /v1/billing/subscription
|
|
207
|
+
* GET /v1/billing/subscription: the account's derived billing lifecycle,
|
|
208
208
|
* licensed vs. used seats, capacity blocks, live pool usage, and Identity
|
|
209
209
|
* attempts. Drives the subscription / usage view. `status` is the derived
|
|
210
210
|
* lifecycle label; `is_paying`/`is_entitled` are the booleans the UI gates on
|
|
@@ -233,18 +233,18 @@ export interface SparkVaultSubscription {
|
|
|
233
233
|
renewal_date: number | null;
|
|
234
234
|
renewal_amount_usd: string;
|
|
235
235
|
seats: {
|
|
236
|
-
/** Licenses the subscription renews with
|
|
236
|
+
/** Licenses the subscription renews with: what the next renewal bills. */
|
|
237
237
|
full: number;
|
|
238
238
|
licensed: number;
|
|
239
239
|
used: number;
|
|
240
|
-
/** Members currently HOLDING each tier
|
|
240
|
+
/** Members currently HOLDING each tier: the display counts. */
|
|
241
241
|
assigned_full: number;
|
|
242
242
|
/** Roster members with no license (no access until licensed; free). */
|
|
243
243
|
unlicensed_members: number;
|
|
244
244
|
/** Licenses paid for the current billing period (a removed license stays
|
|
245
245
|
* paid until the renewal). */
|
|
246
246
|
paid: { full: number };
|
|
247
|
-
/** Paid licenses nobody holds
|
|
247
|
+
/** Paid licenses nobody holds, assignable at no charge until the renewal. */
|
|
248
248
|
available: { full: number };
|
|
249
249
|
/**
|
|
250
250
|
* Licenses are prepaid per period on a web subscription: a removed one
|
|
@@ -328,7 +328,7 @@ export type IapPlatform = 'ios' | 'android';
|
|
|
328
328
|
export type IapChannel = 'appstore' | 'play';
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
|
-
* POST /v1/billing/iap/validate
|
|
331
|
+
* POST /v1/billing/iap/validate: whether Core provisioned the purchase. It is a
|
|
332
332
|
* provisioning status, not a subscription (read the subscription again with
|
|
333
333
|
* `billing.getSubscription()` to show what changed). A purchase the store
|
|
334
334
|
* reports as not entitling (expired, refunded, revoked or not yet paid) is
|
|
@@ -402,7 +402,7 @@ export interface IdentityTokenClaims {
|
|
|
402
402
|
method: string;
|
|
403
403
|
/**
|
|
404
404
|
* The person's public avatar URL (my.auth.sv), present only when they have a visible
|
|
405
|
-
* avatar. The URL always renders an image
|
|
405
|
+
* avatar. The URL always renders an image: their photo, or a neutral placeholder.
|
|
406
406
|
*/
|
|
407
407
|
picture?: string;
|
|
408
408
|
}
|
|
@@ -438,7 +438,7 @@ export interface BackupSendResponse {
|
|
|
438
438
|
method?: 'email' | 'sms' | 'voice';
|
|
439
439
|
/** Code expiry (Unix seconds). */
|
|
440
440
|
expires_at?: number;
|
|
441
|
-
/** True when the identifier is already on the identity
|
|
441
|
+
/** True when the identifier is already on the identity; no code was sent. */
|
|
442
442
|
already_verified?: boolean;
|
|
443
443
|
}
|
|
444
444
|
|
|
@@ -1116,7 +1116,7 @@ export interface MobileFileReader {
|
|
|
1116
1116
|
* Read a byte range of a file as CANONICAL base64: standard alphabet, no
|
|
1117
1117
|
* line wrapping, no whitespace, correctly padded. The string is handed
|
|
1118
1118
|
* verbatim to React Native's native networking (`{ base64 }` request body),
|
|
1119
|
-
* whose iOS decoder is strict
|
|
1119
|
+
* whose iOS decoder is strict: non-canonical output is rejected before
|
|
1120
1120
|
* send. expo-file-system's readAsStringAsync writes this form, but its
|
|
1121
1121
|
* `position` is a 32-bit Int on Android, where a read past 2 GiB returns
|
|
1122
1122
|
* other bytes; a FileHandle read (`File.open`, `offset`, `readBytes`)
|
package/src/users.ts
CHANGED
|
@@ -11,14 +11,14 @@ import { apiPath } from './request-path.js';
|
|
|
11
11
|
import { validateResourceId } from './validation.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Organization team client (member admins only
|
|
14
|
+
* Organization team client (member admins only; the API gates these on the
|
|
15
15
|
* admin role and returns 403 otherwise).
|
|
16
16
|
*
|
|
17
17
|
* Licensing is a billing action (licenses are prepaid: assigning or upgrading
|
|
18
18
|
* one charges the rest of the current billing period at once), so the only
|
|
19
19
|
* seat-affecting operation exposed here is `invite`, which defaults new members
|
|
20
20
|
* to `unlicensed` and never charges. Assigning or changing a paid license is
|
|
21
|
-
* intentionally absent
|
|
21
|
+
* intentionally absent: clients route that to the web dashboard so native
|
|
22
22
|
* apps never initiate an out-of-band purchase.
|
|
23
23
|
*/
|
|
24
24
|
export class MobileUsersClient {
|
|
@@ -51,10 +51,10 @@ export class MobileUsersClient {
|
|
|
51
51
|
* Remove a member: their DVAKs, API keys and sign-in sessions are revoked
|
|
52
52
|
* now, and an access token already issued stays valid until it expires,
|
|
53
53
|
* within the hour. A license they held stays paid until the end of the
|
|
54
|
-
* billing period
|
|
54
|
+
* billing period (nothing is refunded) and is not renewed; until then it
|
|
55
55
|
* can be given to someone else at no charge. `wind_down` is true when this
|
|
56
|
-
* removal ends the subscription
|
|
57
|
-
* it was not already set to end: it ends at the period end.
|
|
56
|
+
* removal ends the subscription (theirs was the last license it renews, and
|
|
57
|
+
* it was not already set to end): it ends at the period end.
|
|
58
58
|
*/
|
|
59
59
|
async remove(userId: string): Promise<RemoveMemberResponse> {
|
|
60
60
|
validateResourceId(userId, 'user ID', 'userId');
|
package/src/vaults.test-d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vault and folder wire-contract assertions
|
|
2
|
+
* Vault and folder wire-contract assertions, COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
4
|
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
5
|
* the server: the transpiler strips them and every assertion passes. `tsc
|