@tinycloud/sdk-core 2.11.0-beta.0 → 2.11.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/index.cjs +0 -4
- package/dist/delegations/index.cjs +93 -112
- 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 +119 -51
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +775 -399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +338 -12
- package/dist/index.d.ts +338 -12
- package/dist/index.js +798 -83
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +10 -74
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.js +10 -8
- package/dist/policy/index.js.map +1 -1
- package/dist/{recipient-types.schema-B2wH53_t.d.cts → recipient-types.schema-D5pDlIqn.d.cts} +116 -5
- package/dist/{recipient-types.schema-B2wH53_t.d.ts → recipient-types.schema-D5pDlIqn.d.ts} +116 -5
- package/dist/requester/index.cjs +10 -38
- package/dist/requester/index.cjs.map +1 -1
- package/dist/requester/index.js +10 -8
- package/dist/requester/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -119,6 +119,7 @@ __export(index_exports, {
|
|
|
119
119
|
MemoryShareCache: () => MemoryShareCache,
|
|
120
120
|
NETWORK_NAME_PATTERN: () => import_sdk_services8.NETWORK_NAME_PATTERN,
|
|
121
121
|
NetworkIdError: () => import_sdk_services8.NetworkIdError,
|
|
122
|
+
OPENKEY_ACTION_ID_SEPARATOR: () => OPENKEY_ACTION_ID_SEPARATOR,
|
|
122
123
|
POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA: () => POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA,
|
|
123
124
|
POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA: () => POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA,
|
|
124
125
|
POLICY_ENGINE_DENIAL_SCHEMA: () => POLICY_ENGINE_DENIAL_SCHEMA,
|
|
@@ -245,6 +246,7 @@ __export(index_exports, {
|
|
|
245
246
|
deriveSignedReceiverKey: () => import_sdk_services8.deriveSignedReceiverKey,
|
|
246
247
|
didCacheKey: () => didCacheKey,
|
|
247
248
|
didEquals: () => didEquals,
|
|
249
|
+
diffImmutableSiweFields: () => diffImmutableSiweFields,
|
|
248
250
|
disableTinyCloudDebug: () => import_sdk_services8.disableTinyCloudDebug,
|
|
249
251
|
discoverLocalTinyCloudNode: () => discoverLocalTinyCloudNode,
|
|
250
252
|
discoverNetwork: () => import_sdk_services8.discoverNetwork,
|
|
@@ -265,6 +267,8 @@ __export(index_exports, {
|
|
|
265
267
|
expandActionShortNames: () => expandActionShortNames,
|
|
266
268
|
expandPermissionEntries: () => expandPermissionEntries,
|
|
267
269
|
expandPermissionEntry: () => expandPermissionEntry,
|
|
270
|
+
extractImmutableSiweFields: () => extractImmutableSiweFields,
|
|
271
|
+
extractRecapAttenuations: () => extractRecapAttenuations,
|
|
268
272
|
fetchLocationRecord: () => fetchLocationRecord,
|
|
269
273
|
fetchPeerId: () => fetchPeerId,
|
|
270
274
|
generateRandomReceiverKey: () => import_sdk_services8.generateRandomReceiverKey,
|
|
@@ -277,6 +281,7 @@ __export(index_exports, {
|
|
|
277
281
|
isCapabilitySubset: () => isCapabilitySubset,
|
|
278
282
|
isEvmAddress: () => isEvmAddress,
|
|
279
283
|
isNetworkId: () => import_sdk_services8.isNetworkId,
|
|
284
|
+
isPlausibleOpenKeyActionId: () => isPlausibleOpenKeyActionId,
|
|
280
285
|
isV2ShareLink: () => isV2ShareLink,
|
|
281
286
|
jcsCanonicalize: () => jcsCanonicalize,
|
|
282
287
|
loadManifest: () => loadManifest,
|
|
@@ -294,6 +299,7 @@ __export(index_exports, {
|
|
|
294
299
|
ok: () => import_sdk_services8.ok,
|
|
295
300
|
openWrappedKey: () => import_sdk_services8.openWrappedKey,
|
|
296
301
|
parseCanonicalNetworkId: () => parseCanonicalNetworkId,
|
|
302
|
+
parseCanonicalRecapResource: () => parseCanonicalRecapResource,
|
|
297
303
|
parseExpiry: () => parseExpiry,
|
|
298
304
|
parseNetworkId: () => import_sdk_services8.parseNetworkId,
|
|
299
305
|
parseNodeNativePortableDelegation: () => parseNodeNativePortableDelegation,
|
|
@@ -325,6 +331,8 @@ __export(index_exports, {
|
|
|
325
331
|
submitHostDelegation: () => submitHostDelegation,
|
|
326
332
|
tinyCloudDebugLogger: () => import_sdk_services8.tinyCloudDebugLogger,
|
|
327
333
|
toSignedObjectError: () => toSignedObjectError,
|
|
334
|
+
unauthorizedRecapCapabilities: () => unauthorizedRecapCapabilities,
|
|
335
|
+
validateAuthorizationResultV1: () => validateAuthorizationResultV1,
|
|
328
336
|
validateClientSession: () => validateClientSession,
|
|
329
337
|
validateEnvelope: () => import_sdk_services8.validateEnvelope,
|
|
330
338
|
validateLocationRecord: () => validateLocationRecord,
|
|
@@ -2200,13 +2208,12 @@ function digest(input, options2) {
|
|
|
2200
2208
|
}
|
|
2201
2209
|
var identity2 = { code: code2, name, encode: encode4, digest };
|
|
2202
2210
|
|
|
2203
|
-
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
2204
|
-
var
|
|
2205
|
-
__export(
|
|
2211
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
|
|
2212
|
+
var sha2_browser_exports = {};
|
|
2213
|
+
__export(sha2_browser_exports, {
|
|
2206
2214
|
sha256: () => sha2562,
|
|
2207
2215
|
sha512: () => sha512
|
|
2208
2216
|
});
|
|
2209
|
-
var import_crypto = __toESM(require("crypto"), 1);
|
|
2210
2217
|
|
|
2211
2218
|
// ../../node_modules/multiformats/dist/src/hashes/hasher.js
|
|
2212
2219
|
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
@@ -2256,21 +2263,24 @@ function createDigest(digest4, code3, truncate) {
|
|
|
2256
2263
|
return create(code3, digest4);
|
|
2257
2264
|
}
|
|
2258
2265
|
|
|
2259
|
-
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
2266
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
|
|
2267
|
+
function sha(name2) {
|
|
2268
|
+
return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
|
|
2269
|
+
}
|
|
2260
2270
|
var sha2562 = from2({
|
|
2261
2271
|
name: "sha2-256",
|
|
2262
2272
|
code: 18,
|
|
2263
|
-
encode: (
|
|
2273
|
+
encode: sha("SHA-256")
|
|
2264
2274
|
});
|
|
2265
2275
|
var sha512 = from2({
|
|
2266
2276
|
name: "sha2-512",
|
|
2267
2277
|
code: 19,
|
|
2268
|
-
encode: (
|
|
2278
|
+
encode: sha("SHA-512")
|
|
2269
2279
|
});
|
|
2270
2280
|
|
|
2271
2281
|
// ../../node_modules/multiformats/dist/src/basics.js
|
|
2272
2282
|
var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
|
|
2273
|
-
var hashes = { ...
|
|
2283
|
+
var hashes = { ...sha2_browser_exports, ...identity_exports2 };
|
|
2274
2284
|
|
|
2275
2285
|
// src/policy/signed-object.ts
|
|
2276
2286
|
var import_viem3 = require("viem");
|
|
@@ -6702,15 +6712,28 @@ function normalizeSpace(space) {
|
|
|
6702
6712
|
function isCapabilitySubset(requested, granted) {
|
|
6703
6713
|
const missing = [];
|
|
6704
6714
|
for (const req of requested) {
|
|
6705
|
-
const
|
|
6706
|
-
|
|
6715
|
+
const matchingScope = granted.filter(
|
|
6716
|
+
(entry) => canonicalizeEntryScopeMatches(req, entry)
|
|
6717
|
+
);
|
|
6718
|
+
const requestedActions = expandActionShortNames(
|
|
6719
|
+
req.service,
|
|
6720
|
+
req.actions
|
|
6721
|
+
);
|
|
6722
|
+
const grantedActions = matchingScope.flatMap(
|
|
6723
|
+
(entry) => expandActionShortNames(entry.service, entry.actions)
|
|
6724
|
+
);
|
|
6725
|
+
const covered = requestedActions.every(
|
|
6726
|
+
(requestedAction) => grantedActions.some(
|
|
6727
|
+
(grantedAction) => actionContains(grantedAction, requestedAction)
|
|
6728
|
+
)
|
|
6729
|
+
);
|
|
6730
|
+
if (!covered) {
|
|
6707
6731
|
missing.push(cloneEntry(req));
|
|
6708
|
-
continue;
|
|
6709
6732
|
}
|
|
6710
6733
|
}
|
|
6711
6734
|
return { subset: missing.length === 0, missing };
|
|
6712
6735
|
}
|
|
6713
|
-
function
|
|
6736
|
+
function canonicalizeEntryScopeMatches(requested, granted) {
|
|
6714
6737
|
if (requested.service !== granted.service) {
|
|
6715
6738
|
return false;
|
|
6716
6739
|
}
|
|
@@ -6720,15 +6743,6 @@ function canonicalizeEntryMatches(requested, granted) {
|
|
|
6720
6743
|
if (!pathContains2(granted.path, requested.path)) {
|
|
6721
6744
|
return false;
|
|
6722
6745
|
}
|
|
6723
|
-
const reqActions = new Set(
|
|
6724
|
-
expandActionShortNames(requested.service, requested.actions)
|
|
6725
|
-
);
|
|
6726
|
-
const grantedActions = expandActionShortNames(granted.service, granted.actions);
|
|
6727
|
-
for (const a of reqActions) {
|
|
6728
|
-
if (!grantedActions.some((grantedAction) => actionContains(grantedAction, a))) {
|
|
6729
|
-
return false;
|
|
6730
|
-
}
|
|
6731
|
-
}
|
|
6732
6746
|
if (!recapCaveatsEqual(requested.caveats, granted.caveats)) {
|
|
6733
6747
|
return false;
|
|
6734
6748
|
}
|
|
@@ -6992,6 +7006,10 @@ function normalizeRecipient(recipient) {
|
|
|
6992
7006
|
}
|
|
6993
7007
|
return { kind: recipient.kind, value: domain };
|
|
6994
7008
|
}
|
|
7009
|
+
if (recipient.kind === "recipientDid") {
|
|
7010
|
+
if (!isCanonicalRecipientDid(recipient.value)) throw new ShareEnvelopeError("invalid-envelope", "recipient DID is invalid");
|
|
7011
|
+
return { kind: recipient.kind, value: recipient.value };
|
|
7012
|
+
}
|
|
6995
7013
|
const exact = recipient.value.trim();
|
|
6996
7014
|
const at = exact.lastIndexOf("@");
|
|
6997
7015
|
const normalizedExact = at > 0 ? `${exact.slice(0, at)}@${exact.slice(at + 1).toLowerCase()}` : exact;
|
|
@@ -7000,6 +7018,28 @@ function normalizeRecipient(recipient) {
|
|
|
7000
7018
|
}
|
|
7001
7019
|
return { kind: recipient.kind, value: normalizedExact };
|
|
7002
7020
|
}
|
|
7021
|
+
function isCanonicalRecipientDid(value) {
|
|
7022
|
+
if (value.length === 0 || value.length > 2048 || /[\u0000-\u0020\u007f]/.test(value)) return false;
|
|
7023
|
+
const parts = value.split(":");
|
|
7024
|
+
if (parts.length < 3 || parts[0] !== "did" || !/^[a-z0-9]+$/.test(parts[1] ?? "")) return false;
|
|
7025
|
+
const identifier = parts.slice(2);
|
|
7026
|
+
if (identifier.some((part) => part.length === 0)) return false;
|
|
7027
|
+
if (parts[1] === "web") {
|
|
7028
|
+
const host = identifier[0] ?? "";
|
|
7029
|
+
if (host.length > 253 || host.split(".").some((label) => !label || label.length > 63 || !/^[A-Za-z0-9-]+$/.test(label) || label.startsWith("-") || label.endsWith("-"))) return false;
|
|
7030
|
+
return identifier.slice(1).every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
7031
|
+
}
|
|
7032
|
+
if (parts[1] === "pkh") return identifier.length >= 3 && identifier.every((part) => /^[A-Za-z0-9._%-]+$/.test(part));
|
|
7033
|
+
if (parts[1] === "key") {
|
|
7034
|
+
try {
|
|
7035
|
+
const bytes2 = base58btc.decode(identifier.join(":"));
|
|
7036
|
+
return bytes2.length === 34 && bytes2[0] === 237 && bytes2[1] === 1;
|
|
7037
|
+
} catch {
|
|
7038
|
+
return false;
|
|
7039
|
+
}
|
|
7040
|
+
}
|
|
7041
|
+
return false;
|
|
7042
|
+
}
|
|
7003
7043
|
function normalizeShareRecipientTarget(recipient) {
|
|
7004
7044
|
const normalized = normalizeRecipient(recipient);
|
|
7005
7045
|
if (normalized === void 0) throw new ShareEnvelopeError("invalid-envelope", "recipient matcher is required");
|
|
@@ -7086,9 +7126,9 @@ function verifyShareEnvelope(envelope, options2 = {}) {
|
|
|
7086
7126
|
const recipient = normalizeRecipient(envelope.recipient);
|
|
7087
7127
|
if (recipient !== void 0 && JSON.stringify(recipient) !== JSON.stringify(envelope.recipient)) throw new ShareEnvelopeError("invalid-envelope", "recipient is not canonical");
|
|
7088
7128
|
if (recipient?.kind === "exactEmail" || recipient?.kind === "emailDomain") throw new ShareEnvelopeError("unsafe-plaintext", "recipient matchers are not public envelope fields");
|
|
7089
|
-
if (envelope.recipientKind !== void 0 && !["exactEmail", "emailDomain", "bearer"].includes(envelope.recipientKind)) throw new ShareEnvelopeError("invalid-envelope", "recipient mode is invalid");
|
|
7129
|
+
if (envelope.recipientKind !== void 0 && !["exactEmail", "emailDomain", "recipientDid", "bearer"].includes(envelope.recipientKind)) throw new ShareEnvelopeError("invalid-envelope", "recipient mode is invalid");
|
|
7090
7130
|
if (envelope.recipientKind === "bearer" && recipient?.kind !== void 0 && recipient.kind !== "bearer") throw new ShareEnvelopeError("invalid-envelope", "recipient mode does not match recipient");
|
|
7091
|
-
if ((envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain") && !envelope.encrypted) throw new ShareEnvelopeError("unsafe-plaintext", "
|
|
7131
|
+
if ((envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.recipientKind === "recipientDid") && !envelope.encrypted) throw new ShareEnvelopeError("unsafe-plaintext", "addressed shares require encryption");
|
|
7092
7132
|
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");
|
|
7093
7133
|
const maxContentBytes = envelope.encrypted ? options2.maxSealedContentBytes ?? MAX_SEALED_SHARE_CONTENT_BYTES : options2.maxContentBytes ?? MAX_SHARE_CONTENT_BYTES;
|
|
7094
7134
|
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");
|
|
@@ -7227,7 +7267,7 @@ function parsePolicyMetadata(policyBytes, target, expectedExpiry) {
|
|
|
7227
7267
|
assertKeys(policy, ["type", "version", "issuerDid", "recipientMatcher", "target", "delegation", "authority", "actions", "resource", "content-source", "expiresAt"], "published canonical policy material");
|
|
7228
7268
|
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");
|
|
7229
7269
|
const matcherValue = policy.recipientMatcher;
|
|
7230
|
-
if (!isPlainObject(matcherValue) || matcherValue.kind !== "exactEmail" && matcherValue.kind !== "emailDomain" || typeof matcherValue.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
|
|
7270
|
+
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");
|
|
7231
7271
|
const matcher2 = normalizeRecipient(matcherValue);
|
|
7232
7272
|
if (matcher2 === void 0 || matcher2.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "policy matcher is invalid");
|
|
7233
7273
|
if (!isPlainObject(policy.target)) throw new ShareEnvelopeError("invalid-envelope", "policy target is invalid");
|
|
@@ -7314,7 +7354,7 @@ function parseCanonicalPublishedV2(value, options2) {
|
|
|
7314
7354
|
if (!Number.isFinite(expiry) || expiry <= (options2.now ?? /* @__PURE__ */ new Date()).getTime() || new Date(expiry).toISOString() !== value.expiry) throw new ShareEnvelopeError("expired", "published share envelope has expired");
|
|
7315
7355
|
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");
|
|
7316
7356
|
const matcher = value.recipientMatcher;
|
|
7317
|
-
if (!isPlainObject(matcher) || matcher.kind !== "exactEmail" && matcher.kind !== "emailDomain" || typeof matcher.value !== "string") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
|
|
7357
|
+
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");
|
|
7318
7358
|
const normalizedMatcher = normalizeRecipient(matcher);
|
|
7319
7359
|
if (normalizedMatcher === void 0 || normalizedMatcher.kind === "bearer") throw new ShareEnvelopeError("invalid-envelope", "published v2 recipient matcher is invalid");
|
|
7320
7360
|
if (!Array.isArray(value.actions)) throw new ShareEnvelopeError("invalid-envelope", "published v2 actions are invalid");
|
|
@@ -7755,10 +7795,11 @@ var ShareConflict = class extends Error {
|
|
|
7755
7795
|
}
|
|
7756
7796
|
};
|
|
7757
7797
|
var ShareAccessError = class extends Error {
|
|
7758
|
-
constructor(code3, message) {
|
|
7798
|
+
constructor(code3, message, details) {
|
|
7759
7799
|
super(message ?? "shared access could not be completed");
|
|
7760
7800
|
this.name = "ShareAccessError";
|
|
7761
7801
|
this.code = code3;
|
|
7802
|
+
this.details = details;
|
|
7762
7803
|
}
|
|
7763
7804
|
};
|
|
7764
7805
|
|
|
@@ -7767,6 +7808,7 @@ var import_zod5 = require("zod");
|
|
|
7767
7808
|
var ShareRecipientTargetSchema = import_zod5.z.discriminatedUnion("kind", [
|
|
7768
7809
|
import_zod5.z.object({ kind: import_zod5.z.literal("exactEmail"), value: import_zod5.z.string().min(1) }).strict(),
|
|
7769
7810
|
import_zod5.z.object({ kind: import_zod5.z.literal("emailDomain"), value: import_zod5.z.string().min(1) }).strict(),
|
|
7811
|
+
import_zod5.z.object({ kind: import_zod5.z.literal("recipientDid"), value: import_zod5.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict(),
|
|
7770
7812
|
import_zod5.z.object({ kind: import_zod5.z.literal("bearer") }).strict()
|
|
7771
7813
|
]);
|
|
7772
7814
|
var ShareResourceSchema = import_zod5.z.discriminatedUnion("kind", [
|
|
@@ -7810,7 +7852,8 @@ var ShareContentSourceSchema = import_zod5.z.discriminatedUnion("kind", [
|
|
|
7810
7852
|
]);
|
|
7811
7853
|
var ShareAddressedRecipientSchema = import_zod5.z.discriminatedUnion("kind", [
|
|
7812
7854
|
import_zod5.z.object({ kind: import_zod5.z.literal("exactEmail"), value: import_zod5.z.string().min(1) }).strict(),
|
|
7813
|
-
import_zod5.z.object({ kind: import_zod5.z.literal("emailDomain"), value: import_zod5.z.string().min(1) }).strict()
|
|
7855
|
+
import_zod5.z.object({ kind: import_zod5.z.literal("emailDomain"), value: import_zod5.z.string().min(1) }).strict(),
|
|
7856
|
+
import_zod5.z.object({ kind: import_zod5.z.literal("recipientDid"), value: import_zod5.z.string().regex(/^did:[a-z0-9]+:.+$/) }).strict()
|
|
7814
7857
|
]);
|
|
7815
7858
|
var ShareAddressedDelegationRequestV2Schema = import_zod5.z.object({
|
|
7816
7859
|
version: import_zod5.z.literal(2),
|
|
@@ -8065,12 +8108,21 @@ var ShareRecipientClient = class {
|
|
|
8065
8108
|
const { envelope } = resolved.artifact;
|
|
8066
8109
|
const { location } = resolved;
|
|
8067
8110
|
const bearer = isBearerEnvelope(envelope);
|
|
8068
|
-
const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain";
|
|
8111
|
+
const policy = envelope.recipientKind === "exactEmail" || envelope.recipientKind === "emailDomain" || envelope.authorizationTargetKind === "recipientDid";
|
|
8069
8112
|
const legacyBearer = !policy && envelope.recipientKind === void 0;
|
|
8070
|
-
|
|
8113
|
+
let recipientDidSession;
|
|
8114
|
+
if (envelope.authorizationTargetKind === "recipientDid") {
|
|
8115
|
+
if (this.options.establishRecipientDidSession === void 0) throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required");
|
|
8116
|
+
const authorization = await this.options.establishRecipientDidSession({ envelope, recipientDid: envelope.recipient?.kind === "recipientDid" ? envelope.recipient.value : "" });
|
|
8117
|
+
if ("state" in authorization) {
|
|
8118
|
+
if (authorization.state === "authorization-required") throw new ShareAccessError("SHARE_DEVICE_AUTH_REQUIRED", "an OpenKey device authorization is required", authorization);
|
|
8119
|
+
throw new ShareAccessError("SHARE_DENIED", "recipient DID authorization was denied", authorization);
|
|
8120
|
+
}
|
|
8121
|
+
recipientDidSession = authorization;
|
|
8122
|
+
}
|
|
8071
8123
|
if (policy && this.options.bearerSession !== void 0) throw new ShareAccessError("SHARE_POLICY_BEARER_MISMATCH");
|
|
8072
8124
|
if (bearer && this.options.presentation !== void 0) throw new ShareAccessError("SHARE_BEARER_PRESENTATION_MISMATCH");
|
|
8073
|
-
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;
|
|
8125
|
+
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;
|
|
8074
8126
|
const kv = bearer || legacyBearer ? session === void 0 ? void 0 : this.createKV(envelope.origin, session) : void 0;
|
|
8075
8127
|
const policySession = policy ? session : void 0;
|
|
8076
8128
|
if (policySession !== void 0) this.assertProvidedPolicySession(policySession, envelope);
|
|
@@ -10126,6 +10178,10 @@ async function createPolicyEnforcementDelegation(input) {
|
|
|
10126
10178
|
spaceId: input.spaceId,
|
|
10127
10179
|
path: input.path,
|
|
10128
10180
|
actions: [...input.actions],
|
|
10181
|
+
...input.decryption === void 0 ? {} : {
|
|
10182
|
+
decryptionNetworkId: input.decryption.networkId,
|
|
10183
|
+
decryptionAction: input.decryption.action
|
|
10184
|
+
},
|
|
10129
10185
|
contentSourceDigest: input.contentSourceDigest,
|
|
10130
10186
|
expiresAt: input.expiresAt
|
|
10131
10187
|
};
|
|
@@ -10145,7 +10201,9 @@ function computeOwnerShareRegistrationCid(registration) {
|
|
|
10145
10201
|
function validateOwnerSharePolicyRegistration(value, expected) {
|
|
10146
10202
|
if (cid(expected.policy.bytes) !== expected.policy.cid) throw new Error("submitted owner-share policy bytes do not match its CID");
|
|
10147
10203
|
const root = assertObject(value, ["registration", "proof"], "owner-share registration response");
|
|
10148
|
-
const
|
|
10204
|
+
const rawRegistration = root.registration;
|
|
10205
|
+
const hasDecryption = typeof rawRegistration === "object" && rawRegistration !== null && Object.prototype.hasOwnProperty.call(rawRegistration, "decryption");
|
|
10206
|
+
const registration = assertObject(root.registration, ["registrationCid", "policyCid", "ownerDelegationCid", "enforcementDelegationCid", "ownerDid", "shareKeyDid", "enforcerDid", "shareId", "recipientMatcher", "target", "resource", "actions", ...hasDecryption ? ["decryption"] : [], "contentSource", "contentSourceDigest", "registeredAt", "expiresAt"], "owner-share registration");
|
|
10149
10207
|
const proof = assertObject(root.proof, ["alg", "kid", "signature"], "owner-share registration proof");
|
|
10150
10208
|
if (registration.policyCid !== expected.policy.cid || registration.ownerDelegationCid !== expected.ownerDelegation.delegationCid || registration.enforcementDelegationCid !== expected.enforcementDelegation.cid || registration.contentSourceDigest !== expected.contentSourceDigest) throw new Error("owner-share registration is not bound to the submitted chain");
|
|
10151
10209
|
let policyValue;
|
|
@@ -10161,7 +10219,9 @@ function validateOwnerSharePolicyRegistration(value, expected) {
|
|
|
10161
10219
|
const registrationTarget = registration.target;
|
|
10162
10220
|
const registrationResource = registration.resource;
|
|
10163
10221
|
const enforcementFacts = expected.enforcementDelegation.facts;
|
|
10164
|
-
|
|
10222
|
+
const decryption = policy.decryption;
|
|
10223
|
+
const decryptionMatches = decryption === void 0 ? registration.decryption === void 0 : registration.decryption !== void 0 && canonicalizeSignedObjectUnsigned(decryption) === canonicalizeSignedObjectUnsigned(registration.decryption);
|
|
10224
|
+
if (typeof target?.origin !== "string" || typeof target.nodeAudience !== "string" || typeof target.enforcerDid !== "string" || typeof target.spaceId !== "string" || typeof resource?.kind !== "string" || !["exact", "prefix"].includes(resource.kind) || typeof resource?.path !== "string" || !Array.isArray(policy.actions) || policy.ownerDid !== registration.ownerDid || policy.shareKeyDid !== registration.shareKeyDid || policy.shareId !== registration.shareId || canonicalizeSignedObjectUnsigned(policy.recipientMatcher) !== canonicalizeSignedObjectUnsigned(registration.recipientMatcher) || target.origin !== registrationTarget.origin || target.nodeAudience !== registrationTarget.nodeAudience || target.enforcerDid !== registration.enforcerDid || target.spaceId !== registrationTarget.spaceId || resource.kind !== registrationResource.kind || resource.path !== registrationResource.path || canonicalizeSignedObjectUnsigned(policy.actions) !== canonicalizeSignedObjectUnsigned(registration.actions) || !decryptionMatches || canonicalizeSignedObjectUnsigned(policy.contentSource) !== canonicalizeSignedObjectUnsigned(registration.contentSource) || policy.expiresAt !== registration.expiresAt || policy.contentSourceDigest !== registration.contentSourceDigest || enforcementFacts.ownerDelegationCid !== registration.ownerDelegationCid || enforcementFacts.policyCid !== registration.policyCid || enforcementFacts.shareKeyDid !== registration.shareKeyDid || enforcementFacts.enforcerDid !== registration.enforcerDid || enforcementFacts.nodeAudience !== registrationTarget.nodeAudience || enforcementFacts.spaceId !== registrationTarget.spaceId || enforcementFacts.path !== registrationResource.path || canonicalizeSignedObjectUnsigned(enforcementFacts.actions) !== canonicalizeSignedObjectUnsigned(registration.actions) || enforcementFacts.decryptionNetworkId !== decryption?.networkId || enforcementFacts.decryptionAction !== decryption?.action || enforcementFacts.expiresAt !== registration.expiresAt) throw new Error("owner-share registration is not bound to the canonical policy");
|
|
10165
10225
|
if (typeof registration.registrationCid !== "string" || typeof registration.expiresAt !== "string" || typeof registration.registeredAt !== "string") throw new Error("owner-share registration timestamps are invalid");
|
|
10166
10226
|
if (new Date(registration.expiresAt).toISOString() !== registration.expiresAt || Date.parse(registration.expiresAt) <= Date.now()) throw new Error("owner-share registration is expired or non-canonical");
|
|
10167
10227
|
const { registrationCid: _registrationCid, ...registrationCore } = registration;
|
|
@@ -10263,7 +10323,7 @@ function validateShareDeliveryAuthorizationBytes(bytesValue, expected) {
|
|
|
10263
10323
|
const authorization = assertObject2(root.authorization, AUTHORIZATION_KEYS, "share delivery authorization");
|
|
10264
10324
|
const proof = assertObject2(root.proof, ["alg", "kid", "signature"], "share delivery authorization proof");
|
|
10265
10325
|
const request = expected.request;
|
|
10266
|
-
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.
|
|
10326
|
+
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) {
|
|
10267
10327
|
throw new Error("share delivery authorization is not bound to the submitted request");
|
|
10268
10328
|
}
|
|
10269
10329
|
if (typeof authorization.issuedAt !== "string" || Date.parse(authorization.issuedAt) > Date.now() + 6e4) throw new Error("share delivery authorization issuedAt is invalid");
|
|
@@ -10398,6 +10458,10 @@ var SenderShareStore = class {
|
|
|
10398
10458
|
}
|
|
10399
10459
|
};
|
|
10400
10460
|
|
|
10461
|
+
// src/delegations/index.ts
|
|
10462
|
+
var import_share_sdk = require("@tinycloud/share-sdk");
|
|
10463
|
+
var import_share_sdk2 = require("@tinycloud/share-sdk");
|
|
10464
|
+
|
|
10401
10465
|
// src/networkId.ts
|
|
10402
10466
|
var import_sdk_services3 = require("@tinycloud/sdk-services");
|
|
10403
10467
|
function canonicalizeNetworkId(networkId) {
|
|
@@ -12112,6 +12176,22 @@ var ACCOUNT_SPACES_PATH = "spaces/";
|
|
|
12112
12176
|
var AccountService = class {
|
|
12113
12177
|
constructor(config) {
|
|
12114
12178
|
this.config = config;
|
|
12179
|
+
/**
|
|
12180
|
+
* Per-account-space memo for {@link ensureAccountIndex}.
|
|
12181
|
+
*
|
|
12182
|
+
* Applying the index migration is a no-op once the schema exists, but the
|
|
12183
|
+
* SQL service still spends two round trips discovering that (create the
|
|
12184
|
+
* migrations table, then read the applied-migration rows). Account bootstrap
|
|
12185
|
+
* touches the index eight times, so without a memo that is ~14 wasted
|
|
12186
|
+
* requests on the cold sign-in path. The in-flight dedupe inside SQLService
|
|
12187
|
+
* never helps here: the node SDK builds a fresh SQLService per
|
|
12188
|
+
* `getAccountDb()` call, so its lock map is always empty.
|
|
12189
|
+
*
|
|
12190
|
+
* Keyed by account space id, so a different account never reuses this entry.
|
|
12191
|
+
* Failures are evicted so a later call retries instead of inheriting a
|
|
12192
|
+
* permanently poisoned result.
|
|
12193
|
+
*/
|
|
12194
|
+
this.accountIndexReady = /* @__PURE__ */ new Map();
|
|
12115
12195
|
this.applications = {
|
|
12116
12196
|
list: async (options2 = {}) => {
|
|
12117
12197
|
if (options2.preferIndex) {
|
|
@@ -12145,7 +12225,7 @@ var AccountService = class {
|
|
|
12145
12225
|
if (!loaded.ok) return accountErr(loaded.error);
|
|
12146
12226
|
return (0, import_sdk_services6.ok)(applicationFromRecord(key, loaded.data.data));
|
|
12147
12227
|
},
|
|
12148
|
-
register: async (manifest) => {
|
|
12228
|
+
register: async (manifest, options2 = {}) => {
|
|
12149
12229
|
const manifests = Array.isArray(manifest) ? manifest : [manifest];
|
|
12150
12230
|
const request = composeManifestRequest(manifests);
|
|
12151
12231
|
if (request.registryRecords.length === 0) {
|
|
@@ -12163,7 +12243,7 @@ var AccountService = class {
|
|
|
12163
12243
|
let registered;
|
|
12164
12244
|
for (const record of request.registryRecords) {
|
|
12165
12245
|
const manifestHash = hashJson(record.manifests);
|
|
12166
|
-
if (await this.indexHasApplicationHash(record.app_id, manifestHash)) {
|
|
12246
|
+
if (!options2.assumeUnregistered && await this.indexHasApplicationHash(record.app_id, manifestHash)) {
|
|
12167
12247
|
registered = {
|
|
12168
12248
|
appId: record.app_id,
|
|
12169
12249
|
manifests: record.manifests,
|
|
@@ -12238,6 +12318,60 @@ var AccountService = class {
|
|
|
12238
12318
|
await this.upsertSpaceIndexQuietly(registered);
|
|
12239
12319
|
return (0, import_sdk_services6.ok)(registered);
|
|
12240
12320
|
},
|
|
12321
|
+
/**
|
|
12322
|
+
* Register multiple spaces in one KV batch write + one multi-row index
|
|
12323
|
+
* write, instead of one `register()` round trip per space (TC-373).
|
|
12324
|
+
*
|
|
12325
|
+
* The stored records are computed exactly once and reused for both the
|
|
12326
|
+
* batch attempt and any reconciliation below, so a fallback never mints a
|
|
12327
|
+
* fresh timestamp for a space that already has a written record — a
|
|
12328
|
+
* second `spaceRecordFromInput` call would produce a new content hash and
|
|
12329
|
+
* leave the first attempt's blocks orphaned.
|
|
12330
|
+
*/
|
|
12331
|
+
registerBatch: async (spaces) => {
|
|
12332
|
+
if (spaces.length === 0) return (0, import_sdk_services6.ok)({ spaces: [] });
|
|
12333
|
+
await this.config.ensureAccountSpaceHosted?.();
|
|
12334
|
+
const kvResult = this.accountKV();
|
|
12335
|
+
if (!kvResult.ok) return kvResult;
|
|
12336
|
+
const stored = spaces.map((space) => spaceRecordFromInput(space));
|
|
12337
|
+
const registered = stored.map(
|
|
12338
|
+
(record) => spaceFromRecord(spaceKey(record.space_id), record)
|
|
12339
|
+
);
|
|
12340
|
+
const items = stored.map((record) => ({
|
|
12341
|
+
key: spaceKey(record.space_id),
|
|
12342
|
+
value: record
|
|
12343
|
+
}));
|
|
12344
|
+
const batchResult = await kvResult.data.batchPut(items);
|
|
12345
|
+
if (batchResult.ok) {
|
|
12346
|
+
await this.upsertSpacesIndexQuietly(registered);
|
|
12347
|
+
return (0, import_sdk_services6.ok)({ spaces: registered });
|
|
12348
|
+
}
|
|
12349
|
+
if (!isAmbiguousBatchFailure(batchResult.error)) {
|
|
12350
|
+
return accountErr(batchResult.error);
|
|
12351
|
+
}
|
|
12352
|
+
const reconcileFailures = [];
|
|
12353
|
+
for (const record of stored) {
|
|
12354
|
+
const written = await kvResult.data.put(spaceKey(record.space_id), record);
|
|
12355
|
+
if (!written.ok) {
|
|
12356
|
+
reconcileFailures.push(`${record.space_id}: ${written.error.message}`);
|
|
12357
|
+
}
|
|
12358
|
+
}
|
|
12359
|
+
if (reconcileFailures.length > 0) {
|
|
12360
|
+
return (0, import_sdk_services6.err)(
|
|
12361
|
+
(0, import_sdk_services6.serviceError)(
|
|
12362
|
+
"KV_BATCH_RECONCILE_FAILED",
|
|
12363
|
+
`KV batch write for ${items.length} space(s) failed ambiguously (${batchResult.error.message}) and per-space reconciliation also failed for: ${reconcileFailures.join("; ")}`,
|
|
12364
|
+
SERVICE_NAME2,
|
|
12365
|
+
{ cause: batchResult.error.cause, meta: { originalError: batchResult.error } }
|
|
12366
|
+
)
|
|
12367
|
+
);
|
|
12368
|
+
}
|
|
12369
|
+
console.warn(
|
|
12370
|
+
`[AccountService] KV batch write for ${items.length} space(s) returned an ambiguous error and was reconciled via per-space fallback. Original error: ${batchResult.error.message}`
|
|
12371
|
+
);
|
|
12372
|
+
await this.upsertSpacesIndexQuietly(registered);
|
|
12373
|
+
return (0, import_sdk_services6.ok)({ spaces: registered, recoveredFromBatchError: batchResult.error });
|
|
12374
|
+
},
|
|
12241
12375
|
syncAccessible: async () => {
|
|
12242
12376
|
const listed = await this.config.getSpaces().list();
|
|
12243
12377
|
if (!listed.ok) return accountErr(listed.error);
|
|
@@ -12344,6 +12478,7 @@ var AccountService = class {
|
|
|
12344
12478
|
const delegations = await this.delegations.list();
|
|
12345
12479
|
if (!delegations.ok) return delegations;
|
|
12346
12480
|
const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
12481
|
+
this.invalidateAccountIndexMemo();
|
|
12347
12482
|
const schema = await this.ensureAccountIndex(dbResult.data);
|
|
12348
12483
|
if (!schema.ok) return schema;
|
|
12349
12484
|
const statements = [
|
|
@@ -12623,6 +12758,47 @@ var AccountService = class {
|
|
|
12623
12758
|
if (!written.ok) return accountErr(written.error);
|
|
12624
12759
|
return (0, import_sdk_services6.ok)(void 0);
|
|
12625
12760
|
}
|
|
12761
|
+
async upsertSpacesIndexQuietly(spaces) {
|
|
12762
|
+
await ignoreIndexFailure(() => this.upsertSpacesIndex(spaces));
|
|
12763
|
+
}
|
|
12764
|
+
/**
|
|
12765
|
+
* Upsert multiple space index rows in ONE multi-row `INSERT OR REPLACE`
|
|
12766
|
+
* statement (TC-373), rather than one statement per space. This matters
|
|
12767
|
+
* because `IDatabaseHandle.batch()` executes its statement list as a plain
|
|
12768
|
+
* loop, not a single database transaction — an N-statement batch is not
|
|
12769
|
+
* atomic. A single multi-row INSERT is one SQLite statement, so it applies
|
|
12770
|
+
* atomically: all rows or none.
|
|
12771
|
+
*/
|
|
12772
|
+
async upsertSpacesIndex(spaces) {
|
|
12773
|
+
if (spaces.length === 0) return (0, import_sdk_services6.ok)(void 0);
|
|
12774
|
+
const dbResult = this.accountDb();
|
|
12775
|
+
if (!dbResult.ok) return (0, import_sdk_services6.ok)(void 0);
|
|
12776
|
+
const schema = await this.ensureAccountIndex(dbResult.data);
|
|
12777
|
+
if (!schema.ok) return schema;
|
|
12778
|
+
const placeholders = spaces.map(() => "(?, ?, ?, ?, ?, ?, ?, ?, ?)").join(", ");
|
|
12779
|
+
const params = spaces.flatMap((space) => {
|
|
12780
|
+
const updatedAt = space.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
12781
|
+
return [
|
|
12782
|
+
space.spaceId,
|
|
12783
|
+
space.name,
|
|
12784
|
+
space.ownerDid,
|
|
12785
|
+
space.type,
|
|
12786
|
+
JSON.stringify(space.permissions),
|
|
12787
|
+
space.status,
|
|
12788
|
+
space.registeredAt ?? updatedAt,
|
|
12789
|
+
updatedAt,
|
|
12790
|
+
space.expiresAt?.toISOString() ?? null
|
|
12791
|
+
];
|
|
12792
|
+
});
|
|
12793
|
+
const written = await dbResult.data.batch([
|
|
12794
|
+
{
|
|
12795
|
+
sql: `INSERT OR REPLACE INTO spaces (space_id, name, owner_did, type, permissions_json, status, registered_at, updated_at, expires_at) VALUES ${placeholders}`,
|
|
12796
|
+
params
|
|
12797
|
+
}
|
|
12798
|
+
]);
|
|
12799
|
+
if (!written.ok) return accountErr(written.error);
|
|
12800
|
+
return (0, import_sdk_services6.ok)(void 0);
|
|
12801
|
+
}
|
|
12626
12802
|
async deleteSpaceIndexQuietly(spaceId) {
|
|
12627
12803
|
await ignoreIndexFailure(() => this.deleteSpaceIndex(spaceId));
|
|
12628
12804
|
}
|
|
@@ -12743,7 +12919,41 @@ var AccountService = class {
|
|
|
12743
12919
|
]);
|
|
12744
12920
|
});
|
|
12745
12921
|
}
|
|
12922
|
+
/**
|
|
12923
|
+
* Apply the account index schema at most once per account space.
|
|
12924
|
+
*
|
|
12925
|
+
* The index is a cache over canonical KV state, and every caller already
|
|
12926
|
+
* tolerates it being absent (`ignoreIndexFailure` / `isMissingIndexError`),
|
|
12927
|
+
* so a memo that is wrong in the "already applied" direction degrades to a
|
|
12928
|
+
* `no such table` read that the caller handles. A memo that is wrong in the
|
|
12929
|
+
* other direction would be a real bug, so failures are never cached.
|
|
12930
|
+
*/
|
|
12746
12931
|
async ensureAccountIndex(db) {
|
|
12932
|
+
const key = this.config.getAccountSpaceId() ?? "";
|
|
12933
|
+
const cached = this.accountIndexReady.get(key);
|
|
12934
|
+
if (cached) return cached;
|
|
12935
|
+
const pending = this.applyAccountIndex(db);
|
|
12936
|
+
this.accountIndexReady.set(key, pending);
|
|
12937
|
+
const evict = () => {
|
|
12938
|
+
if (this.accountIndexReady.get(key) === pending) {
|
|
12939
|
+
this.accountIndexReady.delete(key);
|
|
12940
|
+
}
|
|
12941
|
+
};
|
|
12942
|
+
let settled;
|
|
12943
|
+
try {
|
|
12944
|
+
settled = await pending;
|
|
12945
|
+
} catch (error) {
|
|
12946
|
+
evict();
|
|
12947
|
+
throw error;
|
|
12948
|
+
}
|
|
12949
|
+
if (!settled.ok) evict();
|
|
12950
|
+
return settled;
|
|
12951
|
+
}
|
|
12952
|
+
/** Drop the memo so the next {@link ensureAccountIndex} re-applies the schema. */
|
|
12953
|
+
invalidateAccountIndexMemo() {
|
|
12954
|
+
this.accountIndexReady.delete(this.config.getAccountSpaceId() ?? "");
|
|
12955
|
+
}
|
|
12956
|
+
async applyAccountIndex(db) {
|
|
12747
12957
|
const migrated = await db.migrations.apply({
|
|
12748
12958
|
namespace: ACCOUNT_INDEX_NAMESPACE,
|
|
12749
12959
|
migrations: [
|
|
@@ -12915,6 +13125,17 @@ function accountErr(error) {
|
|
|
12915
13125
|
function isMissingIndexError(error) {
|
|
12916
13126
|
return /no such table:/i.test(error.message);
|
|
12917
13127
|
}
|
|
13128
|
+
var AMBIGUOUS_WRITE_STATUSES = /* @__PURE__ */ new Set([500, 502, 503, 504, 520, 522, 524]);
|
|
13129
|
+
function isAmbiguousBatchFailure(error) {
|
|
13130
|
+
if (error.code === import_sdk_services6.ErrorCodes.NETWORK_ERROR || error.code === import_sdk_services6.ErrorCodes.TIMEOUT) {
|
|
13131
|
+
return error.meta?.requestMayHaveDispatched === true;
|
|
13132
|
+
}
|
|
13133
|
+
if (error.code === import_sdk_services6.ErrorCodes.KV_WRITE_FAILED) {
|
|
13134
|
+
const status = error.meta?.status;
|
|
13135
|
+
return typeof status === "number" && AMBIGUOUS_WRITE_STATUSES.has(status);
|
|
13136
|
+
}
|
|
13137
|
+
return false;
|
|
13138
|
+
}
|
|
12918
13139
|
async function ignoreIndexFailure(task) {
|
|
12919
13140
|
try {
|
|
12920
13141
|
await task();
|
|
@@ -13531,6 +13752,279 @@ var AutoApproveSpaceCreationHandler = class {
|
|
|
13531
13752
|
};
|
|
13532
13753
|
var defaultSpaceCreationHandler = new AutoApproveSpaceCreationHandler();
|
|
13533
13754
|
|
|
13755
|
+
// src/authorization/openkey-protocol.ts
|
|
13756
|
+
function validateAuthorizationResultV1(value) {
|
|
13757
|
+
if (!value || typeof value !== "object") {
|
|
13758
|
+
return { ok: false, error: "authorization result must be an object" };
|
|
13759
|
+
}
|
|
13760
|
+
const v = value;
|
|
13761
|
+
if (v.protocolVersion !== 1) {
|
|
13762
|
+
return { ok: false, error: `unsupported protocolVersion ${String(v.protocolVersion)}` };
|
|
13763
|
+
}
|
|
13764
|
+
if (typeof v.address !== "string" || !v.address) {
|
|
13765
|
+
return { ok: false, error: "address must be a non-empty string" };
|
|
13766
|
+
}
|
|
13767
|
+
if (typeof v.signature !== "string" || !v.signature) {
|
|
13768
|
+
return { ok: false, error: "signature must be a non-empty string" };
|
|
13769
|
+
}
|
|
13770
|
+
if (typeof v.signedMessage !== "string" || !v.signedMessage) {
|
|
13771
|
+
return { ok: false, error: "signedMessage must be a non-empty string" };
|
|
13772
|
+
}
|
|
13773
|
+
if (!Array.isArray(v.selectedActionKeys) || v.selectedActionKeys.some((k) => typeof k !== "string")) {
|
|
13774
|
+
return { ok: false, error: "selectedActionKeys must be a string[]" };
|
|
13775
|
+
}
|
|
13776
|
+
if (!Array.isArray(v.permissions)) {
|
|
13777
|
+
return { ok: false, error: "permissions must be an array" };
|
|
13778
|
+
}
|
|
13779
|
+
const permissions = [];
|
|
13780
|
+
for (const [index, entry] of v.permissions.entries()) {
|
|
13781
|
+
if (!entry || typeof entry !== "object") {
|
|
13782
|
+
return { ok: false, error: `permissions[${index}] must be an object` };
|
|
13783
|
+
}
|
|
13784
|
+
const e = entry;
|
|
13785
|
+
if (typeof e.service !== "string" || typeof e.space !== "string" || typeof e.path !== "string") {
|
|
13786
|
+
return { ok: false, error: `permissions[${index}] must have string service/space/path` };
|
|
13787
|
+
}
|
|
13788
|
+
if (!Array.isArray(e.actions) || e.actions.some((a) => typeof a !== "string")) {
|
|
13789
|
+
return { ok: false, error: `permissions[${index}].actions must be a string[]` };
|
|
13790
|
+
}
|
|
13791
|
+
permissions.push({
|
|
13792
|
+
service: e.service,
|
|
13793
|
+
space: e.space,
|
|
13794
|
+
path: e.path,
|
|
13795
|
+
actions: e.actions
|
|
13796
|
+
});
|
|
13797
|
+
}
|
|
13798
|
+
return {
|
|
13799
|
+
ok: true,
|
|
13800
|
+
value: {
|
|
13801
|
+
protocolVersion: 1,
|
|
13802
|
+
address: v.address,
|
|
13803
|
+
signature: v.signature,
|
|
13804
|
+
signedMessage: v.signedMessage,
|
|
13805
|
+
selectedActionKeys: v.selectedActionKeys,
|
|
13806
|
+
permissions
|
|
13807
|
+
}
|
|
13808
|
+
};
|
|
13809
|
+
}
|
|
13810
|
+
var OPENKEY_ACTION_ID_SEPARATOR = "\0";
|
|
13811
|
+
function isPlausibleOpenKeyActionId(id) {
|
|
13812
|
+
return typeof id === "string" && id.split(OPENKEY_ACTION_ID_SEPARATOR).length === 4 && id.length > 0;
|
|
13813
|
+
}
|
|
13814
|
+
function parseCanonicalRecapResource(resource) {
|
|
13815
|
+
if (!resource.startsWith("tinycloud:")) {
|
|
13816
|
+
return { space: resource, path: "" };
|
|
13817
|
+
}
|
|
13818
|
+
const firstSlash = resource.indexOf("/");
|
|
13819
|
+
if (firstSlash < 0) {
|
|
13820
|
+
return { space: resource, path: "" };
|
|
13821
|
+
}
|
|
13822
|
+
const space = resource.slice(0, firstSlash);
|
|
13823
|
+
const rest = resource.slice(firstSlash + 1);
|
|
13824
|
+
const secondSlash = rest.indexOf("/");
|
|
13825
|
+
if (secondSlash < 0) {
|
|
13826
|
+
return { space, path: "" };
|
|
13827
|
+
}
|
|
13828
|
+
return { space, path: rest.slice(secondSlash + 1) };
|
|
13829
|
+
}
|
|
13830
|
+
function extractImmutableSiweFields(siwe) {
|
|
13831
|
+
const lines = siwe.split(/\r?\n/);
|
|
13832
|
+
const result = {};
|
|
13833
|
+
const headerLine = lines[0];
|
|
13834
|
+
if (headerLine) {
|
|
13835
|
+
const domainMatch = headerLine.match(/^(.+?)\s+wants you to sign in/);
|
|
13836
|
+
if (domainMatch) {
|
|
13837
|
+
result.domain = domainMatch[1];
|
|
13838
|
+
}
|
|
13839
|
+
}
|
|
13840
|
+
for (let i = 1; i < lines.length && i < 5; i++) {
|
|
13841
|
+
const line = lines[i]?.trim() ?? "";
|
|
13842
|
+
if (/^0x[0-9a-fA-F]{40}$/.test(line)) {
|
|
13843
|
+
result.address = line;
|
|
13844
|
+
break;
|
|
13845
|
+
}
|
|
13846
|
+
}
|
|
13847
|
+
for (const line of lines) {
|
|
13848
|
+
const match = line.match(/^([A-Z][A-Za-z ]*):\s*(.*)$/);
|
|
13849
|
+
if (!match) continue;
|
|
13850
|
+
const [, key, value] = match;
|
|
13851
|
+
switch (key) {
|
|
13852
|
+
case "URI":
|
|
13853
|
+
result.uri = value;
|
|
13854
|
+
break;
|
|
13855
|
+
case "Version":
|
|
13856
|
+
result.version = value;
|
|
13857
|
+
break;
|
|
13858
|
+
case "Chain ID":
|
|
13859
|
+
result.chainId = value;
|
|
13860
|
+
break;
|
|
13861
|
+
case "Nonce":
|
|
13862
|
+
result.nonce = value;
|
|
13863
|
+
break;
|
|
13864
|
+
case "Issued At":
|
|
13865
|
+
result.issuedAt = value;
|
|
13866
|
+
break;
|
|
13867
|
+
// Sol MAJOR-4: complete immutable-field coverage.
|
|
13868
|
+
case "Expiration Time":
|
|
13869
|
+
result.expirationTime = value;
|
|
13870
|
+
break;
|
|
13871
|
+
case "Not Before":
|
|
13872
|
+
result.notBefore = value;
|
|
13873
|
+
break;
|
|
13874
|
+
case "Request ID":
|
|
13875
|
+
result.requestId = value;
|
|
13876
|
+
break;
|
|
13877
|
+
default:
|
|
13878
|
+
break;
|
|
13879
|
+
}
|
|
13880
|
+
}
|
|
13881
|
+
const uriLineIdx = lines.findIndex((l) => /^URI:/.test(l));
|
|
13882
|
+
if (uriLineIdx > 3) {
|
|
13883
|
+
let end = uriLineIdx - 1;
|
|
13884
|
+
while (end > 3 && lines[end] === "") end -= 1;
|
|
13885
|
+
if (end >= 3) {
|
|
13886
|
+
result.statement = lines.slice(3, end + 1).join("\n");
|
|
13887
|
+
} else {
|
|
13888
|
+
result.statement = "";
|
|
13889
|
+
}
|
|
13890
|
+
} else {
|
|
13891
|
+
result.statement = "";
|
|
13892
|
+
}
|
|
13893
|
+
result.nonRecapResources = lines.filter((l) => /^- /.test(l) && !/^- urn:recap:/.test(l)).join("\n");
|
|
13894
|
+
return result;
|
|
13895
|
+
}
|
|
13896
|
+
function diffImmutableSiweFields(original, signed, options2) {
|
|
13897
|
+
const baseKeys = [
|
|
13898
|
+
"domain",
|
|
13899
|
+
"address",
|
|
13900
|
+
"uri",
|
|
13901
|
+
"version",
|
|
13902
|
+
"chainId",
|
|
13903
|
+
"nonce",
|
|
13904
|
+
"issuedAt",
|
|
13905
|
+
"expirationTime",
|
|
13906
|
+
"notBefore",
|
|
13907
|
+
"requestId",
|
|
13908
|
+
"nonRecapResources"
|
|
13909
|
+
];
|
|
13910
|
+
const keys = options2?.originalHasRecap ? baseKeys : [...baseKeys, "statement"];
|
|
13911
|
+
const diffs = [];
|
|
13912
|
+
for (const key of keys) {
|
|
13913
|
+
const a = original[key] ?? "";
|
|
13914
|
+
const b = signed[key] ?? "";
|
|
13915
|
+
if (a !== b) {
|
|
13916
|
+
diffs.push(key);
|
|
13917
|
+
}
|
|
13918
|
+
}
|
|
13919
|
+
return diffs;
|
|
13920
|
+
}
|
|
13921
|
+
function extractRecapAttenuations(siwe) {
|
|
13922
|
+
const merged = {};
|
|
13923
|
+
const lines = siwe.split(/\r?\n/);
|
|
13924
|
+
for (const line of lines) {
|
|
13925
|
+
const match = line.match(/urn:recap:([A-Za-z0-9_-]+=*)/);
|
|
13926
|
+
if (!match) continue;
|
|
13927
|
+
const encoded = match[1];
|
|
13928
|
+
let decodedJson;
|
|
13929
|
+
try {
|
|
13930
|
+
const normalized = encoded.replace(/-/g, "+").replace(/_/g, "/");
|
|
13931
|
+
const padded = normalized + "=".repeat((4 - normalized.length % 4) % 4);
|
|
13932
|
+
decodedJson = Buffer.from(padded, "base64").toString("utf8");
|
|
13933
|
+
} catch (err6) {
|
|
13934
|
+
throw new Error(
|
|
13935
|
+
`Failed to decode urn:recap: payload: ${err6.message}`
|
|
13936
|
+
);
|
|
13937
|
+
}
|
|
13938
|
+
let parsed;
|
|
13939
|
+
try {
|
|
13940
|
+
parsed = JSON.parse(decodedJson);
|
|
13941
|
+
} catch (err6) {
|
|
13942
|
+
throw new Error(
|
|
13943
|
+
`urn:recap: payload is not valid JSON: ${err6.message}`
|
|
13944
|
+
);
|
|
13945
|
+
}
|
|
13946
|
+
if (!parsed || typeof parsed !== "object") {
|
|
13947
|
+
throw new Error("urn:recap: payload must be an object");
|
|
13948
|
+
}
|
|
13949
|
+
const att = parsed.att;
|
|
13950
|
+
if (att === void 0) {
|
|
13951
|
+
continue;
|
|
13952
|
+
}
|
|
13953
|
+
if (typeof att !== "object" || att === null || Array.isArray(att)) {
|
|
13954
|
+
throw new Error("urn:recap: att must be an object");
|
|
13955
|
+
}
|
|
13956
|
+
for (const [resource, actionMap] of Object.entries(att)) {
|
|
13957
|
+
if (!actionMap || typeof actionMap !== "object" || Array.isArray(actionMap)) {
|
|
13958
|
+
throw new Error(`urn:recap: att[${resource}] must be an object`);
|
|
13959
|
+
}
|
|
13960
|
+
const existing = merged[resource] ?? {};
|
|
13961
|
+
for (const [action, caveats] of Object.entries(actionMap)) {
|
|
13962
|
+
if (!Array.isArray(caveats)) {
|
|
13963
|
+
throw new Error(
|
|
13964
|
+
`urn:recap: att[${resource}][${action}] must be an array`
|
|
13965
|
+
);
|
|
13966
|
+
}
|
|
13967
|
+
const previous = existing[action] ?? [];
|
|
13968
|
+
existing[action] = previous.concat(caveats);
|
|
13969
|
+
}
|
|
13970
|
+
merged[resource] = existing;
|
|
13971
|
+
}
|
|
13972
|
+
}
|
|
13973
|
+
return merged;
|
|
13974
|
+
}
|
|
13975
|
+
function stableStringify(value) {
|
|
13976
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
13977
|
+
if (Array.isArray(value)) {
|
|
13978
|
+
return `[${value.map(stableStringify).join(",")}]`;
|
|
13979
|
+
}
|
|
13980
|
+
const entries = Object.entries(value).sort(
|
|
13981
|
+
([a], [b]) => a.localeCompare(b)
|
|
13982
|
+
);
|
|
13983
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
|
|
13984
|
+
}
|
|
13985
|
+
function caveatsDeepEqual(a, b) {
|
|
13986
|
+
return stableStringify(a) === stableStringify(b);
|
|
13987
|
+
}
|
|
13988
|
+
function unauthorizedRecapCapabilities(child, parent) {
|
|
13989
|
+
const unauthorized = [];
|
|
13990
|
+
for (const [resource, actions] of Object.entries(child)) {
|
|
13991
|
+
const parentActions = parent[resource];
|
|
13992
|
+
for (const [action, childCaveatsRaw] of Object.entries(actions)) {
|
|
13993
|
+
if (!parentActions || parentActions[action] === void 0) {
|
|
13994
|
+
unauthorized.push({ resource, action });
|
|
13995
|
+
continue;
|
|
13996
|
+
}
|
|
13997
|
+
const parentCaveatsRaw = parentActions[action];
|
|
13998
|
+
const parentCaveats = Array.isArray(parentCaveatsRaw) ? parentCaveatsRaw : [];
|
|
13999
|
+
const childCaveats = Array.isArray(childCaveatsRaw) ? childCaveatsRaw : [];
|
|
14000
|
+
const parentCanonCounts = /* @__PURE__ */ new Map();
|
|
14001
|
+
for (const c of parentCaveats) {
|
|
14002
|
+
const k = stableStringify(c);
|
|
14003
|
+
parentCanonCounts.set(k, (parentCanonCounts.get(k) ?? 0) + 1);
|
|
14004
|
+
}
|
|
14005
|
+
const childCanonCounts = /* @__PURE__ */ new Map();
|
|
14006
|
+
for (const c of childCaveats) {
|
|
14007
|
+
const k = stableStringify(c);
|
|
14008
|
+
childCanonCounts.set(k, (childCanonCounts.get(k) ?? 0) + 1);
|
|
14009
|
+
}
|
|
14010
|
+
let equal = parentCanonCounts.size === childCanonCounts.size;
|
|
14011
|
+
if (equal) {
|
|
14012
|
+
for (const [k, n] of parentCanonCounts) {
|
|
14013
|
+
if (childCanonCounts.get(k) !== n) {
|
|
14014
|
+
equal = false;
|
|
14015
|
+
break;
|
|
14016
|
+
}
|
|
14017
|
+
}
|
|
14018
|
+
}
|
|
14019
|
+
if (!equal) {
|
|
14020
|
+
unauthorized.push({ resource, action });
|
|
14021
|
+
}
|
|
14022
|
+
void caveatsDeepEqual;
|
|
14023
|
+
}
|
|
14024
|
+
}
|
|
14025
|
+
return unauthorized;
|
|
14026
|
+
}
|
|
14027
|
+
|
|
13534
14028
|
// src/version.ts
|
|
13535
14029
|
var ProtocolMismatchError = class extends Error {
|
|
13536
14030
|
constructor(sdkProtocol, nodeProtocol, nodeVersion, host) {
|
|
@@ -13612,17 +14106,9 @@ function equals3(a, b) {
|
|
|
13612
14106
|
return true;
|
|
13613
14107
|
}
|
|
13614
14108
|
|
|
13615
|
-
// ../../node_modules/uint8arrays/dist/src/alloc.
|
|
13616
|
-
var import_node_buffer = require("buffer");
|
|
13617
|
-
|
|
13618
|
-
// ../../node_modules/uint8arrays/dist/src/util/as-uint8array.node.js
|
|
13619
|
-
function asUint8Array(buf) {
|
|
13620
|
-
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
13621
|
-
}
|
|
13622
|
-
|
|
13623
|
-
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
14109
|
+
// ../../node_modules/uint8arrays/dist/src/alloc.js
|
|
13624
14110
|
function allocUnsafe(size = 0) {
|
|
13625
|
-
return
|
|
14111
|
+
return new Uint8Array(size);
|
|
13626
14112
|
}
|
|
13627
14113
|
|
|
13628
14114
|
// ../../node_modules/uint8-varint/dist/src/index.js
|
|
@@ -13798,14 +14284,24 @@ function decode6(buf, offset = 0) {
|
|
|
13798
14284
|
}
|
|
13799
14285
|
}
|
|
13800
14286
|
|
|
13801
|
-
// ../../node_modules/uint8arrays/dist/src/
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
return asUint8Array(import_node_buffer2.Buffer.concat(arrays, length2));
|
|
14287
|
+
// ../../node_modules/uint8arrays/dist/src/util/as-uint8array.js
|
|
14288
|
+
function asUint8Array(buf) {
|
|
14289
|
+
return buf;
|
|
13805
14290
|
}
|
|
13806
14291
|
|
|
13807
|
-
// ../../node_modules/uint8arrays/dist/src/
|
|
13808
|
-
|
|
14292
|
+
// ../../node_modules/uint8arrays/dist/src/concat.js
|
|
14293
|
+
function concat(arrays, length2) {
|
|
14294
|
+
if (length2 == null) {
|
|
14295
|
+
length2 = arrays.reduce((acc, curr) => acc + curr.length, 0);
|
|
14296
|
+
}
|
|
14297
|
+
const output = allocUnsafe(length2);
|
|
14298
|
+
let offset = 0;
|
|
14299
|
+
for (const arr of arrays) {
|
|
14300
|
+
output.set(arr, offset);
|
|
14301
|
+
offset += arr.length;
|
|
14302
|
+
}
|
|
14303
|
+
return asUint8Array(output);
|
|
14304
|
+
}
|
|
13809
14305
|
|
|
13810
14306
|
// ../../node_modules/uint8arrays/dist/src/util/bases.js
|
|
13811
14307
|
function createCodec(name2, prefix, encode5, decode7) {
|
|
@@ -13854,28 +14350,21 @@ var BASES = {
|
|
|
13854
14350
|
};
|
|
13855
14351
|
var bases_default = BASES;
|
|
13856
14352
|
|
|
13857
|
-
// ../../node_modules/uint8arrays/dist/src/from-string.
|
|
14353
|
+
// ../../node_modules/uint8arrays/dist/src/from-string.js
|
|
13858
14354
|
function fromString2(string2, encoding = "utf8") {
|
|
13859
14355
|
const base3 = bases_default[encoding];
|
|
13860
14356
|
if (base3 == null) {
|
|
13861
14357
|
throw new Error(`Unsupported encoding "${encoding}"`);
|
|
13862
14358
|
}
|
|
13863
|
-
if (encoding === "utf8" || encoding === "utf-8") {
|
|
13864
|
-
return asUint8Array(import_node_buffer3.Buffer.from(string2, "utf-8"));
|
|
13865
|
-
}
|
|
13866
14359
|
return base3.decoder.decode(`${base3.prefix}${string2}`);
|
|
13867
14360
|
}
|
|
13868
14361
|
|
|
13869
|
-
// ../../node_modules/uint8arrays/dist/src/to-string.
|
|
13870
|
-
var import_node_buffer4 = require("buffer");
|
|
14362
|
+
// ../../node_modules/uint8arrays/dist/src/to-string.js
|
|
13871
14363
|
function toString2(array, encoding = "utf8") {
|
|
13872
14364
|
const base3 = bases_default[encoding];
|
|
13873
14365
|
if (base3 == null) {
|
|
13874
14366
|
throw new Error(`Unsupported encoding "${encoding}"`);
|
|
13875
14367
|
}
|
|
13876
|
-
if (encoding === "utf8" || encoding === "utf-8") {
|
|
13877
|
-
return import_node_buffer4.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("utf8");
|
|
13878
|
-
}
|
|
13879
14368
|
return base3.encoder.encode(array).substring(1);
|
|
13880
14369
|
}
|
|
13881
14370
|
|
|
@@ -13909,8 +14398,218 @@ var UnknownProtocolError = class extends Error {
|
|
|
13909
14398
|
};
|
|
13910
14399
|
__publicField(UnknownProtocolError, "name", "UnknownProtocolError");
|
|
13911
14400
|
|
|
13912
|
-
// ../../node_modules/@chainsafe/is-ip/lib/
|
|
13913
|
-
var
|
|
14401
|
+
// ../../node_modules/@chainsafe/is-ip/lib/parser.js
|
|
14402
|
+
var Parser = class {
|
|
14403
|
+
constructor() {
|
|
14404
|
+
__publicField(this, "index", 0);
|
|
14405
|
+
__publicField(this, "input", "");
|
|
14406
|
+
}
|
|
14407
|
+
new(input) {
|
|
14408
|
+
this.index = 0;
|
|
14409
|
+
this.input = input;
|
|
14410
|
+
return this;
|
|
14411
|
+
}
|
|
14412
|
+
/** Run a parser, and restore the pre-parse state if it fails. */
|
|
14413
|
+
readAtomically(fn) {
|
|
14414
|
+
const index = this.index;
|
|
14415
|
+
const result = fn();
|
|
14416
|
+
if (result === void 0) {
|
|
14417
|
+
this.index = index;
|
|
14418
|
+
}
|
|
14419
|
+
return result;
|
|
14420
|
+
}
|
|
14421
|
+
/** Run a parser, but fail if the entire input wasn't consumed. Doesn't run atomically. */
|
|
14422
|
+
parseWith(fn) {
|
|
14423
|
+
const result = fn();
|
|
14424
|
+
if (this.index !== this.input.length) {
|
|
14425
|
+
return void 0;
|
|
14426
|
+
}
|
|
14427
|
+
return result;
|
|
14428
|
+
}
|
|
14429
|
+
/** Peek the next character from the input */
|
|
14430
|
+
peekChar() {
|
|
14431
|
+
if (this.index >= this.input.length) {
|
|
14432
|
+
return void 0;
|
|
14433
|
+
}
|
|
14434
|
+
return this.input[this.index];
|
|
14435
|
+
}
|
|
14436
|
+
/** Read the next character from the input */
|
|
14437
|
+
readChar() {
|
|
14438
|
+
if (this.index >= this.input.length) {
|
|
14439
|
+
return void 0;
|
|
14440
|
+
}
|
|
14441
|
+
return this.input[this.index++];
|
|
14442
|
+
}
|
|
14443
|
+
/** Read the next character from the input if it matches the target. */
|
|
14444
|
+
readGivenChar(target) {
|
|
14445
|
+
return this.readAtomically(() => {
|
|
14446
|
+
const char = this.readChar();
|
|
14447
|
+
if (char !== target) {
|
|
14448
|
+
return void 0;
|
|
14449
|
+
}
|
|
14450
|
+
return char;
|
|
14451
|
+
});
|
|
14452
|
+
}
|
|
14453
|
+
/**
|
|
14454
|
+
* Helper for reading separators in an indexed loop. Reads the separator
|
|
14455
|
+
* character iff index > 0, then runs the parser. When used in a loop,
|
|
14456
|
+
* the separator character will only be read on index > 0 (see
|
|
14457
|
+
* readIPv4Addr for an example)
|
|
14458
|
+
*/
|
|
14459
|
+
readSeparator(sep, index, inner) {
|
|
14460
|
+
return this.readAtomically(() => {
|
|
14461
|
+
if (index > 0) {
|
|
14462
|
+
if (this.readGivenChar(sep) === void 0) {
|
|
14463
|
+
return void 0;
|
|
14464
|
+
}
|
|
14465
|
+
}
|
|
14466
|
+
return inner();
|
|
14467
|
+
});
|
|
14468
|
+
}
|
|
14469
|
+
/**
|
|
14470
|
+
* Read a number off the front of the input in the given radix, stopping
|
|
14471
|
+
* at the first non-digit character or eof. Fails if the number has more
|
|
14472
|
+
* digits than max_digits or if there is no number.
|
|
14473
|
+
*/
|
|
14474
|
+
readNumber(radix, maxDigits, allowZeroPrefix, maxBytes) {
|
|
14475
|
+
return this.readAtomically(() => {
|
|
14476
|
+
let result = 0;
|
|
14477
|
+
let digitCount = 0;
|
|
14478
|
+
const leadingChar = this.peekChar();
|
|
14479
|
+
if (leadingChar === void 0) {
|
|
14480
|
+
return void 0;
|
|
14481
|
+
}
|
|
14482
|
+
const hasLeadingZero = leadingChar === "0";
|
|
14483
|
+
const maxValue2 = 2 ** (8 * maxBytes) - 1;
|
|
14484
|
+
while (true) {
|
|
14485
|
+
const digit = this.readAtomically(() => {
|
|
14486
|
+
const char = this.readChar();
|
|
14487
|
+
if (char === void 0) {
|
|
14488
|
+
return void 0;
|
|
14489
|
+
}
|
|
14490
|
+
const num = Number.parseInt(char, radix);
|
|
14491
|
+
if (Number.isNaN(num)) {
|
|
14492
|
+
return void 0;
|
|
14493
|
+
}
|
|
14494
|
+
return num;
|
|
14495
|
+
});
|
|
14496
|
+
if (digit === void 0) {
|
|
14497
|
+
break;
|
|
14498
|
+
}
|
|
14499
|
+
result *= radix;
|
|
14500
|
+
result += digit;
|
|
14501
|
+
if (result > maxValue2) {
|
|
14502
|
+
return void 0;
|
|
14503
|
+
}
|
|
14504
|
+
digitCount += 1;
|
|
14505
|
+
if (maxDigits !== void 0) {
|
|
14506
|
+
if (digitCount > maxDigits) {
|
|
14507
|
+
return void 0;
|
|
14508
|
+
}
|
|
14509
|
+
}
|
|
14510
|
+
}
|
|
14511
|
+
if (digitCount === 0) {
|
|
14512
|
+
return void 0;
|
|
14513
|
+
} else if (!allowZeroPrefix && hasLeadingZero && digitCount > 1) {
|
|
14514
|
+
return void 0;
|
|
14515
|
+
} else {
|
|
14516
|
+
return result;
|
|
14517
|
+
}
|
|
14518
|
+
});
|
|
14519
|
+
}
|
|
14520
|
+
/** Read an IPv4 address. */
|
|
14521
|
+
readIPv4Addr() {
|
|
14522
|
+
return this.readAtomically(() => {
|
|
14523
|
+
const out = new Uint8Array(4);
|
|
14524
|
+
for (let i = 0; i < out.length; i++) {
|
|
14525
|
+
const ix = this.readSeparator(".", i, () => this.readNumber(10, 3, false, 1));
|
|
14526
|
+
if (ix === void 0) {
|
|
14527
|
+
return void 0;
|
|
14528
|
+
}
|
|
14529
|
+
out[i] = ix;
|
|
14530
|
+
}
|
|
14531
|
+
return out;
|
|
14532
|
+
});
|
|
14533
|
+
}
|
|
14534
|
+
/** Read an IPv6 Address. */
|
|
14535
|
+
readIPv6Addr() {
|
|
14536
|
+
const readGroups = (groups) => {
|
|
14537
|
+
for (let i = 0; i < groups.length / 2; i++) {
|
|
14538
|
+
const ix = i * 2;
|
|
14539
|
+
if (i < groups.length - 3) {
|
|
14540
|
+
const ipv4 = this.readSeparator(":", i, () => this.readIPv4Addr());
|
|
14541
|
+
if (ipv4 !== void 0) {
|
|
14542
|
+
groups[ix] = ipv4[0];
|
|
14543
|
+
groups[ix + 1] = ipv4[1];
|
|
14544
|
+
groups[ix + 2] = ipv4[2];
|
|
14545
|
+
groups[ix + 3] = ipv4[3];
|
|
14546
|
+
return [ix + 4, true];
|
|
14547
|
+
}
|
|
14548
|
+
}
|
|
14549
|
+
const group = this.readSeparator(":", i, () => this.readNumber(16, 4, true, 2));
|
|
14550
|
+
if (group === void 0) {
|
|
14551
|
+
return [ix, false];
|
|
14552
|
+
}
|
|
14553
|
+
groups[ix] = group >> 8;
|
|
14554
|
+
groups[ix + 1] = group & 255;
|
|
14555
|
+
}
|
|
14556
|
+
return [groups.length, false];
|
|
14557
|
+
};
|
|
14558
|
+
return this.readAtomically(() => {
|
|
14559
|
+
const head = new Uint8Array(16);
|
|
14560
|
+
const [headSize, headIp4] = readGroups(head);
|
|
14561
|
+
if (headSize === 16) {
|
|
14562
|
+
return head;
|
|
14563
|
+
}
|
|
14564
|
+
if (headIp4) {
|
|
14565
|
+
return void 0;
|
|
14566
|
+
}
|
|
14567
|
+
if (this.readGivenChar(":") === void 0) {
|
|
14568
|
+
return void 0;
|
|
14569
|
+
}
|
|
14570
|
+
if (this.readGivenChar(":") === void 0) {
|
|
14571
|
+
return void 0;
|
|
14572
|
+
}
|
|
14573
|
+
const tail = new Uint8Array(14);
|
|
14574
|
+
const limit = 16 - (headSize + 2);
|
|
14575
|
+
const [tailSize] = readGroups(tail.subarray(0, limit));
|
|
14576
|
+
head.set(tail.subarray(0, tailSize), 16 - tailSize);
|
|
14577
|
+
return head;
|
|
14578
|
+
});
|
|
14579
|
+
}
|
|
14580
|
+
/** Read an IP Address, either IPv4 or IPv6. */
|
|
14581
|
+
readIPAddr() {
|
|
14582
|
+
return this.readIPv4Addr() ?? this.readIPv6Addr();
|
|
14583
|
+
}
|
|
14584
|
+
};
|
|
14585
|
+
|
|
14586
|
+
// ../../node_modules/@chainsafe/is-ip/lib/parse.js
|
|
14587
|
+
var MAX_IPV6_LENGTH = 45;
|
|
14588
|
+
var MAX_IPV4_LENGTH = 15;
|
|
14589
|
+
var parser = new Parser();
|
|
14590
|
+
function parseIPv4(input) {
|
|
14591
|
+
if (input.length > MAX_IPV4_LENGTH) {
|
|
14592
|
+
return void 0;
|
|
14593
|
+
}
|
|
14594
|
+
return parser.new(input).parseWith(() => parser.readIPv4Addr());
|
|
14595
|
+
}
|
|
14596
|
+
function parseIPv6(input) {
|
|
14597
|
+
if (input.includes("%")) {
|
|
14598
|
+
input = input.split("%")[0];
|
|
14599
|
+
}
|
|
14600
|
+
if (input.length > MAX_IPV6_LENGTH) {
|
|
14601
|
+
return void 0;
|
|
14602
|
+
}
|
|
14603
|
+
return parser.new(input).parseWith(() => parser.readIPv6Addr());
|
|
14604
|
+
}
|
|
14605
|
+
|
|
14606
|
+
// ../../node_modules/@chainsafe/is-ip/lib/is-ip.js
|
|
14607
|
+
function isIPv4(input) {
|
|
14608
|
+
return Boolean(parseIPv4(input));
|
|
14609
|
+
}
|
|
14610
|
+
function isIPv6(input) {
|
|
14611
|
+
return Boolean(parseIPv6(input));
|
|
14612
|
+
}
|
|
13914
14613
|
|
|
13915
14614
|
// ../../node_modules/@multiformats/multiaddr/dist/src/constants.js
|
|
13916
14615
|
var CODE_IP4 = 4;
|
|
@@ -14032,7 +14731,7 @@ var ip6ToBytes = function(ip) {
|
|
|
14032
14731
|
const sections = ip.split(":", 8);
|
|
14033
14732
|
let i;
|
|
14034
14733
|
for (i = 0; i < sections.length; i++) {
|
|
14035
|
-
const isv4 =
|
|
14734
|
+
const isv4 = isIPv4(sections[i]);
|
|
14036
14735
|
let v4Buffer;
|
|
14037
14736
|
if (isv4) {
|
|
14038
14737
|
v4Buffer = ip4ToBytes(sections[i]);
|
|
@@ -14199,7 +14898,7 @@ var codecs = [{
|
|
|
14199
14898
|
valueToBytes: ip4ToBytes,
|
|
14200
14899
|
bytesToValue: ip4ToString,
|
|
14201
14900
|
validate: (value) => {
|
|
14202
|
-
if (!
|
|
14901
|
+
if (!isIPv4(value)) {
|
|
14203
14902
|
throw new ValidationError(`Invalid IPv4 address "${value}"`);
|
|
14204
14903
|
}
|
|
14205
14904
|
}
|
|
@@ -14232,7 +14931,7 @@ var codecs = [{
|
|
|
14232
14931
|
bytesToValue: ip6ToString,
|
|
14233
14932
|
stringToValue: ip6StringToValue,
|
|
14234
14933
|
validate: (value) => {
|
|
14235
|
-
if (!
|
|
14934
|
+
if (!isIPv6(value)) {
|
|
14236
14935
|
throw new ValidationError(`Invalid IPv6 address "${value}"`);
|
|
14237
14936
|
}
|
|
14238
14937
|
}
|
|
@@ -14867,25 +15566,17 @@ ipRegex.v4 = (options2) => options2 && options2.exact ? v4exact : new RegExp(`${
|
|
|
14867
15566
|
ipRegex.v6 = (options2) => options2 && options2.exact ? v6exact : new RegExp(`${boundry(options2)}${v6}${boundry(options2)}`, "g");
|
|
14868
15567
|
var ip_regex_default = ipRegex;
|
|
14869
15568
|
|
|
14870
|
-
// ../../node_modules/function-timeout/
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
const script = new import_node_vm.default.Script("returnValue = function_()");
|
|
14874
|
-
const wrappedFunction = (...arguments_) => {
|
|
14875
|
-
const context = {
|
|
14876
|
-
function_: () => function_(...arguments_)
|
|
14877
|
-
};
|
|
14878
|
-
script.runInNewContext(context, { timeout });
|
|
14879
|
-
return context.returnValue;
|
|
14880
|
-
};
|
|
15569
|
+
// ../../node_modules/function-timeout/browser.js
|
|
15570
|
+
function functionTimeout(function_) {
|
|
15571
|
+
const wrappedFunction = (...arguments_) => function_(...arguments_);
|
|
14881
15572
|
Object.defineProperty(wrappedFunction, "name", {
|
|
14882
15573
|
value: `functionTimeout(${function_.name || "<anonymous>"})`,
|
|
14883
15574
|
configurable: true
|
|
14884
15575
|
});
|
|
14885
15576
|
return wrappedFunction;
|
|
14886
15577
|
}
|
|
14887
|
-
function isTimeoutError(
|
|
14888
|
-
return
|
|
15578
|
+
function isTimeoutError() {
|
|
15579
|
+
return false;
|
|
14889
15580
|
}
|
|
14890
15581
|
|
|
14891
15582
|
// ../../node_modules/clone-regexp/node_modules/is-regexp/index.js
|
|
@@ -15287,13 +15978,14 @@ async function discoverLocalTinyCloudNode(options2 = {}) {
|
|
|
15287
15978
|
}
|
|
15288
15979
|
const fetchFn = options2.fetch ?? globalThis.fetch;
|
|
15289
15980
|
const identityStore = options2.identityStore ?? defaultLocalNodeIdentityStore;
|
|
15290
|
-
const staticCandidates = [
|
|
15291
|
-
|
|
15981
|
+
const staticCandidates = [];
|
|
15982
|
+
if (options2.localNodeUrl) {
|
|
15983
|
+
staticCandidates.push({
|
|
15292
15984
|
source: "local-loopback",
|
|
15293
|
-
url: options2.localNodeUrl
|
|
15985
|
+
url: options2.localNodeUrl,
|
|
15294
15986
|
timeoutMs: LOCAL_LOOPBACK_PROBE_TIMEOUT_MS
|
|
15295
|
-
}
|
|
15296
|
-
|
|
15987
|
+
});
|
|
15988
|
+
}
|
|
15297
15989
|
if (options2.localLinkName) {
|
|
15298
15990
|
if (isValidDnsLabel(options2.localLinkName)) {
|
|
15299
15991
|
staticCandidates.push({
|
|
@@ -15687,320 +16379,4 @@ function decodeBase64Url(value) {
|
|
|
15687
16379
|
}
|
|
15688
16380
|
return Uint8Array.from(bytes2);
|
|
15689
16381
|
}
|
|
15690
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
15691
|
-
0 && (module.exports = {
|
|
15692
|
-
ACCOUNT_INDEX_SCHEMA,
|
|
15693
|
-
ACCOUNT_REGISTRY_PATH,
|
|
15694
|
-
ACCOUNT_REGISTRY_SPACE,
|
|
15695
|
-
AccountService,
|
|
15696
|
-
AutoApproveSpaceCreationHandler,
|
|
15697
|
-
BOOTSTRAP_ALLOWLIST,
|
|
15698
|
-
BOOTSTRAP_DEFAULT_SPACE,
|
|
15699
|
-
BOOTSTRAP_ENCRYPTION_NETWORK_NAME,
|
|
15700
|
-
BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE,
|
|
15701
|
-
BOOTSTRAP_MANIFEST,
|
|
15702
|
-
BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS,
|
|
15703
|
-
BOOTSTRAP_PUBLIC_SPACE,
|
|
15704
|
-
BOOTSTRAP_SESSION_REQUESTS,
|
|
15705
|
-
BOOTSTRAP_SPACE_MANIFESTS,
|
|
15706
|
-
BOOTSTRAP_SPACE_NAMES,
|
|
15707
|
-
CAPABILITIES,
|
|
15708
|
-
CAPABILITY_REGISTRY,
|
|
15709
|
-
CapabilityKeyRegistry,
|
|
15710
|
-
CapabilityKeyRegistryErrorCodes,
|
|
15711
|
-
CaveatedDelegationUnsupportedError,
|
|
15712
|
-
ClientSessionSchema,
|
|
15713
|
-
CloudLocationResolutionError,
|
|
15714
|
-
DECRYPT_ACTION,
|
|
15715
|
-
DECRYPT_FACT_TYPE,
|
|
15716
|
-
DECRYPT_RESULT_TYPE,
|
|
15717
|
-
DEFAULT_DEFAULTS,
|
|
15718
|
-
DEFAULT_ENCRYPTION_ALG,
|
|
15719
|
-
DEFAULT_EXPIRY,
|
|
15720
|
-
DEFAULT_KEY_VERSION,
|
|
15721
|
-
DEFAULT_KNOWLEDGE_ROOT,
|
|
15722
|
-
DEFAULT_LOCAL_NODE_PIN_STORAGE_KEY,
|
|
15723
|
-
DEFAULT_LOCAL_NODE_URL,
|
|
15724
|
-
DEFAULT_MANIFEST_SPACE,
|
|
15725
|
-
DEFAULT_MANIFEST_VERSION,
|
|
15726
|
-
DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
|
|
15727
|
-
DEFAULT_TINYCLOUD_FALLBACK_HOST,
|
|
15728
|
-
DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL,
|
|
15729
|
-
DUCKDB,
|
|
15730
|
-
DataVaultService,
|
|
15731
|
-
DatabaseHandle,
|
|
15732
|
-
DecryptTransportResponseError,
|
|
15733
|
-
DelegationErrorCodes,
|
|
15734
|
-
DelegationManager,
|
|
15735
|
-
DuckDbAction,
|
|
15736
|
-
DuckDbDatabaseHandle,
|
|
15737
|
-
DuckDbService,
|
|
15738
|
-
ED25519_JCS_SIGNATURE_SUITE,
|
|
15739
|
-
EIP191_JCS_SIGNATURE_SUITE,
|
|
15740
|
-
ENCRYPTION,
|
|
15741
|
-
ENCRYPTION_MANIFEST_SPACE,
|
|
15742
|
-
ENCRYPTION_NETWORK_URN_PREFIX,
|
|
15743
|
-
ENCRYPTION_PERMISSION_SERVICE,
|
|
15744
|
-
ENCRYPTION_SERVICE,
|
|
15745
|
-
ENCRYPTION_SERVICE_SHORT,
|
|
15746
|
-
ENVELOPE_VERSION,
|
|
15747
|
-
EXPIRY,
|
|
15748
|
-
EncryptionService,
|
|
15749
|
-
EnsDataSchema,
|
|
15750
|
-
ErrorCodes,
|
|
15751
|
-
HOLDER_KEY_BINDING_PRESENTATION_SCHEMA,
|
|
15752
|
-
HOOKS,
|
|
15753
|
-
HooksService,
|
|
15754
|
-
IdentityParseError,
|
|
15755
|
-
KV,
|
|
15756
|
-
KVService,
|
|
15757
|
-
LISTEN_SQL_STATEMENT_CATALOG,
|
|
15758
|
-
LOCAL_LINK_HOST_SUFFIX,
|
|
15759
|
-
LOCAL_LINK_PROBE_TIMEOUT_MS,
|
|
15760
|
-
LOCAL_LOOPBACK_PROBE_TIMEOUT_MS,
|
|
15761
|
-
LocationRecordValidationError,
|
|
15762
|
-
MAX_CONTENT_BYTES,
|
|
15763
|
-
MAX_SEALED_SHARE_CONTENT_BYTES,
|
|
15764
|
-
MAX_SHARE_ARTIFACT_BYTES,
|
|
15765
|
-
MAX_SHARE_CONTENT_BYTES,
|
|
15766
|
-
ManifestValidationError,
|
|
15767
|
-
MemorySenderShareKeyStorage,
|
|
15768
|
-
MemorySenderShareRecordStorage,
|
|
15769
|
-
MemoryShareCache,
|
|
15770
|
-
NETWORK_NAME_PATTERN,
|
|
15771
|
-
NetworkIdError,
|
|
15772
|
-
POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA,
|
|
15773
|
-
POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA,
|
|
15774
|
-
POLICY_ENGINE_DENIAL_SCHEMA,
|
|
15775
|
-
POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES,
|
|
15776
|
-
POLICY_ENGINE_RECORD_SCHEMA,
|
|
15777
|
-
POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA,
|
|
15778
|
-
POLICY_SCHEMA,
|
|
15779
|
-
POLICY_STATUS_SCHEMA,
|
|
15780
|
-
PORTABLE_DELEGATION_SCHEMA,
|
|
15781
|
-
PermissionNotInManifestError,
|
|
15782
|
-
PrefixedKVService,
|
|
15783
|
-
ProtocolMismatchError,
|
|
15784
|
-
REQUESTER_ENGINE_RETRY_ATTEMPTS,
|
|
15785
|
-
REQUESTER_ENGINE_RETRY_MAX_DELAY_MS,
|
|
15786
|
-
REQUESTER_NEAR_EXPIRY_SECONDS,
|
|
15787
|
-
SECRETS_SPACE,
|
|
15788
|
-
SECRET_NAME_RE,
|
|
15789
|
-
SECRET_RECORDS_SCHEMA,
|
|
15790
|
-
SERVICE_LONG_TO_SHORT,
|
|
15791
|
-
SERVICE_SHORT_TO_LONG,
|
|
15792
|
-
SHARE_DELIVERY_AUTHORIZATION_DOMAIN,
|
|
15793
|
-
SPACE,
|
|
15794
|
-
SQL,
|
|
15795
|
-
SQLAction,
|
|
15796
|
-
SQLService,
|
|
15797
|
-
SecretsService,
|
|
15798
|
-
SenderShareStore,
|
|
15799
|
-
ServiceContext,
|
|
15800
|
-
SessionExpiredError,
|
|
15801
|
-
ShareAccessError,
|
|
15802
|
-
ShareAddressedDelegationEnvelopeV2Schema,
|
|
15803
|
-
ShareAddressedDelegationRequestV2Schema,
|
|
15804
|
-
ShareAddressedDelegationResponseV2Schema,
|
|
15805
|
-
ShareConflict,
|
|
15806
|
-
ShareEnvelopeError,
|
|
15807
|
-
ShareNativeResponseSchema,
|
|
15808
|
-
ShareRecipientClient,
|
|
15809
|
-
SharingService,
|
|
15810
|
-
SignatureMaterialError,
|
|
15811
|
-
SignatureVerificationError,
|
|
15812
|
-
SignedObjectCanonicalizationError,
|
|
15813
|
-
SignedObjectDigestError,
|
|
15814
|
-
SignedObjectIdError,
|
|
15815
|
-
SignedObjectProfileError,
|
|
15816
|
-
SignedObjectSchemaError,
|
|
15817
|
-
SigningKeyBindingError,
|
|
15818
|
-
SilentNotificationHandler,
|
|
15819
|
-
SiweConfigSchema,
|
|
15820
|
-
SiweMessage,
|
|
15821
|
-
Space,
|
|
15822
|
-
SpaceErrorCodes,
|
|
15823
|
-
SpaceService,
|
|
15824
|
-
TINYCLOUD_ACCOUNT_SPACE_MANIFEST,
|
|
15825
|
-
TINYCLOUD_APPLICATIONS_SPACE_MANIFEST,
|
|
15826
|
-
TINYCLOUD_DEFAULT_SPACE_MANIFEST,
|
|
15827
|
-
TINYCLOUD_PUBLIC_SPACE_MANIFEST,
|
|
15828
|
-
TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
|
|
15829
|
-
TinyCloud,
|
|
15830
|
-
TinyCloudDebugLogger,
|
|
15831
|
-
TranscriptRequester,
|
|
15832
|
-
TranscriptRequesterError,
|
|
15833
|
-
UnsupportedFeatureError,
|
|
15834
|
-
UnsupportedSignatureSuiteError,
|
|
15835
|
-
VAULT_PERMISSION_SERVICE,
|
|
15836
|
-
VaultHeaders,
|
|
15837
|
-
VaultPublicSpaceKVActions,
|
|
15838
|
-
VersionCheckError,
|
|
15839
|
-
actionContains,
|
|
15840
|
-
activateSessionWithHost,
|
|
15841
|
-
addressStorageKey,
|
|
15842
|
-
applyPrefix,
|
|
15843
|
-
bootstrapEncryptionNetworkId,
|
|
15844
|
-
bootstrapSpaceId,
|
|
15845
|
-
bootstrapSteps,
|
|
15846
|
-
buildCanonicalDecryptRequest,
|
|
15847
|
-
buildDecryptAttenuation,
|
|
15848
|
-
buildDecryptFacts,
|
|
15849
|
-
buildDecryptInvocation,
|
|
15850
|
-
buildNetworkId,
|
|
15851
|
-
buildSpaceUri,
|
|
15852
|
-
canonicalHashHex,
|
|
15853
|
-
canonicalLocationPayload,
|
|
15854
|
-
canonicalOwnerSharePolicy,
|
|
15855
|
-
canonicalSignedResponse,
|
|
15856
|
-
canonicalizeAddress,
|
|
15857
|
-
canonicalizeDid,
|
|
15858
|
-
canonicalizeDidUrl,
|
|
15859
|
-
canonicalizeEncryptionJson,
|
|
15860
|
-
canonicalizeNetworkId,
|
|
15861
|
-
canonicalizeRecapCaveats,
|
|
15862
|
-
canonicalizeSecretScope,
|
|
15863
|
-
canonicalizeSignedObjectUnsigned,
|
|
15864
|
-
checkDecryptInvocationInput,
|
|
15865
|
-
checkNodeInfo,
|
|
15866
|
-
clearTinyCloudDebugLogs,
|
|
15867
|
-
composeBootstrapSpaceManifest,
|
|
15868
|
-
composeManifestRequest,
|
|
15869
|
-
computeOwnerShareRegistrationCid,
|
|
15870
|
-
computeShareCid,
|
|
15871
|
-
createAndSignPolicy,
|
|
15872
|
-
createAndSignPolicyEngineRecord,
|
|
15873
|
-
createAndSignPolicyStatus,
|
|
15874
|
-
createAndSignSignedObject,
|
|
15875
|
-
createCapabilityKeyRegistry,
|
|
15876
|
-
createDelegatedShareKey,
|
|
15877
|
-
createInMemoryLocalNodeIdentityStore,
|
|
15878
|
-
createLocalStorageLocalNodeIdentityStore,
|
|
15879
|
-
createOpenKeyCallbackSigningStrategy,
|
|
15880
|
-
createPolicyEnforcementDelegation,
|
|
15881
|
-
createShareArtifact,
|
|
15882
|
-
createShareArtifactAsync,
|
|
15883
|
-
createSharePolicy,
|
|
15884
|
-
createSharingService,
|
|
15885
|
-
createSpaceService,
|
|
15886
|
-
createTranscriptRequester,
|
|
15887
|
-
createVaultCrypto,
|
|
15888
|
-
decryptEnvelopeWithKey,
|
|
15889
|
-
decryptShareBytesAsync,
|
|
15890
|
-
defaultRetryPolicy,
|
|
15891
|
-
defaultSignStrategy,
|
|
15892
|
-
defaultSpaceCreationHandler,
|
|
15893
|
-
deriveDelegationCid,
|
|
15894
|
-
deriveSignedObjectMaterial,
|
|
15895
|
-
deriveSignedReceiverKey,
|
|
15896
|
-
didCacheKey,
|
|
15897
|
-
didEquals,
|
|
15898
|
-
disableTinyCloudDebug,
|
|
15899
|
-
discoverLocalTinyCloudNode,
|
|
15900
|
-
discoverNetwork,
|
|
15901
|
-
enableTinyCloudDebug,
|
|
15902
|
-
encodeInlineShareUrl,
|
|
15903
|
-
encodeShareArtifact,
|
|
15904
|
-
encodeShareUrl,
|
|
15905
|
-
encryptShareBytes,
|
|
15906
|
-
encryptShareBytesAsync,
|
|
15907
|
-
encryptToNetwork,
|
|
15908
|
-
encryptionBase64Decode,
|
|
15909
|
-
encryptionBase64Encode,
|
|
15910
|
-
encryptionError,
|
|
15911
|
-
encryptionUtf8Decode,
|
|
15912
|
-
encryptionUtf8Encode,
|
|
15913
|
-
ensureNetworkUsableForDecrypt,
|
|
15914
|
-
err,
|
|
15915
|
-
expandActionShortNames,
|
|
15916
|
-
expandPermissionEntries,
|
|
15917
|
-
expandPermissionEntry,
|
|
15918
|
-
fetchLocationRecord,
|
|
15919
|
-
fetchPeerId,
|
|
15920
|
-
generateRandomReceiverKey,
|
|
15921
|
-
getTinyCloudDebugLogs,
|
|
15922
|
-
hexDecode,
|
|
15923
|
-
hexEncode,
|
|
15924
|
-
httpUrlToMultiaddr,
|
|
15925
|
-
installTinyCloudDebugGlobals,
|
|
15926
|
-
intersectShareCapabilities,
|
|
15927
|
-
isCapabilitySubset,
|
|
15928
|
-
isEvmAddress,
|
|
15929
|
-
isNetworkId,
|
|
15930
|
-
isV2ShareLink,
|
|
15931
|
-
jcsCanonicalize,
|
|
15932
|
-
loadManifest,
|
|
15933
|
-
locationPayloadForRecord,
|
|
15934
|
-
makePkhSpaceId,
|
|
15935
|
-
makePublicSpaceId,
|
|
15936
|
-
manifestAbilitiesUnion,
|
|
15937
|
-
multiaddrToHttpUrl,
|
|
15938
|
-
networkDiscoveryKey,
|
|
15939
|
-
normalizeDefaults,
|
|
15940
|
-
normalizeJson,
|
|
15941
|
-
normalizeShareActions,
|
|
15942
|
-
normalizeShareRecipientTarget,
|
|
15943
|
-
normalizeShareResource,
|
|
15944
|
-
ok,
|
|
15945
|
-
openWrappedKey,
|
|
15946
|
-
parseCanonicalNetworkId,
|
|
15947
|
-
parseExpiry,
|
|
15948
|
-
parseNetworkId,
|
|
15949
|
-
parseNodeNativePortableDelegation,
|
|
15950
|
-
parsePkhDid,
|
|
15951
|
-
parseRecapCapabilities,
|
|
15952
|
-
parseShareArtifact,
|
|
15953
|
-
parseShareUrl,
|
|
15954
|
-
parseSpaceUri,
|
|
15955
|
-
pkhDid,
|
|
15956
|
-
principalDid,
|
|
15957
|
-
principalDidEquals,
|
|
15958
|
-
recapCaveatsEqual,
|
|
15959
|
-
resolveCloudLocation,
|
|
15960
|
-
resolveManifest,
|
|
15961
|
-
resolveManifestKnowledgeRoot,
|
|
15962
|
-
resolveSecretListPrefix,
|
|
15963
|
-
resolveSecretPath,
|
|
15964
|
-
resolveTinyCloudHosts,
|
|
15965
|
-
resourceCapabilitiesToAbilitiesMap,
|
|
15966
|
-
resourceCapabilitiesToSpaceAbilitiesMap,
|
|
15967
|
-
restoreDelegatedShareKey,
|
|
15968
|
-
serializeJcsJson,
|
|
15969
|
-
serviceError,
|
|
15970
|
-
shareCapabilityAllows,
|
|
15971
|
-
shareDeliveryTrustedKid,
|
|
15972
|
-
signLocationRecord,
|
|
15973
|
-
signShareEnvelope,
|
|
15974
|
-
signedObjectIdFor,
|
|
15975
|
-
submitHostDelegation,
|
|
15976
|
-
tinyCloudDebugLogger,
|
|
15977
|
-
toSignedObjectError,
|
|
15978
|
-
validateClientSession,
|
|
15979
|
-
validateEnvelope,
|
|
15980
|
-
validateLocationRecord,
|
|
15981
|
-
validateLocationRecordPayload,
|
|
15982
|
-
validateManifest,
|
|
15983
|
-
validateOwnerSharePolicyRegistration,
|
|
15984
|
-
validateOwnerSharePolicyRegistrationBytes,
|
|
15985
|
-
validatePersistedSessionData,
|
|
15986
|
-
validatePolicyEngineRecordSigned,
|
|
15987
|
-
validatePolicyEngineRecordSignedShape,
|
|
15988
|
-
validatePolicyEngineRecordUnsigned,
|
|
15989
|
-
validatePolicySigned,
|
|
15990
|
-
validatePolicySignedShape,
|
|
15991
|
-
validatePolicyStatusSigned,
|
|
15992
|
-
validatePolicyStatusSignedShape,
|
|
15993
|
-
validatePolicyStatusUnsigned,
|
|
15994
|
-
validatePolicyUnsigned,
|
|
15995
|
-
validateShareDeliveryAuthorizationBytes,
|
|
15996
|
-
verifyDecryptResponse,
|
|
15997
|
-
verifyDidKeyEd25519Signature,
|
|
15998
|
-
verifyLocationRecord,
|
|
15999
|
-
verifyPolicy,
|
|
16000
|
-
verifyPolicyEngineRecord,
|
|
16001
|
-
verifyPolicyStatus,
|
|
16002
|
-
verifyShareCid,
|
|
16003
|
-
verifyShareEnvelope,
|
|
16004
|
-
verifySignedObject
|
|
16005
|
-
});
|
|
16006
16382
|
//# sourceMappingURL=index.cjs.map
|