@tinycloud/sdk-core 2.11.0-beta.7 → 2.11.0-beta.8
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.
|
@@ -5748,15 +5748,11 @@ function verifySignedChild(result, expected, computeCid) {
|
|
|
5748
5748
|
|
|
5749
5749
|
// src/delegations/owner-policy.ts
|
|
5750
5750
|
import { ed25519 as ed255195 } from "@noble/curves/ed25519";
|
|
5751
|
-
import { sha256 as
|
|
5751
|
+
import { sha256 as sha2566 } from "@noble/hashes/sha256";
|
|
5752
5752
|
|
|
5753
5753
|
// src/policy/signed-object.ts
|
|
5754
5754
|
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";
|
|
5755
|
+
import { bytesToHex, sha256 as sha2565, verifyMessage } from "viem";
|
|
5760
5756
|
|
|
5761
5757
|
// src/policy/errors.ts
|
|
5762
5758
|
var SignedObjectProfileError = class extends Error {
|
|
@@ -5954,33 +5950,11 @@ function assertUnicodeScalarString(value, path) {
|
|
|
5954
5950
|
}
|
|
5955
5951
|
}
|
|
5956
5952
|
|
|
5957
|
-
// src/policy/
|
|
5953
|
+
// src/policy/signed-object.ts
|
|
5958
5954
|
var textEncoder2 = new TextEncoder();
|
|
5959
5955
|
var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
5960
5956
|
Object.prototype.hasOwnProperty
|
|
5961
5957
|
);
|
|
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
5958
|
function canonicalizeSignedObjectUnsigned(input) {
|
|
5985
5959
|
return jcsCanonicalize(input);
|
|
5986
5960
|
}
|
|
@@ -6012,10 +5986,10 @@ function fromB64(value) {
|
|
|
6012
5986
|
throw new Error("base64url decoding is unavailable");
|
|
6013
5987
|
}
|
|
6014
5988
|
function cid(bytesValue) {
|
|
6015
|
-
return CID.createV1(code, create(sha256.code,
|
|
5989
|
+
return CID.createV1(code, create(sha256.code, sha2566(bytesValue))).toString(base32.encoder);
|
|
6016
5990
|
}
|
|
6017
5991
|
function digest3(bytesValue) {
|
|
6018
|
-
return b64(
|
|
5992
|
+
return b64(sha2566(bytesValue));
|
|
6019
5993
|
}
|
|
6020
5994
|
function didKeyFromEd25519PublicKey(publicKey) {
|
|
6021
5995
|
if (publicKey.length !== 32) throw new Error("share key public key must be 32 bytes");
|