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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 sha2_exports = {};
2205
- __export(sha2_exports, {
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: (input) => coerce(import_crypto.default.createHash("sha256").update(input).digest())
2273
+ encode: sha("SHA-256")
2264
2274
  });
2265
2275
  var sha512 = from2({
2266
2276
  name: "sha2-512",
2267
2277
  code: 19,
2268
- encode: (input) => coerce(import_crypto.default.createHash("sha512").update(input).digest())
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 = { ...sha2_exports, ...identity_exports2 };
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 match = granted.find((g) => canonicalizeEntryMatches(req, g));
6706
- if (match === void 0) {
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 canonicalizeEntryMatches(requested, granted) {
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", "policy shares require encryption");
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
- if (envelope.authorizationTargetKind === "recipientDid") throw new ShareAccessError("SHARE_RECIPIENT_DID_UNSUPPORTED");
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);
@@ -10271,7 +10323,7 @@ function validateShareDeliveryAuthorizationBytes(bytesValue, expected) {
10271
10323
  const authorization = assertObject2(root.authorization, AUTHORIZATION_KEYS, "share delivery authorization");
10272
10324
  const proof = assertObject2(root.proof, ["alg", "kid", "signature"], "share delivery authorization proof");
10273
10325
  const request = expected.request;
10274
- if (authorization.type !== "TinyCloudShareDeliveryAuthorization" || authorization.version !== 2 || authorization.dataAuthority !== false || authorization.jti !== request.jti || authorization.shareCid !== request.shareCid || authorization.shareId !== request.shareId || authorization.registrationCid !== request.registrationCid || authorization.delegationCid !== request.delegationCid || authorization.enforcementDelegationCid !== request.enforcementDelegationCid || authorization.envelopeCid !== request.envelopeCid || authorization.policyCid !== request.policyCid || authorization.deliveryEmail !== request.recipientEmail || authorization.shareUrl !== request.shareUrl || authorization.documentName !== request.documentName || authorization.requestBodyDigest !== request.requestBodyDigest || authorization.expiresAt !== request.expiresAt || authorization.idempotencyKey !== request.jti || authorization.reportAbuseToken !== request.jti || authorization.authorityMaterialHandle !== request.registrationCid) {
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) {
10275
10327
  throw new Error("share delivery authorization is not bound to the submitted request");
10276
10328
  }
10277
10329
  if (typeof authorization.issuedAt !== "string" || Date.parse(authorization.issuedAt) > Date.now() + 6e4) throw new Error("share delivery authorization issuedAt is invalid");
@@ -10406,6 +10458,10 @@ var SenderShareStore = class {
10406
10458
  }
10407
10459
  };
10408
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
+
10409
10465
  // src/networkId.ts
10410
10466
  var import_sdk_services3 = require("@tinycloud/sdk-services");
10411
10467
  function canonicalizeNetworkId(networkId) {
@@ -12120,6 +12176,22 @@ var ACCOUNT_SPACES_PATH = "spaces/";
12120
12176
  var AccountService = class {
12121
12177
  constructor(config) {
12122
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();
12123
12195
  this.applications = {
12124
12196
  list: async (options2 = {}) => {
12125
12197
  if (options2.preferIndex) {
@@ -12153,7 +12225,7 @@ var AccountService = class {
12153
12225
  if (!loaded.ok) return accountErr(loaded.error);
12154
12226
  return (0, import_sdk_services6.ok)(applicationFromRecord(key, loaded.data.data));
12155
12227
  },
12156
- register: async (manifest) => {
12228
+ register: async (manifest, options2 = {}) => {
12157
12229
  const manifests = Array.isArray(manifest) ? manifest : [manifest];
12158
12230
  const request = composeManifestRequest(manifests);
12159
12231
  if (request.registryRecords.length === 0) {
@@ -12171,7 +12243,7 @@ var AccountService = class {
12171
12243
  let registered;
12172
12244
  for (const record of request.registryRecords) {
12173
12245
  const manifestHash = hashJson(record.manifests);
12174
- if (await this.indexHasApplicationHash(record.app_id, manifestHash)) {
12246
+ if (!options2.assumeUnregistered && await this.indexHasApplicationHash(record.app_id, manifestHash)) {
12175
12247
  registered = {
12176
12248
  appId: record.app_id,
12177
12249
  manifests: record.manifests,
@@ -12246,6 +12318,60 @@ var AccountService = class {
12246
12318
  await this.upsertSpaceIndexQuietly(registered);
12247
12319
  return (0, import_sdk_services6.ok)(registered);
12248
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
+ },
12249
12375
  syncAccessible: async () => {
12250
12376
  const listed = await this.config.getSpaces().list();
12251
12377
  if (!listed.ok) return accountErr(listed.error);
@@ -12352,6 +12478,7 @@ var AccountService = class {
12352
12478
  const delegations = await this.delegations.list();
12353
12479
  if (!delegations.ok) return delegations;
12354
12480
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
12481
+ this.invalidateAccountIndexMemo();
12355
12482
  const schema = await this.ensureAccountIndex(dbResult.data);
12356
12483
  if (!schema.ok) return schema;
12357
12484
  const statements = [
@@ -12631,6 +12758,47 @@ var AccountService = class {
12631
12758
  if (!written.ok) return accountErr(written.error);
12632
12759
  return (0, import_sdk_services6.ok)(void 0);
12633
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
+ }
12634
12802
  async deleteSpaceIndexQuietly(spaceId) {
12635
12803
  await ignoreIndexFailure(() => this.deleteSpaceIndex(spaceId));
12636
12804
  }
@@ -12751,7 +12919,41 @@ var AccountService = class {
12751
12919
  ]);
12752
12920
  });
12753
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
+ */
12754
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) {
12755
12957
  const migrated = await db.migrations.apply({
12756
12958
  namespace: ACCOUNT_INDEX_NAMESPACE,
12757
12959
  migrations: [
@@ -12923,6 +13125,17 @@ function accountErr(error) {
12923
13125
  function isMissingIndexError(error) {
12924
13126
  return /no such table:/i.test(error.message);
12925
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
+ }
12926
13139
  async function ignoreIndexFailure(task) {
12927
13140
  try {
12928
13141
  await task();
@@ -13539,6 +13752,279 @@ var AutoApproveSpaceCreationHandler = class {
13539
13752
  };
13540
13753
  var defaultSpaceCreationHandler = new AutoApproveSpaceCreationHandler();
13541
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
+
13542
14028
  // src/version.ts
13543
14029
  var ProtocolMismatchError = class extends Error {
13544
14030
  constructor(sdkProtocol, nodeProtocol, nodeVersion, host) {
@@ -13620,17 +14106,9 @@ function equals3(a, b) {
13620
14106
  return true;
13621
14107
  }
13622
14108
 
13623
- // ../../node_modules/uint8arrays/dist/src/alloc.node.js
13624
- var import_node_buffer = require("buffer");
13625
-
13626
- // ../../node_modules/uint8arrays/dist/src/util/as-uint8array.node.js
13627
- function asUint8Array(buf) {
13628
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
13629
- }
13630
-
13631
- // ../../node_modules/uint8arrays/dist/src/alloc.node.js
14109
+ // ../../node_modules/uint8arrays/dist/src/alloc.js
13632
14110
  function allocUnsafe(size = 0) {
13633
- return asUint8Array(import_node_buffer.Buffer.allocUnsafe(size));
14111
+ return new Uint8Array(size);
13634
14112
  }
13635
14113
 
13636
14114
  // ../../node_modules/uint8-varint/dist/src/index.js
@@ -13806,14 +14284,24 @@ function decode6(buf, offset = 0) {
13806
14284
  }
13807
14285
  }
13808
14286
 
13809
- // ../../node_modules/uint8arrays/dist/src/concat.node.js
13810
- var import_node_buffer2 = require("buffer");
13811
- function concat(arrays, length2) {
13812
- 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;
13813
14290
  }
13814
14291
 
13815
- // ../../node_modules/uint8arrays/dist/src/from-string.node.js
13816
- var import_node_buffer3 = require("buffer");
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
+ }
13817
14305
 
13818
14306
  // ../../node_modules/uint8arrays/dist/src/util/bases.js
13819
14307
  function createCodec(name2, prefix, encode5, decode7) {
@@ -13862,28 +14350,21 @@ var BASES = {
13862
14350
  };
13863
14351
  var bases_default = BASES;
13864
14352
 
13865
- // ../../node_modules/uint8arrays/dist/src/from-string.node.js
14353
+ // ../../node_modules/uint8arrays/dist/src/from-string.js
13866
14354
  function fromString2(string2, encoding = "utf8") {
13867
14355
  const base3 = bases_default[encoding];
13868
14356
  if (base3 == null) {
13869
14357
  throw new Error(`Unsupported encoding "${encoding}"`);
13870
14358
  }
13871
- if (encoding === "utf8" || encoding === "utf-8") {
13872
- return asUint8Array(import_node_buffer3.Buffer.from(string2, "utf-8"));
13873
- }
13874
14359
  return base3.decoder.decode(`${base3.prefix}${string2}`);
13875
14360
  }
13876
14361
 
13877
- // ../../node_modules/uint8arrays/dist/src/to-string.node.js
13878
- var import_node_buffer4 = require("buffer");
14362
+ // ../../node_modules/uint8arrays/dist/src/to-string.js
13879
14363
  function toString2(array, encoding = "utf8") {
13880
14364
  const base3 = bases_default[encoding];
13881
14365
  if (base3 == null) {
13882
14366
  throw new Error(`Unsupported encoding "${encoding}"`);
13883
14367
  }
13884
- if (encoding === "utf8" || encoding === "utf-8") {
13885
- return import_node_buffer4.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("utf8");
13886
- }
13887
14368
  return base3.encoder.encode(array).substring(1);
13888
14369
  }
13889
14370
 
@@ -13917,8 +14398,218 @@ var UnknownProtocolError = class extends Error {
13917
14398
  };
13918
14399
  __publicField(UnknownProtocolError, "name", "UnknownProtocolError");
13919
14400
 
13920
- // ../../node_modules/@chainsafe/is-ip/lib/is-ip.node.js
13921
- var import_node_net = require("net");
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
+ }
13922
14613
 
13923
14614
  // ../../node_modules/@multiformats/multiaddr/dist/src/constants.js
13924
14615
  var CODE_IP4 = 4;
@@ -14040,7 +14731,7 @@ var ip6ToBytes = function(ip) {
14040
14731
  const sections = ip.split(":", 8);
14041
14732
  let i;
14042
14733
  for (i = 0; i < sections.length; i++) {
14043
- const isv4 = (0, import_node_net.isIPv4)(sections[i]);
14734
+ const isv4 = isIPv4(sections[i]);
14044
14735
  let v4Buffer;
14045
14736
  if (isv4) {
14046
14737
  v4Buffer = ip4ToBytes(sections[i]);
@@ -14207,7 +14898,7 @@ var codecs = [{
14207
14898
  valueToBytes: ip4ToBytes,
14208
14899
  bytesToValue: ip4ToString,
14209
14900
  validate: (value) => {
14210
- if (!(0, import_node_net.isIPv4)(value)) {
14901
+ if (!isIPv4(value)) {
14211
14902
  throw new ValidationError(`Invalid IPv4 address "${value}"`);
14212
14903
  }
14213
14904
  }
@@ -14240,7 +14931,7 @@ var codecs = [{
14240
14931
  bytesToValue: ip6ToString,
14241
14932
  stringToValue: ip6StringToValue,
14242
14933
  validate: (value) => {
14243
- if (!(0, import_node_net.isIPv6)(value)) {
14934
+ if (!isIPv6(value)) {
14244
14935
  throw new ValidationError(`Invalid IPv6 address "${value}"`);
14245
14936
  }
14246
14937
  }
@@ -14875,25 +15566,17 @@ ipRegex.v4 = (options2) => options2 && options2.exact ? v4exact : new RegExp(`${
14875
15566
  ipRegex.v6 = (options2) => options2 && options2.exact ? v6exact : new RegExp(`${boundry(options2)}${v6}${boundry(options2)}`, "g");
14876
15567
  var ip_regex_default = ipRegex;
14877
15568
 
14878
- // ../../node_modules/function-timeout/index.js
14879
- var import_node_vm = __toESM(require("vm"), 1);
14880
- function functionTimeout(function_, { timeout } = {}) {
14881
- const script = new import_node_vm.default.Script("returnValue = function_()");
14882
- const wrappedFunction = (...arguments_) => {
14883
- const context = {
14884
- function_: () => function_(...arguments_)
14885
- };
14886
- script.runInNewContext(context, { timeout });
14887
- return context.returnValue;
14888
- };
15569
+ // ../../node_modules/function-timeout/browser.js
15570
+ function functionTimeout(function_) {
15571
+ const wrappedFunction = (...arguments_) => function_(...arguments_);
14889
15572
  Object.defineProperty(wrappedFunction, "name", {
14890
15573
  value: `functionTimeout(${function_.name || "<anonymous>"})`,
14891
15574
  configurable: true
14892
15575
  });
14893
15576
  return wrappedFunction;
14894
15577
  }
14895
- function isTimeoutError(error) {
14896
- return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
15578
+ function isTimeoutError() {
15579
+ return false;
14897
15580
  }
14898
15581
 
14899
15582
  // ../../node_modules/clone-regexp/node_modules/is-regexp/index.js
@@ -15295,13 +15978,14 @@ async function discoverLocalTinyCloudNode(options2 = {}) {
15295
15978
  }
15296
15979
  const fetchFn = options2.fetch ?? globalThis.fetch;
15297
15980
  const identityStore = options2.identityStore ?? defaultLocalNodeIdentityStore;
15298
- const staticCandidates = [
15299
- {
15981
+ const staticCandidates = [];
15982
+ if (options2.localNodeUrl) {
15983
+ staticCandidates.push({
15300
15984
  source: "local-loopback",
15301
- url: options2.localNodeUrl ?? DEFAULT_LOCAL_NODE_URL,
15985
+ url: options2.localNodeUrl,
15302
15986
  timeoutMs: LOCAL_LOOPBACK_PROBE_TIMEOUT_MS
15303
- }
15304
- ];
15987
+ });
15988
+ }
15305
15989
  if (options2.localLinkName) {
15306
15990
  if (isValidDnsLabel(options2.localLinkName)) {
15307
15991
  staticCandidates.push({
@@ -15695,320 +16379,4 @@ function decodeBase64Url(value) {
15695
16379
  }
15696
16380
  return Uint8Array.from(bytes2);
15697
16381
  }
15698
- // Annotate the CommonJS export names for ESM import in node:
15699
- 0 && (module.exports = {
15700
- ACCOUNT_INDEX_SCHEMA,
15701
- ACCOUNT_REGISTRY_PATH,
15702
- ACCOUNT_REGISTRY_SPACE,
15703
- AccountService,
15704
- AutoApproveSpaceCreationHandler,
15705
- BOOTSTRAP_ALLOWLIST,
15706
- BOOTSTRAP_DEFAULT_SPACE,
15707
- BOOTSTRAP_ENCRYPTION_NETWORK_NAME,
15708
- BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE,
15709
- BOOTSTRAP_MANIFEST,
15710
- BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS,
15711
- BOOTSTRAP_PUBLIC_SPACE,
15712
- BOOTSTRAP_SESSION_REQUESTS,
15713
- BOOTSTRAP_SPACE_MANIFESTS,
15714
- BOOTSTRAP_SPACE_NAMES,
15715
- CAPABILITIES,
15716
- CAPABILITY_REGISTRY,
15717
- CapabilityKeyRegistry,
15718
- CapabilityKeyRegistryErrorCodes,
15719
- CaveatedDelegationUnsupportedError,
15720
- ClientSessionSchema,
15721
- CloudLocationResolutionError,
15722
- DECRYPT_ACTION,
15723
- DECRYPT_FACT_TYPE,
15724
- DECRYPT_RESULT_TYPE,
15725
- DEFAULT_DEFAULTS,
15726
- DEFAULT_ENCRYPTION_ALG,
15727
- DEFAULT_EXPIRY,
15728
- DEFAULT_KEY_VERSION,
15729
- DEFAULT_KNOWLEDGE_ROOT,
15730
- DEFAULT_LOCAL_NODE_PIN_STORAGE_KEY,
15731
- DEFAULT_LOCAL_NODE_URL,
15732
- DEFAULT_MANIFEST_SPACE,
15733
- DEFAULT_MANIFEST_VERSION,
15734
- DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
15735
- DEFAULT_TINYCLOUD_FALLBACK_HOST,
15736
- DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL,
15737
- DUCKDB,
15738
- DataVaultService,
15739
- DatabaseHandle,
15740
- DecryptTransportResponseError,
15741
- DelegationErrorCodes,
15742
- DelegationManager,
15743
- DuckDbAction,
15744
- DuckDbDatabaseHandle,
15745
- DuckDbService,
15746
- ED25519_JCS_SIGNATURE_SUITE,
15747
- EIP191_JCS_SIGNATURE_SUITE,
15748
- ENCRYPTION,
15749
- ENCRYPTION_MANIFEST_SPACE,
15750
- ENCRYPTION_NETWORK_URN_PREFIX,
15751
- ENCRYPTION_PERMISSION_SERVICE,
15752
- ENCRYPTION_SERVICE,
15753
- ENCRYPTION_SERVICE_SHORT,
15754
- ENVELOPE_VERSION,
15755
- EXPIRY,
15756
- EncryptionService,
15757
- EnsDataSchema,
15758
- ErrorCodes,
15759
- HOLDER_KEY_BINDING_PRESENTATION_SCHEMA,
15760
- HOOKS,
15761
- HooksService,
15762
- IdentityParseError,
15763
- KV,
15764
- KVService,
15765
- LISTEN_SQL_STATEMENT_CATALOG,
15766
- LOCAL_LINK_HOST_SUFFIX,
15767
- LOCAL_LINK_PROBE_TIMEOUT_MS,
15768
- LOCAL_LOOPBACK_PROBE_TIMEOUT_MS,
15769
- LocationRecordValidationError,
15770
- MAX_CONTENT_BYTES,
15771
- MAX_SEALED_SHARE_CONTENT_BYTES,
15772
- MAX_SHARE_ARTIFACT_BYTES,
15773
- MAX_SHARE_CONTENT_BYTES,
15774
- ManifestValidationError,
15775
- MemorySenderShareKeyStorage,
15776
- MemorySenderShareRecordStorage,
15777
- MemoryShareCache,
15778
- NETWORK_NAME_PATTERN,
15779
- NetworkIdError,
15780
- POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA,
15781
- POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA,
15782
- POLICY_ENGINE_DENIAL_SCHEMA,
15783
- POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES,
15784
- POLICY_ENGINE_RECORD_SCHEMA,
15785
- POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA,
15786
- POLICY_SCHEMA,
15787
- POLICY_STATUS_SCHEMA,
15788
- PORTABLE_DELEGATION_SCHEMA,
15789
- PermissionNotInManifestError,
15790
- PrefixedKVService,
15791
- ProtocolMismatchError,
15792
- REQUESTER_ENGINE_RETRY_ATTEMPTS,
15793
- REQUESTER_ENGINE_RETRY_MAX_DELAY_MS,
15794
- REQUESTER_NEAR_EXPIRY_SECONDS,
15795
- SECRETS_SPACE,
15796
- SECRET_NAME_RE,
15797
- SECRET_RECORDS_SCHEMA,
15798
- SERVICE_LONG_TO_SHORT,
15799
- SERVICE_SHORT_TO_LONG,
15800
- SHARE_DELIVERY_AUTHORIZATION_DOMAIN,
15801
- SPACE,
15802
- SQL,
15803
- SQLAction,
15804
- SQLService,
15805
- SecretsService,
15806
- SenderShareStore,
15807
- ServiceContext,
15808
- SessionExpiredError,
15809
- ShareAccessError,
15810
- ShareAddressedDelegationEnvelopeV2Schema,
15811
- ShareAddressedDelegationRequestV2Schema,
15812
- ShareAddressedDelegationResponseV2Schema,
15813
- ShareConflict,
15814
- ShareEnvelopeError,
15815
- ShareNativeResponseSchema,
15816
- ShareRecipientClient,
15817
- SharingService,
15818
- SignatureMaterialError,
15819
- SignatureVerificationError,
15820
- SignedObjectCanonicalizationError,
15821
- SignedObjectDigestError,
15822
- SignedObjectIdError,
15823
- SignedObjectProfileError,
15824
- SignedObjectSchemaError,
15825
- SigningKeyBindingError,
15826
- SilentNotificationHandler,
15827
- SiweConfigSchema,
15828
- SiweMessage,
15829
- Space,
15830
- SpaceErrorCodes,
15831
- SpaceService,
15832
- TINYCLOUD_ACCOUNT_SPACE_MANIFEST,
15833
- TINYCLOUD_APPLICATIONS_SPACE_MANIFEST,
15834
- TINYCLOUD_DEFAULT_SPACE_MANIFEST,
15835
- TINYCLOUD_PUBLIC_SPACE_MANIFEST,
15836
- TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
15837
- TinyCloud,
15838
- TinyCloudDebugLogger,
15839
- TranscriptRequester,
15840
- TranscriptRequesterError,
15841
- UnsupportedFeatureError,
15842
- UnsupportedSignatureSuiteError,
15843
- VAULT_PERMISSION_SERVICE,
15844
- VaultHeaders,
15845
- VaultPublicSpaceKVActions,
15846
- VersionCheckError,
15847
- actionContains,
15848
- activateSessionWithHost,
15849
- addressStorageKey,
15850
- applyPrefix,
15851
- bootstrapEncryptionNetworkId,
15852
- bootstrapSpaceId,
15853
- bootstrapSteps,
15854
- buildCanonicalDecryptRequest,
15855
- buildDecryptAttenuation,
15856
- buildDecryptFacts,
15857
- buildDecryptInvocation,
15858
- buildNetworkId,
15859
- buildSpaceUri,
15860
- canonicalHashHex,
15861
- canonicalLocationPayload,
15862
- canonicalOwnerSharePolicy,
15863
- canonicalSignedResponse,
15864
- canonicalizeAddress,
15865
- canonicalizeDid,
15866
- canonicalizeDidUrl,
15867
- canonicalizeEncryptionJson,
15868
- canonicalizeNetworkId,
15869
- canonicalizeRecapCaveats,
15870
- canonicalizeSecretScope,
15871
- canonicalizeSignedObjectUnsigned,
15872
- checkDecryptInvocationInput,
15873
- checkNodeInfo,
15874
- clearTinyCloudDebugLogs,
15875
- composeBootstrapSpaceManifest,
15876
- composeManifestRequest,
15877
- computeOwnerShareRegistrationCid,
15878
- computeShareCid,
15879
- createAndSignPolicy,
15880
- createAndSignPolicyEngineRecord,
15881
- createAndSignPolicyStatus,
15882
- createAndSignSignedObject,
15883
- createCapabilityKeyRegistry,
15884
- createDelegatedShareKey,
15885
- createInMemoryLocalNodeIdentityStore,
15886
- createLocalStorageLocalNodeIdentityStore,
15887
- createOpenKeyCallbackSigningStrategy,
15888
- createPolicyEnforcementDelegation,
15889
- createShareArtifact,
15890
- createShareArtifactAsync,
15891
- createSharePolicy,
15892
- createSharingService,
15893
- createSpaceService,
15894
- createTranscriptRequester,
15895
- createVaultCrypto,
15896
- decryptEnvelopeWithKey,
15897
- decryptShareBytesAsync,
15898
- defaultRetryPolicy,
15899
- defaultSignStrategy,
15900
- defaultSpaceCreationHandler,
15901
- deriveDelegationCid,
15902
- deriveSignedObjectMaterial,
15903
- deriveSignedReceiverKey,
15904
- didCacheKey,
15905
- didEquals,
15906
- disableTinyCloudDebug,
15907
- discoverLocalTinyCloudNode,
15908
- discoverNetwork,
15909
- enableTinyCloudDebug,
15910
- encodeInlineShareUrl,
15911
- encodeShareArtifact,
15912
- encodeShareUrl,
15913
- encryptShareBytes,
15914
- encryptShareBytesAsync,
15915
- encryptToNetwork,
15916
- encryptionBase64Decode,
15917
- encryptionBase64Encode,
15918
- encryptionError,
15919
- encryptionUtf8Decode,
15920
- encryptionUtf8Encode,
15921
- ensureNetworkUsableForDecrypt,
15922
- err,
15923
- expandActionShortNames,
15924
- expandPermissionEntries,
15925
- expandPermissionEntry,
15926
- fetchLocationRecord,
15927
- fetchPeerId,
15928
- generateRandomReceiverKey,
15929
- getTinyCloudDebugLogs,
15930
- hexDecode,
15931
- hexEncode,
15932
- httpUrlToMultiaddr,
15933
- installTinyCloudDebugGlobals,
15934
- intersectShareCapabilities,
15935
- isCapabilitySubset,
15936
- isEvmAddress,
15937
- isNetworkId,
15938
- isV2ShareLink,
15939
- jcsCanonicalize,
15940
- loadManifest,
15941
- locationPayloadForRecord,
15942
- makePkhSpaceId,
15943
- makePublicSpaceId,
15944
- manifestAbilitiesUnion,
15945
- multiaddrToHttpUrl,
15946
- networkDiscoveryKey,
15947
- normalizeDefaults,
15948
- normalizeJson,
15949
- normalizeShareActions,
15950
- normalizeShareRecipientTarget,
15951
- normalizeShareResource,
15952
- ok,
15953
- openWrappedKey,
15954
- parseCanonicalNetworkId,
15955
- parseExpiry,
15956
- parseNetworkId,
15957
- parseNodeNativePortableDelegation,
15958
- parsePkhDid,
15959
- parseRecapCapabilities,
15960
- parseShareArtifact,
15961
- parseShareUrl,
15962
- parseSpaceUri,
15963
- pkhDid,
15964
- principalDid,
15965
- principalDidEquals,
15966
- recapCaveatsEqual,
15967
- resolveCloudLocation,
15968
- resolveManifest,
15969
- resolveManifestKnowledgeRoot,
15970
- resolveSecretListPrefix,
15971
- resolveSecretPath,
15972
- resolveTinyCloudHosts,
15973
- resourceCapabilitiesToAbilitiesMap,
15974
- resourceCapabilitiesToSpaceAbilitiesMap,
15975
- restoreDelegatedShareKey,
15976
- serializeJcsJson,
15977
- serviceError,
15978
- shareCapabilityAllows,
15979
- shareDeliveryTrustedKid,
15980
- signLocationRecord,
15981
- signShareEnvelope,
15982
- signedObjectIdFor,
15983
- submitHostDelegation,
15984
- tinyCloudDebugLogger,
15985
- toSignedObjectError,
15986
- validateClientSession,
15987
- validateEnvelope,
15988
- validateLocationRecord,
15989
- validateLocationRecordPayload,
15990
- validateManifest,
15991
- validateOwnerSharePolicyRegistration,
15992
- validateOwnerSharePolicyRegistrationBytes,
15993
- validatePersistedSessionData,
15994
- validatePolicyEngineRecordSigned,
15995
- validatePolicyEngineRecordSignedShape,
15996
- validatePolicyEngineRecordUnsigned,
15997
- validatePolicySigned,
15998
- validatePolicySignedShape,
15999
- validatePolicyStatusSigned,
16000
- validatePolicyStatusSignedShape,
16001
- validatePolicyStatusUnsigned,
16002
- validatePolicyUnsigned,
16003
- validateShareDeliveryAuthorizationBytes,
16004
- verifyDecryptResponse,
16005
- verifyDidKeyEd25519Signature,
16006
- verifyLocationRecord,
16007
- verifyPolicy,
16008
- verifyPolicyEngineRecord,
16009
- verifyPolicyStatus,
16010
- verifyShareCid,
16011
- verifyShareEnvelope,
16012
- verifySignedObject
16013
- });
16014
16382
  //# sourceMappingURL=index.cjs.map