@proveanything/smartlinks 1.15.15 → 1.15.17

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/openapi.yaml CHANGED
@@ -12183,6 +12183,90 @@ paths:
12183
12183
  application/json:
12184
12184
  schema:
12185
12185
  $ref: "#/components/schemas/ProofClaimRequest"
12186
+ /public/collection/{collectionId}/product/{productId}/proof/{proofId}/grant/redeem:
12187
+ post:
12188
+ tags:
12189
+ - proof
12190
+ summary: Redeem a grant token (anonymous or signed-in).
12191
+ operationId: proof_redeemGrant
12192
+ security: []
12193
+ parameters:
12194
+ - name: collectionId
12195
+ in: path
12196
+ required: true
12197
+ schema:
12198
+ type: string
12199
+ - name: productId
12200
+ in: path
12201
+ required: true
12202
+ schema:
12203
+ type: string
12204
+ - name: proofId
12205
+ in: path
12206
+ required: true
12207
+ schema:
12208
+ type: string
12209
+ responses:
12210
+ 200:
12211
+ description: Success
12212
+ content:
12213
+ application/json:
12214
+ schema:
12215
+ $ref: "#/components/schemas/RedeemGrantResult"
12216
+ 400:
12217
+ description: Bad request
12218
+ 401:
12219
+ description: Unauthorized
12220
+ 404:
12221
+ description: Not found
12222
+ requestBody:
12223
+ required: true
12224
+ content:
12225
+ application/json:
12226
+ schema:
12227
+ $ref: "#/components/schemas/RedeemGrantOptions"
12228
+ /public/collection/{collectionId}/product/{productId}/proof/{proofId}/grant/{grantId}:
12229
+ delete:
12230
+ tags:
12231
+ - proof
12232
+ summary: Revoke a grant by id (owner / collection admin only).
12233
+ operationId: proof_revokeGrant
12234
+ security: []
12235
+ parameters:
12236
+ - name: collectionId
12237
+ in: path
12238
+ required: true
12239
+ schema:
12240
+ type: string
12241
+ - name: productId
12242
+ in: path
12243
+ required: true
12244
+ schema:
12245
+ type: string
12246
+ - name: proofId
12247
+ in: path
12248
+ required: true
12249
+ schema:
12250
+ type: string
12251
+ - name: grantId
12252
+ in: path
12253
+ required: true
12254
+ schema:
12255
+ type: string
12256
+ responses:
12257
+ 200:
12258
+ description: Success
12259
+ content:
12260
+ application/json:
12261
+ schema:
12262
+ type: object
12263
+ additionalProperties: true
12264
+ 400:
12265
+ description: Bad request
12266
+ 401:
12267
+ description: Unauthorized
12268
+ 404:
12269
+ description: Not found
12186
12270
  /public/collection/{collectionId}/products/{productId}/createClaim:
12187
12271
  post:
12188
12272
  tags:
@@ -17731,6 +17815,8 @@ components:
17731
17815
  type: string
17732
17816
  admin:
17733
17817
  type: boolean
17818
+ signal:
17819
+ $ref: "#/components/schemas/AbortSignal"
17734
17820
  required:
17735
17821
  - file
17736
17822
  UploadFromUrlOptions:
@@ -17996,6 +18082,39 @@ components:
17996
18082
  - collectionId
17997
18083
  - tokenId
17998
18084
  - file
18085
+ CreateResumableUploadOptions:
18086
+ type: object
18087
+ properties:
18088
+ file:
18089
+ $ref: "#/components/schemas/File"
18090
+ name:
18091
+ type: string
18092
+ metadata:
18093
+ type: object
18094
+ additionalProperties: true
18095
+ appId:
18096
+ type: string
18097
+ admin:
18098
+ type: boolean
18099
+ token:
18100
+ type: string
18101
+ required:
18102
+ - file
18103
+ ResumableStartOptions:
18104
+ type: object
18105
+ properties:
18106
+ signal:
18107
+ $ref: "#/components/schemas/AbortSignal"
18108
+ ResumableUploadHandle:
18109
+ type: object
18110
+ properties:
18111
+ id:
18112
+ type: string
18113
+ size:
18114
+ type: number
18115
+ required:
18116
+ - id
18117
+ - size
17999
18118
  AttestationResponse:
18000
18119
  type: object
18001
18120
  properties:
@@ -24830,6 +24949,80 @@ components:
24830
24949
  $ref: "#/components/schemas/ProofFieldDef"
