@primitivedotdev/sdk 1.23.0 → 1.24.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.
@@ -1240,6 +1240,100 @@ const openapiDocument = {
1240
1240
  }
1241
1241
  }
1242
1242
  },
1243
+ "/emails/{id}/attachments/{part_index}": {
1244
+ "parameters": [{ "$ref": "#/components/parameters/ResourceId" }, { "$ref": "#/components/parameters/AttachmentPartIndex" }],
1245
+ "get": {
1246
+ "operationId": "downloadEmailAttachmentPart",
1247
+ "summary": "Download one inbound email attachment",
1248
+ "description": "Pending service release. This contract does not establish live availability.\nDownloads the original bytes of one ordinary email attachment, selected by\nits metadata `part_index`, not its position in an attachments array. Refresh\nthe email detail after `attachment_changed` before choosing an index again.\nUses bearer authentication only; signed raw-email download tokens are not accepted.\nA paired-agent credential may read only a message addressed to its claimed address.\nFunction credentials are denied. Other bearer credentials retain their\nexisting email access boundaries. This endpoint serves email bytes only.\n",
1249
+ "tags": ["Emails"],
1250
+ "security": [{ "BearerAuth": [] }],
1251
+ "responses": {
1252
+ "200": { "$ref": "#/components/responses/AttachmentPart" },
1253
+ "400": { "$ref": "#/components/responses/ValidationError" },
1254
+ "401": { "$ref": "#/components/responses/Unauthorized" },
1255
+ "403": { "$ref": "#/components/responses/Forbidden" },
1256
+ "404": {
1257
+ "description": "Missing or inaccessible message, or missing attachment part",
1258
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1259
+ },
1260
+ "409": {
1261
+ "description": "attachment_changed; refresh email detail before selecting a part again",
1262
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1263
+ },
1264
+ "410": {
1265
+ "description": "content_discarded; the original content is no longer available",
1266
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1267
+ },
1268
+ "413": {
1269
+ "description": "attachment_limit_exceeded; the attachment exceeds download limits",
1270
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1271
+ },
1272
+ "502": {
1273
+ "description": "attachment_integrity_failed; stored content failed integrity validation",
1274
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1275
+ },
1276
+ "503": {
1277
+ "description": "attachment_not_ready or attachment_storage_unavailable; retry after the indicated delay",
1278
+ "headers": { "Retry-After": {
1279
+ "description": "Delay in seconds before retrying this read",
1280
+ "schema": {
1281
+ "type": "integer",
1282
+ "minimum": 0
1283
+ }
1284
+ } },
1285
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1286
+ }
1287
+ }
1288
+ }
1289
+ },
1290
+ "/sent-emails/{id}/attachments/{part_index}": {
1291
+ "parameters": [{ "$ref": "#/components/parameters/ResourceId" }, { "$ref": "#/components/parameters/AttachmentPartIndex" }],
1292
+ "get": {
1293
+ "operationId": "downloadSentAttachmentPart",
1294
+ "summary": "Download one sent email attachment",
1295
+ "description": "Pending service release. This contract does not establish live availability.\nDownloads the original bytes of one ordinary email attachment, selected by\nits metadata `part_index`, not its position in an attachments array. Refresh\nthe email detail after `attachment_changed` before choosing an index again.\nUses bearer authentication only; signed raw-email download tokens are not accepted.\nA paired-agent credential may read only mail sent from its claimed address.\nReceiving a copy does not authorize downloading another sender's sent content.\nFunction credentials are denied. Other bearer credentials retain their\nexisting email access boundaries. This endpoint serves email bytes only.\n",
1296
+ "tags": ["Sending"],
1297
+ "security": [{ "BearerAuth": [] }],
1298
+ "responses": {
1299
+ "200": { "$ref": "#/components/responses/AttachmentPart" },
1300
+ "400": { "$ref": "#/components/responses/ValidationError" },
1301
+ "401": { "$ref": "#/components/responses/Unauthorized" },
1302
+ "403": { "$ref": "#/components/responses/Forbidden" },
1303
+ "404": {
1304
+ "description": "Missing or inaccessible message, or missing attachment part",
1305
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1306
+ },
1307
+ "409": {
1308
+ "description": "attachment_changed; refresh email detail before selecting a part again",
1309
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1310
+ },
1311
+ "410": {
1312
+ "description": "content_discarded; the original content is no longer available",
1313
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1314
+ },
1315
+ "413": {
1316
+ "description": "attachment_limit_exceeded; the attachment exceeds download limits",
1317
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1318
+ },
1319
+ "502": {
1320
+ "description": "attachment_integrity_failed; stored content failed integrity validation",
1321
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1322
+ },
1323
+ "503": {
1324
+ "description": "attachment_not_ready or attachment_storage_unavailable; retry after the indicated delay",
1325
+ "headers": { "Retry-After": {
1326
+ "description": "Delay in seconds before retrying this read",
1327
+ "schema": {
1328
+ "type": "integer",
1329
+ "minimum": 0
1330
+ }
1331
+ } },
1332
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
1333
+ }
1334
+ }
1335
+ }
1336
+ },
1243
1337
  "/emails/{id}/reply": {
1244
1338
  "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
1245
1339
  "post": {
@@ -3923,6 +4017,18 @@ const openapiDocument = {
3923
4017
  }
3924
4018
  },
3925
4019
  "parameters": {
4020
+ "AttachmentPartIndex": {
4021
+ "name": "part_index",
4022
+ "in": "path",
4023
+ "required": true,
4024
+ "description": "The attachment metadata `part_index`, not its offset in the attachments array",
4025
+ "schema": {
4026
+ "type": "integer",
4027
+ "format": "int32",
4028
+ "minimum": 0,
4029
+ "maximum": 2147483647
4030
+ }
4031
+ },
3926
4032
  "ResourceId": {
3927
4033
  "name": "id",
3928
4034
  "in": "path",
@@ -3993,6 +4099,33 @@ const openapiDocument = {
3993
4099
  }
3994
4100
  },
3995
4101
  "responses": {
4102
+ "AttachmentPart": {
4103
+ "description": "Original attachment bytes; never a JSON envelope or a base64 string",
4104
+ "content": { "application/octet-stream": { "schema": {
4105
+ "type": "string",
4106
+ "format": "binary"
4107
+ } } },
4108
+ "headers": {
4109
+ "X-Content-SHA256": {
4110
+ "description": "SHA-256 hex digest of the original bytes",
4111
+ "schema": {
4112
+ "type": "string",
4113
+ "pattern": "^[a-fA-F0-9]{64}$"
4114
+ }
4115
+ },
4116
+ "Content-Disposition": {
4117
+ "description": "Safe attachment disposition with a sanitized filename",
4118
+ "schema": { "type": "string" }
4119
+ },
4120
+ "Cache-Control": {
4121
+ "description": "Attachment responses are private and must not be stored by caches",
4122
+ "schema": {
4123
+ "type": "string",
4124
+ "example": "private, no-store"
4125
+ }
4126
+ }
4127
+ }
4128
+ },
3996
4129
  "PullContentGone": {
3997
4130
  "description": "Queued content is no longer available",
3998
4131
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
@@ -5011,6 +5144,12 @@ const openapiDocument = {
5011
5144
  "conflict",
5012
5145
  "mx_conflict",
5013
5146
  "not_scheduled",
5147
+ "attachment_changed",
5148
+ "content_discarded",
5149
+ "attachment_limit_exceeded",
5150
+ "attachment_integrity_failed",
5151
+ "attachment_not_ready",
5152
+ "attachment_storage_unavailable",
5014
5153
  "outbound_disabled",
5015
5154
  "cannot_send_from_domain",
5016
5155
  "recipient_not_allowed",
@@ -7820,6 +7959,53 @@ const openapiDocument = {
7820
7959
  "body_html": {
7821
7960
  "type": ["string", "null"],
7822
7961
  "description": "HTML body sent on the wire. Null when the send\ncarried only a plain-text body, or when bodies\nhave been discarded post-send.\n"
7962
+ },
7963
+ "attachments": {
7964
+ "type": "array",
7965
+ "description": "Metadata for submitted inline attachments; download availability is reported separately. Metadata may exist when the archive is unavailable, and legacy sends may have no metadata. Offloaded payload files are not included in the inline archive.",
7966
+ "items": {
7967
+ "type": "object",
7968
+ "description": "Metadata for one submitted inline attachment.",
7969
+ "additionalProperties": true,
7970
+ "properties": {
7971
+ "filename": { "type": ["string", "null"] },
7972
+ "content_type": { "type": "string" },
7973
+ "size_bytes": {
7974
+ "type": "integer",
7975
+ "minimum": 0,
7976
+ "maximum": 9007199254740991
7977
+ },
7978
+ "sha256": { "type": "string" },
7979
+ "part_index": {
7980
+ "type": "integer",
7981
+ "minimum": 0,
7982
+ "maximum": 9007199254740991
7983
+ },
7984
+ "tar_path": { "type": "string" }
7985
+ },
7986
+ "required": [
7987
+ "filename",
7988
+ "content_type",
7989
+ "size_bytes",
7990
+ "sha256",
7991
+ "part_index",
7992
+ "tar_path"
7993
+ ]
7994
+ }
7995
+ },
7996
+ "attachments_size_bytes": {
7997
+ "type": "integer",
7998
+ "minimum": 0,
7999
+ "maximum": 9007199254740991,
8000
+ "description": "Original decoded attachment byte total accepted for this send, not the compressed archive size. It may exceed the retained inline total after offloading."
8001
+ },
8002
+ "attachments_complete": {
8003
+ "type": "boolean",
8004
+ "description": "Whether attachments enumerates the complete original submitted attachment set, including zero-byte and inline CID parts. True requires no submitted payload-reference, offloaded, or visibility-filtered attachment to be omitted, retained content, and a published archive when the attachment inventory is nonempty. False or absent provides no completeness proof, including for legacy or discarded content. This field grants no download access and has no interaction semantics."
8005
+ },
8006
+ "attachments_download_available": {
8007
+ "type": "boolean",
8008
+ "description": "Whether an inline attachment archive has been successfully retained and is available for download. Download authorization is checked separately; address-bound agent connection keys cannot download archives."
7823
8009
  }
7824
8010
  }
7825
8011
  }]
@@ -13609,6 +13795,38 @@ const operationManifest = [
13609
13795
  "tag": "Emails",
13610
13796
  "tagCommand": "emails"
13611
13797
  },
13798
+ {
13799
+ "binaryResponse": true,
13800
+ "bodyRequired": false,
13801
+ "command": "download-email-attachment-part",
13802
+ "description": "Pending service release. This contract does not establish live availability.\nDownloads the original bytes of one ordinary email attachment, selected by\nits metadata `part_index`, not its position in an attachments array. Refresh\nthe email detail after `attachment_changed` before choosing an index again.\nUses bearer authentication only; signed raw-email download tokens are not accepted.\nA paired-agent credential may read only a message addressed to its claimed address.\nFunction credentials are denied. Other bearer credentials retain their\nexisting email access boundaries. This endpoint serves email bytes only.\n",
13803
+ "hasJsonBody": false,
13804
+ "method": "GET",
13805
+ "operationId": "downloadEmailAttachmentPart",
13806
+ "path": "/emails/{id}/attachments/{part_index}",
13807
+ "pathParams": [{
13808
+ "description": "Resource UUID",
13809
+ "enum": null,
13810
+ "name": "id",
13811
+ "required": true,
13812
+ "type": "string"
13813
+ }, {
13814
+ "description": "The attachment metadata `part_index`, not its offset in the attachments array",
13815
+ "enum": null,
13816
+ "maximum": 2147483647,
13817
+ "minimum": 0,
13818
+ "name": "part_index",
13819
+ "required": true,
13820
+ "type": "integer"
13821
+ }],
13822
+ "queryParams": [],
13823
+ "requestSchema": null,
13824
+ "responseSchema": null,
13825
+ "sdkName": "downloadEmailAttachmentPart",
13826
+ "summary": "Download one inbound email attachment",
13827
+ "tag": "Emails",
13828
+ "tagCommand": "emails"
13829
+ },
13612
13830
  {
13613
13831
  "binaryResponse": true,
13614
13832
  "bodyRequired": false,
@@ -21095,6 +21313,53 @@ const operationManifest = [
21095
21313
  "body_html": {
21096
21314
  "type": ["string", "null"],
21097
21315
  "description": "HTML body sent on the wire. Null when the send\ncarried only a plain-text body, or when bodies\nhave been discarded post-send.\n"
21316
+ },
21317
+ "attachments": {
21318
+ "type": "array",
21319
+ "description": "Metadata for submitted inline attachments; download availability is reported separately. Metadata may exist when the archive is unavailable, and legacy sends may have no metadata. Offloaded payload files are not included in the inline archive.",
21320
+ "items": {
21321
+ "type": "object",
21322
+ "description": "Metadata for one submitted inline attachment.",
21323
+ "additionalProperties": true,
21324
+ "properties": {
21325
+ "filename": { "type": ["string", "null"] },
21326
+ "content_type": { "type": "string" },
21327
+ "size_bytes": {
21328
+ "type": "integer",
21329
+ "minimum": 0,
21330
+ "maximum": 9007199254740991
21331
+ },
21332
+ "sha256": { "type": "string" },
21333
+ "part_index": {
21334
+ "type": "integer",
21335
+ "minimum": 0,
21336
+ "maximum": 9007199254740991
21337
+ },
21338
+ "tar_path": { "type": "string" }
21339
+ },
21340
+ "required": [
21341
+ "filename",
21342
+ "content_type",
21343
+ "size_bytes",
21344
+ "sha256",
21345
+ "part_index",
21346
+ "tar_path"
21347
+ ]
21348
+ }
21349
+ },
21350
+ "attachments_size_bytes": {
21351
+ "type": "integer",
21352
+ "minimum": 0,
21353
+ "maximum": 9007199254740991,
21354
+ "description": "Original decoded attachment byte total accepted for this send, not the compressed archive size. It may exceed the retained inline total after offloading."
21355
+ },
21356
+ "attachments_complete": {
21357
+ "type": "boolean",
21358
+ "description": "Whether attachments enumerates the complete original submitted attachment set, including zero-byte and inline CID parts. True requires no submitted payload-reference, offloaded, or visibility-filtered attachment to be omitted, retained content, and a published archive when the attachment inventory is nonempty. False or absent provides no completeness proof, including for legacy or discarded content. This field grants no download access and has no interaction semantics."
21359
+ },
21360
+ "attachments_download_available": {
21361
+ "type": "boolean",
21362
+ "description": "Whether an inline attachment archive has been successfully retained and is available for download. Download authorization is checked separately; address-bound agent connection keys cannot download archives."
21098
21363
  }
21099
21364
  }
21100
21365
  }]
@@ -21104,6 +21369,38 @@ const operationManifest = [
21104
21369
  "tag": "Sending",
21105
21370
  "tagCommand": "sending"
21106
21371
  },
21372
+ {
21373
+ "binaryResponse": true,
21374
+ "bodyRequired": false,
21375
+ "command": "download-sent-attachment-part",
21376
+ "description": "Pending service release. This contract does not establish live availability.\nDownloads the original bytes of one ordinary email attachment, selected by\nits metadata `part_index`, not its position in an attachments array. Refresh\nthe email detail after `attachment_changed` before choosing an index again.\nUses bearer authentication only; signed raw-email download tokens are not accepted.\nA paired-agent credential may read only mail sent from its claimed address.\nReceiving a copy does not authorize downloading another sender's sent content.\nFunction credentials are denied. Other bearer credentials retain their\nexisting email access boundaries. This endpoint serves email bytes only.\n",
21377
+ "hasJsonBody": false,
21378
+ "method": "GET",
21379
+ "operationId": "downloadSentAttachmentPart",
21380
+ "path": "/sent-emails/{id}/attachments/{part_index}",
21381
+ "pathParams": [{
21382
+ "description": "Resource UUID",
21383
+ "enum": null,
21384
+ "name": "id",
21385
+ "required": true,
21386
+ "type": "string"
21387
+ }, {
21388
+ "description": "The attachment metadata `part_index`, not its offset in the attachments array",
21389
+ "enum": null,
21390
+ "maximum": 2147483647,
21391
+ "minimum": 0,
21392
+ "name": "part_index",
21393
+ "required": true,
21394
+ "type": "integer"
21395
+ }],
21396
+ "queryParams": [],
21397
+ "requestSchema": null,
21398
+ "responseSchema": null,
21399
+ "sdkName": "downloadSentAttachmentPart",
21400
+ "summary": "Download one sent email attachment",
21401
+ "tag": "Sending",
21402
+ "tagCommand": "sending"
21403
+ },
21107
21404
  {
21108
21405
  "binaryResponse": false,
21109
21406
  "bodyRequired": false,
@@ -21572,6 +21869,53 @@ const operationManifest = [
21572
21869
  "body_html": {
21573
21870
  "type": ["string", "null"],
21574
21871
  "description": "HTML body sent on the wire. Null when the send\ncarried only a plain-text body, or when bodies\nhave been discarded post-send.\n"
21872
+ },
21873
+ "attachments": {
21874
+ "type": "array",
21875
+ "description": "Metadata for submitted inline attachments; download availability is reported separately. Metadata may exist when the archive is unavailable, and legacy sends may have no metadata. Offloaded payload files are not included in the inline archive.",
21876
+ "items": {
21877
+ "type": "object",
21878
+ "description": "Metadata for one submitted inline attachment.",
21879
+ "additionalProperties": true,
21880
+ "properties": {
21881
+ "filename": { "type": ["string", "null"] },
21882
+ "content_type": { "type": "string" },
21883
+ "size_bytes": {
21884
+ "type": "integer",
21885
+ "minimum": 0,
21886
+ "maximum": 9007199254740991
21887
+ },
21888
+ "sha256": { "type": "string" },
21889
+ "part_index": {
21890
+ "type": "integer",
21891
+ "minimum": 0,
21892
+ "maximum": 9007199254740991
21893
+ },
21894
+ "tar_path": { "type": "string" }
21895
+ },
21896
+ "required": [
21897
+ "filename",
21898
+ "content_type",
21899
+ "size_bytes",
21900
+ "sha256",
21901
+ "part_index",
21902
+ "tar_path"
21903
+ ]
21904
+ }
21905
+ },
21906
+ "attachments_size_bytes": {
21907
+ "type": "integer",
21908
+ "minimum": 0,
21909
+ "maximum": 9007199254740991,
21910
+ "description": "Original decoded attachment byte total accepted for this send, not the compressed archive size. It may exceed the retained inline total after offloading."
21911
+ },
21912
+ "attachments_complete": {
21913
+ "type": "boolean",
21914
+ "description": "Whether attachments enumerates the complete original submitted attachment set, including zero-byte and inline CID parts. True requires no submitted payload-reference, offloaded, or visibility-filtered attachment to be omitted, retained content, and a published archive when the attachment inventory is nonempty. False or absent provides no completeness proof, including for legacy or discarded content. This field grants no download access and has no interaction semantics."
21915
+ },
21916
+ "attachments_download_available": {
21917
+ "type": "boolean",
21918
+ "description": "Whether an inline attachment archive has been successfully retained and is available for download. Download authorization is checked separately; address-bound agent connection keys cannot download archives."
21575
21919
  }
21576
21920
  }
21577
21921
  }]
@@ -22296,6 +22640,53 @@ const operationManifest = [
22296
22640
  "body_html": {
22297
22641
  "type": ["string", "null"],
22298
22642
  "description": "HTML body sent on the wire. Null when the send\ncarried only a plain-text body, or when bodies\nhave been discarded post-send.\n"
22643
+ },
22644
+ "attachments": {
22645
+ "type": "array",
22646
+ "description": "Metadata for submitted inline attachments; download availability is reported separately. Metadata may exist when the archive is unavailable, and legacy sends may have no metadata. Offloaded payload files are not included in the inline archive.",
22647
+ "items": {
22648
+ "type": "object",
22649
+ "description": "Metadata for one submitted inline attachment.",
22650
+ "additionalProperties": true,
22651
+ "properties": {
22652
+ "filename": { "type": ["string", "null"] },
22653
+ "content_type": { "type": "string" },
22654
+ "size_bytes": {
22655
+ "type": "integer",
22656
+ "minimum": 0,
22657
+ "maximum": 9007199254740991
22658
+ },
22659
+ "sha256": { "type": "string" },
22660
+ "part_index": {
22661
+ "type": "integer",
22662
+ "minimum": 0,
22663
+ "maximum": 9007199254740991
22664
+ },
22665
+ "tar_path": { "type": "string" }
22666
+ },
22667
+ "required": [
22668
+ "filename",
22669
+ "content_type",
22670
+ "size_bytes",
22671
+ "sha256",
22672
+ "part_index",
22673
+ "tar_path"
22674
+ ]
22675
+ }
22676
+ },
22677
+ "attachments_size_bytes": {
22678
+ "type": "integer",
22679
+ "minimum": 0,
22680
+ "maximum": 9007199254740991,
22681
+ "description": "Original decoded attachment byte total accepted for this send, not the compressed archive size. It may exceed the retained inline total after offloading."
22682
+ },
22683
+ "attachments_complete": {
22684
+ "type": "boolean",
22685
+ "description": "Whether attachments enumerates the complete original submitted attachment set, including zero-byte and inline CID parts. True requires no submitted payload-reference, offloaded, or visibility-filtered attachment to be omitted, retained content, and a published archive when the attachment inventory is nonempty. False or absent provides no completeness proof, including for legacy or discarded content. This field grants no download access and has no interaction semantics."
22686
+ },
22687
+ "attachments_download_available": {
22688
+ "type": "boolean",
22689
+ "description": "Whether an inline attachment archive has been successfully retained and is available for download. Download authorization is checked separately; address-bound agent connection keys cannot download archives."
22299
22690
  }
22300
22691
  }
22301
22692
  }]
