@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.
- package/dist/bootstrap/index.cjs +0 -4
- package/dist/{capability-BjzXwtNw.d.cts → capability-BA49Uboq.d.cts} +1 -1
- package/dist/{capability-BjzXwtNw.d.ts → capability-BA49Uboq.d.ts} +1 -1
- package/dist/delegations/index.cjs +11 -120
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.js +15 -39
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +250 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +247 -48
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +10 -74
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.d.cts +4 -4
- package/dist/policy/index.d.ts +4 -4
- package/dist/policy/index.js +10 -8
- package/dist/policy/index.js.map +1 -1
- package/dist/requester/index.cjs +10 -38
- package/dist/requester/index.cjs.map +1 -1
- package/dist/requester/index.d.cts +1 -1
- package/dist/requester/index.d.ts +1 -1
- package/dist/requester/index.js +10 -8
- package/dist/requester/index.js.map +1 -1
- package/dist/{signed-object-C6mWbTbB.d.ts → signed-object-B3dMzh8O.d.ts} +1 -1
- package/dist/{signed-object-IMAm5a32.d.cts → signed-object-DwPZl6kV.d.cts} +1 -1
- package/package.json +4 -3
|
@@ -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
|
|
2158
|
-
__export(
|
|
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: (
|
|
2218
|
+
encode: sha("SHA-256")
|
|
2217
2219
|
});
|
|
2218
2220
|
var sha512 = from2({
|
|
2219
2221
|
name: "sha2-512",
|
|
2220
2222
|
code: 19,
|
|
2221
|
-
encode: (
|
|
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 = { ...
|
|
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
|
|
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
|
|
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/
|
|
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,
|
|
5991
|
+
return CID.createV1(code, create(sha256.code, sha2566(bytesValue))).toString(base32.encoder);
|
|
6016
5992
|
}
|
|
6017
5993
|
function digest3(bytesValue) {
|
|
6018
|
-
return b64(
|
|
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");
|