24831
24950
  required:
24832
24951
  - fields
24952
+ GrantAudience:
24953
+ type: object
24954
+ properties:
24955
+ kind:
24956
+ type: string
24957
+ enum:
24958
+ - public_link
24959
+ - named
24960
+ email:
24961
+ type: string
24962
+ userId:
24963
+ type: string
24964
+ required:
24965
+ - kind
24966
+ ProofGrant:
24967
+ type: object
24968
+ properties:
24969
+ grantId:
24970
+ type: string
24971
+ proofId:
24972
+ type: string
24973
+ productId:
24974
+ type: string
24975
+ scope:
24976
+ type: array
24977
+ items:
24978
+ $ref: "#/components/schemas/GrantScope"
24979
+ audience:
24980
+ $ref: "#/components/schemas/GrantAudience"
24981
+ createdBy:
24982
+ type: string
24983
+ expiresAt:
24984
+ type: string
24985
+ revokedAt:
24986
+ type: string
24987
+ redeemedBy:
24988
+ type: object
24989
+ additionalProperties: true
24990
+ redeemCount:
24991
+ type: number
24992
+ createdAt:
24993
+ type: string
24994
+ updatedAt:
24995
+ type: string
24996
+ token:
24997
+ type: string
24998
+ required:
24999
+ - grantId
25000
+ - proofId
25001
+ - scope
25002
+ - audience
25003
+ - createdBy
25004
+ - redeemCount
25005
+ - createdAt
25006
+ - updatedAt
25007
+ CreateGrantOptions:
25008
+ type: object
25009
+ properties:
25010
+ scope:
25011
+ type: array
25012
+ items:
25013
+ $ref: "#/components/schemas/GrantScope"
25014
+ audience:
25015
+ $ref: "#/components/schemas/GrantAudience"
25016
+ expiresAt:
25017
+ type: object
25018
+ additionalProperties: true
25019
+ required:
25020
+ - scope
25021
+ RedeemGrantOptions:
25022
+ type: object
25023
+ properties:
25024
+ guestName:
25025
+ type: string
24833
25026
  ProofResponse:
24834
25027
  type: object
24835
25028
  additionalProperties: true
@@ -122,6 +122,8 @@ export interface UploadAssetOptions {
122
122
  appId?: string;
123
123
  /** Optional: Upload via admin route instead of public */
124
124
  admin?: boolean;
125
+ /** Optional: Abort the in-flight upload (browser fetch/XHR only) */
126
+ signal?: AbortSignal;
125
127
  }
