@tinycloud/share-sdk 1.2.0-beta.3 → 1.2.0-beta.5

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.
@@ -1,5 +1,6 @@
1
1
  import { CompactUcanAuthorization, UnifiedContentSource } from '@tinycloud/share-envelope';
2
- import { C as CreateOwnerDelegationParams, r as OwnerDelegationReceipt, A as AddressedOwnerRootInput, i as AddressedOwnerRootReceipt, D as DelegatedShareKey, l as AddressedPublishAuthority } from './addressed-publish-CsUS7-SI.cjs';
2
+ import { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, i as AddressedPublishAuthority } from './addressed-publish-DtcLNG2m.cjs';
3
+ import { C as CreateOwnerDelegationParams, c as OwnerDelegationReceipt, a as DelegatedShareKey } from './owner-policy-BqzRlkb6.cjs';
3
4
 
4
5
  /**
5
6
  * The fields of an owner-signed SIWE CACAO that bound its authority. Read
@@ -1,5 +1,6 @@
1
1
  import { CompactUcanAuthorization, UnifiedContentSource } from '@tinycloud/share-envelope';
2
- import { C as CreateOwnerDelegationParams, r as OwnerDelegationReceipt, A as AddressedOwnerRootInput, i as AddressedOwnerRootReceipt, D as DelegatedShareKey, l as AddressedPublishAuthority } from './addressed-publish-CsUS7-SI.js';
2
+ import { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, i as AddressedPublishAuthority } from './addressed-publish-BnSBJ-MX.js';
3
+ import { C as CreateOwnerDelegationParams, c as OwnerDelegationReceipt, a as DelegatedShareKey } from './owner-policy-BqzRlkb6.js';
3
4
 
4
5
  /**
5
6
  * The fields of an owner-signed SIWE CACAO that bound its authority. Read
@@ -5312,6 +5312,20 @@ var v3TargetSchema = external_exports.object({
5312
5312
  nodeAudience: external_exports.string().min(1),
5313
5313
  spaceId: external_exports.string().refine(isCanonicalPathSegment, { message: "expected a canonical space id" })
5314
5314
  }).strict();
5315
+ var ARTIFACT_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{2,62}$/;
5316
+ var artifactPinSchema = external_exports.object({
5317
+ v: external_exports.literal(1),
5318
+ artifactId: external_exports.string().regex(ARTIFACT_ID_PATTERN),
5319
+ version: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER),
5320
+ /** SHA-256 (lowercase hex) of the exact `manifest.json` bytes. The manifest itself stays an owner-side record. */
5321
+ manifestSha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
5322
+ /** An addressed share reads one exact file, so exactly one entry: the stored bytes (ciphertext) it will fetch. */
5323
+ files: external_exports.array(external_exports.object({
5324
+ path: external_exports.string().min(1).max(255),
5325
+ sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
5326
+ bytes: external_exports.number().int().nonnegative()
5327
+ }).strict()).length(1)
5328
+ }).strict();
5315
5329
  var unsignedShareEnvelopeV3BaseSchema = external_exports.object({
5316
5330
  version: external_exports.literal(3),
5317
5331
  shareId: external_exports.string().min(1),
@@ -5331,7 +5345,13 @@ var unsignedShareEnvelopeV3BaseSchema = external_exports.object({
5331
5345
  expiry: external_exports.string().datetime({ offset: true }),
5332
5346
  display: displaySchema,
5333
5347
  encrypted: external_exports.literal(true),
5334
- metadata: contentMetadataSchema
5348
+ metadata: contentMetadataSchema,
5349
+ /**
5350
+ * TC-1428: an owner-signed statement that this share reads one write-once artifact version. Additive: absent on
5351
+ * every other share, and covered by the envelope signature because the signature spans the whole unsigned object.
5352
+ * The shape is checked here; its binding to the content source is `verifyArtifactShare` in share-sdk.
5353
+ */
5354
+ artifactPin: artifactPinSchema.optional()
5335
5355
  }).strict();
5336
5356
  function validateV3Invariants(value, ctx) {
5337
5357
  const actions = [...value.actions];
@@ -6985,6 +7005,8 @@ async function ensureShareRoot(input) {
6985
7005
 
6986
7006
  // src/artifact.ts
6987
7007
  import { sha256 as sha2564 } from "@noble/hashes/sha256";
7008
+
7009
+ // src/artifact-core.ts
6988
7010
  function parseArtifactVersionPath(path) {
6989
7011
  const match = /^artifacts\/([a-z0-9][a-z0-9_-]{2,62})\/versions\/([1-9][0-9]{0,14})\/([^/]+)$/.exec(path);
6990
7012
  if (match === null) return void 0;