@tinycloud/share-sdk 1.3.0 → 1.4.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.
- package/README.md +6 -0
- package/dist/{addressed-publish-Db-6rqkA.d.cts → addressed-publish-BP6nsgRq.d.cts} +58 -2
- package/dist/{addressed-publish-CAdGCqiX.d.ts → addressed-publish-CpkwV-Au.d.ts} +58 -2
- package/dist/artifact.cjs +2 -2
- package/dist/artifact.cjs.map +1 -1
- package/dist/artifact.js +2 -2
- package/dist/artifact.js.map +1 -1
- package/dist/{history-ZJFHV-IU.d.cts → history-Bg25JIsi.d.cts} +1 -1
- package/dist/{history-q0ALXTv7.d.ts → history-kwJxrZgq.d.ts} +1 -1
- package/dist/index.cjs +304 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +290 -154
- package/dist/index.js.map +1 -1
- package/dist/{owner-policy-CRFeEC98.d.cts → owner-policy-aPmXIR3e.d.cts} +1 -1
- package/dist/{owner-policy-CRFeEC98.d.ts → owner-policy-aPmXIR3e.d.ts} +1 -1
- package/dist/share-index.cjs +47 -87
- package/dist/share-index.cjs.map +1 -1
- package/dist/share-index.d.cts +28 -30
- package/dist/share-index.d.ts +28 -30
- package/dist/share-index.js +46 -86
- package/dist/share-index.js.map +1 -1
- package/dist/share-root.cjs +2 -2
- package/dist/share-root.cjs.map +1 -1
- package/dist/share-root.d.cts +2 -2
- package/dist/share-root.d.ts +2 -2
- package/dist/share-root.js +2 -2
- package/dist/share-root.js.map +1 -1
- package/dist/{web-recipient-entry-D9IJEyRA.d.cts → web-recipient-entry-CiUzdSQs.d.cts} +9 -1
- package/dist/{web-recipient-entry-CKA_vCi5.d.ts → web-recipient-entry-DVyTQBl0.d.ts} +9 -1
- package/dist/web-recipient.cjs +76 -105
- package/dist/web-recipient.cjs.map +1 -1
- package/dist/web-recipient.d.cts +1 -1
- package/dist/web-recipient.d.ts +1 -1
- package/dist/web-recipient.js +66 -105
- package/dist/web-recipient.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-
|
|
1
|
+
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-aPmXIR3e.cjs';
|
|
2
2
|
|
|
3
3
|
interface EncryptedShareHistoryStorage {
|
|
4
4
|
put(value: Uint8Array): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-
|
|
1
|
+
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-aPmXIR3e.js';
|
|
2
2
|
|
|
3
3
|
interface EncryptedShareHistoryStorage {
|
|
4
4
|
put(value: Uint8Array): Promise<void>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,11 +17,21 @@ var __copyProps = (to, from3, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
33
|
+
ADDRESSED_SHARE_TOO_LARGE_MESSAGE: () => ADDRESSED_SHARE_TOO_LARGE_MESSAGE,
|
|
34
|
+
AddressedShareOverLimitError: () => AddressedShareOverLimitError,
|
|
23
35
|
ArtifactPinError: () => ArtifactPinError,
|
|
24
36
|
CredentialInvitationError: () => CredentialInvitationError,
|
|
25
37
|
DEFAULT_MAX_CONTENT_BLOB_BYTES: () => DEFAULT_MAX_CONTENT_BLOB_BYTES,
|
|
@@ -43,7 +55,9 @@ __export(src_exports, {
|
|
|
43
55
|
ShareReceiveError: () => ShareReceiveError,
|
|
44
56
|
ShareRecipientClient: () => ShareRecipientClient,
|
|
45
57
|
addressedCredentialRequirement: () => addressedCredentialRequirement,
|
|
58
|
+
addressedShareBodyUpperBound: () => addressedShareBodyUpperBound,
|
|
46
59
|
artifactBindingView: () => artifactBindingView,
|
|
60
|
+
assertAddressedShareFits: () => assertAddressedShareFits,
|
|
47
61
|
assertArtifactBinding: () => assertArtifactBinding,
|
|
48
62
|
authorizationMethodForTarget: () => authorizationMethodForTarget,
|
|
49
63
|
authorizeShare: () => authorizeShare,
|
|
@@ -5022,7 +5036,8 @@ function isCanonicalRawCid(cidString) {
|
|
|
5022
5036
|
} catch {
|
|
5023
5037
|
return false;
|
|
5024
5038
|
}
|
|
5025
|
-
return cid2.version === 1 && cid2.code === code && cid2.multihash.code === SHA256_CODE &&
|
|
5039
|
+
return cid2.version === 1 && cid2.code === code && cid2.multihash.code === SHA256_CODE && // `toString` of a parsed CID gives back the string it was parsed from; a fresh CID is encoded again.
|
|
5040
|
+
CID.createV1(cid2.code, cid2.multihash).toString() === cidString;
|
|
5026
5041
|
}
|
|
5027
5042
|
var base64 = rfc4648({
|
|
5028
5043
|
prefix: "m",
|
|
@@ -5684,7 +5699,6 @@ var SEALED_BLOB_VERSION = 1;
|
|
|
5684
5699
|
var AAD = utf8Bytes(ENVELOPE_AAD_LABEL);
|
|
5685
5700
|
var KEY_LENGTH = 32;
|
|
5686
5701
|
var NONCE_LENGTH = 12;
|
|
5687
|
-
var TAG_LENGTH = 16;
|
|
5688
5702
|
var HEADER_LENGTH = 1;
|
|
5689
5703
|
function assertKey(key32) {
|
|
5690
5704
|
if (key32.length !== KEY_LENGTH) {
|
|
@@ -5712,17 +5726,6 @@ async function seal(plaintextBytes, key32) {
|
|
|
5712
5726
|
blob.set(ciphertext, HEADER_LENGTH + nonce.length);
|
|
5713
5727
|
return { blob, cid: await computeCid(blob) };
|
|
5714
5728
|
}
|
|
5715
|
-
async function open(blob, key32) {
|
|
5716
|
-
if (blob.length < HEADER_LENGTH + NONCE_LENGTH + TAG_LENGTH) {
|
|
5717
|
-
throw new TypeError(`sealed blob too short: ${blob.length} bytes`);
|
|
5718
|
-
}
|
|
5719
|
-
if (blob[0] !== SEALED_BLOB_VERSION) {
|
|
5720
|
-
throw new TypeError(`unknown sealed blob version: ${blob[0]}`);
|
|
5721
|
-
}
|
|
5722
|
-
const nonce = blob.subarray(HEADER_LENGTH, HEADER_LENGTH + NONCE_LENGTH);
|
|
5723
|
-
const ciphertext = blob.subarray(HEADER_LENGTH + NONCE_LENGTH);
|
|
5724
|
-
return decryptEnvelope(nonce, ciphertext, key32);
|
|
5725
|
-
}
|
|
5726
5729
|
async function encryptEnvelope(plaintextBytes, key32) {
|
|
5727
5730
|
const key = await importAesKey(key32, "encrypt");
|
|
5728
5731
|
const nonce = globalThis.crypto.getRandomValues(new Uint8Array(NONCE_LENGTH));
|
|
@@ -5735,19 +5738,6 @@ async function encryptEnvelope(plaintextBytes, key32) {
|
|
|
5735
5738
|
);
|
|
5736
5739
|
return { nonce, ciphertext };
|
|
5737
5740
|
}
|
|
5738
|
-
async function decryptEnvelope(nonce, ciphertext, key32) {
|
|
5739
|
-
if (nonce.length !== NONCE_LENGTH) {
|
|
5740
|
-
throw new TypeError(`nonce must be ${NONCE_LENGTH} bytes, got ${nonce.length}`);
|
|
5741
|
-
}
|
|
5742
|
-
const key = await importAesKey(key32, "decrypt");
|
|
5743
|
-
return new Uint8Array(
|
|
5744
|
-
await globalThis.crypto.subtle.decrypt(
|
|
5745
|
-
{ name: "AES-GCM", iv: nonce, additionalData: AAD },
|
|
5746
|
-
key,
|
|
5747
|
-
ciphertext
|
|
5748
|
-
)
|
|
5749
|
-
);
|
|
5750
|
-
}
|
|
5751
5741
|
function isPlainRecord(value) {
|
|
5752
5742
|
const proto = Object.getPrototypeOf(value);
|
|
5753
5743
|
return proto === Object.prototype || proto === null;
|
|
@@ -5994,71 +5984,6 @@ function base32Lower(bytes3) {
|
|
|
5994
5984
|
if (bits > 0) output += alphabet[buffer << 5 - bits & 31];
|
|
5995
5985
|
return output;
|
|
5996
5986
|
}
|
|
5997
|
-
var KEY_LENGTH2 = 32;
|
|
5998
|
-
var MAX_INLINE_BYTES = 256 * 1024;
|
|
5999
|
-
function assertCanonicalCid(cidString) {
|
|
6000
|
-
const cid2 = CID.parse(cidString);
|
|
6001
|
-
if (cid2.version !== 1 || cid2.code !== code || cid2.multihash.code !== 18 || // sha2-256 (0x12) only, at the link layer too
|
|
6002
|
-
cid2.toString() !== cidString) {
|
|
6003
|
-
throw new TypeError(`not a canonical CIDv1 raw sha2-256 base32 CID: ${cidString}`);
|
|
6004
|
-
}
|
|
6005
|
-
}
|
|
6006
|
-
async function encodeSealedInlineShareUrl(parts) {
|
|
6007
|
-
if (!isCanonicalHttpsOrigin(parts.origin)) throw new TypeError("origin must be a canonical https origin");
|
|
6008
|
-
if (parts.ciphertext.byteLength === 0 || parts.ciphertext.byteLength > MAX_INLINE_BYTES) throw new RangeError("inline ciphertext is outside the allowed size");
|
|
6009
|
-
if (parts.key32.byteLength !== KEY_LENGTH2) throw new TypeError("inline key must be 32 bytes");
|
|
6010
|
-
const ciphertextCid = await computeCid(parts.ciphertext);
|
|
6011
|
-
const payload = canonicalize({
|
|
6012
|
-
v: 2,
|
|
6013
|
-
c: toBase64Url(parts.ciphertext),
|
|
6014
|
-
cid: ciphertextCid,
|
|
6015
|
-
k: toBase64Url(parts.key32)
|
|
6016
|
-
});
|
|
6017
|
-
const payloadBytes = new TextEncoder().encode(payload);
|
|
6018
|
-
if (payloadBytes.byteLength > MAX_INLINE_BYTES * 2) throw new RangeError("inline URL is too large");
|
|
6019
|
-
return `${parts.origin}/s/inline#v=2&p=${toBase64Url(payloadBytes)}`;
|
|
6020
|
-
}
|
|
6021
|
-
async function parseSealedInlineShareUrl(url, options = {}) {
|
|
6022
|
-
const parsed = new URL(url);
|
|
6023
|
-
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "") throw new TypeError("sealed inline share URL must be canonical HTTPS without userinfo");
|
|
6024
|
-
if (!isCanonicalHttpsOrigin(parsed.origin) || options.expectedOrigin !== void 0 && parsed.origin !== options.expectedOrigin) throw new TypeError("sealed inline share URL origin is not trusted");
|
|
6025
|
-
if (parsed.pathname !== "/s/inline" || parsed.search !== "") throw new TypeError("not a Node sealed-inline share URL");
|
|
6026
|
-
if (url !== `${parsed.origin}/s/inline${parsed.hash}`) throw new TypeError("sealed inline share URL is not lexically canonical");
|
|
6027
|
-
const prefix = "#v=2&p=";
|
|
6028
|
-
if (!parsed.hash.startsWith(prefix)) throw new TypeError("sealed inline URL is missing its canonical fragment");
|
|
6029
|
-
const encoded = parsed.hash.slice(prefix.length);
|
|
6030
|
-
if (encoded.length === 0 || parsed.hash !== `${prefix}${encoded}`) throw new TypeError("sealed inline URL fragment is not canonical");
|
|
6031
|
-
let payloadBytes;
|
|
6032
|
-
try {
|
|
6033
|
-
payloadBytes = fromBase64Url(encoded);
|
|
6034
|
-
} catch {
|
|
6035
|
-
throw new TypeError("sealed inline payload is not canonical base64url");
|
|
6036
|
-
}
|
|
6037
|
-
if (payloadBytes.byteLength === 0 || payloadBytes.byteLength > MAX_INLINE_BYTES * 2) throw new TypeError("sealed inline payload is too large");
|
|
6038
|
-
const payloadText = new TextDecoder("utf-8", { fatal: true }).decode(payloadBytes);
|
|
6039
|
-
let value;
|
|
6040
|
-
try {
|
|
6041
|
-
value = JSON.parse(payloadText);
|
|
6042
|
-
} catch {
|
|
6043
|
-
throw new TypeError("sealed inline payload is not valid JSON");
|
|
6044
|
-
}
|
|
6045
|
-
if (typeof value !== "object" || value === null || Array.isArray(value) || canonicalize(value) !== payloadText) throw new TypeError("sealed inline payload is not canonical JSON");
|
|
6046
|
-
const record = value;
|
|
6047
|
-
if (Object.keys(record).length !== 4 || record.v !== 2 || typeof record.c !== "string" || typeof record.cid !== "string" || typeof record.k !== "string") throw new TypeError("sealed inline payload has invalid fields");
|
|
6048
|
-
let ciphertext;
|
|
6049
|
-
let key32;
|
|
6050
|
-
try {
|
|
6051
|
-
ciphertext = fromBase64Url(record.c);
|
|
6052
|
-
key32 = fromBase64Url(record.k);
|
|
6053
|
-
} catch {
|
|
6054
|
-
throw new TypeError("sealed inline payload has invalid base64url material");
|
|
6055
|
-
}
|
|
6056
|
-
if (ciphertext.byteLength === 0 || ciphertext.byteLength > MAX_INLINE_BYTES) throw new TypeError("sealed inline ciphertext is outside the allowed size");
|
|
6057
|
-
if (key32.byteLength !== KEY_LENGTH2) throw new TypeError("sealed inline key must be 32 bytes");
|
|
6058
|
-
assertCanonicalCid(record.cid);
|
|
6059
|
-
if (await computeCid(ciphertext) !== record.cid) throw new TypeError("sealed inline ciphertext does not match its CID");
|
|
6060
|
-
return { kind: "inline", ciphertextCid: record.cid, ciphertext, key32 };
|
|
6061
|
-
}
|
|
6062
5987
|
|
|
6063
5988
|
// src/artifact-core.ts
|
|
6064
5989
|
var ARTIFACT_ROOT = "artifacts";
|
|
@@ -6178,26 +6103,80 @@ function metadataFor(envelope, origin) {
|
|
|
6178
6103
|
...envelope.artifactPin === void 0 ? {} : { artifact: { id: envelope.artifactPin.artifactId, version: envelope.artifactPin.version } }
|
|
6179
6104
|
};
|
|
6180
6105
|
}
|
|
6106
|
+
function receiveErrorFor(error) {
|
|
6107
|
+
switch (error.code) {
|
|
6108
|
+
case "origin_not_trusted":
|
|
6109
|
+
return new ShareReceiveError("origin-mismatch", "share link origin is not trusted");
|
|
6110
|
+
case "body_over_cap":
|
|
6111
|
+
case "response_too_large":
|
|
6112
|
+
return new ShareReceiveError("max-bytes-exceeded", "sealed policy envelope exceeds the size limit");
|
|
6113
|
+
case "body_hash_mismatch":
|
|
6114
|
+
case "link_cid_mismatch":
|
|
6115
|
+
return new ShareReceiveError("cid-mismatch", "sealed envelope bytes do not match the link CID");
|
|
6116
|
+
case "body_open_failed":
|
|
6117
|
+
return new ShareReceiveError("decrypt-failed", "share envelope could not be opened");
|
|
6118
|
+
case "gone":
|
|
6119
|
+
case "expired":
|
|
6120
|
+
return new ShareReceiveError("expired", "share link has expired, was deleted, or never existed");
|
|
6121
|
+
case "bad_signature":
|
|
6122
|
+
case "issuer_binding_mismatch":
|
|
6123
|
+
return new ShareReceiveError("signature-invalid", "share link signature is invalid");
|
|
6124
|
+
case "service_refused":
|
|
6125
|
+
case "service_unavailable":
|
|
6126
|
+
case "invalid_response":
|
|
6127
|
+
return new ShareReceiveError("fetch-failed", "share link could not be fetched");
|
|
6128
|
+
case "not_a_url":
|
|
6129
|
+
case "not_https":
|
|
6130
|
+
case "userinfo":
|
|
6131
|
+
case "not_canonical":
|
|
6132
|
+
case "query_present":
|
|
6133
|
+
case "removed_version":
|
|
6134
|
+
case "path_grammar":
|
|
6135
|
+
case "fragment_grammar":
|
|
6136
|
+
case "key_noncanonical":
|
|
6137
|
+
case "cid_grammar":
|
|
6138
|
+
case "record_encoding":
|
|
6139
|
+
case "record_json":
|
|
6140
|
+
case "record_not_canonical":
|
|
6141
|
+
case "type_path_mismatch":
|
|
6142
|
+
case "full_non_share":
|
|
6143
|
+
return new ShareReceiveError("invalid-link", "share link format is invalid");
|
|
6144
|
+
default:
|
|
6145
|
+
return new ShareReceiveError("envelope-invalid", "share envelope is invalid");
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6181
6148
|
async function resolvePolicyShare(link, options) {
|
|
6182
6149
|
options.signal?.throwIfAborted();
|
|
6183
6150
|
let url;
|
|
6184
|
-
let parsed;
|
|
6185
6151
|
try {
|
|
6186
6152
|
url = new URL(link);
|
|
6187
|
-
parsed = await parseSealedInlineShareUrl(link, { ...options.expectedOrigin === void 0 ? {} : { expectedOrigin: options.expectedOrigin } });
|
|
6188
6153
|
} catch {
|
|
6189
6154
|
throw new ShareReceiveError("invalid-link", "share link format is invalid");
|
|
6190
6155
|
}
|
|
6156
|
+
const links = await import("@tinycloud/share-envelope/links");
|
|
6157
|
+
let resolved;
|
|
6158
|
+
try {
|
|
6159
|
+
resolved = await links.resolveLink(link, {
|
|
6160
|
+
trustedOrigins: [options.expectedOrigin ?? url.origin],
|
|
6161
|
+
apiOrigin: options.apiOrigin ?? links.DEFAULT_LINKS_API_ORIGIN,
|
|
6162
|
+
...options.fetch === void 0 ? {} : { fetch: options.fetch },
|
|
6163
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
6164
|
+
now: options.now?.() ?? Date.now()
|
|
6165
|
+
});
|
|
6166
|
+
} catch (error) {
|
|
6167
|
+
options.signal?.throwIfAborted();
|
|
6168
|
+
throw error instanceof links.LinkError ? receiveErrorFor(error) : error;
|
|
6169
|
+
}
|
|
6170
|
+
if (resolved.type !== "share") throw new ShareReceiveError("invalid-link", "share link is not a share");
|
|
6191
6171
|
const limit = options.maxSealedBlobBytes ?? DEFAULT_MAX_SEALED_BLOB_BYTES;
|
|
6192
|
-
if (!Number.isSafeInteger(limit) || limit <= 0 ||
|
|
6193
|
-
|
|
6172
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || resolved.body.byteLength > limit) throw new ShareReceiveError("max-bytes-exceeded", "sealed policy envelope exceeds the configured byte limit");
|
|
6173
|
+
const cid2 = resolved.header.bodyCid;
|
|
6194
6174
|
options.signal?.throwIfAborted();
|
|
6195
6175
|
let envelope;
|
|
6196
6176
|
try {
|
|
6197
|
-
const encoded = new TextDecoder("utf-8", { fatal: true }).decode(
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
envelope = shareEnvelopeV3Schema.parse(value);
|
|
6177
|
+
const encoded = new TextDecoder("utf-8", { fatal: true }).decode(resolved.plaintext);
|
|
6178
|
+
if (canonicalize(resolved.value) !== encoded) throw new Error("non-canonical envelope");
|
|
6179
|
+
envelope = shareEnvelopeV3Schema.parse(resolved.value);
|
|
6201
6180
|
} catch {
|
|
6202
6181
|
throw new ShareReceiveError("envelope-invalid", "share envelope is invalid");
|
|
6203
6182
|
}
|
|
@@ -6216,8 +6195,8 @@ async function resolvePolicyShare(link, options) {
|
|
|
6216
6195
|
const expiry = Date.parse(envelope.expiry);
|
|
6217
6196
|
if (!Number.isFinite(expiry)) throw new ShareReceiveError("envelope-invalid", "share expiry is invalid");
|
|
6218
6197
|
if (expiry <= (options.now?.() ?? Date.now())) throw new ShareReceiveError("expired", "share has expired", { expiresAt: envelope.expiry });
|
|
6219
|
-
options.onResolvedAddressedEnvelope?.(envelope,
|
|
6220
|
-
return { envelope, origin: url.origin, cid:
|
|
6198
|
+
options.onResolvedAddressedEnvelope?.(envelope, cid2);
|
|
6199
|
+
return { envelope, origin: url.origin, cid: cid2 };
|
|
6221
6200
|
}
|
|
6222
6201
|
async function inspectShare(link, options = {}) {
|
|
6223
6202
|
const resolved = await resolvePolicyShare(link, options);
|
|
@@ -6846,6 +6825,53 @@ async function createPolicy(options, capabilities) {
|
|
|
6846
6825
|
};
|
|
6847
6826
|
return { policy, policyCid: await computeCid(textEncoder.encode(canonicalize(policy))), policyDigestHex };
|
|
6848
6827
|
}
|
|
6828
|
+
function addressedPlan(options) {
|
|
6829
|
+
const capabilities = sortCanonical([
|
|
6830
|
+
{ kind: "kv", resource: options.contentSource.kvResource, selector: options.resource.kind, actions: [...options.policyActions] },
|
|
6831
|
+
{ kind: "encryption", resource: options.contentSource.encryptionNetwork, action: "tinycloud.encryption/decrypt" }
|
|
6832
|
+
]);
|
|
6833
|
+
return {
|
|
6834
|
+
expiry: rfc3339Seconds(options.expiresAt),
|
|
6835
|
+
capabilities,
|
|
6836
|
+
contentSourceDigestHex: digestHex(options.contentSource, CONTENT_SOURCE_V1_DOMAIN2),
|
|
6837
|
+
capabilityCeilingHashHex: digestHex(capabilities, POLICY_CAPABILITY_V1_DOMAIN2),
|
|
6838
|
+
nativeProjectionHashHex: digestHex(nativeProjection(capabilities), NATIVE_PROJECTION_V1_DOMAIN2)
|
|
6839
|
+
};
|
|
6840
|
+
}
|
|
6841
|
+
function unsignedAddressedEnvelope(input) {
|
|
6842
|
+
const { options } = input;
|
|
6843
|
+
return {
|
|
6844
|
+
version: 3,
|
|
6845
|
+
shareId: options.shareId,
|
|
6846
|
+
recipientMatcher: input.matcher,
|
|
6847
|
+
...options.deliveryEmail === void 0 ? {} : { deliveryEmail: options.deliveryEmail },
|
|
6848
|
+
actions: [...options.actions],
|
|
6849
|
+
resource: { ...options.resource },
|
|
6850
|
+
target: { origin: options.nodeOrigin, nodeAudience: input.attestedEnforcerBinding.enforcerDid, spaceId: options.spaceId },
|
|
6851
|
+
policy: input.policy,
|
|
6852
|
+
policyCid: input.policyCid,
|
|
6853
|
+
policyRoot: input.policyRoot,
|
|
6854
|
+
enforcementRoot: input.enforcementRoot,
|
|
6855
|
+
attestedEnforcerBinding: input.attestedEnforcerBinding,
|
|
6856
|
+
contentSource: options.contentSource,
|
|
6857
|
+
contentSourceDigestHex: input.contentSourceDigestHex,
|
|
6858
|
+
encryptionNetwork: options.contentSource.encryptionNetwork,
|
|
6859
|
+
expiry: input.expiry,
|
|
6860
|
+
display: { filename: options.filename },
|
|
6861
|
+
encrypted: true,
|
|
6862
|
+
metadata: {
|
|
6863
|
+
mediaType: options.mediaType,
|
|
6864
|
+
byteLength: options.byteLength,
|
|
6865
|
+
filename: options.filename,
|
|
6866
|
+
...options.mediaType.startsWith("text/") ? { encoding: "utf-8" } : {},
|
|
6867
|
+
...options.artifact === void 0 ? {} : { artifact: options.artifact }
|
|
6868
|
+
},
|
|
6869
|
+
...options.artifactPin === void 0 ? {} : { artifactPin: options.artifactPin }
|
|
6870
|
+
};
|
|
6871
|
+
}
|
|
6872
|
+
function signedAddressedEnvelope(unsigned, signerDid, signature) {
|
|
6873
|
+
return { ...unsigned, signature: { signerDid, algorithm: "Ed25519", value: toBase64Url(signature) } };
|
|
6874
|
+
}
|
|
6849
6875
|
function publicationResult(input) {
|
|
6850
6876
|
const result = {
|
|
6851
6877
|
protocol: "tinycloud-share",
|
|
@@ -6940,16 +6966,10 @@ async function publishAddressedShare(input) {
|
|
|
6940
6966
|
});
|
|
6941
6967
|
const options = { ...input, filename: canonicalShareFilename(input.filename) };
|
|
6942
6968
|
if (target.kind !== "recipientDid") assertMailboxCommitment(options.credentialRequirement, target);
|
|
6943
|
-
const expiry = rfc3339Seconds(options.expiresAt);
|
|
6944
6969
|
const matcher = targetMatcher(target);
|
|
6945
|
-
const capabilities =
|
|
6946
|
-
|
|
6947
|
-
{ kind: "encryption", resource: options.contentSource.encryptionNetwork, action: "tinycloud.encryption/decrypt" }
|
|
6948
|
-
]);
|
|
6970
|
+
const { expiry, capabilities, contentSourceDigestHex, capabilityCeilingHashHex, nativeProjectionHashHex } = addressedPlan(options);
|
|
6971
|
+
await assertSealedBodyFits({ ...options, matcher, ownerDid: options.authority.ownerDid });
|
|
6949
6972
|
const created = await createPolicy(options, capabilities);
|
|
6950
|
-
const contentSourceDigestHex = digestHex(options.contentSource, CONTENT_SOURCE_V1_DOMAIN2);
|
|
6951
|
-
const capabilityCeilingHashHex = digestHex(capabilities, POLICY_CAPABILITY_V1_DOMAIN2);
|
|
6952
|
-
const nativeProjectionHashHex = digestHex(nativeProjection(capabilities), NATIVE_PROJECTION_V1_DOMAIN2);
|
|
6953
6973
|
const commonRoot = {
|
|
6954
6974
|
ownerDid: options.authority.ownerDid,
|
|
6955
6975
|
policyId: created.policy.policyId,
|
|
@@ -6979,48 +6999,39 @@ async function publishAddressedShare(input) {
|
|
|
6979
6999
|
expectedNodeAudience: options.nodeAudience
|
|
6980
7000
|
});
|
|
6981
7001
|
if (registration.policyCid !== created.policyCid || registration.policyRootCid !== policyRoot.cid || registration.enforcementRootCid !== enforcementRoot.cid) throw new Error("Policy/v3 registration receipt is not bound to the published roots");
|
|
6982
|
-
const unsigned = {
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
recipientMatcher: matcher,
|
|
6986
|
-
...options.deliveryEmail === void 0 ? {} : { deliveryEmail: options.deliveryEmail },
|
|
6987
|
-
actions: [...options.actions],
|
|
6988
|
-
resource: { ...options.resource },
|
|
6989
|
-
target: { origin: options.nodeOrigin, nodeAudience: registration.attestedEnforcerBinding.enforcerDid, spaceId: options.spaceId },
|
|
7002
|
+
const unsigned = unsignedAddressedEnvelope({
|
|
7003
|
+
options,
|
|
7004
|
+
matcher,
|
|
6990
7005
|
policy: created.policy,
|
|
6991
7006
|
policyCid: created.policyCid,
|
|
6992
7007
|
policyRoot,
|
|
6993
7008
|
enforcementRoot,
|
|
6994
7009
|
attestedEnforcerBinding: registration.attestedEnforcerBinding,
|
|
6995
|
-
contentSource: options.contentSource,
|
|
6996
7010
|
contentSourceDigestHex,
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
display: { filename: options.filename },
|
|
7000
|
-
encrypted: true,
|
|
7001
|
-
metadata: {
|
|
7002
|
-
mediaType: options.mediaType,
|
|
7003
|
-
byteLength: options.byteLength,
|
|
7004
|
-
filename: options.filename,
|
|
7005
|
-
...options.mediaType.startsWith("text/") ? { encoding: "utf-8" } : {},
|
|
7006
|
-
...options.artifact === void 0 ? {} : { artifact: options.artifact }
|
|
7007
|
-
},
|
|
7008
|
-
...options.artifactPin === void 0 ? {} : { artifactPin: options.artifactPin }
|
|
7009
|
-
};
|
|
7011
|
+
expiry
|
|
7012
|
+
});
|
|
7010
7013
|
unsignedShareEnvelopeV3Schema.parse(unsigned);
|
|
7011
7014
|
const envelopeSignature = await options.authority.sign((0, import_sha2562.sha256)(textEncoder.encode(`${ENVELOPE_V3_DOMAIN}${canonicalize(unsigned)}`)));
|
|
7012
7015
|
if (envelopeSignature.byteLength !== 64) throw new TypeError("v3 envelope signature must be Ed25519");
|
|
7013
|
-
const envelope =
|
|
7016
|
+
const envelope = signedAddressedEnvelope(unsigned, options.authority.ownerDid, envelopeSignature);
|
|
7014
7017
|
shareEnvelopeV3Schema.parse(envelope);
|
|
7015
7018
|
const envelopeBytes = textEncoder.encode(canonicalize(envelope));
|
|
7016
7019
|
const envelopeKeyBytes = generateKey();
|
|
7017
7020
|
const sealed = await seal(envelopeBytes, envelopeKeyBytes);
|
|
7018
7021
|
const envelopeKey = toBase64Url(envelopeKeyBytes);
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7022
|
+
if (sealed.blob.length > await linkBodyLimit()) {
|
|
7023
|
+
throw new AddressedShareOverLimitError({ policyCid: created.policyCid, policyRootCid: policyRoot.cid, enforcementRootCid: enforcementRoot.cid });
|
|
7024
|
+
}
|
|
7025
|
+
const links = await import("@tinycloud/share-envelope/links");
|
|
7026
|
+
const { record } = await links.prepareLinkRecord({
|
|
7027
|
+
type: "share",
|
|
7028
|
+
sealed: { blob: sealed.blob, key: envelopeKeyBytes },
|
|
7029
|
+
issuerKey: { did: options.authority.ownerDid, sign: (digest3) => options.authority.sign(digest3) },
|
|
7030
|
+
apiOrigin: options.apiOrigin ?? links.DEFAULT_LINKS_API_ORIGIN,
|
|
7031
|
+
expiresAt: new Date(expiry),
|
|
7032
|
+
enforceServiceLife: false
|
|
7023
7033
|
});
|
|
7034
|
+
const url = links.buildFullLink({ origin: options.shareOrigin, key: envelopeKeyBytes, record });
|
|
7024
7035
|
const deliveryMaterial = {
|
|
7025
7036
|
envelope,
|
|
7026
7037
|
shareCid: sealed.cid,
|
|
@@ -7041,6 +7052,149 @@ async function publishAddressedShare(input) {
|
|
|
7041
7052
|
deliveryMaterial
|
|
7042
7053
|
});
|
|
7043
7054
|
}
|
|
7055
|
+
var ADDRESSED_SHARE_TOO_LARGE_MESSAGE = "This share is too large to send as a link, so nothing was shared. Use a shorter path or fewer folders.";
|
|
7056
|
+
var AddressedShareOverLimitError = class extends SharePublishError {
|
|
7057
|
+
constructor(written) {
|
|
7058
|
+
super("max-bytes-exceeded", ADDRESSED_SHARE_TOO_LARGE_MESSAGE);
|
|
7059
|
+
this.written = written;
|
|
7060
|
+
this.name = "AddressedShareOverLimitError";
|
|
7061
|
+
}
|
|
7062
|
+
};
|
|
7063
|
+
async function linkBodyLimit() {
|
|
7064
|
+
return (await import("@tinycloud/share-envelope/links")).MAX_LINK_BODY_BYTES;
|
|
7065
|
+
}
|
|
7066
|
+
var ROOT_CID_BOUND_CHARS = 128;
|
|
7067
|
+
var NODE_TIMESTAMP_BOUND = "2026-01-01T00:00:00.123456789+00:00";
|
|
7068
|
+
var ED25519_DID_KEY_CHARS = 56;
|
|
7069
|
+
function rootAuthorizationBound(input) {
|
|
7070
|
+
const attenuation = {};
|
|
7071
|
+
for (const capability of input.capabilities) {
|
|
7072
|
+
attenuation[capability.resource] = capability.kind === "encryption" ? { [capability.action]: [{}] } : Object.fromEntries(capability.actions.map((action) => [action, [{ type: "xyz.tinycloud.resource/selector", kind: capability.selector, value: capability.resource }]]));
|
|
7073
|
+
}
|
|
7074
|
+
const facts = {
|
|
7075
|
+
role: input.role,
|
|
7076
|
+
mode: input.role === "policy-authority" ? "policy-source" : "conditional-mint",
|
|
7077
|
+
ownerDid: input.ownerDid,
|
|
7078
|
+
policyId: input.policyId,
|
|
7079
|
+
policyDigestHex: input.policyDigestHex,
|
|
7080
|
+
policyCid: input.policyCid,
|
|
7081
|
+
contentSourceDigestHex: input.contentSourceDigestHex,
|
|
7082
|
+
capabilityCeilingHashHex: input.capabilityCeilingHashHex,
|
|
7083
|
+
nativeProjectionHashHex: input.nativeProjectionHashHex,
|
|
7084
|
+
nodeAudience: input.nodeAudience,
|
|
7085
|
+
...input.role === "policy-enforcement" ? { enforcerDid: input.audienceDid } : {}
|
|
7086
|
+
};
|
|
7087
|
+
const header = { alg: "EdDSA", jwk: { alg: "EdDSA", crv: "Ed25519", kty: "OKP", x: "A".repeat(43) }, typ: "JWT", ucv: "0.10.0" };
|
|
7088
|
+
const payload = {
|
|
7089
|
+
att: attenuation,
|
|
7090
|
+
aud: input.audienceDid,
|
|
7091
|
+
exp: Number.MAX_SAFE_INTEGER,
|
|
7092
|
+
fct: [facts],
|
|
7093
|
+
iss: `${input.ownerDid}#${input.ownerDid.slice("did:key:".length)}`,
|
|
7094
|
+
nbf: Number.MAX_SAFE_INTEGER,
|
|
7095
|
+
nnc: "A".repeat(36),
|
|
7096
|
+
prf: []
|
|
7097
|
+
};
|
|
7098
|
+
return `${toBase64Url(textEncoder.encode(canonicalize(header)))}.${toBase64Url(textEncoder.encode(canonicalize(payload)))}.${"A".repeat(86)}`;
|
|
7099
|
+
}
|
|
7100
|
+
async function sealedBodyUpperBound(options) {
|
|
7101
|
+
const plan = addressedPlan(options);
|
|
7102
|
+
const signature = new Uint8Array(64);
|
|
7103
|
+
const created = await createPolicy({ ...options, authority: { ownerDid: options.ownerDid, sign: async () => signature } }, plan.capabilities);
|
|
7104
|
+
const common = {
|
|
7105
|
+
ownerDid: options.ownerDid,
|
|
7106
|
+
policyId: created.policy.policyId,
|
|
7107
|
+
policyDigestHex: created.policyDigestHex,
|
|
7108
|
+
policyCid: created.policyCid,
|
|
7109
|
+
contentSourceDigestHex: plan.contentSourceDigestHex,
|
|
7110
|
+
capabilityCeilingHashHex: plan.capabilityCeilingHashHex,
|
|
7111
|
+
nativeProjectionHashHex: plan.nativeProjectionHashHex,
|
|
7112
|
+
nodeAudience: options.nodeAudience,
|
|
7113
|
+
capabilities: plan.capabilities
|
|
7114
|
+
};
|
|
7115
|
+
const policyRoot = {
|
|
7116
|
+
cid: "b".repeat(ROOT_CID_BOUND_CHARS),
|
|
7117
|
+
role: "policy-authority",
|
|
7118
|
+
authorization: rootAuthorizationBound({ ...common, role: "policy-authority", audienceDid: `did:tinycloud:policy:${created.policyDigestHex}` })
|
|
7119
|
+
};
|
|
7120
|
+
const enforcementRoot = {
|
|
7121
|
+
cid: "b".repeat(ROOT_CID_BOUND_CHARS),
|
|
7122
|
+
role: "policy-enforcement",
|
|
7123
|
+
authorization: rootAuthorizationBound({ ...common, role: "policy-enforcement", audienceDid: options.enforcerDid })
|
|
7124
|
+
};
|
|
7125
|
+
const nodeDid = options.enforcerDid.padEnd(ED25519_DID_KEY_CHARS, "z");
|
|
7126
|
+
const unsigned = unsignedAddressedEnvelope({
|
|
7127
|
+
options,
|
|
7128
|
+
matcher: options.matcher,
|
|
7129
|
+
policy: created.policy,
|
|
7130
|
+
policyCid: created.policyCid,
|
|
7131
|
+
policyRoot,
|
|
7132
|
+
enforcementRoot,
|
|
7133
|
+
attestedEnforcerBinding: {
|
|
7134
|
+
schema: "xyz.tinycloud.policy/attested-enforcer/v2",
|
|
7135
|
+
enforcerDid: nodeDid,
|
|
7136
|
+
nodeAudience: nodeDid,
|
|
7137
|
+
attestationBindingDigestHex: "f".repeat(64),
|
|
7138
|
+
issuedAt: NODE_TIMESTAMP_BOUND,
|
|
7139
|
+
expiresAt: NODE_TIMESTAMP_BOUND,
|
|
7140
|
+
signature: { suite: "Ed25519", signerDid: nodeDid, value: "A".repeat(86) }
|
|
7141
|
+
},
|
|
7142
|
+
contentSourceDigestHex: plan.contentSourceDigestHex,
|
|
7143
|
+
expiry: plan.expiry
|
|
7144
|
+
});
|
|
7145
|
+
const envelope = signedAddressedEnvelope(unsigned, options.ownerDid, signature);
|
|
7146
|
+
return (await seal(textEncoder.encode(canonicalize(envelope)), generateKey())).blob.length;
|
|
7147
|
+
}
|
|
7148
|
+
async function assertSealedBodyFits(options) {
|
|
7149
|
+
if (await sealedBodyUpperBound(options) > await linkBodyLimit()) throw new SharePublishError("max-bytes-exceeded", ADDRESSED_SHARE_TOO_LARGE_MESSAGE);
|
|
7150
|
+
}
|
|
7151
|
+
async function addressedShareBodyUpperBound(input) {
|
|
7152
|
+
const { target, credentialRequirement } = prepareAddressedShare(input);
|
|
7153
|
+
const deliveryEmail = input.deliveryEmail ?? (target.kind === "email" && isEnvelopeDeliveryEmail(target.address) ? target.address : void 0);
|
|
7154
|
+
const artifactStorage = "artifactId" in input.storage ? input.storage : void 0;
|
|
7155
|
+
const path = "path" in input.storage ? input.storage.path : `${ARTIFACT_ROOT}/${input.storage.artifactId}/versions/${Number.MAX_SAFE_INTEGER}/${input.storage.storageName}`;
|
|
7156
|
+
const contentSource = {
|
|
7157
|
+
shareId: input.shareId,
|
|
7158
|
+
kvResource: `${input.spaceId}/kv/${path}`,
|
|
7159
|
+
selector: input.resource.kind,
|
|
7160
|
+
encryptionNetwork: input.encryptionNetwork,
|
|
7161
|
+
encryptedSymmetricKeyDigestHex: "f".repeat(64),
|
|
7162
|
+
keyVersion: Number.MAX_SAFE_INTEGER,
|
|
7163
|
+
mode: "immutable",
|
|
7164
|
+
initialCiphertextDigestHex: "f".repeat(64)
|
|
7165
|
+
};
|
|
7166
|
+
const artifactPin = artifactStorage === void 0 ? void 0 : {
|
|
7167
|
+
v: 1,
|
|
7168
|
+
artifactId: artifactStorage.artifactId,
|
|
7169
|
+
version: Number.MAX_SAFE_INTEGER,
|
|
7170
|
+
manifestSha256: "f".repeat(64),
|
|
7171
|
+
files: [{ path: artifactStorage.storageName, sha256: "f".repeat(64), bytes: Number.MAX_SAFE_INTEGER }]
|
|
7172
|
+
};
|
|
7173
|
+
return sealedBodyUpperBound({
|
|
7174
|
+
shareId: input.shareId,
|
|
7175
|
+
nodeOrigin: input.nodeOrigin,
|
|
7176
|
+
nodeAudience: input.nodeAudience,
|
|
7177
|
+
enforcerDid: input.enforcerDid,
|
|
7178
|
+
spaceId: input.spaceId,
|
|
7179
|
+
actions: input.actions,
|
|
7180
|
+
policyActions: input.policyActions,
|
|
7181
|
+
resource: { kind: input.resource.kind, path },
|
|
7182
|
+
contentSource,
|
|
7183
|
+
...artifactPin === void 0 ? {} : { artifactPin },
|
|
7184
|
+
...credentialRequirement === void 0 ? {} : { credentialRequirement },
|
|
7185
|
+
...deliveryEmail === void 0 ? {} : { deliveryEmail },
|
|
7186
|
+
...input.artifact === void 0 ? {} : { artifact: input.artifact },
|
|
7187
|
+
filename: canonicalShareFilename(input.filename),
|
|
7188
|
+
mediaType: input.mediaType,
|
|
7189
|
+
byteLength: input.byteLength,
|
|
7190
|
+
expiresAt: input.expiresAt,
|
|
7191
|
+
matcher: targetMatcher(target),
|
|
7192
|
+
ownerDid: input.ownerDid
|
|
7193
|
+
});
|
|
7194
|
+
}
|
|
7195
|
+
async function assertAddressedShareFits(input) {
|
|
7196
|
+
if (await addressedShareBodyUpperBound(input) > await linkBodyLimit()) throw new SharePublishError("max-bytes-exceeded", ADDRESSED_SHARE_TOO_LARGE_MESSAGE);
|
|
7197
|
+
}
|
|
7044
7198
|
|
|
7045
7199
|
// src/cache.ts
|
|
7046
7200
|
var import_sha2563 = require("@noble/hashes/sha256");
|
|
@@ -8137,7 +8291,8 @@ async function notifyShare(input) {
|
|
|
8137
8291
|
reason: "delivery-window-expired"
|
|
8138
8292
|
};
|
|
8139
8293
|
}
|
|
8140
|
-
|
|
8294
|
+
const refused = error !== null && typeof error === "object" && "code" in error && error.code === "delivery-authorization-invalid";
|
|
8295
|
+
if (refused || error !== null && typeof error === "object" && "status" in error && (error.status === 401 || error.status === 403)) {
|
|
8141
8296
|
return {
|
|
8142
8297
|
protocol: "tinycloud-share",
|
|
8143
8298
|
version: 1,
|
|
@@ -8189,6 +8344,7 @@ function canonicalOrigin(value) {
|
|
|
8189
8344
|
function object2(value) {
|
|
8190
8345
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8191
8346
|
}
|
|
8347
|
+
var MAX_INVITATION_LINK_BYTES = 512;
|
|
8192
8348
|
async function validateReceipt(receipt, shareUrl) {
|
|
8193
8349
|
if (!object2(receipt) || !object2(receipt.request) || !object2(receipt.admission) || !object2(receipt.proof)) {
|
|
8194
8350
|
throw new CredentialInvitationError(
|
|
@@ -8202,27 +8358,17 @@ async function validateReceipt(receipt, shareUrl) {
|
|
|
8202
8358
|
"credential invitation is not bound to the share link"
|
|
8203
8359
|
);
|
|
8204
8360
|
}
|
|
8205
|
-
|
|
8206
|
-
try {
|
|
8207
|
-
link = new URL(shareUrl);
|
|
8208
|
-
} catch {
|
|
8209
|
-
throw new CredentialInvitationError(
|
|
8210
|
-
"invalid-receipt",
|
|
8211
|
-
"credential invitation share link is invalid"
|
|
8212
|
-
);
|
|
8213
|
-
}
|
|
8214
|
-
if (link.search !== "" || link.pathname !== "/s/inline") {
|
|
8215
|
-
throw new CredentialInvitationError(
|
|
8216
|
-
"invalid-receipt",
|
|
8217
|
-
"credential invitation share link must be sealed inline"
|
|
8218
|
-
);
|
|
8219
|
-
}
|
|
8361
|
+
const links = await import("@tinycloud/share-envelope/links");
|
|
8220
8362
|
try {
|
|
8221
|
-
|
|
8363
|
+
const origin = new URL(shareUrl).origin;
|
|
8364
|
+
const parsed = links.parseLink(shareUrl, { trustedOrigins: [origin] });
|
|
8365
|
+
if (parsed.form !== "short" || parsed.pathType !== "share" || shareUrl.length > MAX_INVITATION_LINK_BYTES || shareUrl !== links.buildShortLink({ origin, type: "share", id: parsed.id, key: parsed.key, bodyCid: parsed.c })) {
|
|
8366
|
+
throw new Error("not a short share link");
|
|
8367
|
+
}
|
|
8222
8368
|
} catch {
|
|
8223
8369
|
throw new CredentialInvitationError(
|
|
8224
8370
|
"invalid-receipt",
|
|
8225
|
-
"credential invitation share link
|
|
8371
|
+
"credential invitation share link must be a short share link"
|
|
8226
8372
|
);
|
|
8227
8373
|
}
|
|
8228
8374
|
}
|
|
@@ -8889,6 +9035,8 @@ async function openNativeShare(sharing, link) {
|
|
|
8889
9035
|
}
|
|
8890
9036
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8891
9037
|
0 && (module.exports = {
|
|
9038
|
+
ADDRESSED_SHARE_TOO_LARGE_MESSAGE,
|
|
9039
|
+
AddressedShareOverLimitError,
|
|
8892
9040
|
ArtifactPinError,
|
|
8893
9041
|
CredentialInvitationError,
|
|
8894
9042
|
DEFAULT_MAX_CONTENT_BLOB_BYTES,
|
|
@@ -8912,7 +9060,9 @@ async function openNativeShare(sharing, link) {
|
|
|
8912
9060
|
ShareReceiveError,
|
|
8913
9061
|
ShareRecipientClient,
|
|
8914
9062
|
addressedCredentialRequirement,
|
|
9063
|
+
addressedShareBodyUpperBound,
|
|
8915
9064
|
artifactBindingView,
|
|
9065
|
+
assertAddressedShareFits,
|
|
8916
9066
|
assertArtifactBinding,
|
|
8917
9067
|
authorizationMethodForTarget,
|
|
8918
9068
|
authorizeShare,
|