126
128
  /**
127
129
  * Options for uploading an asset from a URL.
@@ -304,3 +306,57 @@ export interface PublicTokenUploadOptions {
304
306
  metadata?: Record<string, any>;
305
307
  onProgress?: (percent: number) => void;
306
308
  }
309
+ /**
310
+ * Options for opening a resumable upload. Mirrors {@link UploadAssetOptions}
311
+ * but the transfer is chunked directly to storage and can be paused/resumed,
312
+ * including after a page reload or app restart.
313
+ */
314
+ export interface CreateResumableUploadOptions {
315
+ file: File;
316
+ scope: {
317
+ type: 'collection';
318
+ collectionId: string;
319
+ } | {
320
+ type: 'product';
321
+ collectionId: string;
322
+ productId: string;
323
+ } | {
324
+ type: 'proof';
325
+ collectionId: string;
326
+ productId: string;
327
+ proofId: string;
328
+ };
329
+ name?: string;
330
+ metadata?: Record<string, any>;
331
+ appId?: string;
332
+ /** Upload via admin route (default) or, when set, the public token route. */
333
+ admin?: boolean;
334
+ /**
335
+ * Upload token id (from {@link requestUploadToken}) for public/unauthenticated
336
+ * uploads. When provided, the public resumable route is used.
337
+ */
338
+ token?: string;
339
+ }
340
+ export interface ResumableStartOptions {
341
+ /** Progress callback (0-100), driven by bytes confirmed by storage. */
342
+ onProgress?: (percent: number) => void;
343
+ /** Abort the in-flight transfer. */
344
+ signal?: AbortSignal;
345
+ }
346
+ /**
347
+ * A handle to a resumable upload. `id` is durable — persist it (e.g. in
348
+ * IndexedDB) alongside a reference to the file and pass it to
349
+ * {@link asset.resumeUpload} after a reload to continue mid-file.
350
+ */
351
+ export interface ResumableUploadHandle {
352
+ /** Durable, persistable upload id (survives reload/app restart). */
353
+ readonly id: string;
354
+ /** Total bytes of the file being uploaded. */
355
+ readonly size: number;
356
+ /** Begin (or continue) uploading, resuming from the storage offset. */
357
+ start(options?: ResumableStartOptions): Promise<Asset>;
358
+ /** Pause after the current chunk. */
359
+ pause(): void;
360
+ /** Resume a paused transfer. */
361
+ resume(options?: ResumableStartOptions): Promise<Asset>;
362
+ }
@@ -37,6 +37,11 @@ export type LinkTarget = {
37
37
  kind: 'app';
38
38
  /** The target app's `appId`. */
39
39
  appId: string;
40
+ /**
41
+ * App-specific query params (e.g. `{ proofId, shareToken }` for a share link).
42
+ * Platform context params are injected automatically.
43
+ */
44
+ params?: Record<string, string>;
40
45
  target?: LinkOpenTarget;
41
46
  } | {
42
47
  kind: 'deep';
@@ -65,3 +65,58 @@ export type ProofFieldDef = ScopedFieldDef & {
65
65
  export interface ProofFieldsConfig {
66
66
  fields: ProofFieldDef[];
67
67
  }
68
+ /** What a grant authorises the bearer to do on the proof. */
69
+ export type GrantScope = 'read' | 'comment' | 'admin' | 'verify_owner';
70
+ /** Who may redeem a grant. */
71
+ export interface GrantAudience {
72
+ kind: 'public_link' | 'named';
73
+ email?: string;
74
+ userId?: string;
75
+ }
76
+ /** A share grant issued on a proof. */
77
+ export interface ProofGrant {
78
+ grantId: string;
79
+ proofId: string;
80
+ productId?: string | null;
81
+ scope: GrantScope[];
82
+ audience: GrantAudience;
83
+ createdBy: string;
84
+ expiresAt?: string | null;
85
+ revokedAt?: string | null;
86
+ redeemedBy?: {
87
+ userId?: string;
88
+ guestName?: string;
89
+ redeemedAt: string;
90
+ };
91
+ redeemCount: number;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ /** The opaque bearer token — present ONLY on the `createGrant` response, never on `listGrants`. */
95
+ token?: string;
96
+ }
97
+ export interface CreateGrantOptions {
98
+ /** At least one scope is required. */
99
+ scope: GrantScope[];
100
+ /** Defaults to `{ kind: 'public_link' }`. */
101
+ audience?: GrantAudience;
102
+ /** Optional expiry — a `Date` or ISO string. */
103
+ expiresAt?: Date | string;
104
+ }
105
+ export interface RedeemGrantOptions {
106
+ /** Display name to stamp on guest activity when the redeemer is not signed in. */
107
+ guestName?: string;
108
+ }
109
+ /**
110
+ * Result of redeeming a grant. For read/comment/admin grants this is the granted
111
+ * scope; for a `verify_owner` grant it is an ownership assertion (never the account).
112
+ */
113
+ export type RedeemGrantResult = {
114
+ scope: GrantScope[];
115
+ redeemedAt: string;
116
+ } | {
117
+ proofId: string;
118
+ assertsOwnership: true;
119
+ ownerDisplayName?: string;
120
+ issuedAt?: string;
121
+ expiresAt?: string;
122
+ };
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.15.15 | Generated: 2026-07-29T17:46:34.198Z
3
+ Version: 1.15.17 | Generated: 2026-08-18T08:10:50.608Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -170,6 +170,12 @@ Replace or augment globally applied custom headers.
170
170
  **setBearerToken**(token: string | undefined) → `void`
171
171
  Allows setting the bearerToken at runtime (e.g. after login/logout). Clears the HTTP cache whenever the token actually changes so that stale user-scoped responses (e.g. /account/profile) are not served after a login or logout event.
172
172
 
173
+ **setGrantToken**(token: string | undefined) → `void`
174
+ Set (or clear) the per-proof share-grant token. When set, it is attached as the `X-Grant-Token` header on every request, so a recipient who has opened a shared link can read/comment on the granted proof's data. Pass `undefined` to clear it. The server re-checks the grant against the database on every request, so calling `revokeGrant` invalidates an in-flight token immediately. Clears the GET cache on change so grant-tier responses are not served after the token changes. ```ts // On opening ?proofId=…&shareToken=abc setGrantToken(shareToken) const { attestations } = await proof.get(...) // now sees owner-tier memories ```
175
+
176
+ **getGrantToken**() → `string | undefined`
177
+ Returns the currently-set share-grant token, or `undefined`.
178
+
173
179
  **getBearerToken**() → `string | undefined`
174
180
  Returns the bearer token currently held by the SDK, or `undefined` if none is set. In proxy mode, credentials are held by the parent frame, not the local SDK, so this returns `undefined` even when the caller is authenticated.
175
181
 
@@ -2459,6 +2465,7 @@ interface UploadAssetOptions {
2459
2465
  onProgress?: (percent: number) => void
2460
2466
  appId?: string
2461
2467
  admin?: boolean
2468
+ signal?: AbortSignal
2462
2469
  }
2463
2470
  ```
2464
2471
 
@@ -2639,6 +2646,43 @@ interface PublicTokenUploadOptions {
2639
2646
  }
2640
2647
  ```
2641
2648
 
2649
+ **CreateResumableUploadOptions** (interface)
2650
+ ```typescript
2651
+ interface CreateResumableUploadOptions {
2652
+ file: File
2653
+ scope:
2654
+ | { type: 'collection'; collectionId: string }
2655
+ | { type: 'product'; collectionId: string; productId: string }
2656
+ | { type: 'proof'; collectionId: string; productId: string; proofId: string }
2657
+ name?: string
2658
+ metadata?: Record<string, any>
2659
+ appId?: string
2660
+ admin?: boolean
2661
+ * Upload token id (from {@link requestUploadToken}) for public/unauthenticated
2662
+ * uploads. When provided, the public resumable route is used.
2663
+ token?: string
2664
+ }
2665
+ ```
2666
+
2667
+ **ResumableStartOptions** (interface)
2668
+ ```typescript
2669
+ interface ResumableStartOptions {
2670
+ onProgress?: (percent: number) => void
2671
+ signal?: AbortSignal
2672
+ }
2673
+ ```
2674
+
2675
+ **ResumableUploadHandle** (interface)
2676
+ ```typescript
2677
+ interface ResumableUploadHandle {
2678
+ readonly id: string
2679
+ readonly size: number
2680
+ start(options?: ResumableStartOptions): Promise<Asset>
2681
+ pause(): void
2682
+ resume(options?: ResumableStartOptions): Promise<Asset>
2683
+ }
2684
+ ```
2685
+
2642
2686
  **AssetResponse** = `Asset`
2643
2687
 
2644
2688
  ### attestation
@@ -7249,6 +7293,50 @@ interface ProofFieldsConfig {
7249
7293
  }
7250
7294
  ```
7251
7295
 
7296
+ **GrantAudience** (interface)
7297
+ ```typescript
7298
+ interface GrantAudience {
7299
+ kind: 'public_link' | 'named'
7300
+ email?: string
7301
+ userId?: string
7302
+ }
7303
+ ```
7304
+
7305
+ **ProofGrant** (interface)
7306
+ ```typescript
7307
+ interface ProofGrant {
7308
+ grantId: string
7309
+ proofId: string
7310
+ productId?: string | null
7311
+ scope: GrantScope[]
7312
+ audience: GrantAudience
7313
+ createdBy: string
7314
+ expiresAt?: string | null
7315
+ revokedAt?: string | null
7316
+ redeemedBy?: { userId?: string; guestName?: string; redeemedAt: string }
7317
+ redeemCount: number
7318
+ createdAt: string
7319
+ updatedAt: string
7320
+ token?: string
7321
+ }
7322
+ ```
7323
+
7324
+ **CreateGrantOptions** (interface)
7325
+ ```typescript
7326
+ interface CreateGrantOptions {
7327
+ scope: GrantScope[]
7328
+ audience?: GrantAudience
7329
+ expiresAt?: Date | string
7330
+ }
7331
+ ```
7332
+
7333
+ **RedeemGrantOptions** (interface)
7334
+ ```typescript
7335
+ interface RedeemGrantOptions {
7336
+ guestName?: string
7337
+ }
7338
+ ```
7339
+
7252
7340
  **ProofResponse** = `Proof`
7253
7341
 
7254
7342
  **ProofUpdateRequest** = `Partial<ProofCreateRequest>`
@@ -7259,6 +7347,10 @@ interface ProofFieldsConfig {
7259
7347
 
7260
7348
  **ProofFieldDef** = `ScopedFieldDef & { scope?: ProofFieldScope }`
7261
7349
 
7350
+ **GrantScope** = `'read' | 'comment' | 'admin' | 'verify_owner'`
7351
+
7352
+ **RedeemGrantResult** = ``
7353
+
7262
7354
  ### qr
7263
7355
 
7264
7356
  **QrShortCodeLookupResponse** (interface)
@@ -8479,6 +8571,12 @@ Request a single-use upload token for a public (unauthenticated) upload. The tok
8479
8571
  **publicUploadWithToken**(options: PublicTokenUploadOptions) → `Promise<Asset>`
8480
8572
  Upload a file using a single-use upload token (no admin auth required). Assets are created with `status: 'pending_review'` when the token policy has `reviewRequired: true`.
8481
8573
 
8574
+ **createResumableUpload**(options: CreateResumableUploadOptions) → `Promise<ResumableUploadHandle>`
8575
+ Open a resumable upload for a large file (e.g. video). The bytes are chunked directly to storage and can be paused/resumed — including after a page reload or app restart, by persisting `handle.id` and calling {@link resumeUpload}. ```ts const handle = await asset.createResumableUpload({ file, scope, appId }) localStorage.setItem('pendingUpload', handle.id) // survives reload const uploaded = await handle.start({ onProgress: p => setPct(p) }) ```
8576
+
8577
+ **resumeUpload**(handleId: string, file: File) → `Promise<ResumableUploadHandle>`
8578
+ Resume a previously-created resumable upload after a reload/app restart. Pass the persisted `handle.id` and the same `File`; the transfer continues from the offset storage already holds rather than restarting.
8579
+
8482
8580
  ### async
8483
8581
 
8484
8582
  **enqueueAsyncJob**(collectionId: string,
@@ -9893,6 +9991,30 @@ Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product
9893
9991
  data: { targetProductId: string }) → `Promise<ProofResponse>`
9894
9992
  Migrate a proof to a different product within the same collection (admin only). Because the Firestore ledger document ID is `{productId}-{proofId}`, a proof cannot simply be re-assigned to another product by updating a field — the document must be re-keyed. This endpoint handles that atomically: 1. Reads the source ledger document (`{sourceProductId}-{proofId}`). 2. Writes a new document (`{targetProductId}-{proofId}`) with `productId` and `proofGroup` updated. The short `proofId` (nanoid) is unchanged. 3. Writes a migration history entry to the new document's `history` subcollection (snapshot of the original proof + migration metadata). 4. Copies all subcollections — `assets`, `attestations`, `history` — from the old document to the new one. 5. Deletes the old subcollections and then the old document. Repeated migrations are safe — each one appends a history record; no migration metadata is stored on the proof document itself. ```typescript const migrated = await proof.migrate('coll_123', 'prod_old', 'proof_abc', { targetProductId: 'prod_new', }) console.log(migrated.productId) // 'prod_new' ```
9895
9993
 
9994
+ **createGrant**(collectionId: string,
9995
+ productId: string,
9996
+ proofId: string,
9997
+ options: CreateGrantOptions) → `Promise<ProofGrant>`
9998
+ Create a share grant on a proof (owner / collection admin only). The returned grant includes `token` — the opaque bearer secret, available ONLY on this response. Embed it in a share link and hand recipients {@link redeemGrant} / {@link setGrantToken}.
9999
+
10000
+ **listGrants**(collectionId: string,
10001
+ productId: string,
10002
+ proofId: string) → `Promise<ProofGrant[]>`
10003
+ List the active + past grants on a proof (owner / collection admin only). Tokens are never returned here.
10004
+
10005
+ **revokeGrant**(collectionId: string,
10006
+ productId: string,
10007
+ proofId: string,
10008
+ grantId: string) → `Promise<void>`
10009
+ Revoke a grant by id (owner / collection admin only). Takes effect immediately.
10010
+
10011
+ **redeemGrant**(collectionId: string,
10012
+ productId: string,
10013
+ proofId: string,
10014
+ token: string,
10015
+ options?: RedeemGrantOptions) → `Promise<RedeemGrantResult>`
10016
+ Redeem a grant token (anonymous or signed-in). Records the redemption and returns the granted scope, or — for a `verify_owner` grant — an ownership assertion (never the account). After redeeming, call {@link setGrantToken} so subsequent data requests carry the token.
10017
+
9896
10018
  ### publicClient
9897
10019
 
9898
10020
  **chat**(collectionId: string,