@tinycloud/sdk-core 2.11.0-beta.1 → 2.11.0-beta.10

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.
@@ -18,8 +18,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var bootstrap_exports = {};
19
19
  module.exports = __toCommonJS(bootstrap_exports);
20
20
  __reExport(bootstrap_exports, require("@tinycloud/bootstrap"), module.exports);
21
- // Annotate the CommonJS export names for ESM import in node:
22
- 0 && (module.exports = {
23
- ...require("@tinycloud/bootstrap")
24
- });
25
21
  //# sourceMappingURL=index.cjs.map
@@ -35,10 +35,12 @@ __export(delegations_exports, {
35
35
  DelegationErrorCodes: () => DelegationErrorCodes,
36
36
  DelegationManager: () => DelegationManager,
37
37
  EncodedShareDataSchema: () => EncodedShareDataSchema,
38
+ EncryptedSenderShareHistory: () => import_share_sdk.EncryptedSenderShareHistory,
38
39
  MAX_CONTENT_BYTES: () => MAX_CONTENT_BYTES,
39
40
  MAX_SEALED_SHARE_CONTENT_BYTES: () => MAX_SEALED_SHARE_CONTENT_BYTES,
40
41
  MAX_SHARE_ARTIFACT_BYTES: () => MAX_SHARE_ARTIFACT_BYTES,
41
42
  MAX_SHARE_CONTENT_BYTES: () => MAX_SHARE_CONTENT_BYTES,
43
+ MemoryEncryptedShareHistoryStorage: () => import_share_sdk.MemoryEncryptedShareHistoryStorage,
42
44
  MemorySenderShareKeyStorage: () => MemorySenderShareKeyStorage,
43
45
  MemorySenderShareRecordStorage: () => MemorySenderShareRecordStorage,
44
46
  MemoryShareCache: () => MemoryShareCache,
@@ -53,6 +55,7 @@ __export(delegations_exports, {
53
55
  ShareConflict: () => ShareConflict,
54
56
  ShareEnvelopeError: () => ShareEnvelopeError,
55
57
  ShareNativeResponseSchema: () => ShareNativeResponseSchema,
58
+ ShareReceiveError: () => import_share_sdk2.ShareReceiveError,
56
59
  ShareRecipientClient: () => ShareRecipientClient,
57
60
  ShareRecipientClientOptionsSchema: () => ShareRecipientClientOptionsSchema,
58
61
  ShareRecipientPolicySchema: () => ShareRecipientPolicySchema,
@@ -60,7 +63,10 @@ __export(delegations_exports, {
60
63
  ShareResourceSchema: () => ShareResourceSchema,
61
64
  SharingService: () => SharingService,
62
65
  SharingServiceConfigSchema: () => SharingServiceConfigSchema,
66
+ authorizationMethodForTarget: () => import_share_sdk.authorizationMethodForTarget,
67
+ authorizeShare: () => import_share_sdk.authorizeShare,
63
68
  canonicalOwnerSharePolicy: () => canonicalOwnerSharePolicy,
69
+ claimShare: () => import_share_sdk.claimShare,
64
70
  computeOwnerShareRegistrationCid: () => computeOwnerShareRegistrationCid,
65
71
  computeShareCid: () => computeShareCid,
66
72
  createDelegatedShareKey: () => createDelegatedShareKey,
@@ -75,23 +81,37 @@ __export(delegations_exports, {
75
81
  encodeShareUrl: () => encodeShareUrl,
76
82
  encryptShareBytes: () => encryptShareBytes,
77
83
  encryptShareBytesAsync: () => encryptShareBytesAsync,
84
+ inspectShare: () => import_share_sdk2.inspectShare,
78
85
  intersectShareCapabilities: () => intersectShareCapabilities,
86
+ isLegacyShareLink: () => import_share_sdk.isLegacyShareLink,
79
87
  isV2ShareLink: () => isV2ShareLink,
88
+ listShares: () => import_share_sdk.listShares,
89
+ migrateShare: () => import_share_sdk.migrateShare,
80
90
  normalizeShareActions: () => normalizeShareActions,
81
91
  normalizeShareRecipientTarget: () => normalizeShareRecipientTarget,
82
92
  normalizeShareResource: () => normalizeShareResource,
93
+ notifyShare: () => import_share_sdk.notifyShare,
83
94
  parseShareArtifact: () => parseShareArtifact,
84
95
  parseShareUrl: () => parseShareUrl,
96
+ publishPolicyShare: () => import_share_sdk.publishPolicyShare,
97
+ publishTargetShare: () => import_share_sdk.publishTargetShare,
98
+ receiveLegacyShare: () => import_share_sdk.receiveLegacyShare,
99
+ receiveShare: () => import_share_sdk2.receiveShare,
85
100
  restoreDelegatedShareKey: () => restoreDelegatedShareKey,
101
+ resumeShareAuthorization: () => import_share_sdk.resumeShareAuthorization,
102
+ revokeShare: () => import_share_sdk.revokeShare,
86
103
  shareCapabilityAllows: () => shareCapabilityAllows,
87
104
  shareDeliveryTrustedKid: () => shareDeliveryTrustedKid,
105
+ showShare: () => import_share_sdk.showShare,
88
106
  signShareEnvelope: () => signShareEnvelope,
107
+ toShareErrorInfo: () => import_share_sdk2.toShareErrorInfo,
89
108
  validateEncodedShareData: () => validateEncodedShareData,
90
109
  validateOwnerSharePolicyRegistration: () => validateOwnerSharePolicyRegistration,
91
110
  validateOwnerSharePolicyRegistrationBytes: () => validateOwnerSharePolicyRegistrationBytes,
92
111
  validateReceiveOptions: () => validateReceiveOptions,
93
112
  validateShareDeliveryAuthorizationBytes: () => validateShareDeliveryAuthorizationBytes,
94
113
  validateSharingServiceConfig: () => validateSharingServiceConfig,
114
+ verifyBearerEnvelope: () => import_share_sdk2.verifyBearerEnvelope,
95
115
  verifyShareCid: () => verifyShareCid,
96
116
  verifyShareEnvelope: () => verifyShareEnvelope
97
117
  });
@@ -2244,13 +2264,12 @@ function digest(input, options) {
2244
2264
  }
2245
2265
  var identity2 = { code: code2, name, encode: encode4, digest };
2246
2266
 
2247
- // ../../node_modules/multiformats/dist/src/hashes/sha2.js
2248
- var sha2_exports = {};
2249
- __export(sha2_exports, {
2267
+ // ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
2268
+ var sha2_browser_exports = {};
2269
+ __export(sha2_browser_exports, {
2250
2270
  sha256: () => sha256,
2251
2271
  sha512: () => sha512
2252
2272
  });
2253
- var import_crypto = __toESM(require("crypto"), 1);
2254
2273
 
2255
2274
  // ../../node_modules/multiformats/dist/src/hashes/hasher.js
2256
2275
  var DEFAULT_MIN_DIGEST_LENGTH = 20;
@@ -2300,16 +2319,19 @@ function createDigest(digest4, code3, truncate) {
2300
2319
  return create(code3, digest4);
2301
2320
  }
2302
2321
 
2303
- // ../../node_modules/multiformats/dist/src/hashes/sha2.js
2322
+ // ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
2323
+ function sha(name2) {
2324
+ return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
2325
+ }
2304
2326
  var sha256 = from2({
2305
2327
  name: "sha2-256",
2306
2328
  code: 18,
2307
- encode: (input) => coerce(import_crypto.default.createHash("sha256").update(input).digest())
2329
+ encode: sha("SHA-256")
2308
2330
  });
2309
2331
  var sha512 = from2({
2310
2332
  name: "sha2-512",
2311
2333
  code: 19,
2312
- encode: (input) => coerce(import_crypto.default.createHash("sha512").update(input).digest())
2334
+ encode: sha("SHA-512")
2313
2335
  });
2314
2336
 
2315
2337
  // ../../node_modules/multiformats/dist/src/cid.js
@@ -2651,7 +2673,7 @@ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
2651
2673
 
2652
2674
  // ../../node_modules/multiformats/dist/src/basics.js
2653
2675
  var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
2654
- var hashes = { ...sha2_exports, ...identity_exports2 };
2676
+ var hashes = { ...sha2_browser_exports, ...identity_exports2 };
2655
2677
 
2656
2678
  // src/delegations/SharingService.ts
2657
2679
  var import_ed255193 = require("@noble/curves/ed25519");
@@ -2820,6 +2842,10 @@ function normalizeRecipient(recipient) {
2820
2842
  }
2821
2843
  return { kind: recipient.kind, value: domain };
2822
2844
  }
2845
+ if (recipient.kind === "recipientDid") {
2846
+ if (!isCanonicalRecipientDid(recipient.value)) throw new ShareEnvelopeError("invalid-envelope", "recipient DID is invalid");
2847
+ return { kind: recipient.kind, value: recipient.value };
2848
+ }
2823
2849
  const exact = recipient.value.trim();
2824
2850
  const at = exact.lastIndexOf("@");
2825
2851
  const normalizedExact = at > 0 ? `${exact.slice(0, at)}@${exact.slice(at + 1).toLowerCase()}` : exact;
@@ -2828,6 +2854,28 @@ function normalizeRecipient(recipient) {
2828
2854
  }
2829
2855
  return { kind: recipient.kind, value: normalizedExact };
2830
2856
  }
2857
+ function isCanonicalRecipientDid(value) {
2858
+ if (value.length === 0 || value.length > 2048 || /[\u0000-\u0020\u007f]/.test(value)) return false;
2859
+ const parts = value.split(":");
2860
+ if (parts.length < 3 || parts[0] !== "did" || !/^[a-z0-9]+$/.test(parts[1] ?? "")) return false;
2861
+ const identifier = parts.slice(2);
2862
+ if (identifier.some((part) => part.length === 0)) return false;
2863
+ if (parts[1] === "web") {
2864
+ const host = identifier[0] ?? "";
2865
+ if (host.length > 253 || host.split(".").some((label) => !label || label.length > 63 || !/^[A-Za-z0-9-]+$/.test(label) || label.startsWith("-") || label.endsWith("-"))) return false;
2866
+ return identifier.slice(1).every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
2867
+ }
2868
+ if (parts[1] === "pkh") return identifier.length >= 3 && identifier.every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
2869
+ if (parts[1] === "key") {
2870
+ try {
2871
+ const bytes2 = base58btc.decode(identifier.join(":"));
2872
+ return bytes2.length === 34 && bytes2[0] === 237 && bytes2[1] === 1;
2873
+ } catch {
2874
+ return false;
2875
+ }
2876
+ }
2877
+ return false;
2878
+ }
2831
2879
  function normalizeShareRecipientTarget(recipient) {
2832
2880
  const normalized = normalizeRecipient(recipient);
2833
2881
  if (normalized === void 0) throw new ShareEnvelopeError("invalid-envelope", "recipient matcher is required");
@@ -2914,9 +2962,9 @@ function verifyShareEnvelope(envelope, options = {}) {
2914
2962
  const recipient = normalizeRecipient(envelope.recipient);
2915
2963
  if (recipient !== void 0 && JSON.stringify(recipient) !== JSON.stringify(envelope.recipient)) throw new ShareEnvelopeError("invalid-envelope", "recipient is not canonical");
2916
2964
  if (recipient?.kind === "exactEmail" || recipient?.kind === "emailDomain") throw new ShareEnvelopeError("unsafe-plaintext", "recipient matchers are not public envelope fields");
2917
- if (envelope.recipientKind !== void 0 && !["exactEmail", "emailDomain", "bearer"].includes(envelope.recipientKind)) throw new ShareEnvelopeError("invalid-envelope", "recipient mode is invalid");
2965
+ if (envelope.recipientKind !== void 0 && !["exactEmail", "emailDomain", "recipientDid", "bearer"].includes(envelope.recipientKind)) throw new ShareEnvelopeError("invalid-envelope", "recipient mode is invalid");
2918
2966
  if (envelope.recipientKind === "bearer" && recipient?.kind !== void 0 && recipient.kind !== "bearer") throw new ShareEnvelopeError("invalid-envelope", "recipient mode does not match recipient");
2919
- if ((envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain") && !envelope.encrypted) throw new ShareEnvelopeError("unsafe-plaintext", "policy shares require encryption");
2967
+ if ((envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.recipientKind === "recipientDid") && !envelope.encrypted) throw new ShareEnvelopeError("unsafe-plaintext", "addressed shares require encryption");
2920
2968
  if (typeof envelope.spaceId !== "string" || envelope.spaceId.length === 0 || typeof envelope.content.mimeType !== "string" || envelope.content.mimeType.length === 0 || typeof envelope.content.digest !== "string" || !/^[A-Za-z0-9_-]+$/.test(envelope.content.digest)) throw new ShareEnvelopeError("invalid-envelope", "content metadata is invalid");
2921
2969
  const maxContentBytes = envelope.encrypted ? options.maxSealedContentBytes ?? MAX_SEALED_SHARE_CONTENT_BYTES : options.maxContentBytes ?? MAX_SHARE_CONTENT_BYTES;
2922
2970
  if (!Number.isInteger(envelope.content.size) || envelope.content.size < 0 || envelope.content.size > maxContentBytes) throw new ShareEnvelopeError("content-too-large", "share content exceeds the configured limit");
@@ -3055,7 +3103,7 @@ function parsePolicyMetadata(policyBytes, target, expectedExpiry) {
3055
3103
  assertKeys(policy, ["type", "version", "issuerDid", "recipientMatcher", "target", "delegation", "authority", "actions", "resource", "content-source", "expiresAt"], "published canonical policy material");
3056
3104
  if (typeof policy.issuerDid !== "string" || typeof policy.expiresAt !== "string" || policy.expiresAt !== expectedExpiry) throw new ShareEnvelopeError("invalid-envelope", "policy expiry is not bound to the envelope");
3057
3105
  const matcherValue = policy.recipientMatcher;
3058
- if (!isPlainObject(matcherValue) || matcherValue.kind !== "exactEmail" && matcherValue.kind !== "emailDomain" || typeof matcherValue.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
3106
+ if (!isPlainObject(matcherValue) || matcherValue.kind !== "exactEmail" && matcherValue.kind !== "emailDomain" && matcherValue.kind !== "recipientDid" || typeof matcherValue.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
3059
3107
  const matcher2 = normalizeRecipient(matcherValue);
3060
3108
  if (matcher2 === void 0 || matcher2.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
3061
3109
  if (!isPlainObject(policy.target)) throw new ShareEnvelopeError("invalid-envelope", "policy target is invalid");
@@ -3142,7 +3190,7 @@ function parseCanonicalPublishedV2(value, options) {
3142
3190
  if (!Number.isFinite(expiry) || expiry <= (options.now ?? /* @__PURE__ */ new Date()).getTime() || new Date(expiry).toISOString() !== value.expiry) throw new ShareEnvelopeError("expired", "published share envelope has expired");
3143
3191
  if (typeof delegation.cid !== "string" || typeof delegation.issuerDid !== "string" || typeof delegation.audience !== "string" || typeof delegation.expiresAt !== "string" || Date.parse(delegation.expiresAt) > expiry) throw new ShareEnvelopeError("invalid-envelope", "published v2 delegation is invalid");
3144
3192
  const matcher = value.recipientMatcher;
3145
- if (!isPlainObject(matcher) || matcher.kind !== "exactEmail" && matcher.kind !== "emailDomain" || typeof matcher.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
3193
+ if (!isPlainObject(matcher) || matcher.kind !== "exactEmail" && matcher.kind !== "emailDomain" && matcher.kind !== "recipientDid" || typeof matcher.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
3146
3194
  const normalizedMatcher = normalizeRecipient(matcher);
3147
3195
  if (normalizedMatcher === void 0 || normalizedMatcher.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
3148
3196
  if (!Array.isArray(value.actions)) throw new ShareEnvelopeError("invalid-envelope", "published v2 actions are invalid");
@@ -3583,10 +3631,11 @@ var ShareConflict = class extends Error {
3583
3631
  }
3584
3632
  };
3585
3633
  var ShareAccessError = class extends Error {
3586
- constructor(code3, message) {
3634
+ constructor(code3, message, details) {
3587
3635
  super(message ?? "shared access could not be completed");
3588
3636
  this.name = "ShareAccessError";
3589
3637
  this.code = code3;
3638
+ this.details = details;
3590
3639
  }
3591
3640
  };
3592
3641
 
@@ -3595,6 +3644,7 @@ var import_zod3 = require("zod");
3595
3644
  var ShareRecipientTargetSchema = import_zod3.z.discriminatedUnion("kind", [
3596
3645
  import_zod3.z.object({ kind: import_zod3.z.literal("exactEmail"), value: import_zod3.z.string().min(1) }).strict(),
3597
3646
  import_zod3.z.object({ kind: import_zod3.z.literal("emailDomain"), value: import_zod3.z.string().min(1) }).strict(),
3647
+ import_zod3.z.object({ kind: import_zod3.z.literal("recipientDid"), value: import_zod3.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict(),
3598
3648
  import_zod3.z.object({ kind: import_zod3.z.literal("bearer") }).strict()
3599
3649
  ]);
3600
3650
  var ShareResourceSchema = import_zod3.z.discriminatedUnion("kind", [
@@ -3638,7 +3688,8 @@ var ShareContentSourceSchema = import_zod3.z.discriminatedUnion("kind", [
3638
3688
  ]);
3639
3689
  var ShareAddressedRecipientSchema = import_zod3.z.discriminatedUnion("kind", [
3640
3690
  import_zod3.z.object({ kind: import_zod3.z.literal("exactEmail"), value: import_zod3.z.string().min(1) }).strict(),
3641
- import_zod3.z.object({ kind: import_zod3.z.literal("emailDomain"), value: import_zod3.z.string().min(1) }).strict()
3691
+ import_zod3.z.object({ kind: import_zod3.z.literal("emailDomain"), value: import_zod3.z.string().min(1) }).strict(),
3692
+ import_zod3.z.object({ kind: import_zod3.z.literal("recipientDid"), value: import_zod3.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict()
3642
3693
  ]);
3643
3694
  var ShareAddressedDelegationRequestV2Schema = import_zod3.z.object({
3644
3695
  version: import_zod3.z.literal(2),
@@ -3893,12 +3944,21 @@ var ShareRecipientClient = class {
3893
3944
  const { envelope } = resolved.artifact;
3894
3945
  const { location } = resolved;
3895
3946
  const bearer = isBearerEnvelope(envelope);
3896
- const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain";
3947
+ const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.authorizationTargetKind === "recipientDid";
3897
3948
  const legacyBearer = !policy && envelope.recipientKind === void 0;
3898
- if (envelope.authorizationTargetKind === "recipientDid") throw new ShareAccessError("SHARE_RECIPIENT_DID_UNSUPPORTED");
3949
+ let recipientDidSession;
3950
+ if (envelope.authorizationTargetKind === "recipientDid") {
3951
+ if (this.options.establishRecipientDidSession === void 0) throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required");
3952
+ const authorization = await this.options.establishRecipientDidSession({ envelope, recipientDid: envelope.recipient?.kind === "recipientDid" ? envelope.recipient.value : "" });
3953
+ if ("state" in authorization) {
3954
+ if (authorization.state === "authorization-required") throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required", authorization);
3955
+ throw new ShareAccessError("SHARE_DENIED", "recipient DID authorization was denied", authorization);
3956
+ }
3957
+ recipientDidSession = authorization;
3958
+ }
3899
3959
  if (policy && this.options.bearerSession !== void 0) throw new ShareAccessError("SHARE_POLICY_BEARER_MISMATCH");
3900
3960
  if (bearer && this.options.presentation !== void 0) throw new ShareAccessError("SHARE_BEARER_PRESENTATION_MISMATCH");
3901
- const session = bearer || legacyBearer ? this.options.bearerSession : policy && this.options.establishPolicySession !== void 0 ? await this.options.establishPolicySession({ envelope, presentation: this.options.presentation }) : policy ? await this.establishPolicySession(envelope) : void 0;
3961
+ const session = bearer || legacyBearer ? this.options.bearerSession : recipientDidSession ? recipientDidSession : policy && this.options.establishPolicySession !== void 0 ? await this.options.establishPolicySession({ envelope, presentation: this.options.presentation }) : policy ? await this.establishPolicySession(envelope) : void 0;
3902
3962
  const kv = bearer || legacyBearer ? session === void 0 ? void 0 : this.createKV(envelope.origin, session) : void 0;
3903
3963
  const policySession = policy ? session : void 0;
3904
3964
  if (policySession !== void 0) this.assertProvidedPolicySession(policySession, envelope);
@@ -5801,10 +5861,6 @@ var import_sha2564 = require("@noble/hashes/sha256");
5801
5861
 
5802
5862
  // src/policy/signed-object.ts
5803
5863
  var import_ed255194 = require("@noble/curves/ed25519");
5804
- var import_viem3 = require("viem");
5805
-
5806
- // src/policy/capability.ts
5807
- var import_bootstrap = require("@tinycloud/bootstrap");
5808
5864
  var import_viem2 = require("viem");
5809
5865
 
5810
5866
  // src/policy/errors.ts
@@ -6003,33 +6059,11 @@ function assertUnicodeScalarString(value, path) {
6003
6059
  }
6004
6060
  }
6005
6061
 
6006
- // src/policy/capability.ts
6062
+ // src/policy/signed-object.ts
6007
6063
  var textEncoder2 = new TextEncoder();
6008
6064
  var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
6009
6065
  Object.prototype.hasOwnProperty
6010
6066
  );
6011
- var CEILING_SERVICES = /* @__PURE__ */ new Set(["tinycloud.kv", "tinycloud.sql", "tinycloud.vfs"]);
6012
- var GRANTABLE_ACTIONS = /* @__PURE__ */ new Map();
6013
- for (const entry of import_bootstrap.CAPABILITY_REGISTRY) {
6014
- if (!CEILING_SERVICES.has(entry.service)) {
6015
- continue;
6016
- }
6017
- if (entry.aliasOf !== void 0 || entry.implies !== void 0 || entry.urn.endsWith("/*")) {
6018
- continue;
6019
- }
6020
- const existing = GRANTABLE_ACTIONS.get(entry.service);
6021
- if (existing === void 0) {
6022
- GRANTABLE_ACTIONS.set(entry.service, /* @__PURE__ */ new Set([entry.urn]));
6023
- continue;
6024
- }
6025
- existing.add(entry.urn);
6026
- }
6027
-
6028
- // src/policy/signed-object.ts
6029
- var textEncoder3 = new TextEncoder();
6030
- var objectHasOwn3 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
6031
- Object.prototype.hasOwnProperty
6032
- );
6033
6067
  function canonicalizeSignedObjectUnsigned(input) {
6034
6068
  return jcsCanonicalize(input);
6035
6069
  }
@@ -6336,7 +6370,7 @@ function validateShareDeliveryAuthorizationBytes(bytesValue, expected) {
6336
6370
  const authorization = assertObject2(root.authorization, AUTHORIZATION_KEYS, "share delivery authorization");
6337
6371
  const proof = assertObject2(root.proof, ["alg", "kid", "signature"], "share delivery authorization proof");
6338
6372
  const request = expected.request;
6339
- if (authorization.type !== "TinyCloudShareDeliveryAuthorization" || authorization.version !== 2 || authorization.dataAuthority !== false || authorization.jti !== request.jti || authorization.shareCid !== request.shareCid || authorization.shareId !== request.shareId || authorization.registrationCid !== request.registrationCid || authorization.delegationCid !== request.delegationCid || authorization.enforcementDelegationCid !== request.enforcementDelegationCid || authorization.envelopeCid !== request.envelopeCid || authorization.policyCid !== request.policyCid || authorization.deliveryEmail !== request.recipientEmail || authorization.shareUrl !== request.shareUrl || authorization.documentName !== request.documentName || authorization.requestBodyDigest !== request.requestBodyDigest || authorization.expiresAt !== request.expiresAt || authorization.idempotencyKey !== request.jti || authorization.reportAbuseToken !== request.jti || authorization.authorityMaterialHandle !== request.registrationCid) {
6373
+ if (authorization.type !== "TinyCloudShareDeliveryAuthorization" || authorization.version !== 2 || authorization.dataAuthority !== false || authorization.jti !== request.jti || authorization.shareCid !== request.shareCid || authorization.shareId !== request.shareId || authorization.registrationCid !== request.registrationCid || authorization.delegationCid !== request.delegationCid || authorization.enforcementDelegationCid !== request.enforcementDelegationCid || authorization.envelopeCid !== request.envelopeCid || authorization.policyCid !== request.policyCid || authorization.deliveryEmail !== request.recipientEmail || authorization.shareUrl !== request.shareUrl || authorization.documentName !== request.documentName || authorization.requestBodyDigest !== request.requestBodyDigest || authorization.expiresAt !== request.expiresAt || authorization.idempotencyKey !== request.idempotencyKey || authorization.reportAbuseToken !== request.jti || authorization.authorityMaterialHandle !== request.registrationCid) {
6340
6374
  throw new Error("share delivery authorization is not bound to the submitted request");
6341
6375
  }
6342
6376
  if (typeof authorization.issuedAt !== "string" || Date.parse(authorization.issuedAt) > Date.now() + 6e4) throw new Error("share delivery authorization issuedAt is invalid");
@@ -6470,69 +6504,8 @@ var SenderShareStore = class {
6470
6504
  await this.keys.delete(shareId);
6471
6505
  }
6472
6506
  };
6473
- // Annotate the CommonJS export names for ESM import in node:
6474
- 0 && (module.exports = {
6475
- DelegationErrorCodes,
6476
- DelegationManager,
6477
- EncodedShareDataSchema,
6478
- MAX_CONTENT_BYTES,
6479
- MAX_SEALED_SHARE_CONTENT_BYTES,
6480
- MAX_SHARE_ARTIFACT_BYTES,
6481
- MAX_SHARE_CONTENT_BYTES,
6482
- MemorySenderShareKeyStorage,
6483
- MemorySenderShareRecordStorage,
6484
- MemoryShareCache,
6485
- ReceiveOptionsSchema,
6486
- SHARE_DELIVERY_AUTHORIZATION_DOMAIN,
6487
- SenderShareStore,
6488
- ShareAccessError,
6489
- ShareActionSchema,
6490
- ShareAddressedDelegationEnvelopeV2Schema,
6491
- ShareAddressedDelegationRequestV2Schema,
6492
- ShareAddressedDelegationResponseV2Schema,
6493
- ShareConflict,
6494
- ShareEnvelopeError,
6495
- ShareNativeResponseSchema,
6496
- ShareRecipientClient,
6497
- ShareRecipientClientOptionsSchema,
6498
- ShareRecipientPolicySchema,
6499
- ShareRecipientTargetSchema,
6500
- ShareResourceSchema,
6501
- SharingService,
6502
- SharingServiceConfigSchema,
6503
- canonicalOwnerSharePolicy,
6504
- computeOwnerShareRegistrationCid,
6505
- computeShareCid,
6506
- createDelegatedShareKey,
6507
- createPolicyEnforcementDelegation,
6508
- createShareArtifact,
6509
- createShareArtifactAsync,
6510
- createSharePolicy,
6511
- createSharingService,
6512
- decryptShareBytesAsync,
6513
- encodeInlineShareUrl,
6514
- encodeShareArtifact,
6515
- encodeShareUrl,
6516
- encryptShareBytes,
6517
- encryptShareBytesAsync,
6518
- intersectShareCapabilities,
6519
- isV2ShareLink,
6520
- normalizeShareActions,
6521
- normalizeShareRecipientTarget,
6522
- normalizeShareResource,
6523
- parseShareArtifact,
6524
- parseShareUrl,
6525
- restoreDelegatedShareKey,
6526
- shareCapabilityAllows,
6527
- shareDeliveryTrustedKid,
6528
- signShareEnvelope,
6529
- validateEncodedShareData,
6530
- validateOwnerSharePolicyRegistration,
6531
- validateOwnerSharePolicyRegistrationBytes,
6532
- validateReceiveOptions,
6533
- validateShareDeliveryAuthorizationBytes,
6534
- validateSharingServiceConfig,
6535
- verifyShareCid,
6536
- verifyShareEnvelope
6537
- });
6507
+
6508
+ // src/delegations/index.ts
6509
+ var import_share_sdk = require("@tinycloud/share-sdk");
6510
+ var import_share_sdk2 = require("@tinycloud/share-sdk");
6538
6511
  //# sourceMappingURL=index.cjs.map