@tinycloud/cli 0.9.0-beta.7 → 0.9.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11675,16 +11675,16 @@ function ensureNetworkUsableForDecrypt(descriptor) {
11675
11675
  })
11676
11676
  };
11677
11677
  }
11678
- function encryptToNetwork(crypto23, input) {
11678
+ function encryptToNetwork(crypto22, input) {
11679
11679
  parseNetworkId(input.networkId);
11680
11680
  const alg = input.alg ?? DEFAULT_ENCRYPTION_ALG;
11681
11681
  const keyVersion = input.keyVersion ?? DEFAULT_KEY_VERSION;
11682
- const symmetricKey = crypto23.randomBytes(32);
11683
- const ciphertext = crypto23.authEncrypt(symmetricKey, input.plaintext, input.aad);
11684
- const wrapped = crypto23.sealToNetworkKey(input.networkPublicKey, symmetricKey);
11682
+ const symmetricKey = crypto22.randomBytes(32);
11683
+ const ciphertext = crypto22.authEncrypt(symmetricKey, input.plaintext, input.aad);
11684
+ const wrapped = crypto22.sealToNetworkKey(input.networkPublicKey, symmetricKey);
11685
11685
  const encryptedSymmetricKey = base64Encode2(wrapped);
11686
11686
  const encryptedSymmetricKeyHash = canonicalHashHex(
11687
- crypto23.sha256,
11687
+ crypto22.sha256,
11688
11688
  encryptedSymmetricKey
11689
11689
  );
11690
11690
  const envelope = {
@@ -11700,7 +11700,7 @@ function encryptToNetwork(crypto23, input) {
11700
11700
  };
11701
11701
  return { envelope, symmetricKey };
11702
11702
  }
11703
- function validateEnvelope(crypto23, envelope) {
11703
+ function validateEnvelope(crypto22, envelope) {
11704
11704
  if (envelope === null || typeof envelope !== "object") {
11705
11705
  return {
11706
11706
  ok: false,
@@ -11756,7 +11756,7 @@ function validateEnvelope(crypto23, envelope) {
11756
11756
  })
11757
11757
  };
11758
11758
  }
11759
- const expectedHash = canonicalHashHex(crypto23.sha256, e.encryptedSymmetricKey);
11759
+ const expectedHash = canonicalHashHex(crypto22.sha256, e.encryptedSymmetricKey);
11760
11760
  if (expectedHash !== e.encryptedSymmetricKeyHash) {
11761
11761
  return {
11762
11762
  ok: false,
@@ -11768,10 +11768,10 @@ function validateEnvelope(crypto23, envelope) {
11768
11768
  }
11769
11769
  return { ok: true, data: e };
11770
11770
  }
11771
- function decryptEnvelopeWithKey(crypto23, envelope, symmetricKey) {
11771
+ function decryptEnvelopeWithKey(crypto22, envelope, symmetricKey) {
11772
11772
  const ciphertext = base64Decode2(envelope.ciphertext);
11773
11773
  const aad = envelope.aad !== void 0 ? base64Decode2(envelope.aad) : void 0;
11774
- return crypto23.authDecrypt(symmetricKey, ciphertext, aad);
11774
+ return crypto22.authDecrypt(symmetricKey, ciphertext, aad);
11775
11775
  }
11776
11776
  function buildCanonicalDecryptRequest(input) {
11777
11777
  const canonicalBody = canonicalize(input.body);
@@ -11805,7 +11805,7 @@ function buildDecryptFacts(input) {
11805
11805
  keyVersion: input.body.keyVersion
11806
11806
  };
11807
11807
  }
11808
- function checkDecryptInvocationInput(crypto23, input) {
11808
+ function checkDecryptInvocationInput(crypto22, input) {
11809
11809
  if (input.body.type !== DECRYPT_FACT_TYPE) {
11810
11810
  return {
11811
11811
  ok: false,
@@ -11910,7 +11910,7 @@ function checkDecryptInvocationInput(crypto23, input) {
11910
11910
  const canonicalBody = canonicalize(
11911
11911
  input.body
11912
11912
  );
11913
- const expectedBodyHash = canonicalHashHex(crypto23.sha256, input.body);
11913
+ const expectedBodyHash = canonicalHashHex(crypto22.sha256, input.body);
11914
11914
  if (expectedBodyHash !== input.facts.bodyHash) {
11915
11915
  return {
11916
11916
  ok: false,
@@ -11922,8 +11922,8 @@ function checkDecryptInvocationInput(crypto23, input) {
11922
11922
  }
11923
11923
  return { ok: true, data: input, canonicalBody };
11924
11924
  }
11925
- async function buildDecryptInvocation(crypto23, signer, input) {
11926
- const checked = checkDecryptInvocationInput(crypto23, input);
11925
+ async function buildDecryptInvocation(crypto22, signer, input) {
11926
+ const checked = checkDecryptInvocationInput(crypto22, input);
11927
11927
  if (!checked.ok) {
11928
11928
  return checked;
11929
11929
  }
@@ -11968,7 +11968,7 @@ function canonicalSignedResponse(response) {
11968
11968
  return canonicalize(rest);
11969
11969
  }
11970
11970
  function verifyDecryptResponse(input) {
11971
- const { crypto: crypto23, request, facts, invocationCid, requestBodyHash, response } = input;
11971
+ const { crypto: crypto22, request, facts, invocationCid, requestBodyHash, response } = input;
11972
11972
  if (response.type !== DECRYPT_RESULT_TYPE) {
11973
11973
  return {
11974
11974
  ok: false,
@@ -12051,7 +12051,7 @@ function verifyDecryptResponse(input) {
12051
12051
  };
12052
12052
  }
12053
12053
  const expectedRequestHash = hexEncode2(
12054
- crypto23.sha256(utf8Encode(`${invocationCid}${requestBodyHash}`))
12054
+ crypto22.sha256(utf8Encode(`${invocationCid}${requestBodyHash}`))
12055
12055
  );
12056
12056
  if (response.requestHash !== expectedRequestHash) {
12057
12057
  return {
@@ -12075,7 +12075,7 @@ function verifyDecryptResponse(input) {
12075
12075
  canonicalSignedResponse(response)
12076
12076
  );
12077
12077
  const signatureBytes = base64Decode2(response.nodeSignature);
12078
- if (!crypto23.verifyNodeSignature(response.nodeId, signedBytes, signatureBytes)) {
12078
+ if (!crypto22.verifyNodeSignature(response.nodeId, signedBytes, signatureBytes)) {
12079
12079
  return {
12080
12080
  ok: false,
12081
12081
  error: encryptionError({
@@ -12085,9 +12085,9 @@ function verifyDecryptResponse(input) {
12085
12085
  }
12086
12086
  return { ok: true, data: response };
12087
12087
  }
12088
- function openWrappedKey(crypto23, receiverPrivateKey, response) {
12088
+ function openWrappedKey(crypto22, receiverPrivateKey, response) {
12089
12089
  const wrapped = base64Decode2(response.wrappedKey);
12090
- return crypto23.openWithReceiverKey(receiverPrivateKey, wrapped);
12090
+ return crypto22.openWithReceiverKey(receiverPrivateKey, wrapped);
12091
12091
  }
12092
12092
  function encOk(data) {
12093
12093
  return { ok: true, data };
@@ -24687,12 +24687,6 @@ var init_dist3 = __esm({
24687
24687
 
24688
24688
  // ../sdk-core/dist/index.js
24689
24689
  import { SiweMessage } from "siwe";
24690
- import crypto22 from "crypto";
24691
- import { Buffer as Buffer2 } from "buffer";
24692
- import { Buffer as Buffer3 } from "buffer";
24693
- import { Buffer as Buffer4 } from "buffer";
24694
- import { Buffer as Buffer5 } from "buffer";
24695
- import { isIPv4, isIPv6, isIP as ipVersion } from "net";
24696
24690
  function equals5(aa, bb) {
24697
24691
  if (aa === bb) {
24698
24692
  return true;
@@ -25137,6 +25131,9 @@ function createDigest(digest4, code32, truncate) {
25137
25131
  }
25138
25132
  return create3(code32, digest4);
25139
25133
  }
25134
+ function sha(name2) {
25135
+ return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
25136
+ }
25140
25137
  function parseStrictRfc33392(value) {
25141
25138
  if (!/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(
25142
25139
  value
@@ -25235,11 +25232,8 @@ function equals32(a, b) {
25235
25232
  }
25236
25233
  return true;
25237
25234
  }
25238
- function asUint8Array(buf) {
25239
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
25240
- }
25241
25235
  function allocUnsafe(size2 = 0) {
25242
- return asUint8Array(Buffer2.allocUnsafe(size2));
25236
+ return new Uint8Array(size2);
25243
25237
  }
25244
25238
  function encodingLength22(value) {
25245
25239
  if (value < N122) {
@@ -25403,8 +25397,20 @@ function decode62(buf, offset = 0) {
25403
25397
  return decodeUint8ArrayList(buf, offset);
25404
25398
  }
25405
25399
  }
25400
+ function asUint8Array(buf) {
25401
+ return buf;
25402
+ }
25406
25403
  function concat2(arrays, length22) {
25407
- return asUint8Array(Buffer3.concat(arrays, length22));
25404
+ if (length22 == null) {
25405
+ length22 = arrays.reduce((acc, curr) => acc + curr.length, 0);
25406
+ }
25407
+ const output = allocUnsafe(length22);
25408
+ let offset = 0;
25409
+ for (const arr of arrays) {
25410
+ output.set(arr, offset);
25411
+ offset += arr.length;
25412
+ }
25413
+ return asUint8Array(output);
25408
25414
  }
25409
25415
  function createCodec(name2, prefix, encode52, decode72) {
25410
25416
  return {
@@ -25425,9 +25431,6 @@ function fromString2(string2, encoding = "utf8") {
25425
25431
  if (base33 == null) {
25426
25432
  throw new Error(`Unsupported encoding "${encoding}"`);
25427
25433
  }
25428
- if (encoding === "utf8" || encoding === "utf-8") {
25429
- return asUint8Array(Buffer4.from(string2, "utf-8"));
25430
- }
25431
25434
  return base33.decoder.decode(`${base33.prefix}${string2}`);
25432
25435
  }
25433
25436
  function toString2(array, encoding = "utf8") {
@@ -25435,11 +25438,29 @@ function toString2(array, encoding = "utf8") {
25435
25438
  if (base33 == null) {
25436
25439
  throw new Error(`Unsupported encoding "${encoding}"`);
25437
25440
  }
25438
- if (encoding === "utf8" || encoding === "utf-8") {
25439
- return Buffer5.from(array.buffer, array.byteOffset, array.byteLength).toString("utf8");
25440
- }
25441
25441
  return base33.encoder.encode(array).substring(1);
25442
25442
  }
25443
+ function parseIPv4(input) {
25444
+ if (input.length > MAX_IPV4_LENGTH) {
25445
+ return void 0;
25446
+ }
25447
+ return parser.new(input).parseWith(() => parser.readIPv4Addr());
25448
+ }
25449
+ function parseIPv6(input) {
25450
+ if (input.includes("%")) {
25451
+ input = input.split("%")[0];
25452
+ }
25453
+ if (input.length > MAX_IPV6_LENGTH) {
25454
+ return void 0;
25455
+ }
25456
+ return parser.new(input).parseWith(() => parser.readIPv6Addr());
25457
+ }
25458
+ function isIPv4(input) {
25459
+ return Boolean(parseIPv4(input));
25460
+ }
25461
+ function isIPv6(input) {
25462
+ return Boolean(parseIPv6(input));
25463
+ }
25443
25464
  function bytesToString(base33) {
25444
25465
  return (buf) => {
25445
25466
  return toString2(buf, base33);
@@ -26135,7 +26156,7 @@ function decodeBase64Url(value) {
26135
26156
  }
26136
26157
  return Uint8Array.from(bytes22);
26137
26158
  }
26138
- var import_ms, __defProp3, __typeError, __defNormalProp, __export3, __publicField, __accessCheck, __privateGet, __privateAdd, __privateSet, EnsDataSchema, SiweConfigSchema, ClientSessionSchema, base32_exports, empty3, src3, _brrp__multiformats_scope_baseX3, base_x_default3, Encoder3, Decoder3, ComposedDecoder3, Codec3, base323, base32upper3, base32pad3, base32padupper3, base32hex3, base32hexupper3, base32hexpad3, base32hexpadupper3, base32z3, base36_exports, base363, base36upper3, base58_exports, base58btc3, base58flickr3, encode_13, MSB3, REST3, MSBALL3, INT3, decode22, MSB$13, REST$13, N13, N23, N33, N43, N53, N63, N73, N83, N93, length3, varint3, _brrp_varint3, varint_default3, Digest3, cache3, _a, CID3, DAG_PB_CODE3, SHA_256_CODE3, cidSymbol3, objectHasOwn, textEncoder, objectHasOwn2, CEILING_SERVICES, GRANTABLE_ACTIONS, base10_exports, base10, base16_exports, base16, base16upper, base2_exports, base22, base256emoji_exports, alphabet, alphabetBytesToChars, alphabetCharsToBytes, base256emoji, base64_exports, base642, base64pad2, base64url2, base64urlpad2, base8_exports, base8, identity_exports, identity, textEncoder2, textDecoder, identity_exports2, code22, name, encode42, identity2, sha2_exports, DEFAULT_MIN_DIGEST_LENGTH, Hasher, sha25622, sha5122, bases, hashes, textEncoder3, objectHasOwn3, TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA, OWNER_NODE_ENDPOINT_SCHEMA, W3C_VC_CREDENTIAL_VERIFIER, objectHasOwn4, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, JsonValueSchema, Rfc3339Schema, SignedRecordSchema, PolicyEngineSchema, OwnerNodeSchema, ResourceHintSchema, BootstrapSchema, SignatureSchema, ChallengeSchema, ChallengeResponseSchema, DenialSchema, ErrorEnvelopeDenialSchema, WireDelegationSchema, ResolveResponseSchema, DelegateReceiptSchema, SqlReadResponseSchema, KvReadResponseSchema, LISTEN_SQL_STATEMENT_CATALOG, LISTEN_SQL_STATEMENT_BY_NAME, JWKSchema, KeyTypeSchema, KeyInfoSchema, DelegationErrorSchema, DelegationSchema, DelegationStatusSchema, DelegationRevocationReceiptSchema, AccountDelegationResourceSchema, AccountDelegationDateSchema, AccountDelegationRecordSchema, AccountDelegationPageSchema, AccountDelegationQueryOptionsSchema, CapabilityEntrySchema, DelegationRecordSchema, CreateDelegationParamsSchema, DelegationChainSchema, DelegationChainV2Schema, DelegationDirectionSchema, DelegationFiltersSchema, SpaceOwnershipSchema, SpaceInfoSchema, ShareSchemaSchema, ShareLinkSchema, ShareLinkDataSchema, IngestOptionsSchema, GenerateShareParamsSchema, DelegationManagerConfigSchema, KeyProviderSchema, DelegationApiResponseSchema, DelegatedResourceSchema, CreateDelegationWasmParamsSchema, CreateDelegationWasmResultSchema, EPHEMERAL_MS, SIGNED_READ_URL_MS, SESSION_MS, SHARE_MS, APP_MS, MAX_MS, EXPIRY, DEFAULT_SIGNED_READ_URL_EXPIRY_MS2, EncodedShareDataSchema, ReceiveOptionsSchema, SharingServiceConfigSchema, SERVICE_SHORT_TO_LONG, SERVICE_LONG_TO_SHORT, DEFAULT_MAX_INLINE_BYTES, MAX_SHARE_CONTENT_BYTES, MAX_SEALED_SHARE_CONTENT_BYTES, MAX_SHARE_ARTIFACT_BYTES, PUBLISHED_AAD, ShareRecipientTargetSchema, ShareResourceSchema, ShareActionSchema, ShareRecipientPolicySchema, ShareRecipientClientOptionsSchema, ShareNativeActionSchema, ShareWireActionSchema, ShareContentSourceSchema, ShareAddressedRecipientSchema, ShareAddressedDelegationRequestV2Schema, ShareAddressedDelegationEnvelopeV2Schema, ShareAddressedDelegationResponseV2Schema, ShareNativeResponseEntrySchema, ShareNativeResponseBase, ShareNativeResponseSchema, MAX_NATIVE_CURSOR_BYTES, DEFAULT_EXPIRY_MS2, MAX_CONTENT_BYTES2, ethereumAddressPattern, EnsDataSchema2, PersistedTinyCloudSessionSchema, PersistedSessionDataSchema, TinyCloudSessionSchema, SpaceConfigSchema, SpaceServiceConfigSchema, SpaceDelegationParamsSchema, ServerDelegationInfoSchema, ServerDelegationsResponseSchema, ServerOwnedSpaceSchema, ServerOwnedSpacesResponseSchema, ServerCreateSpaceResponseSchema, ServerSpaceInfoResponseSchema, inFlightActivations, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, N122, N222, N322, N422, N522, N622, N722, MSB22, REST22, string, ascii, BASES, bases_default, InvalidMultiaddrError, ValidationError, InvalidParametersError, UnknownProtocolError, CODE_IP4, CODE_TCP, CODE_UDP, CODE_DCCP, CODE_IP6, CODE_IP6ZONE, CODE_IPCIDR, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR, CODE_SCTP, CODE_UDT, CODE_UTP, CODE_UNIX, CODE_P2P, CODE_ONION, CODE_ONION3, CODE_GARLIC64, CODE_GARLIC32, CODE_TLS, CODE_SNI, CODE_NOISE, CODE_QUIC, CODE_QUIC_V1, CODE_WEBTRANSPORT, CODE_CERTHASH, CODE_HTTP, CODE_HTTP_PATH, CODE_HTTPS, CODE_WS, CODE_WSS, CODE_P2P_WEBSOCKET_STAR, CODE_P2P_STARDUST, CODE_P2P_WEBRTC_STAR, CODE_P2P_WEBRTC_DIRECT, CODE_WEBRTC_DIRECT, CODE_WEBRTC, CODE_P2P_CIRCUIT, CODE_MEMORY, ip4ToBytes, ip6ToBytes, ip4ToString, ip6ToString, decoders, anybaseDecoder, validatePort, V, Registry, registry, codecs, inspect, symbol, _a2, _components, _string, _bytes, _Multiaddr, Multiaddr, ASSUME_HTTP_CODES, interpreters, word, boundry, v4, v6segment, v6, v46Exact, v4exact, v6exact, ipRegex, toString3, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, LOCAL_LOOPBACK_PROBE_TIMEOUT_MS, LOCAL_LINK_PROBE_TIMEOUT_MS, LOCAL_LINK_HOST_SUFFIX, LocationRecordValidationError, defaultLocalNodeIdentityStore, DNS_LABEL_REGEX;
26159
+ var import_ms, __defProp3, __typeError, __defNormalProp, __export3, __publicField, __accessCheck, __privateGet, __privateAdd, __privateSet, EnsDataSchema, SiweConfigSchema, ClientSessionSchema, base32_exports, empty3, src3, _brrp__multiformats_scope_baseX3, base_x_default3, Encoder3, Decoder3, ComposedDecoder3, Codec3, base323, base32upper3, base32pad3, base32padupper3, base32hex3, base32hexupper3, base32hexpad3, base32hexpadupper3, base32z3, base36_exports, base363, base36upper3, base58_exports, base58btc3, base58flickr3, encode_13, MSB3, REST3, MSBALL3, INT3, decode22, MSB$13, REST$13, N13, N23, N33, N43, N53, N63, N73, N83, N93, length3, varint3, _brrp_varint3, varint_default3, Digest3, cache3, _a, CID3, DAG_PB_CODE3, SHA_256_CODE3, cidSymbol3, objectHasOwn, textEncoder, objectHasOwn2, CEILING_SERVICES, GRANTABLE_ACTIONS, base10_exports, base10, base16_exports, base16, base16upper, base2_exports, base22, base256emoji_exports, alphabet, alphabetBytesToChars, alphabetCharsToBytes, base256emoji, base64_exports, base642, base64pad2, base64url2, base64urlpad2, base8_exports, base8, identity_exports, identity, textEncoder2, textDecoder, identity_exports2, code22, name, encode42, identity2, sha2_browser_exports, DEFAULT_MIN_DIGEST_LENGTH, Hasher, sha25622, sha5122, bases, hashes, textEncoder3, objectHasOwn3, TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA, OWNER_NODE_ENDPOINT_SCHEMA, W3C_VC_CREDENTIAL_VERIFIER, objectHasOwn4, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, JsonValueSchema, Rfc3339Schema, SignedRecordSchema, PolicyEngineSchema, OwnerNodeSchema, ResourceHintSchema, BootstrapSchema, SignatureSchema, ChallengeSchema, ChallengeResponseSchema, DenialSchema, ErrorEnvelopeDenialSchema, WireDelegationSchema, ResolveResponseSchema, DelegateReceiptSchema, SqlReadResponseSchema, KvReadResponseSchema, LISTEN_SQL_STATEMENT_CATALOG, LISTEN_SQL_STATEMENT_BY_NAME, JWKSchema, KeyTypeSchema, KeyInfoSchema, DelegationErrorSchema, DelegationSchema, DelegationStatusSchema, DelegationRevocationReceiptSchema, AccountDelegationResourceSchema, AccountDelegationDateSchema, AccountDelegationRecordSchema, AccountDelegationPageSchema, AccountDelegationQueryOptionsSchema, CapabilityEntrySchema, DelegationRecordSchema, CreateDelegationParamsSchema, DelegationChainSchema, DelegationChainV2Schema, DelegationDirectionSchema, DelegationFiltersSchema, SpaceOwnershipSchema, SpaceInfoSchema, ShareSchemaSchema, ShareLinkSchema, ShareLinkDataSchema, IngestOptionsSchema, GenerateShareParamsSchema, DelegationManagerConfigSchema, KeyProviderSchema, DelegationApiResponseSchema, DelegatedResourceSchema, CreateDelegationWasmParamsSchema, CreateDelegationWasmResultSchema, EPHEMERAL_MS, SIGNED_READ_URL_MS, SESSION_MS, SHARE_MS, APP_MS, MAX_MS, EXPIRY, DEFAULT_SIGNED_READ_URL_EXPIRY_MS2, EncodedShareDataSchema, ReceiveOptionsSchema, SharingServiceConfigSchema, SERVICE_SHORT_TO_LONG, SERVICE_LONG_TO_SHORT, DEFAULT_MAX_INLINE_BYTES, MAX_SHARE_CONTENT_BYTES, MAX_SEALED_SHARE_CONTENT_BYTES, MAX_SHARE_ARTIFACT_BYTES, PUBLISHED_AAD, ShareRecipientTargetSchema, ShareResourceSchema, ShareActionSchema, ShareRecipientPolicySchema, ShareRecipientClientOptionsSchema, ShareNativeActionSchema, ShareWireActionSchema, ShareContentSourceSchema, ShareAddressedRecipientSchema, ShareAddressedDelegationRequestV2Schema, ShareAddressedDelegationEnvelopeV2Schema, ShareAddressedDelegationResponseV2Schema, ShareNativeResponseEntrySchema, ShareNativeResponseBase, ShareNativeResponseSchema, MAX_NATIVE_CURSOR_BYTES, DEFAULT_EXPIRY_MS2, MAX_CONTENT_BYTES2, ethereumAddressPattern, EnsDataSchema2, PersistedTinyCloudSessionSchema, PersistedSessionDataSchema, TinyCloudSessionSchema, SpaceConfigSchema, SpaceServiceConfigSchema, SpaceDelegationParamsSchema, ServerDelegationInfoSchema, ServerDelegationsResponseSchema, ServerOwnedSpaceSchema, ServerOwnedSpacesResponseSchema, ServerCreateSpaceResponseSchema, ServerSpaceInfoResponseSchema, inFlightActivations, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, N122, N222, N322, N422, N522, N622, N722, MSB22, REST22, string, ascii, BASES, bases_default, InvalidMultiaddrError, ValidationError, InvalidParametersError, UnknownProtocolError, Parser, MAX_IPV6_LENGTH, MAX_IPV4_LENGTH, parser, CODE_IP4, CODE_TCP, CODE_UDP, CODE_DCCP, CODE_IP6, CODE_IP6ZONE, CODE_IPCIDR, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR, CODE_SCTP, CODE_UDT, CODE_UTP, CODE_UNIX, CODE_P2P, CODE_ONION, CODE_ONION3, CODE_GARLIC64, CODE_GARLIC32, CODE_TLS, CODE_SNI, CODE_NOISE, CODE_QUIC, CODE_QUIC_V1, CODE_WEBTRANSPORT, CODE_CERTHASH, CODE_HTTP, CODE_HTTP_PATH, CODE_HTTPS, CODE_WS, CODE_WSS, CODE_P2P_WEBSOCKET_STAR, CODE_P2P_STARDUST, CODE_P2P_WEBRTC_STAR, CODE_P2P_WEBRTC_DIRECT, CODE_WEBRTC_DIRECT, CODE_WEBRTC, CODE_P2P_CIRCUIT, CODE_MEMORY, ip4ToBytes, ip6ToBytes, ip4ToString, ip6ToString, decoders, anybaseDecoder, validatePort, V, Registry, registry, codecs, inspect, symbol, _a2, _components, _string, _bytes, _Multiaddr, Multiaddr, ASSUME_HTTP_CODES, interpreters, word, boundry, v4, v6segment, v6, v46Exact, v4exact, v6exact, ipRegex, toString3, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, LOCAL_LOOPBACK_PROBE_TIMEOUT_MS, LOCAL_LINK_PROBE_TIMEOUT_MS, LOCAL_LINK_HOST_SUFFIX, LocationRecordValidationError, defaultLocalNodeIdentityStore, DNS_LABEL_REGEX;
26139
26160
  var init_dist4 = __esm({
26140
26161
  "../sdk-core/dist/index.js"() {
26141
26162
  "use strict";
@@ -26819,8 +26840,8 @@ var init_dist4 = __esm({
26819
26840
  name = "identity";
26820
26841
  encode42 = coerce4;
26821
26842
  identity2 = { code: code22, name, encode: encode42, digest: digest2 };
26822
- sha2_exports = {};
26823
- __export3(sha2_exports, {
26843
+ sha2_browser_exports = {};
26844
+ __export3(sha2_browser_exports, {
26824
26845
  sha256: () => sha25622,
26825
26846
  sha512: () => sha5122
26826
26847
  });
@@ -26861,15 +26882,15 @@ var init_dist4 = __esm({
26861
26882
  sha25622 = from22({
26862
26883
  name: "sha2-256",
26863
26884
  code: 18,
26864
- encode: (input) => coerce4(crypto22.createHash("sha256").update(input).digest())
26885
+ encode: sha("SHA-256")
26865
26886
  });
26866
26887
  sha5122 = from22({
26867
26888
  name: "sha2-512",
26868
26889
  code: 19,
26869
- encode: (input) => coerce4(crypto22.createHash("sha512").update(input).digest())
26890
+ encode: sha("SHA-512")
26870
26891
  });
26871
26892
  bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
26872
- hashes = { ...sha2_exports, ...identity_exports2 };
26893
+ hashes = { ...sha2_browser_exports, ...identity_exports2 };
26873
26894
  textEncoder3 = new TextEncoder();
26874
26895
  objectHasOwn3 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
26875
26896
  Object.prototype.hasOwnProperty
@@ -27978,6 +27999,192 @@ var init_dist4 = __esm({
27978
27999
  }
27979
28000
  };
27980
28001
  __publicField(UnknownProtocolError, "name", "UnknownProtocolError");
28002
+ Parser = class {
28003
+ constructor() {
28004
+ __publicField(this, "index", 0);
28005
+ __publicField(this, "input", "");
28006
+ }
28007
+ new(input) {
28008
+ this.index = 0;
28009
+ this.input = input;
28010
+ return this;
28011
+ }
28012
+ /** Run a parser, and restore the pre-parse state if it fails. */
28013
+ readAtomically(fn) {
28014
+ const index = this.index;
28015
+ const result = fn();
28016
+ if (result === void 0) {
28017
+ this.index = index;
28018
+ }
28019
+ return result;
28020
+ }
28021
+ /** Run a parser, but fail if the entire input wasn't consumed. Doesn't run atomically. */
28022
+ parseWith(fn) {
28023
+ const result = fn();
28024
+ if (this.index !== this.input.length) {
28025
+ return void 0;
28026
+ }
28027
+ return result;
28028
+ }
28029
+ /** Peek the next character from the input */
28030
+ peekChar() {
28031
+ if (this.index >= this.input.length) {
28032
+ return void 0;
28033
+ }
28034
+ return this.input[this.index];
28035
+ }
28036
+ /** Read the next character from the input */
28037
+ readChar() {
28038
+ if (this.index >= this.input.length) {
28039
+ return void 0;
28040
+ }
28041
+ return this.input[this.index++];
28042
+ }
28043
+ /** Read the next character from the input if it matches the target. */
28044
+ readGivenChar(target) {
28045
+ return this.readAtomically(() => {
28046
+ const char = this.readChar();
28047
+ if (char !== target) {
28048
+ return void 0;
28049
+ }
28050
+ return char;
28051
+ });
28052
+ }
28053
+ /**
28054
+ * Helper for reading separators in an indexed loop. Reads the separator
28055
+ * character iff index > 0, then runs the parser. When used in a loop,
28056
+ * the separator character will only be read on index > 0 (see
28057
+ * readIPv4Addr for an example)
28058
+ */
28059
+ readSeparator(sep2, index, inner) {
28060
+ return this.readAtomically(() => {
28061
+ if (index > 0) {
28062
+ if (this.readGivenChar(sep2) === void 0) {
28063
+ return void 0;
28064
+ }
28065
+ }
28066
+ return inner();
28067
+ });
28068
+ }
28069
+ /**
28070
+ * Read a number off the front of the input in the given radix, stopping
28071
+ * at the first non-digit character or eof. Fails if the number has more
28072
+ * digits than max_digits or if there is no number.
28073
+ */
28074
+ readNumber(radix, maxDigits, allowZeroPrefix, maxBytes) {
28075
+ return this.readAtomically(() => {
28076
+ let result = 0;
28077
+ let digitCount = 0;
28078
+ const leadingChar = this.peekChar();
28079
+ if (leadingChar === void 0) {
28080
+ return void 0;
28081
+ }
28082
+ const hasLeadingZero = leadingChar === "0";
28083
+ const maxValue2 = 2 ** (8 * maxBytes) - 1;
28084
+ while (true) {
28085
+ const digit = this.readAtomically(() => {
28086
+ const char = this.readChar();
28087
+ if (char === void 0) {
28088
+ return void 0;
28089
+ }
28090
+ const num2 = Number.parseInt(char, radix);
28091
+ if (Number.isNaN(num2)) {
28092
+ return void 0;
28093
+ }
28094
+ return num2;
28095
+ });
28096
+ if (digit === void 0) {
28097
+ break;
28098
+ }
28099
+ result *= radix;
28100
+ result += digit;
28101
+ if (result > maxValue2) {
28102
+ return void 0;
28103
+ }
28104
+ digitCount += 1;
28105
+ if (maxDigits !== void 0) {
28106
+ if (digitCount > maxDigits) {
28107
+ return void 0;
28108
+ }
28109
+ }
28110
+ }
28111
+ if (digitCount === 0) {
28112
+ return void 0;
28113
+ } else if (!allowZeroPrefix && hasLeadingZero && digitCount > 1) {
28114
+ return void 0;
28115
+ } else {
28116
+ return result;
28117
+ }
28118
+ });
28119
+ }
28120
+ /** Read an IPv4 address. */
28121
+ readIPv4Addr() {
28122
+ return this.readAtomically(() => {
28123
+ const out = new Uint8Array(4);
28124
+ for (let i = 0; i < out.length; i++) {
28125
+ const ix = this.readSeparator(".", i, () => this.readNumber(10, 3, false, 1));
28126
+ if (ix === void 0) {
28127
+ return void 0;
28128
+ }
28129
+ out[i] = ix;
28130
+ }
28131
+ return out;
28132
+ });
28133
+ }
28134
+ /** Read an IPv6 Address. */
28135
+ readIPv6Addr() {
28136
+ const readGroups = (groups) => {
28137
+ for (let i = 0; i < groups.length / 2; i++) {
28138
+ const ix = i * 2;
28139
+ if (i < groups.length - 3) {
28140
+ const ipv4 = this.readSeparator(":", i, () => this.readIPv4Addr());
28141
+ if (ipv4 !== void 0) {
28142
+ groups[ix] = ipv4[0];
28143
+ groups[ix + 1] = ipv4[1];
28144
+ groups[ix + 2] = ipv4[2];
28145
+ groups[ix + 3] = ipv4[3];
28146
+ return [ix + 4, true];
28147
+ }
28148
+ }
28149
+ const group = this.readSeparator(":", i, () => this.readNumber(16, 4, true, 2));
28150
+ if (group === void 0) {
28151
+ return [ix, false];
28152
+ }
28153
+ groups[ix] = group >> 8;
28154
+ groups[ix + 1] = group & 255;
28155
+ }
28156
+ return [groups.length, false];
28157
+ };
28158
+ return this.readAtomically(() => {
28159
+ const head = new Uint8Array(16);
28160
+ const [headSize, headIp4] = readGroups(head);
28161
+ if (headSize === 16) {
28162
+ return head;
28163
+ }
28164
+ if (headIp4) {
28165
+ return void 0;
28166
+ }
28167
+ if (this.readGivenChar(":") === void 0) {
28168
+ return void 0;
28169
+ }
28170
+ if (this.readGivenChar(":") === void 0) {
28171
+ return void 0;
28172
+ }
28173
+ const tail = new Uint8Array(14);
28174
+ const limit = 16 - (headSize + 2);
28175
+ const [tailSize] = readGroups(tail.subarray(0, limit));
28176
+ head.set(tail.subarray(0, tailSize), 16 - tailSize);
28177
+ return head;
28178
+ });
28179
+ }
28180
+ /** Read an IP Address, either IPv4 or IPv6. */
28181
+ readIPAddr() {
28182
+ return this.readIPv4Addr() ?? this.readIPv6Addr();
28183
+ }
28184
+ };
28185
+ MAX_IPV6_LENGTH = 45;
28186
+ MAX_IPV4_LENGTH = 15;
28187
+ parser = new Parser();
27981
28188
  CODE_IP4 = 4;
27982
28189
  CODE_TCP = 6;
27983
28190
  CODE_UDP = 273;