@@ -1,2 +1,2 @@
1
- import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-CJqzx713.js";
1
+ import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-B7L4E0zP.js";
2
2
  export { type ParseFromHeaderFailureReason, type ParseFromHeaderResult, type ParsedAddress, type ValidatedAddress, parseFromHeader, parseFromHeaderLoose };
@@ -1,5 +1,5 @@
1
1
  import { I as WebhookAttachment, l as EmailAddress, w as ParsedDataComplete } from "../types-DcXtFARL.js";
2
- import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-CJqzx713.js";
2
+ import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-B7L4E0zP.js";
3
3
 
4
4
  //#region src/parser/attachment-parser.d.ts
5
5
  interface ParsedAttachment {
@@ -1,2 +1,2 @@
1
- import { a as pushFile, i as pushBytes, n as fetchManifest, r as pullFile, t as encodeManifest } from "../payloads-CQtSsUT6.js";
1
+ import { a as pushFile, i as pushBytes, n as fetchManifest, r as pullFile, t as encodeManifest } from "../payloads-BfJAtqW9.js";
2
2
  export { encodeManifest, fetchManifest, pullFile, pushBytes, pushFile };
@@ -33,7 +33,9 @@ const MANIFEST_VERSION = 1;
33
33
  const CHUNK_KDF_INFO = "payloads-chunk";
34
34
  const OBJECT_ID_BYTES = 16;
35
35
  const CEK_BYTES = 32;
36
- const subtle = globalThis.crypto.subtle;
36
+ function subtle() {
37
+ return globalThis.crypto.subtle;
38
+ }
37
39
  const textEncoder = new TextEncoder();
38
40
  function randomBytes(length) {
39
41
  const out = new Uint8Array(length);
@@ -53,7 +55,7 @@ function fromHex(hex) {
53
55
  return out;
54
56
  }
55
57
  async function contentHash(bytes) {
56
- return new Uint8Array(await subtle.digest("SHA-256", bytes));
58
+ return new Uint8Array(await subtle().digest("SHA-256", bytes));
57
59
  }
58
60
  async function contentHashHex(bytes) {
59
61
  return toHex(await contentHash(bytes));
@@ -77,9 +79,9 @@ async function merkleRoot(leafHashesHex) {
77
79
  return toHex(level[0]);
78
80
  }
79
81
  async function deriveChunkKey(cek, index) {
80
- const baseKey = await subtle.importKey("raw", cek, "HKDF", false, ["deriveKey"]);
82
+ const baseKey = await subtle().importKey("raw", cek, "HKDF", false, ["deriveKey"]);
81
83
  const info = textEncoder.encode(`${CHUNK_KDF_INFO}:${index}`);
82
- return subtle.deriveKey({
84
+ return subtle().deriveKey({
83
85
  name: "HKDF",
84
86
  hash: "SHA-256",
85
87
  salt: new Uint8Array(32),
@@ -102,7 +104,7 @@ function chunkAad(objectId, index) {
102
104
  }
103
105
  async function encryptChunk(cek, objectId, index, plaintext) {
104
106
  const key = await deriveChunkKey(cek, index);
105
- const ct = await subtle.encrypt({
107
+ const ct = await subtle().encrypt({
106
108
  name: "AES-GCM",
107
109
  iv: chunkNonce(index),
108
110
  additionalData: chunkAad(objectId, index)
@@ -111,7 +113,7 @@ async function encryptChunk(cek, objectId, index, plaintext) {
111
113
  }
112
114
  async function decryptChunk(cek, objectId, index, ciphertext) {
113
115
  const key = await deriveChunkKey(cek, index);
114
- const pt = await subtle.decrypt({
116
+ const pt = await subtle().decrypt({
115
117
  name: "AES-GCM",
116
118
  iv: chunkNonce(index),
117
119
  additionalData: chunkAad(objectId, index)