@tinycloud/cli 0.9.1-beta.7 → 0.9.1-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/index.js +830 -1591
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +181 -179
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +5 -5
package/dist/legacy-entry.js
CHANGED
|
@@ -17471,25 +17471,25 @@ function encodeTo(int, target, offset = 0) {
|
|
|
17471
17471
|
function encodingLength(int) {
|
|
17472
17472
|
return varint_default.encodingLength(int);
|
|
17473
17473
|
}
|
|
17474
|
-
function create(code22,
|
|
17475
|
-
const size2 =
|
|
17474
|
+
function create(code22, digest3) {
|
|
17475
|
+
const size2 = digest3.byteLength;
|
|
17476
17476
|
const sizeOffset = encodingLength(code22);
|
|
17477
17477
|
const digestOffset = sizeOffset + encodingLength(size2);
|
|
17478
17478
|
const bytes3 = new Uint8Array(digestOffset + size2);
|
|
17479
17479
|
encodeTo(code22, bytes3, 0);
|
|
17480
17480
|
encodeTo(size2, bytes3, sizeOffset);
|
|
17481
|
-
bytes3.set(
|
|
17482
|
-
return new Digest(code22, size2,
|
|
17481
|
+
bytes3.set(digest3, digestOffset);
|
|
17482
|
+
return new Digest(code22, size2, digest3, bytes3);
|
|
17483
17483
|
}
|
|
17484
17484
|
function decode4(multihash) {
|
|
17485
17485
|
const bytes3 = coerce22(multihash);
|
|
17486
17486
|
const [code22, sizeOffset] = decode3(bytes3);
|
|
17487
17487
|
const [size2, digestOffset] = decode3(bytes3.subarray(sizeOffset));
|
|
17488
|
-
const
|
|
17489
|
-
if (
|
|
17488
|
+
const digest3 = bytes3.subarray(sizeOffset + digestOffset);
|
|
17489
|
+
if (digest3.byteLength !== size2) {
|
|
17490
17490
|
throw new Error("Incorrect length");
|
|
17491
17491
|
}
|
|
17492
|
-
return new Digest(code22, size2,
|
|
17492
|
+
return new Digest(code22, size2, digest3, bytes3);
|
|
17493
17493
|
}
|
|
17494
17494
|
function equals2(a, b) {
|
|
17495
17495
|
if (a === b) {
|
|
@@ -17582,8 +17582,8 @@ function encodeCID(version2, code22, multihash) {
|
|
|
17582
17582
|
return bytes3;
|
|
17583
17583
|
}
|
|
17584
17584
|
async function computeCid(bytes3) {
|
|
17585
|
-
const
|
|
17586
|
-
return CID.create(1, code,
|
|
17585
|
+
const digest3 = create(SHA256_CODE, sha256(new Uint8Array(bytes3)));
|
|
17586
|
+
return CID.create(1, code, digest3).toString();
|
|
17587
17587
|
}
|
|
17588
17588
|
function isCanonicalRawCid(cidString) {
|
|
17589
17589
|
let cid2;
|
|
@@ -18179,8 +18179,8 @@ async function verifyEnvelopeV3(envelope, options) {
|
|
|
18179
18179
|
if (hex(sourceDigest) !== parsed.contentSourceDigestHex) return false;
|
|
18180
18180
|
const sortedCapabilities = [...policy.capabilityCeiling].sort((left, right) => canonicalize2(left).localeCompare(canonicalize2(right)));
|
|
18181
18181
|
const capabilityCeilingHashHex = hex(sha2562(new TextEncoder().encode(`${POLICY_CAPABILITY_V1_DOMAIN}${canonicalize2(sortedCapabilities)}`)));
|
|
18182
|
-
const
|
|
18183
|
-
const nativeProjectionHashHex = hex(sha2562(new TextEncoder().encode(`${NATIVE_PROJECTION_V1_DOMAIN}${canonicalize2(
|
|
18182
|
+
const nativeProjection2 = sortedCapabilities.map((capability) => capability.kind === "encryption" ? { service: "tinycloud.encryption", space: capability.resource, path: capability.resource, actions: [capability.action] } : { service: "tinycloud.kv", space: capability.resource.slice(0, capability.resource.indexOf("/kv/")), path: capability.resource.split("/kv/")[1], actions: [...capability.actions], caveat: { type: "xyz.tinycloud.resource/selector", kind: capability.selector, value: capability.resource } }).sort((left, right) => canonicalize2(left).localeCompare(canonicalize2(right)));
|
|
18183
|
+
const nativeProjectionHashHex = hex(sha2562(new TextEncoder().encode(`${NATIVE_PROJECTION_V1_DOMAIN}${canonicalize2(nativeProjection2)}`)));
|
|
18184
18184
|
const expectedAttenuation = Object.fromEntries(sortedCapabilities.map((capability) => capability.kind === "encryption" ? [capability.resource, { [capability.action]: [{}] }] : [capability.resource, Object.fromEntries(capability.actions.map((action) => [action, [{ kind: capability.selector, type: "xyz.tinycloud.resource/selector", value: capability.resource }]]))]));
|
|
18185
18185
|
const kv = policy.capabilityCeiling.find((capability) => capability.kind === "kv");
|
|
18186
18186
|
const expectedKvActions = parsed.actions.flatMap((action) => action === "read" ? ["tinycloud.kv/get", "tinycloud.kv/metadata"] : action === "list" ? ["tinycloud.kv/list"] : ["tinycloud.kv/put"]);
|
|
@@ -18193,8 +18193,8 @@ async function verifyEnvelopeV3(envelope, options) {
|
|
|
18193
18193
|
const expectedBindingDigestHex = hex(sha2562(new TextEncoder().encode(canonicalize2({ enforcerDid: binding.enforcerDid, nodeAudience: binding.nodeAudience }))));
|
|
18194
18194
|
if (binding.enforcerDid !== parsed.target.nodeAudience || binding.attestationBindingDigestHex !== expectedBindingDigestHex || bindingSignature.signerDid !== binding.nodeAudience || bindingSignature.suite !== "Ed25519" || Date.parse(binding.issuedAt) > Date.now() || Date.parse(binding.expiresAt) <= Date.now() || Date.parse(binding.expiresAt) < Date.parse(parsed.expiry)) return false;
|
|
18195
18195
|
try {
|
|
18196
|
-
const
|
|
18197
|
-
if (!ed25519.verify(fromBase64Url(bindingSignature.value),
|
|
18196
|
+
const digest3 = sha2562(new TextEncoder().encode(`${ATTESTED_ENFORCER_V2_DOMAIN}${canonicalize2(unsignedBinding)}`));
|
|
18197
|
+
if (!ed25519.verify(fromBase64Url(bindingSignature.value), digest3, ed25519PublicKeyFromDidKey(binding.nodeAudience), ED25519_VERIFY_OPTS2)) return false;
|
|
18198
18198
|
} catch {
|
|
18199
18199
|
return false;
|
|
18200
18200
|
}
|
|
@@ -18918,6 +18918,12 @@ async function publishShare(options) {
|
|
|
18918
18918
|
envelopeKey?.fill(0);
|
|
18919
18919
|
}
|
|
18920
18920
|
}
|
|
18921
|
+
function authorizationMethodForTarget(target) {
|
|
18922
|
+
if (target.kind === "recipientDid") return "openkey-device";
|
|
18923
|
+
if (target.kind === "email") return "email-claim";
|
|
18924
|
+
if (target.kind === "emailDomain") return "email-claim";
|
|
18925
|
+
return void 0;
|
|
18926
|
+
}
|
|
18921
18927
|
function equals3(aa, bb) {
|
|
18922
18928
|
if (aa === bb) {
|
|
18923
18929
|
return true;
|
|
@@ -19163,6 +19169,109 @@ function rfc46482({ name: name2, prefix, bitsPerChar, alphabet: alphabet2 }) {
|
|
|
19163
19169
|
}
|
|
19164
19170
|
});
|
|
19165
19171
|
}
|
|
19172
|
+
function validEmail(value) {
|
|
19173
|
+
return /^[^@\s]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i.test(value);
|
|
19174
|
+
}
|
|
19175
|
+
function validDomain(value) {
|
|
19176
|
+
return /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?))+$/i.test(value);
|
|
19177
|
+
}
|
|
19178
|
+
function validRecipientDid(value) {
|
|
19179
|
+
if (value.length === 0 || value.length > 2048 || /[\u0000-\u0020\u007f]/.test(value)) return false;
|
|
19180
|
+
const parts = value.split(":");
|
|
19181
|
+
if (parts.length < 3 || parts[0] !== "did" || !/^[a-z0-9]+$/.test(parts[1] ?? "")) return false;
|
|
19182
|
+
const identifier = parts.slice(2);
|
|
19183
|
+
if (identifier.some((part) => part.length === 0)) return false;
|
|
19184
|
+
if (parts[1] === "web") {
|
|
19185
|
+
const host = identifier[0] ?? "";
|
|
19186
|
+
if (host.length > 253 || host.split(".").some((label) => !label || label.length > 63 || !/^[A-Za-z0-9-]+$/.test(label) || label.startsWith("-") || label.endsWith("-"))) return false;
|
|
19187
|
+
return identifier.slice(1).every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
19188
|
+
}
|
|
19189
|
+
if (parts[1] === "pkh") return identifier.length >= 3 && identifier.every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
19190
|
+
if (parts[1] === "key") {
|
|
19191
|
+
try {
|
|
19192
|
+
const bytes3 = base58btc2.decode(identifier.join(":"));
|
|
19193
|
+
return bytes3.length === 34 && bytes3[0] === 237 && bytes3[1] === 1;
|
|
19194
|
+
} catch {
|
|
19195
|
+
return false;
|
|
19196
|
+
}
|
|
19197
|
+
}
|
|
19198
|
+
return false;
|
|
19199
|
+
}
|
|
19200
|
+
function normalizeShareTarget(target) {
|
|
19201
|
+
if (target.kind === "bearer") return target;
|
|
19202
|
+
if (target.kind === "recipientDid") {
|
|
19203
|
+
if (!validRecipientDid(target.did)) throw new TypeError("recipient DID is invalid");
|
|
19204
|
+
return { kind: target.kind, did: target.did };
|
|
19205
|
+
}
|
|
19206
|
+
if (target.kind === "email") {
|
|
19207
|
+
if (!validEmail(target.address)) throw new TypeError("recipient email is invalid");
|
|
19208
|
+
const at = target.address.lastIndexOf("@");
|
|
19209
|
+
return { kind: target.kind, address: `${target.address.slice(0, at)}@${target.address.slice(at + 1).toLowerCase()}` };
|
|
19210
|
+
}
|
|
19211
|
+
if (!validDomain(target.domain)) throw new TypeError("recipient email domain is invalid");
|
|
19212
|
+
return { kind: target.kind, domain: target.domain.toLowerCase() };
|
|
19213
|
+
}
|
|
19214
|
+
function targetAuthorizationMethod(target) {
|
|
19215
|
+
return authorizationMethodForTarget(target);
|
|
19216
|
+
}
|
|
19217
|
+
async function publishTargetShare(input) {
|
|
19218
|
+
const target = normalizeShareTarget(input.target);
|
|
19219
|
+
if (target.kind === "bearer") return publishShare(input);
|
|
19220
|
+
if (input.targetAdapter === void 0) {
|
|
19221
|
+
return {
|
|
19222
|
+
state: "authorization-required",
|
|
19223
|
+
method: targetAuthorizationMethod(target)
|
|
19224
|
+
};
|
|
19225
|
+
}
|
|
19226
|
+
const source = input.source instanceof Uint8Array ? input.source.slice() : await (async () => {
|
|
19227
|
+
const chunks = [];
|
|
19228
|
+
let size2 = 0;
|
|
19229
|
+
for await (const chunk of input.source) {
|
|
19230
|
+
if (!(chunk instanceof Uint8Array)) throw new TypeError("addressed publication source yielded invalid bytes");
|
|
19231
|
+
size2 += chunk.byteLength;
|
|
19232
|
+
if (size2 > (input.maxBytes ?? 100 * 1024 * 1024)) throw new TypeError("addressed publication exceeds maxBytes");
|
|
19233
|
+
chunks.push(chunk.slice());
|
|
19234
|
+
}
|
|
19235
|
+
const bytes3 = new Uint8Array(size2);
|
|
19236
|
+
let offset = 0;
|
|
19237
|
+
for (const chunk of chunks) {
|
|
19238
|
+
bytes3.set(chunk, offset);
|
|
19239
|
+
offset += chunk.byteLength;
|
|
19240
|
+
}
|
|
19241
|
+
return bytes3;
|
|
19242
|
+
})();
|
|
19243
|
+
const files = input.files === void 0 || input.files.length === 0 ? [{ bytes: source }] : input.files;
|
|
19244
|
+
const limit = input.maxBytes ?? SHARE_CONTENT_LIMIT;
|
|
19245
|
+
let totalBytes = 0;
|
|
19246
|
+
for (const file of files) {
|
|
19247
|
+
totalBytes += file.bytes.byteLength;
|
|
19248
|
+
if (!Number.isSafeInteger(totalBytes) || totalBytes > limit) {
|
|
19249
|
+
throw new SharePublishError("max-bytes-exceeded", "addressed publication exceeds the combined byte limit");
|
|
19250
|
+
}
|
|
19251
|
+
}
|
|
19252
|
+
return input.targetAdapter.publish({
|
|
19253
|
+
source,
|
|
19254
|
+
filename: input.filename,
|
|
19255
|
+
...input.files === void 0 ? {} : { files: input.files },
|
|
19256
|
+
...input.mediaType === void 0 ? {} : { mediaType: input.mediaType },
|
|
19257
|
+
...input.resourceKind === void 0 ? {} : { resourceKind: input.resourceKind },
|
|
19258
|
+
...input.actions === void 0 ? {} : { actions: input.actions },
|
|
19259
|
+
target,
|
|
19260
|
+
expiresAt: input.expiresAt ?? new Date((input.now?.() ?? Date.now()) + 7 * 24 * 60 * 60 * 1e3),
|
|
19261
|
+
origin: input.origin,
|
|
19262
|
+
...input.inline === void 0 ? {} : { inline: input.inline },
|
|
19263
|
+
upload: {
|
|
19264
|
+
...input.registryBaseUrl === void 0 ? {} : { registryBaseUrl: input.registryBaseUrl },
|
|
19265
|
+
...input.fetchFn === void 0 ? {} : { fetchFn: input.fetchFn },
|
|
19266
|
+
...input.authorizeUpload === void 0 ? {} : { authorizeUpload: input.authorizeUpload },
|
|
19267
|
+
...input.authorizationOrigin === void 0 ? {} : { authorizationOrigin: input.authorizationOrigin },
|
|
19268
|
+
...input.credentials === void 0 ? {} : { credentials: input.credentials },
|
|
19269
|
+
...input.allowInsecureRegistry === void 0 ? {} : { allowInsecureRegistry: input.allowInsecureRegistry },
|
|
19270
|
+
...input.uploadBlob === void 0 ? {} : { uploadBlob: input.uploadBlob }
|
|
19271
|
+
},
|
|
19272
|
+
...input.notify === void 0 ? {} : { notify: input.notify }
|
|
19273
|
+
});
|
|
19274
|
+
}
|
|
19166
19275
|
function encode4(num2, out, offset) {
|
|
19167
19276
|
out = out || [];
|
|
19168
19277
|
offset = offset || 0;
|
|
@@ -19204,25 +19313,25 @@ function encodeTo2(int, target, offset = 0) {
|
|
|
19204
19313
|
function encodingLength2(int) {
|
|
19205
19314
|
return varint_default2.encodingLength(int);
|
|
19206
19315
|
}
|
|
19207
|
-
function create2(code3,
|
|
19208
|
-
const size2 =
|
|
19316
|
+
function create2(code3, digest3) {
|
|
19317
|
+
const size2 = digest3.byteLength;
|
|
19209
19318
|
const sizeOffset = encodingLength2(code3);
|
|
19210
19319
|
const digestOffset = sizeOffset + encodingLength2(size2);
|
|
19211
19320
|
const bytes3 = new Uint8Array(digestOffset + size2);
|
|
19212
19321
|
encodeTo2(code3, bytes3, 0);
|
|
19213
19322
|
encodeTo2(size2, bytes3, sizeOffset);
|
|
19214
|
-
bytes3.set(
|
|
19215
|
-
return new Digest2(code3, size2,
|
|
19323
|
+
bytes3.set(digest3, digestOffset);
|
|
19324
|
+
return new Digest2(code3, size2, digest3, bytes3);
|
|
19216
19325
|
}
|
|
19217
19326
|
function decode8(multihash) {
|
|
19218
19327
|
const bytes3 = coerce3(multihash);
|
|
19219
19328
|
const [code3, sizeOffset] = decode7(bytes3);
|
|
19220
19329
|
const [size2, digestOffset] = decode7(bytes3.subarray(sizeOffset));
|
|
19221
|
-
const
|
|
19222
|
-
if (
|
|
19330
|
+
const digest3 = bytes3.subarray(sizeOffset + digestOffset);
|
|
19331
|
+
if (digest3.byteLength !== size2) {
|
|
19223
19332
|
throw new Error("Incorrect length");
|
|
19224
19333
|
}
|
|
19225
|
-
return new Digest2(code3, size2,
|
|
19334
|
+
return new Digest2(code3, size2, digest3, bytes3);
|
|
19226
19335
|
}
|
|
19227
19336
|
function equals4(a, b) {
|
|
19228
19337
|
if (a === b) {
|
|
@@ -19314,115 +19423,6 @@ function encodeCID2(version2, code3, multihash) {
|
|
|
19314
19423
|
bytes3.set(multihash, hashOffset);
|
|
19315
19424
|
return bytes3;
|
|
19316
19425
|
}
|
|
19317
|
-
function authorizationMethodForTarget(target) {
|
|
19318
|
-
if (target.kind === "recipientDid") return "openkey-device";
|
|
19319
|
-
if (target.kind === "email") return "email-claim";
|
|
19320
|
-
if (target.kind === "emailDomain") return "email-claim";
|
|
19321
|
-
return void 0;
|
|
19322
|
-
}
|
|
19323
|
-
function validEmail(value) {
|
|
19324
|
-
return /^[^@\s]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i.test(value);
|
|
19325
|
-
}
|
|
19326
|
-
function validDomain(value) {
|
|
19327
|
-
return /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?))+$/i.test(value);
|
|
19328
|
-
}
|
|
19329
|
-
function validRecipientDid(value) {
|
|
19330
|
-
if (value.length === 0 || value.length > 2048 || /[\u0000-\u0020\u007f]/.test(value)) return false;
|
|
19331
|
-
const parts = value.split(":");
|
|
19332
|
-
if (parts.length < 3 || parts[0] !== "did" || !/^[a-z0-9]+$/.test(parts[1] ?? "")) return false;
|
|
19333
|
-
const identifier = parts.slice(2);
|
|
19334
|
-
if (identifier.some((part) => part.length === 0)) return false;
|
|
19335
|
-
if (parts[1] === "web") {
|
|
19336
|
-
const host = identifier[0] ?? "";
|
|
19337
|
-
if (host.length > 253 || host.split(".").some((label) => !label || label.length > 63 || !/^[A-Za-z0-9-]+$/.test(label) || label.startsWith("-") || label.endsWith("-"))) return false;
|
|
19338
|
-
return identifier.slice(1).every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
19339
|
-
}
|
|
19340
|
-
if (parts[1] === "pkh") return identifier.length >= 3 && identifier.every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
19341
|
-
if (parts[1] === "key") {
|
|
19342
|
-
try {
|
|
19343
|
-
const bytes3 = base58btc2.decode(identifier.join(":"));
|
|
19344
|
-
return bytes3.length === 34 && bytes3[0] === 237 && bytes3[1] === 1;
|
|
19345
|
-
} catch {
|
|
19346
|
-
return false;
|
|
19347
|
-
}
|
|
19348
|
-
}
|
|
19349
|
-
return false;
|
|
19350
|
-
}
|
|
19351
|
-
function normalizeShareTarget(target) {
|
|
19352
|
-
if (target.kind === "bearer") return target;
|
|
19353
|
-
if (target.kind === "recipientDid") {
|
|
19354
|
-
if (!validRecipientDid(target.did)) throw new TypeError("recipient DID is invalid");
|
|
19355
|
-
return { kind: target.kind, did: target.did };
|
|
19356
|
-
}
|
|
19357
|
-
if (target.kind === "email") {
|
|
19358
|
-
if (!validEmail(target.address)) throw new TypeError("recipient email is invalid");
|
|
19359
|
-
const at = target.address.lastIndexOf("@");
|
|
19360
|
-
return { kind: target.kind, address: `${target.address.slice(0, at)}@${target.address.slice(at + 1).toLowerCase()}` };
|
|
19361
|
-
}
|
|
19362
|
-
if (!validDomain(target.domain)) throw new TypeError("recipient email domain is invalid");
|
|
19363
|
-
return { kind: target.kind, domain: target.domain.toLowerCase() };
|
|
19364
|
-
}
|
|
19365
|
-
function targetAuthorizationMethod(target) {
|
|
19366
|
-
return authorizationMethodForTarget(target);
|
|
19367
|
-
}
|
|
19368
|
-
async function publishTargetShare(input) {
|
|
19369
|
-
const target = normalizeShareTarget(input.target);
|
|
19370
|
-
if (target.kind === "bearer") return publishShare(input);
|
|
19371
|
-
if (input.targetAdapter === void 0) {
|
|
19372
|
-
return {
|
|
19373
|
-
state: "authorization-required",
|
|
19374
|
-
method: targetAuthorizationMethod(target)
|
|
19375
|
-
};
|
|
19376
|
-
}
|
|
19377
|
-
const source = input.source instanceof Uint8Array ? input.source.slice() : await (async () => {
|
|
19378
|
-
const chunks = [];
|
|
19379
|
-
let size2 = 0;
|
|
19380
|
-
for await (const chunk of input.source) {
|
|
19381
|
-
if (!(chunk instanceof Uint8Array)) throw new TypeError("addressed publication source yielded invalid bytes");
|
|
19382
|
-
size2 += chunk.byteLength;
|
|
19383
|
-
if (size2 > (input.maxBytes ?? 100 * 1024 * 1024)) throw new TypeError("addressed publication exceeds maxBytes");
|
|
19384
|
-
chunks.push(chunk.slice());
|
|
19385
|
-
}
|
|
19386
|
-
const bytes3 = new Uint8Array(size2);
|
|
19387
|
-
let offset = 0;
|
|
19388
|
-
for (const chunk of chunks) {
|
|
19389
|
-
bytes3.set(chunk, offset);
|
|
19390
|
-
offset += chunk.byteLength;
|
|
19391
|
-
}
|
|
19392
|
-
return bytes3;
|
|
19393
|
-
})();
|
|
19394
|
-
const files = input.files === void 0 || input.files.length === 0 ? [{ bytes: source }] : input.files;
|
|
19395
|
-
const limit = input.maxBytes ?? SHARE_CONTENT_LIMIT;
|
|
19396
|
-
let totalBytes = 0;
|
|
19397
|
-
for (const file of files) {
|
|
19398
|
-
totalBytes += file.bytes.byteLength;
|
|
19399
|
-
if (!Number.isSafeInteger(totalBytes) || totalBytes > limit) {
|
|
19400
|
-
throw new SharePublishError("max-bytes-exceeded", "addressed publication exceeds the combined byte limit");
|
|
19401
|
-
}
|
|
19402
|
-
}
|
|
19403
|
-
return input.targetAdapter.publish({
|
|
19404
|
-
source,
|
|
19405
|
-
filename: input.filename,
|
|
19406
|
-
...input.files === void 0 ? {} : { files: input.files },
|
|
19407
|
-
...input.mediaType === void 0 ? {} : { mediaType: input.mediaType },
|
|
19408
|
-
...input.resourceKind === void 0 ? {} : { resourceKind: input.resourceKind },
|
|
19409
|
-
...input.actions === void 0 ? {} : { actions: input.actions },
|
|
19410
|
-
target,
|
|
19411
|
-
expiresAt: input.expiresAt ?? new Date((input.now?.() ?? Date.now()) + 7 * 24 * 60 * 60 * 1e3),
|
|
19412
|
-
origin: input.origin,
|
|
19413
|
-
...input.inline === void 0 ? {} : { inline: input.inline },
|
|
19414
|
-
upload: {
|
|
19415
|
-
...input.registryBaseUrl === void 0 ? {} : { registryBaseUrl: input.registryBaseUrl },
|
|
19416
|
-
...input.fetchFn === void 0 ? {} : { fetchFn: input.fetchFn },
|
|
19417
|
-
...input.authorizeUpload === void 0 ? {} : { authorizeUpload: input.authorizeUpload },
|
|
19418
|
-
...input.authorizationOrigin === void 0 ? {} : { authorizationOrigin: input.authorizationOrigin },
|
|
19419
|
-
...input.credentials === void 0 ? {} : { credentials: input.credentials },
|
|
19420
|
-
...input.allowInsecureRegistry === void 0 ? {} : { allowInsecureRegistry: input.allowInsecureRegistry },
|
|
19421
|
-
...input.uploadBlob === void 0 ? {} : { uploadBlob: input.uploadBlob }
|
|
19422
|
-
},
|
|
19423
|
-
...input.notify === void 0 ? {} : { notify: input.notify }
|
|
19424
|
-
});
|
|
19425
|
-
}
|
|
19426
19426
|
function historyRecordForPublishedShare(result, now = /* @__PURE__ */ new Date()) {
|
|
19427
19427
|
const target = result.metadata.target.kind;
|
|
19428
19428
|
const supplied = result.metadata.recipientMatcher;
|
|
@@ -19453,6 +19453,7 @@ function historyRecordForPublishedShare(result, now = /* @__PURE__ */ new Date()
|
|
|
19453
19453
|
registeredAt: now.toISOString(),
|
|
19454
19454
|
expiresAt: result.metadata.expiresAt,
|
|
19455
19455
|
link: result.url,
|
|
19456
|
+
...result.deliveryMaterial === void 0 ? {} : { deliveryMaterial: result.deliveryMaterial },
|
|
19456
19457
|
...result.metadata.display.filename === void 0 ? {} : { filename: result.metadata.display.filename }
|
|
19457
19458
|
};
|
|
19458
19459
|
}
|
|
@@ -19488,11 +19489,11 @@ async function notifyShare(input) {
|
|
|
19488
19489
|
}
|
|
19489
19490
|
async function defaultIdempotencyKey(shareId, recipient) {
|
|
19490
19491
|
const canonicalRecipient = canonicalize2(recipient.trim().toLowerCase());
|
|
19491
|
-
const
|
|
19492
|
+
const digest3 = new Uint8Array(await crypto.subtle.digest(
|
|
19492
19493
|
"SHA-256",
|
|
19493
19494
|
new TextEncoder().encode(canonicalRecipient)
|
|
19494
19495
|
));
|
|
19495
|
-
return `tinycloud-share:${shareId}:${toBase64Url(
|
|
19496
|
+
return `tinycloud-share:${shareId}:${toBase64Url(digest3)}`;
|
|
19496
19497
|
}
|
|
19497
19498
|
function targetKind2(record2) {
|
|
19498
19499
|
if (record2.targetKind !== void 0) return record2.targetKind;
|
|
@@ -19542,7 +19543,7 @@ async function migrateShare(input) {
|
|
|
19542
19543
|
const value = await receiveLegacyShare(input.link, input.reader);
|
|
19543
19544
|
return { protocol: "tinycloud-share", version: 1, legacy: true, value, migrated: await input.publish(value) };
|
|
19544
19545
|
}
|
|
19545
|
-
var __defProp2, __export2, external_exports2, util2, objectUtil2, ZodParsedType2, getParsedType2, ZodIssueCode2, quotelessJson2, ZodError2, errorMap2, en_default2, overrideErrorMap2, makeIssue2, EMPTY_PATH2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, instanceOfType2, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, ostring2, onumber2, oboolean2, coerce2, NEVER2, empty, src, _brrp__multiformats_scope_baseX, base_x_default, Encoder, Decoder, ComposedDecoder, Codec, base32, base32upper, base32pad, base32padupper, base32hex, base32hexupper, base32hexpad, base32hexpadupper, base32z, base36, base36upper, base58btc, base58flickr, encode_1, MSB, REST, MSBALL, INT, decode2, MSB$1, REST$1, N1, N2, N3, N4, N5, N6, N7, N8, N9, length, varint, _brrp_varint, varint_default, Digest, cache, CID, DAG_PB_CODE, SHA_256_CODE, cidSymbol, code, SHA256_CODE, base64, base64pad, base64url, base64urlpad, ED25519_MULTICODEC_PREFIX, PUBLIC_KEY_LENGTH, base64UrlString, sessionJwkCommonFields, okpPrivateJwkSchema, ecPrivateJwkSchema, sessionJwkSchema, policyTargetSchema, bearerKeyTargetSchema, recipientDidTargetSchema, authorizationTargetSchema, resourceSelectorSchema, targetSchema, displaySchema, contentPointerSchema, signatureSchema, unsignedShareEnvelopeSchema, shareEnvelopeSchema, recipientMatcherSchema, shareActionSchema, kvContentSourceSchema, sqlContentSourceSchema, contentSourceSchema, v2TargetSchema, shareDecryptionSchema, ownerAuthoritySchema, contentMetadataSchema, unsignedShareEnvelopeV2BaseSchema, unsignedShareEnvelopeV2Schema, shareEnvelopeV2Schema, unifiedResourceSchema, unifiedEncryptionNetworkSchema, unifiedKvCapabilitySchema, unifiedEncryptionCapabilitySchema, unifiedCapabilitySchema, unifiedContentSourceSchema, unifiedPolicyV1Schema, policyCredentialRequirementV1Schema, unifiedPolicyV2Schema, unifiedPolicySchema, unifiedRootSchema, attestedEnforcerBindingV2Schema, v3TargetSchema, unsignedShareEnvelopeV3BaseSchema, unsignedShareEnvelopeV3Schema, shareEnvelopeV3Schema, BEARER_READ_ABILITY, READ_ABILITIES, ED25519_VERIFY_OPTS, ENVELOPE_AAD_LABEL, SEALED_BLOB_VERSION, AAD, KEY_LENGTH, NONCE_LENGTH, TAG_LENGTH, HEADER_LENGTH, ED25519_VERIFY_OPTS2, ENVELOPE_SIGNATURE_DOMAIN, ENVELOPE_V2_SIGNATURE_DOMAIN, ENVELOPE_V3_SIGNATURE_DOMAIN, POLICY_V1_SIGNATURE_DOMAIN, POLICY_V2_SIGNATURE_DOMAIN, CONTENT_SOURCE_V1_DOMAIN, POLICY_CAPABILITY_V1_DOMAIN, NATIVE_PROJECTION_V1_DOMAIN, ATTESTED_ENFORCER_V2_DOMAIN, KEY_LENGTH2, INLINE_PREFIX, MAX_INLINE_BYTES, SHARE_RESULT_VERSION, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_MAX_CONTENT_BLOB_BYTES, CONTENT_SEALED_OVERHEAD, ShareReceiveError, SHARE_CONTENT_LIMIT, SHARE_SEALED_OVERHEAD, SHARE_PUBLISH_RESULT_VERSION, DEFAULT_SHARE_LIFETIME_MS, SharePublishError, empty2, src2, _brrp__multiformats_scope_baseX2, base_x_default2, Encoder2, Decoder2, ComposedDecoder2, Codec2, base322, base32upper2, base32pad2, base32padupper2, base32hex2, base32hexupper2, base32hexpad2, base32hexpadupper2, base32z2, base362, base36upper2,
|
|
19546
|
+
var __defProp2, __export2, external_exports2, util2, objectUtil2, ZodParsedType2, getParsedType2, ZodIssueCode2, quotelessJson2, ZodError2, errorMap2, en_default2, overrideErrorMap2, makeIssue2, EMPTY_PATH2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, instanceOfType2, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, ostring2, onumber2, oboolean2, coerce2, NEVER2, empty, src, _brrp__multiformats_scope_baseX, base_x_default, Encoder, Decoder, ComposedDecoder, Codec, base32, base32upper, base32pad, base32padupper, base32hex, base32hexupper, base32hexpad, base32hexpadupper, base32z, base36, base36upper, base58btc, base58flickr, encode_1, MSB, REST, MSBALL, INT, decode2, MSB$1, REST$1, N1, N2, N3, N4, N5, N6, N7, N8, N9, length, varint, _brrp_varint, varint_default, Digest, cache, CID, DAG_PB_CODE, SHA_256_CODE, cidSymbol, code, SHA256_CODE, base64, base64pad, base64url, base64urlpad, ED25519_MULTICODEC_PREFIX, PUBLIC_KEY_LENGTH, base64UrlString, sessionJwkCommonFields, okpPrivateJwkSchema, ecPrivateJwkSchema, sessionJwkSchema, policyTargetSchema, bearerKeyTargetSchema, recipientDidTargetSchema, authorizationTargetSchema, resourceSelectorSchema, targetSchema, displaySchema, contentPointerSchema, signatureSchema, unsignedShareEnvelopeSchema, shareEnvelopeSchema, recipientMatcherSchema, shareActionSchema, kvContentSourceSchema, sqlContentSourceSchema, contentSourceSchema, v2TargetSchema, shareDecryptionSchema, ownerAuthoritySchema, contentMetadataSchema, unsignedShareEnvelopeV2BaseSchema, unsignedShareEnvelopeV2Schema, shareEnvelopeV2Schema, unifiedResourceSchema, unifiedEncryptionNetworkSchema, unifiedKvCapabilitySchema, unifiedEncryptionCapabilitySchema, unifiedCapabilitySchema, unifiedContentSourceSchema, unifiedPolicyV1Schema, policyCredentialRequirementV1Schema, unifiedPolicyV2Schema, unifiedPolicySchema, unifiedRootSchema, attestedEnforcerBindingV2Schema, v3TargetSchema, unsignedShareEnvelopeV3BaseSchema, unsignedShareEnvelopeV3Schema, shareEnvelopeV3Schema, BEARER_READ_ABILITY, READ_ABILITIES, ED25519_VERIFY_OPTS, ENVELOPE_AAD_LABEL, SEALED_BLOB_VERSION, AAD, KEY_LENGTH, NONCE_LENGTH, TAG_LENGTH, HEADER_LENGTH, ED25519_VERIFY_OPTS2, ENVELOPE_SIGNATURE_DOMAIN, ENVELOPE_V2_SIGNATURE_DOMAIN, ENVELOPE_V3_SIGNATURE_DOMAIN, POLICY_V1_SIGNATURE_DOMAIN, POLICY_V2_SIGNATURE_DOMAIN, CONTENT_SOURCE_V1_DOMAIN, POLICY_CAPABILITY_V1_DOMAIN, NATIVE_PROJECTION_V1_DOMAIN, ATTESTED_ENFORCER_V2_DOMAIN, KEY_LENGTH2, INLINE_PREFIX, MAX_INLINE_BYTES, SHARE_RESULT_VERSION, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_MAX_CONTENT_BLOB_BYTES, CONTENT_SEALED_OVERHEAD, ShareReceiveError, SHARE_CONTENT_LIMIT, SHARE_SEALED_OVERHEAD, SHARE_PUBLISH_RESULT_VERSION, DEFAULT_SHARE_LIFETIME_MS, SharePublishError, empty2, src2, _brrp__multiformats_scope_baseX2, base_x_default2, Encoder2, Decoder2, ComposedDecoder2, Codec2, base58btc2, base58flickr2, textEncoder, base322, base32upper2, base32pad2, base32padupper2, base32hex2, base32hexupper2, base32hexpad2, base32hexpadupper2, base32z2, base362, base36upper2, encode_12, MSB2, REST2, MSBALL2, INT2, decode6, MSB$12, REST$12, N12, N22, N32, N42, N52, N62, N72, N82, N92, length2, varint2, _brrp_varint2, varint_default2, Digest2, cache2, CID2, DAG_PB_CODE2, SHA_256_CODE2, cidSymbol2, MAX_CONTENT_BYTES, ShareNotifyError, SHARE_V2_PROTOCOL, DOMAIN, PRESENTATION_DOMAIN, SESSION_DOMAIN, INVOCATION_DOMAIN;
|
|
19546
19547
|
var init_dist3 = __esm({
|
|
19547
19548
|
"../share-sdk/dist/index.js"() {
|
|
19548
19549
|
"use strict";
|
|
@@ -23561,10 +23562,10 @@ var init_dist3 = __esm({
|
|
|
23561
23562
|
/**
|
|
23562
23563
|
* Creates a multihash digest.
|
|
23563
23564
|
*/
|
|
23564
|
-
constructor(code22, size2,
|
|
23565
|
+
constructor(code22, size2, digest3, bytes3) {
|
|
23565
23566
|
this.code = code22;
|
|
23566
23567
|
this.size = size2;
|
|
23567
|
-
this.digest =
|
|
23568
|
+
this.digest = digest3;
|
|
23568
23569
|
this.bytes = bytes3;
|
|
23569
23570
|
}
|
|
23570
23571
|
};
|
|
@@ -23627,8 +23628,8 @@ var init_dist3 = __esm({
|
|
|
23627
23628
|
toV1() {
|
|
23628
23629
|
switch (this.version) {
|
|
23629
23630
|
case 0: {
|
|
23630
|
-
const { code: code22, digest:
|
|
23631
|
-
const multihash = create(code22,
|
|
23631
|
+
const { code: code22, digest: digest3 } = this.multihash;
|
|
23632
|
+
const multihash = create(code22, digest3);
|
|
23632
23633
|
return _CID.createV1(this.code, multihash);
|
|
23633
23634
|
}
|
|
23634
23635
|
case 1: {
|
|
@@ -23682,8 +23683,8 @@ var init_dist3 = __esm({
|
|
|
23682
23683
|
return new _CID(version2, code22, multihash, bytes3 ?? encodeCID(version2, code22, multihash.bytes));
|
|
23683
23684
|
} else if (value[cidSymbol] === true) {
|
|
23684
23685
|
const { version: version2, multihash, code: code22 } = value;
|
|
23685
|
-
const
|
|
23686
|
-
return _CID.create(version2, code22,
|
|
23686
|
+
const digest3 = decode4(multihash);
|
|
23687
|
+
return _CID.create(version2, code22, digest3);
|
|
23687
23688
|
} else {
|
|
23688
23689
|
return null;
|
|
23689
23690
|
}
|
|
@@ -23693,11 +23694,11 @@ var init_dist3 = __esm({
|
|
|
23693
23694
|
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
23694
23695
|
* @param digest - (Multi)hash of the of the content.
|
|
23695
23696
|
*/
|
|
23696
|
-
static create(version2, code22,
|
|
23697
|
+
static create(version2, code22, digest3) {
|
|
23697
23698
|
if (typeof code22 !== "number") {
|
|
23698
23699
|
throw new Error("String codecs are no longer supported");
|
|
23699
23700
|
}
|
|
23700
|
-
if (!(
|
|
23701
|
+
if (!(digest3.bytes instanceof Uint8Array)) {
|
|
23701
23702
|
throw new Error("Invalid digest");
|
|
23702
23703
|
}
|
|
23703
23704
|
switch (version2) {
|
|
@@ -23705,12 +23706,12 @@ var init_dist3 = __esm({
|
|
|
23705
23706
|
if (code22 !== DAG_PB_CODE) {
|
|
23706
23707
|
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
|
|
23707
23708
|
} else {
|
|
23708
|
-
return new _CID(version2, code22,
|
|
23709
|
+
return new _CID(version2, code22, digest3, digest3.bytes);
|
|
23709
23710
|
}
|
|
23710
23711
|
}
|
|
23711
23712
|
case 1: {
|
|
23712
|
-
const bytes3 = encodeCID(version2, code22,
|
|
23713
|
-
return new _CID(version2, code22,
|
|
23713
|
+
const bytes3 = encodeCID(version2, code22, digest3.bytes);
|
|
23714
|
+
return new _CID(version2, code22, digest3, bytes3);
|
|
23714
23715
|
}
|
|
23715
23716
|
default: {
|
|
23716
23717
|
throw new Error("Invalid version");
|
|
@@ -23720,8 +23721,8 @@ var init_dist3 = __esm({
|
|
|
23720
23721
|
/**
|
|
23721
23722
|
* Simplified version of `create` for CIDv0.
|
|
23722
23723
|
*/
|
|
23723
|
-
static createV0(
|
|
23724
|
-
return _CID.create(0, DAG_PB_CODE,
|
|
23724
|
+
static createV0(digest3) {
|
|
23725
|
+
return _CID.create(0, DAG_PB_CODE, digest3);
|
|
23725
23726
|
}
|
|
23726
23727
|
/**
|
|
23727
23728
|
* Simplified version of `create` for CIDv1.
|
|
@@ -23729,8 +23730,8 @@ var init_dist3 = __esm({
|
|
|
23729
23730
|
* @param code - Content encoding format code.
|
|
23730
23731
|
* @param digest - Multihash of the content.
|
|
23731
23732
|
*/
|
|
23732
|
-
static createV1(code22,
|
|
23733
|
-
return _CID.create(1, code22,
|
|
23733
|
+
static createV1(code22, digest3) {
|
|
23734
|
+
return _CID.create(1, code22, digest3);
|
|
23734
23735
|
}
|
|
23735
23736
|
/**
|
|
23736
23737
|
* Decoded a CID from its binary representation. The byte array must contain
|
|
@@ -23763,8 +23764,8 @@ var init_dist3 = __esm({
|
|
|
23763
23764
|
throw new Error("Incorrect length");
|
|
23764
23765
|
}
|
|
23765
23766
|
const digestBytes3 = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
23766
|
-
const
|
|
23767
|
-
const cid2 = specs.version === 0 ? _CID.createV0(
|
|
23767
|
+
const digest3 = new Digest(specs.multihashCode, specs.digestSize, digestBytes3, multihashBytes);
|
|
23768
|
+
const cid2 = specs.version === 0 ? _CID.createV0(digest3) : _CID.createV1(specs.codec, digest3);
|
|
23768
23769
|
return [cid2, bytes3.subarray(specs.size)];
|
|
23769
23770
|
}
|
|
23770
23771
|
/**
|
|
@@ -24302,6 +24303,17 @@ var init_dist3 = __esm({
|
|
|
24302
24303
|
return this.decoder.decode(input);
|
|
24303
24304
|
}
|
|
24304
24305
|
};
|
|
24306
|
+
base58btc2 = baseX2({
|
|
24307
|
+
name: "base58btc",
|
|
24308
|
+
prefix: "z",
|
|
24309
|
+
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
24310
|
+
});
|
|
24311
|
+
base58flickr2 = baseX2({
|
|
24312
|
+
name: "base58flickr",
|
|
24313
|
+
prefix: "Z",
|
|
24314
|
+
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
24315
|
+
});
|
|
24316
|
+
textEncoder = new TextEncoder();
|
|
24305
24317
|
base322 = rfc46482({
|
|
24306
24318
|
prefix: "b",
|
|
24307
24319
|
name: "base32",
|
|
@@ -24366,16 +24378,6 @@ var init_dist3 = __esm({
|
|
|
24366
24378
|
name: "base36upper",
|
|
24367
24379
|
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
24368
24380
|
});
|
|
24369
|
-
base58btc2 = baseX2({
|
|
24370
|
-
name: "base58btc",
|
|
24371
|
-
prefix: "z",
|
|
24372
|
-
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
24373
|
-
});
|
|
24374
|
-
base58flickr2 = baseX2({
|
|
24375
|
-
name: "base58flickr",
|
|
24376
|
-
prefix: "Z",
|
|
24377
|
-
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
24378
|
-
});
|
|
24379
24381
|
encode_12 = encode4;
|
|
24380
24382
|
MSB2 = 128;
|
|
24381
24383
|
REST2 = 127;
|
|
@@ -24411,10 +24413,10 @@ var init_dist3 = __esm({
|
|
|
24411
24413
|
/**
|
|
24412
24414
|
* Creates a multihash digest.
|
|
24413
24415
|
*/
|
|
24414
|
-
constructor(code3, size2,
|
|
24416
|
+
constructor(code3, size2, digest3, bytes3) {
|
|
24415
24417
|
this.code = code3;
|
|
24416
24418
|
this.size = size2;
|
|
24417
|
-
this.digest =
|
|
24419
|
+
this.digest = digest3;
|
|
24418
24420
|
this.bytes = bytes3;
|
|
24419
24421
|
}
|
|
24420
24422
|
};
|
|
@@ -24477,8 +24479,8 @@ var init_dist3 = __esm({
|
|
|
24477
24479
|
toV1() {
|
|
24478
24480
|
switch (this.version) {
|
|
24479
24481
|
case 0: {
|
|
24480
|
-
const { code: code3, digest:
|
|
24481
|
-
const multihash = create2(code3,
|
|
24482
|
+
const { code: code3, digest: digest3 } = this.multihash;
|
|
24483
|
+
const multihash = create2(code3, digest3);
|
|
24482
24484
|
return _CID2.createV1(this.code, multihash);
|
|
24483
24485
|
}
|
|
24484
24486
|
case 1: {
|
|
@@ -24532,8 +24534,8 @@ var init_dist3 = __esm({
|
|
|
24532
24534
|
return new _CID2(version2, code3, multihash, bytes3 ?? encodeCID2(version2, code3, multihash.bytes));
|
|
24533
24535
|
} else if (value[cidSymbol2] === true) {
|
|
24534
24536
|
const { version: version2, multihash, code: code3 } = value;
|
|
24535
|
-
const
|
|
24536
|
-
return _CID2.create(version2, code3,
|
|
24537
|
+
const digest3 = decode8(multihash);
|
|
24538
|
+
return _CID2.create(version2, code3, digest3);
|
|
24537
24539
|
} else {
|
|
24538
24540
|
return null;
|
|
24539
24541
|
}
|
|
@@ -24543,11 +24545,11 @@ var init_dist3 = __esm({
|
|
|
24543
24545
|
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
24544
24546
|
* @param digest - (Multi)hash of the of the content.
|
|
24545
24547
|
*/
|
|
24546
|
-
static create(version2, code3,
|
|
24548
|
+
static create(version2, code3, digest3) {
|
|
24547
24549
|
if (typeof code3 !== "number") {
|
|
24548
24550
|
throw new Error("String codecs are no longer supported");
|
|
24549
24551
|
}
|
|
24550
|
-
if (!(
|
|
24552
|
+
if (!(digest3.bytes instanceof Uint8Array)) {
|
|
24551
24553
|
throw new Error("Invalid digest");
|
|
24552
24554
|
}
|
|
24553
24555
|
switch (version2) {
|
|
@@ -24555,12 +24557,12 @@ var init_dist3 = __esm({
|
|
|
24555
24557
|
if (code3 !== DAG_PB_CODE2) {
|
|
24556
24558
|
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE2}) block encoding`);
|
|
24557
24559
|
} else {
|
|
24558
|
-
return new _CID2(version2, code3,
|
|
24560
|
+
return new _CID2(version2, code3, digest3, digest3.bytes);
|
|
24559
24561
|
}
|
|
24560
24562
|
}
|
|
24561
24563
|
case 1: {
|
|
24562
|
-
const bytes3 = encodeCID2(version2, code3,
|
|
24563
|
-
return new _CID2(version2, code3,
|
|
24564
|
+
const bytes3 = encodeCID2(version2, code3, digest3.bytes);
|
|
24565
|
+
return new _CID2(version2, code3, digest3, bytes3);
|
|
24564
24566
|
}
|
|
24565
24567
|
default: {
|
|
24566
24568
|
throw new Error("Invalid version");
|
|
@@ -24570,8 +24572,8 @@ var init_dist3 = __esm({
|
|
|
24570
24572
|
/**
|
|
24571
24573
|
* Simplified version of `create` for CIDv0.
|
|
24572
24574
|
*/
|
|
24573
|
-
static createV0(
|
|
24574
|
-
return _CID2.create(0, DAG_PB_CODE2,
|
|
24575
|
+
static createV0(digest3) {
|
|
24576
|
+
return _CID2.create(0, DAG_PB_CODE2, digest3);
|
|
24575
24577
|
}
|
|
24576
24578
|
/**
|
|
24577
24579
|
* Simplified version of `create` for CIDv1.
|
|
@@ -24579,8 +24581,8 @@ var init_dist3 = __esm({
|
|
|
24579
24581
|
* @param code - Content encoding format code.
|
|
24580
24582
|
* @param digest - Multihash of the content.
|
|
24581
24583
|
*/
|
|
24582
|
-
static createV1(code3,
|
|
24583
|
-
return _CID2.create(1, code3,
|
|
24584
|
+
static createV1(code3, digest3) {
|
|
24585
|
+
return _CID2.create(1, code3, digest3);
|
|
24584
24586
|
}
|
|
24585
24587
|
/**
|
|
24586
24588
|
* Decoded a CID from its binary representation. The byte array must contain
|
|
@@ -24613,8 +24615,8 @@ var init_dist3 = __esm({
|
|
|
24613
24615
|
throw new Error("Incorrect length");
|
|
24614
24616
|
}
|
|
24615
24617
|
const digestBytes3 = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
24616
|
-
const
|
|
24617
|
-
const cid2 = specs.version === 0 ? _CID2.createV0(
|
|
24618
|
+
const digest3 = new Digest2(specs.multihashCode, specs.digestSize, digestBytes3, multihashBytes);
|
|
24619
|
+
const cid2 = specs.version === 0 ? _CID2.createV0(digest3) : _CID2.createV1(specs.codec, digest3);
|
|
24618
24620
|
return [cid2, bytes3.subarray(specs.size)];
|
|
24619
24621
|
}
|
|
24620
24622
|
/**
|
|
@@ -26127,7 +26129,7 @@ function decodeBase64Url4(value) {
|
|
|
26127
26129
|
}
|
|
26128
26130
|
return Uint8Array.from(bytes2);
|
|
26129
26131
|
}
|
|
26130
|
-
var import_ms, __defProp3, __typeError, __defNormalProp, __export3, __publicField, __accessCheck, __privateGet, __privateAdd, __privateSet, EnsDataSchema, SiweConfigSchema, ClientSessionSchema, objectHasOwn, base32_exports, empty3, src3, _brrp__multiformats_scope_baseX3, base_x_default3, Encoder3, Decoder3, ComposedDecoder3, Codec3, base323, base32upper3, base32pad3, base32padupper3, base32hex3, base32hexupper3, base32hexpad3, base32hexpadupper3, base32z3, base36_exports, base363, base36upper3, base58_exports, base58btc3, base58flickr3, encode_13, MSB3, REST3, MSBALL3, INT3, decode22, MSB$13, REST$13, N13, N23, N33, N43, N53, N63, N73, N83, N93, length3, varint3, _brrp_varint3, varint_default3, Digest3, cache3, _a, CID3, DAG_PB_CODE3, SHA_256_CODE3, cidSymbol3,
|
|
26132
|
+
var import_ms, __defProp3, __typeError, __defNormalProp, __export3, __publicField, __accessCheck, __privateGet, __privateAdd, __privateSet, EnsDataSchema, SiweConfigSchema, ClientSessionSchema, objectHasOwn, base32_exports, empty3, src3, _brrp__multiformats_scope_baseX3, base_x_default3, Encoder3, Decoder3, ComposedDecoder3, Codec3, base323, base32upper3, base32pad3, base32padupper3, base32hex3, base32hexupper3, base32hexpad3, base32hexpadupper3, base32z3, base36_exports, base363, base36upper3, base58_exports, base58btc3, base58flickr3, encode_13, MSB3, REST3, MSBALL3, INT3, decode22, MSB$13, REST$13, N13, N23, N33, N43, N53, N63, N73, N83, N93, length3, varint3, _brrp_varint3, varint_default3, Digest3, cache3, _a, CID3, DAG_PB_CODE3, SHA_256_CODE3, cidSymbol3, textEncoder2, objectHasOwn2, CEILING_SERVICES, GRANTABLE_ACTIONS, base10_exports, base10, base16_exports, base16, base16upper, base2_exports, base22, base256emoji_exports, alphabet, alphabetBytesToChars, alphabetCharsToBytes, base256emoji, base64_exports, base642, base64pad2, base64url2, base64urlpad2, base8_exports, base8, identity_exports, identity, textEncoder22, textDecoder, identity_exports2, code2, name, encode42, identity2, sha2_browser_exports, DEFAULT_MIN_DIGEST_LENGTH, Hasher, sha25622, sha5122, bases, hashes, textEncoder3, objectHasOwn3, TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA, OWNER_NODE_ENDPOINT_SCHEMA, W3C_VC_CREDENTIAL_VERIFIER, objectHasOwn4, CompactHeaderSchema, CompactPayloadSchema, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, JsonValueSchema, Rfc3339Schema, SignedRecordSchema, PolicyEngineSchema, OwnerNodeSchema, ResourceHintSchema, BootstrapSchema, SignatureSchema, ChallengeSchema, ChallengeResponseSchema, DenialSchema, ErrorEnvelopeDenialSchema, WireDelegationSchema, ResolveResponseSchema, DelegateReceiptSchema, SqlReadResponseSchema, KvReadResponseSchema, LISTEN_SQL_STATEMENT_CATALOG, LISTEN_SQL_STATEMENT_BY_NAME, JWKSchema, KeyTypeSchema, KeyInfoSchema, DelegationErrorSchema, DelegationSchema, DelegationStatusSchema, DelegationRevocationReceiptSchema, AccountDelegationResourceSchema, AccountDelegationDateSchema, AccountDelegationRecordSchema, AccountDelegationPageSchema, AccountDelegationQueryOptionsSchema, CapabilityEntrySchema, DelegationRecordSchema, CreateDelegationParamsSchema, DelegationChainSchema, DelegationChainV2Schema, DelegationDirectionSchema, DelegationFiltersSchema, SpaceOwnershipSchema, SpaceInfoSchema, ShareSchemaSchema, ShareLinkSchema, ShareLinkDataSchema, IngestOptionsSchema, GenerateShareParamsSchema, DelegationManagerConfigSchema, KeyProviderSchema, DelegationApiResponseSchema, DelegatedResourceSchema, CreateDelegationWasmParamsSchema, CreateDelegationWasmResultSchema, EPHEMERAL_MS, SIGNED_READ_URL_MS, SESSION_MS, SHARE_MS, APP_MS, MAX_MS, EXPIRY, DEFAULT_SIGNED_READ_URL_EXPIRY_MS2, EncodedShareDataSchema, ReceiveOptionsSchema, SharingServiceConfigSchema, DEFAULT_KNOWLEDGE_ROOT, ManifestValidationError, SERVICE_SHORT_TO_LONG, SERVICE_LONG_TO_SHORT, DEFAULT_MAX_INLINE_BYTES, MAX_SHARE_CONTENT_BYTES, MAX_SEALED_SHARE_CONTENT_BYTES, MAX_SHARE_ARTIFACT_BYTES, PUBLISHED_AAD, ShareRecipientTargetSchema, ShareResourceSchema, ShareActionSchema, ShareRecipientPolicySchema, ShareRecipientClientOptionsSchema, ShareNativeActionSchema, ShareWireActionSchema, ShareContentSourceSchema, ShareAddressedRecipientSchema, ShareAddressedDelegationRequestV2Schema, ShareAddressedDelegationEnvelopeV2Schema, ShareAddressedDelegationResponseV2Schema, ShareNativeResponseEntrySchema, ShareNativeResponseBase, ShareNativeResponseSchema, ResourceSchema, PortableDelegationSchema, MAX_NATIVE_CURSOR_BYTES, DEFAULT_EXPIRY_MS2, MAX_CONTENT_BYTES2, ethereumAddressPattern, EnsDataSchema2, PersistedTinyCloudSessionSchema, PersistedSessionDataSchema, TinyCloudSessionSchema, SpaceConfigSchema, SpaceServiceConfigSchema, SpaceDelegationParamsSchema, ServerDelegationInfoSchema, ServerDelegationsResponseSchema, ServerOwnedSpaceSchema, ServerOwnedSpacesResponseSchema, ServerCreateSpaceResponseSchema, ServerSpaceInfoResponseSchema, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, N122, N222, N322, N422, N522, N622, N722, MSB22, REST22, string, ascii, BASES, bases_default, InvalidMultiaddrError, ValidationError, InvalidParametersError, UnknownProtocolError, Parser, MAX_IPV6_LENGTH, MAX_IPV4_LENGTH, parser, CODE_IP4, CODE_TCP, CODE_UDP, CODE_DCCP, CODE_IP6, CODE_IP6ZONE, CODE_IPCIDR, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR, CODE_SCTP, CODE_UDT, CODE_UTP, CODE_UNIX, CODE_P2P, CODE_ONION, CODE_ONION3, CODE_GARLIC64, CODE_GARLIC32, CODE_TLS, CODE_SNI, CODE_NOISE, CODE_QUIC, CODE_QUIC_V1, CODE_WEBTRANSPORT, CODE_CERTHASH, CODE_HTTP, CODE_HTTP_PATH, CODE_HTTPS, CODE_WS, CODE_WSS, CODE_P2P_WEBSOCKET_STAR, CODE_P2P_STARDUST, CODE_P2P_WEBRTC_STAR, CODE_P2P_WEBRTC_DIRECT, CODE_WEBRTC_DIRECT, CODE_WEBRTC, CODE_P2P_CIRCUIT, CODE_MEMORY, ip4ToBytes, ip6ToBytes, ip4ToString, ip6ToString, decoders, anybaseDecoder, validatePort, V, Registry, registry, codecs, inspect, symbol, _a2, _components, _string, _bytes, _Multiaddr, Multiaddr, ASSUME_HTTP_CODES, interpreters, word, boundry, v4, v6segment, v6, v46Exact, v4exact, v6exact, ipRegex, toString3, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, LOCAL_LOOPBACK_PROBE_TIMEOUT_MS, LOCAL_LINK_PROBE_TIMEOUT_MS, LOCAL_LINK_HOST_SUFFIX, LocationRecordValidationError, defaultLocalNodeIdentityStore, DNS_LABEL_REGEX;
|
|
26131
26133
|
var init_dist4 = __esm({
|
|
26132
26134
|
"../sdk-core/dist/index.js"() {
|
|
26133
26135
|
"use strict";
|
|
@@ -26673,7 +26675,7 @@ var init_dist4 = __esm({
|
|
|
26673
26675
|
DAG_PB_CODE3 = 112;
|
|
26674
26676
|
SHA_256_CODE3 = 18;
|
|
26675
26677
|
cidSymbol3 = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
|
|
26676
|
-
|
|
26678
|
+
textEncoder2 = new TextEncoder();
|
|
26677
26679
|
objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
26678
26680
|
Object.prototype.hasOwnProperty
|
|
26679
26681
|
);
|
|
@@ -26803,7 +26805,7 @@ var init_dist4 = __esm({
|
|
|
26803
26805
|
encode: (buf) => toString(buf),
|
|
26804
26806
|
decode: (str) => fromString(str)
|
|
26805
26807
|
});
|
|
26806
|
-
|
|
26808
|
+
textEncoder22 = new TextEncoder();
|
|
26807
26809
|
textDecoder = new TextDecoder();
|
|
26808
26810
|
identity_exports2 = {};
|
|
26809
26811
|
__export3(identity_exports2, {
|