@tinycloud/sdk-core 2.11.0-beta.5 → 2.11.0-beta.8
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/delegations/index.cjs +93 -37
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +3 -2
- package/dist/delegations/index.d.ts +3 -2
- package/dist/delegations/index.js +99 -41
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +52 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +74 -10
- package/dist/index.js.map +1 -1
- package/dist/{recipient-types.schema-CWIt63Qp.d.cts → recipient-types.schema-D5pDlIqn.d.cts} +82 -1
- package/dist/{recipient-types.schema-CWIt63Qp.d.ts → recipient-types.schema-D5pDlIqn.d.ts} +82 -1
- package/package.json +6 -3
|
@@ -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
|
});
|
|
@@ -2820,6 +2840,10 @@ function normalizeRecipient(recipient) {
|
|
|
2820
2840
|
}
|
|
2821
2841
|
return { kind: recipient.kind, value: domain };
|
|
2822
2842
|
}
|
|
2843
|
+
if (recipient.kind === "recipientDid") {
|
|
2844
|
+
if (!isCanonicalRecipientDid(recipient.value)) throw new ShareEnvelopeError("invalid-envelope", "recipient DID is invalid");
|
|
2845
|
+
return { kind: recipient.kind, value: recipient.value };
|
|
2846
|
+
}
|
|
2823
2847
|
const exact = recipient.value.trim();
|
|
2824
2848
|
const at = exact.lastIndexOf("@");
|
|
2825
2849
|
const normalizedExact = at > 0 ? `${exact.slice(0, at)}@${exact.slice(at + 1).toLowerCase()}` : exact;
|
|
@@ -2828,6 +2852,28 @@ function normalizeRecipient(recipient) {
|
|
|
2828
2852
|
}
|
|
2829
2853
|
return { kind: recipient.kind, value: normalizedExact };
|
|
2830
2854
|
}
|
|
2855
|
+
function isCanonicalRecipientDid(value) {
|
|
2856
|
+
if (value.length === 0 || value.length > 2048 || /[\u0000-\u0020\u007f]/.test(value)) return false;
|
|
2857
|
+
const parts = value.split(":");
|
|
2858
|
+
if (parts.length < 3 || parts[0] !== "did" || !/^[a-z0-9]+$/.test(parts[1] ?? "")) return false;
|
|
2859
|
+
const identifier = parts.slice(2);
|
|
2860
|
+
if (identifier.some((part) => part.length === 0)) return false;
|
|
2861
|
+
if (parts[1] === "web") {
|
|
2862
|
+
const host = identifier[0] ?? "";
|
|
2863
|
+
if (host.length > 253 || host.split(".").some((label) => !label || label.length > 63 || !/^[A-Za-z0-9-]+$/.test(label) || label.startsWith("-") || label.endsWith("-"))) return false;
|
|
2864
|
+
return identifier.slice(1).every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
2865
|
+
}
|
|
2866
|
+
if (parts[1] === "pkh") return identifier.length >= 3 && identifier.every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
2867
|
+
if (parts[1] === "key") {
|
|
2868
|
+
try {
|
|
2869
|
+
const bytes2 = base58btc.decode(identifier.join(":"));
|
|
2870
|
+
return bytes2.length === 34 && bytes2[0] === 237 && bytes2[1] === 1;
|
|
2871
|
+
} catch {
|
|
2872
|
+
return false;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
return false;
|
|
2876
|
+
}
|
|
2831
2877
|
function normalizeShareRecipientTarget(recipient) {
|
|
2832
2878
|
const normalized = normalizeRecipient(recipient);
|
|
2833
2879
|
if (normalized === void 0) throw new ShareEnvelopeError("invalid-envelope", "recipient matcher is required");
|
|
@@ -2914,9 +2960,9 @@ function verifyShareEnvelope(envelope, options = {}) {
|
|
|
2914
2960
|
const recipient = normalizeRecipient(envelope.recipient);
|
|
2915
2961
|
if (recipient !== void 0 && JSON.stringify(recipient) !== JSON.stringify(envelope.recipient)) throw new ShareEnvelopeError("invalid-envelope", "recipient is not canonical");
|
|
2916
2962
|
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");
|
|
2963
|
+
if (envelope.recipientKind !== void 0 && !["exactEmail", "emailDomain", "recipientDid", "bearer"].includes(envelope.recipientKind)) throw new ShareEnvelopeError("invalid-envelope", "recipient mode is invalid");
|
|
2918
2964
|
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", "
|
|
2965
|
+
if ((envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.recipientKind === "recipientDid") && !envelope.encrypted) throw new ShareEnvelopeError("unsafe-plaintext", "addressed shares require encryption");
|
|
2920
2966
|
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
2967
|
const maxContentBytes = envelope.encrypted ? options.maxSealedContentBytes ?? MAX_SEALED_SHARE_CONTENT_BYTES : options.maxContentBytes ?? MAX_SHARE_CONTENT_BYTES;
|
|
2922
2968
|
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 +3101,7 @@ function parsePolicyMetadata(policyBytes, target, expectedExpiry) {
|
|
|
3055
3101
|
assertKeys(policy, ["type", "version", "issuerDid", "recipientMatcher", "target", "delegation", "authority", "actions", "resource", "content-source", "expiresAt"], "published canonical policy material");
|
|
3056
3102
|
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
3103
|
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");
|
|
3104
|
+
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
3105
|
const matcher2 = normalizeRecipient(matcherValue);
|
|
3060
3106
|
if (matcher2 === void 0 || matcher2.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
|
|
3061
3107
|
if (!isPlainObject(policy.target)) throw new ShareEnvelopeError("invalid-envelope", "policy target is invalid");
|
|
@@ -3142,7 +3188,7 @@ function parseCanonicalPublishedV2(value, options) {
|
|
|
3142
3188
|
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
3189
|
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
3190
|
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");
|
|
3191
|
+
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
3192
|
const normalizedMatcher = normalizeRecipient(matcher);
|
|
3147
3193
|
if (normalizedMatcher === void 0 || normalizedMatcher.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
|
|
3148
3194
|
if (!Array.isArray(value.actions)) throw new ShareEnvelopeError("invalid-envelope", "published v2 actions are invalid");
|
|
@@ -3583,10 +3629,11 @@ var ShareConflict = class extends Error {
|
|
|
3583
3629
|
}
|
|
3584
3630
|
};
|
|
3585
3631
|
var ShareAccessError = class extends Error {
|
|
3586
|
-
constructor(code3, message) {
|
|
3632
|
+
constructor(code3, message, details) {
|
|
3587
3633
|
super(message ?? "shared access could not be completed");
|
|
3588
3634
|
this.name = "ShareAccessError";
|
|
3589
3635
|
this.code = code3;
|
|
3636
|
+
this.details = details;
|
|
3590
3637
|
}
|
|
3591
3638
|
};
|
|
3592
3639
|
|
|
@@ -3595,6 +3642,7 @@ var import_zod3 = require("zod");
|
|
|
3595
3642
|
var ShareRecipientTargetSchema = import_zod3.z.discriminatedUnion("kind", [
|
|
3596
3643
|
import_zod3.z.object({ kind: import_zod3.z.literal("exactEmail"), value: import_zod3.z.string().min(1) }).strict(),
|
|
3597
3644
|
import_zod3.z.object({ kind: import_zod3.z.literal("emailDomain"), value: import_zod3.z.string().min(1) }).strict(),
|
|
3645
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("recipientDid"), value: import_zod3.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict(),
|
|
3598
3646
|
import_zod3.z.object({ kind: import_zod3.z.literal("bearer") }).strict()
|
|
3599
3647
|
]);
|
|
3600
3648
|
var ShareResourceSchema = import_zod3.z.discriminatedUnion("kind", [
|
|
@@ -3638,7 +3686,8 @@ var ShareContentSourceSchema = import_zod3.z.discriminatedUnion("kind", [
|
|
|
3638
3686
|
]);
|
|
3639
3687
|
var ShareAddressedRecipientSchema = import_zod3.z.discriminatedUnion("kind", [
|
|
3640
3688
|
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()
|
|
3689
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("emailDomain"), value: import_zod3.z.string().min(1) }).strict(),
|
|
3690
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("recipientDid"), value: import_zod3.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict()
|
|
3642
3691
|
]);
|
|
3643
3692
|
var ShareAddressedDelegationRequestV2Schema = import_zod3.z.object({
|
|
3644
3693
|
version: import_zod3.z.literal(2),
|
|
@@ -3893,12 +3942,21 @@ var ShareRecipientClient = class {
|
|
|
3893
3942
|
const { envelope } = resolved.artifact;
|
|
3894
3943
|
const { location } = resolved;
|
|
3895
3944
|
const bearer = isBearerEnvelope(envelope);
|
|
3896
|
-
const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain";
|
|
3945
|
+
const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.authorizationTargetKind === "recipientDid";
|
|
3897
3946
|
const legacyBearer = !policy && envelope.recipientKind === void 0;
|
|
3898
|
-
|
|
3947
|
+
let recipientDidSession;
|
|
3948
|
+
if (envelope.authorizationTargetKind === "recipientDid") {
|
|
3949
|
+
if (this.options.establishRecipientDidSession === void 0) throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required");
|
|
3950
|
+
const authorization = await this.options.establishRecipientDidSession({ envelope, recipientDid: envelope.recipient?.kind === "recipientDid" ? envelope.recipient.value : "" });
|
|
3951
|
+
if ("state" in authorization) {
|
|
3952
|
+
if (authorization.state === "authorization-required") throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required", authorization);
|
|
3953
|
+
throw new ShareAccessError("SHARE_DENIED", "recipient DID authorization was denied", authorization);
|
|
3954
|
+
}
|
|
3955
|
+
recipientDidSession = authorization;
|
|
3956
|
+
}
|
|
3899
3957
|
if (policy && this.options.bearerSession !== void 0) throw new ShareAccessError("SHARE_POLICY_BEARER_MISMATCH");
|
|
3900
3958
|
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;
|
|
3959
|
+
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
3960
|
const kv = bearer || legacyBearer ? session === void 0 ? void 0 : this.createKV(envelope.origin, session) : void 0;
|
|
3903
3961
|
const policySession = policy ? session : void 0;
|
|
3904
3962
|
if (policySession !== void 0) this.assertProvidedPolicySession(policySession, envelope);
|
|
@@ -5801,10 +5859,6 @@ var import_sha2564 = require("@noble/hashes/sha256");
|
|
|
5801
5859
|
|
|
5802
5860
|
// src/policy/signed-object.ts
|
|
5803
5861
|
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
5862
|
var import_viem2 = require("viem");
|
|
5809
5863
|
|
|
5810
5864
|
// src/policy/errors.ts
|
|
@@ -6003,33 +6057,11 @@ function assertUnicodeScalarString(value, path) {
|
|
|
6003
6057
|
}
|
|
6004
6058
|
}
|
|
6005
6059
|
|
|
6006
|
-
// src/policy/
|
|
6060
|
+
// src/policy/signed-object.ts
|
|
6007
6061
|
var textEncoder2 = new TextEncoder();
|
|
6008
6062
|
var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
6009
6063
|
Object.prototype.hasOwnProperty
|
|
6010
6064
|
);
|
|
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
6065
|
function canonicalizeSignedObjectUnsigned(input) {
|
|
6034
6066
|
return jcsCanonicalize(input);
|
|
6035
6067
|
}
|
|
@@ -6336,7 +6368,7 @@ function validateShareDeliveryAuthorizationBytes(bytesValue, expected) {
|
|
|
6336
6368
|
const authorization = assertObject2(root.authorization, AUTHORIZATION_KEYS, "share delivery authorization");
|
|
6337
6369
|
const proof = assertObject2(root.proof, ["alg", "kid", "signature"], "share delivery authorization proof");
|
|
6338
6370
|
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.
|
|
6371
|
+
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
6372
|
throw new Error("share delivery authorization is not bound to the submitted request");
|
|
6341
6373
|
}
|
|
6342
6374
|
if (typeof authorization.issuedAt !== "string" || Date.parse(authorization.issuedAt) > Date.now() + 6e4) throw new Error("share delivery authorization issuedAt is invalid");
|
|
@@ -6470,15 +6502,21 @@ var SenderShareStore = class {
|
|
|
6470
6502
|
await this.keys.delete(shareId);
|
|
6471
6503
|
}
|
|
6472
6504
|
};
|
|
6505
|
+
|
|
6506
|
+
// src/delegations/index.ts
|
|
6507
|
+
var import_share_sdk = require("@tinycloud/share-sdk");
|
|
6508
|
+
var import_share_sdk2 = require("@tinycloud/share-sdk");
|
|
6473
6509
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6474
6510
|
0 && (module.exports = {
|
|
6475
6511
|
DelegationErrorCodes,
|
|
6476
6512
|
DelegationManager,
|
|
6477
6513
|
EncodedShareDataSchema,
|
|
6514
|
+
EncryptedSenderShareHistory,
|
|
6478
6515
|
MAX_CONTENT_BYTES,
|
|
6479
6516
|
MAX_SEALED_SHARE_CONTENT_BYTES,
|
|
6480
6517
|
MAX_SHARE_ARTIFACT_BYTES,
|
|
6481
6518
|
MAX_SHARE_CONTENT_BYTES,
|
|
6519
|
+
MemoryEncryptedShareHistoryStorage,
|
|
6482
6520
|
MemorySenderShareKeyStorage,
|
|
6483
6521
|
MemorySenderShareRecordStorage,
|
|
6484
6522
|
MemoryShareCache,
|
|
@@ -6493,6 +6531,7 @@ var SenderShareStore = class {
|
|
|
6493
6531
|
ShareConflict,
|
|
6494
6532
|
ShareEnvelopeError,
|
|
6495
6533
|
ShareNativeResponseSchema,
|
|
6534
|
+
ShareReceiveError,
|
|
6496
6535
|
ShareRecipientClient,
|
|
6497
6536
|
ShareRecipientClientOptionsSchema,
|
|
6498
6537
|
ShareRecipientPolicySchema,
|
|
@@ -6500,7 +6539,10 @@ var SenderShareStore = class {
|
|
|
6500
6539
|
ShareResourceSchema,
|
|
6501
6540
|
SharingService,
|
|
6502
6541
|
SharingServiceConfigSchema,
|
|
6542
|
+
authorizationMethodForTarget,
|
|
6543
|
+
authorizeShare,
|
|
6503
6544
|
canonicalOwnerSharePolicy,
|
|
6545
|
+
claimShare,
|
|
6504
6546
|
computeOwnerShareRegistrationCid,
|
|
6505
6547
|
computeShareCid,
|
|
6506
6548
|
createDelegatedShareKey,
|
|
@@ -6515,23 +6557,37 @@ var SenderShareStore = class {
|
|
|
6515
6557
|
encodeShareUrl,
|
|
6516
6558
|
encryptShareBytes,
|
|
6517
6559
|
encryptShareBytesAsync,
|
|
6560
|
+
inspectShare,
|
|
6518
6561
|
intersectShareCapabilities,
|
|
6562
|
+
isLegacyShareLink,
|
|
6519
6563
|
isV2ShareLink,
|
|
6564
|
+
listShares,
|
|
6565
|
+
migrateShare,
|
|
6520
6566
|
normalizeShareActions,
|
|
6521
6567
|
normalizeShareRecipientTarget,
|
|
6522
6568
|
normalizeShareResource,
|
|
6569
|
+
notifyShare,
|
|
6523
6570
|
parseShareArtifact,
|
|
6524
6571
|
parseShareUrl,
|
|
6572
|
+
publishPolicyShare,
|
|
6573
|
+
publishTargetShare,
|
|
6574
|
+
receiveLegacyShare,
|
|
6575
|
+
receiveShare,
|
|
6525
6576
|
restoreDelegatedShareKey,
|
|
6577
|
+
resumeShareAuthorization,
|
|
6578
|
+
revokeShare,
|
|
6526
6579
|
shareCapabilityAllows,
|
|
6527
6580
|
shareDeliveryTrustedKid,
|
|
6581
|
+
showShare,
|
|
6528
6582
|
signShareEnvelope,
|
|
6583
|
+
toShareErrorInfo,
|
|
6529
6584
|
validateEncodedShareData,
|
|
6530
6585
|
validateOwnerSharePolicyRegistration,
|
|
6531
6586
|
validateOwnerSharePolicyRegistrationBytes,
|
|
6532
6587
|
validateReceiveOptions,
|
|
6533
6588
|
validateShareDeliveryAuthorizationBytes,
|
|
6534
6589
|
validateSharingServiceConfig,
|
|
6590
|
+
verifyBearerEnvelope,
|
|
6535
6591
|
verifyShareCid,
|
|
6536
6592
|
verifyShareEnvelope
|
|
6537
6593
|
});
|