@calimero-network/mero-js 16.0.0 → 17.0.0
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/admin-api/admin-types.d.ts +30 -16
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +2 -2
- package/dist/namespace-op/namespace-op.d.ts +1 -1
- package/dist/namespace-op/namespace-op.js +25 -13
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2767,7 +2767,7 @@ async function accountForRoot(rootSecret) {
|
|
|
2767
2767
|
}
|
|
2768
2768
|
|
|
2769
2769
|
// src/namespace-op/namespace-op.ts
|
|
2770
|
-
var SIGNED_NAMESPACE_OP_SCHEMA_VERSION =
|
|
2770
|
+
var SIGNED_NAMESPACE_OP_SCHEMA_VERSION = 8;
|
|
2771
2771
|
var NAMESPACE_SIGN_DOMAIN = new TextEncoder().encode("calimero.namespace.v1");
|
|
2772
2772
|
var NAMESPACE_OP_ROOT = 0;
|
|
2773
2773
|
var ROOT_OP = {
|
|
@@ -2802,16 +2802,10 @@ function borshString(value) {
|
|
|
2802
2802
|
const bytes = new TextEncoder().encode(value);
|
|
2803
2803
|
return concat(u32le(bytes.length), bytes);
|
|
2804
2804
|
}
|
|
2805
|
-
function encodeAdmitterHint(hint) {
|
|
2806
|
-
if ("multiaddr" in hint) {
|
|
2807
|
-
return concat(new Uint8Array([0]), borshString(hint.multiaddr));
|
|
2808
|
-
}
|
|
2809
|
-
return concat(new Uint8Array([1]), borshString(hint.url));
|
|
2810
|
-
}
|
|
2811
2805
|
function encodeSignedInvitation(signed) {
|
|
2812
2806
|
const body = signed.invitation;
|
|
2813
2807
|
const admitters = body.admitters ?? [];
|
|
2814
|
-
const
|
|
2808
|
+
const admitterAddrs = signed.admitter_addrs ?? [];
|
|
2815
2809
|
return concat(
|
|
2816
2810
|
// GroupInvitationFromAdmin.
|
|
2817
2811
|
//
|
|
@@ -2826,12 +2820,17 @@ function encodeSignedInvitation(signed) {
|
|
|
2826
2820
|
u32le(admitters.length),
|
|
2827
2821
|
...admitters.map((a, i) => fromHex(a, `admitters[${i}]`, 32)),
|
|
2828
2822
|
// ...then the enclosing SignedGroupOpenInvitation, in declaration order.
|
|
2829
|
-
// `inviter_account` sits between the signature and the
|
|
2823
|
+
// `inviter_account` sits between the signature and the addresses; putting it
|
|
2830
2824
|
// anywhere else still encodes 32 bytes and still verifies as nothing.
|
|
2831
2825
|
borshString(signed.inviter_signature),
|
|
2832
2826
|
signed.inviter_account ? concat(new Uint8Array([1]), fromHex(signed.inviter_account, "inviter_account", 32)) : new Uint8Array([0]),
|
|
2833
|
-
|
|
2834
|
-
|
|
2827
|
+
// A `Vec<String>`, so each entry is a bare borsh string. This carried an
|
|
2828
|
+
// enum until core dropped the URL variant, and an enum writes a
|
|
2829
|
+
// discriminant byte ahead of each entry — encoding one here now would shift
|
|
2830
|
+
// every following byte and fail as `invalid invitation signature`, pointing
|
|
2831
|
+
// nowhere near this line.
|
|
2832
|
+
u32le(admitterAddrs.length),
|
|
2833
|
+
...admitterAddrs.map(borshString),
|
|
2835
2834
|
optionalBytes32(signed.application_id, "application_id"),
|
|
2836
2835
|
// Borsh order follows core's field order, where this is `bytecode_id`; the
|
|
2837
2836
|
// JSON key is `app_key`, a rename covering both directions that core pins in
|
|
@@ -2872,7 +2871,8 @@ async function signMemberJoinOp(input) {
|
|
|
2872
2871
|
const signature = new Uint8Array(
|
|
2873
2872
|
await crypto.subtle.sign("Ed25519", key, concat(NAMESPACE_SIGN_DOMAIN, signable))
|
|
2874
2873
|
);
|
|
2875
|
-
|
|
2874
|
+
const unendorsed = new Uint8Array([0]);
|
|
2875
|
+
return hex(concat(signable, signature, unendorsed));
|
|
2876
2876
|
}
|
|
2877
2877
|
|
|
2878
2878
|
// src/capabilities.ts
|