@tinycloud/sdk-core 2.11.0-beta.7 → 2.11.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.
@@ -2153,13 +2153,12 @@ function digest(input, options) {
2153
2153
  }
2154
2154
  var identity2 = { code: code2, name, encode: encode4, digest };
2155
2155
 
2156
- // ../../node_modules/multiformats/dist/src/hashes/sha2.js
2157
- var sha2_exports = {};
2158
- __export(sha2_exports, {
2156
+ // ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
2157
+ var sha2_browser_exports = {};
2158
+ __export(sha2_browser_exports, {
2159
2159
  sha256: () => sha256,
2160
2160
  sha512: () => sha512
2161
2161
  });
2162
- import crypto2 from "crypto";
2163
2162
 
2164
2163
  // ../../node_modules/multiformats/dist/src/hashes/hasher.js
2165
2164
  var DEFAULT_MIN_DIGEST_LENGTH = 20;
@@ -2209,16 +2208,19 @@ function createDigest(digest4, code3, truncate) {
2209
2208
  return create(code3, digest4);
2210
2209
  }
2211
2210
 
2212
- // ../../node_modules/multiformats/dist/src/hashes/sha2.js
2211
+ // ../../node_modules/multiformats/dist/src/hashes/sha2-browser.js
2212
+ function sha(name2) {
2213
+ return async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
2214
+ }
2213
2215
  var sha256 = from2({
2214
2216
  name: "sha2-256",
2215
2217
  code: 18,
2216
- encode: (input) => coerce(crypto2.createHash("sha256").update(input).digest())
2218
+ encode: sha("SHA-256")
2217
2219
  });
2218
2220
  var sha512 = from2({
2219
2221
  name: "sha2-512",
2220
2222
  code: 19,
2221
- encode: (input) => coerce(crypto2.createHash("sha512").update(input).digest())
2223
+ encode: sha("SHA-512")
2222
2224
  });
2223
2225
 
2224
2226
  // ../../node_modules/multiformats/dist/src/cid.js
@@ -2560,7 +2562,7 @@ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
2560
2562
 
2561
2563
  // ../../node_modules/multiformats/dist/src/basics.js
2562
2564
  var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
2563
- var hashes = { ...sha2_exports, ...identity_exports2 };
2565
+ var hashes = { ...sha2_browser_exports, ...identity_exports2 };
2564
2566
 
2565
2567
  // src/delegations/SharingService.ts
2566
2568
  import { ed25519 as ed255193 } from "@noble/curves/ed25519";
@@ -5748,15 +5750,11 @@ function verifySignedChild(result, expected, computeCid) {
5748
5750
 
5749
5751
  // src/delegations/owner-policy.ts
5750
5752
  import { ed25519 as ed255195 } from "@noble/curves/ed25519";
5751
- import { sha256 as sha2567 } from "@noble/hashes/sha256";
5753
+ import { sha256 as sha2566 } from "@noble/hashes/sha256";
5752
5754
 
5753
5755
  // src/policy/signed-object.ts
5754
5756
  import { ed25519 as ed255194 } from "@noble/curves/ed25519";
5755
- import { bytesToHex as bytesToHex2, sha256 as sha2566, verifyMessage } from "viem";
5756
-
5757
- // src/policy/capability.ts
5758
- import { CAPABILITY_REGISTRY } from "@tinycloud/bootstrap";
5759
- import { bytesToHex, sha256 as sha2565 } from "viem";
5757
+ import { bytesToHex, sha256 as sha2565, verifyMessage } from "viem";
5760
5758
 
5761
5759
  // src/policy/errors.ts
5762
5760
  var SignedObjectProfileError = class extends Error {
@@ -5954,33 +5952,11 @@ function assertUnicodeScalarString(value, path) {
5954
5952
  }
5955
5953
  }
5956
5954
 
5957
- // src/policy/capability.ts
5955
+ // src/policy/signed-object.ts
5958
5956
  var textEncoder2 = new TextEncoder();
5959
5957
  var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
5960
5958
  Object.prototype.hasOwnProperty
5961
5959
  );
5962
- var CEILING_SERVICES = /* @__PURE__ */ new Set(["tinycloud.kv", "tinycloud.sql", "tinycloud.vfs"]);
5963
- var GRANTABLE_ACTIONS = /* @__PURE__ */ new Map();
5964
- for (const entry of CAPABILITY_REGISTRY) {
5965
- if (!CEILING_SERVICES.has(entry.service)) {
5966
- continue;
5967
- }
5968
- if (entry.aliasOf !== void 0 || entry.implies !== void 0 || entry.urn.endsWith("/*")) {
5969
- continue;
5970
- }
5971
- const existing = GRANTABLE_ACTIONS.get(entry.service);
5972
- if (existing === void 0) {
5973
- GRANTABLE_ACTIONS.set(entry.service, /* @__PURE__ */ new Set([entry.urn]));
5974
- continue;
5975
- }
5976
- existing.add(entry.urn);
5977
- }
5978
-
5979
- // src/policy/signed-object.ts
5980
- var textEncoder3 = new TextEncoder();
5981
- var objectHasOwn3 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
5982
- Object.prototype.hasOwnProperty
5983
- );
5984
5960
  function canonicalizeSignedObjectUnsigned(input) {
5985
5961
  return jcsCanonicalize(input);
5986
5962
  }
@@ -6012,10 +5988,10 @@ function fromB64(value) {
6012
5988
  throw new Error("base64url decoding is unavailable");
6013
5989
  }
6014
5990
  function cid(bytesValue) {
6015
- return CID.createV1(code, create(sha256.code, sha2567(bytesValue))).toString(base32.encoder);
5991
+ return CID.createV1(code, create(sha256.code, sha2566(bytesValue))).toString(base32.encoder);
6016
5992
  }
6017
5993
  function digest3(bytesValue) {
6018
- return b64(sha2567(bytesValue));
5994
+ return b64(sha2566(bytesValue));
6019
5995
  }
6020
5996
  function didKeyFromEd25519PublicKey(publicKey) {
6021
5997
  if (publicKey.length !== 32) throw new Error("share key public key must be 32 bytes");