@calimero-network/mero-js 13.4.0 → 14.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/account/index.d.ts +15 -15
- package/dist/account/index.js +15 -15
- package/dist/admin-api/admin-client.d.ts +10 -5
- package/dist/admin-api/admin-client.js +10 -5
- package/dist/admin-api/admin-types.d.ts +8 -7
- package/dist/events/group.d.ts +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +11 -48
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +11 -48
- package/dist/index.mjs.map +2 -2
- package/dist/warrant/warrant.d.ts +5 -6
- package/dist/warrant/warrant.js +1 -54
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1299,14 +1299,16 @@ var AdminApiClient = class {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
/**
|
|
1301
1301
|
* `identity` is the member's ACCOUNT (64 hex), as returned by
|
|
1302
|
-
* {@link listGroupMembers} — not the
|
|
1302
|
+
* {@link listGroupMembers} — not the signing key that added them. Both are
|
|
1303
|
+
* 64 hex, so nothing but the source tells them apart.
|
|
1303
1304
|
*/
|
|
1304
1305
|
async updateMemberRole(groupId, identity, request) {
|
|
1305
1306
|
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/role`, request);
|
|
1306
1307
|
}
|
|
1307
1308
|
/**
|
|
1308
1309
|
* `identity` is the member's ACCOUNT (64 hex), as returned by
|
|
1309
|
-
* {@link listGroupMembers} — not the
|
|
1310
|
+
* {@link listGroupMembers} — not the signing key that added them. Both are
|
|
1311
|
+
* 64 hex, so nothing but the source tells them apart.
|
|
1310
1312
|
*/
|
|
1311
1313
|
async getMemberCapabilities(groupId, identity) {
|
|
1312
1314
|
return unwrap(
|
|
@@ -1317,7 +1319,8 @@ var AdminApiClient = class {
|
|
|
1317
1319
|
}
|
|
1318
1320
|
/**
|
|
1319
1321
|
* `identity` is the member's ACCOUNT (64 hex), as returned by
|
|
1320
|
-
* {@link listGroupMembers} — not the
|
|
1322
|
+
* {@link listGroupMembers} — not the signing key that added them. Both are
|
|
1323
|
+
* 64 hex, so nothing but the source tells them apart.
|
|
1321
1324
|
*/
|
|
1322
1325
|
async setMemberCapabilities(groupId, identity, request) {
|
|
1323
1326
|
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/capabilities`, request);
|
|
@@ -1350,7 +1353,8 @@ var AdminApiClient = class {
|
|
|
1350
1353
|
}
|
|
1351
1354
|
/**
|
|
1352
1355
|
* `identity` is the member's ACCOUNT (64 hex), as returned by
|
|
1353
|
-
* {@link listGroupMembers} — not the
|
|
1356
|
+
* {@link listGroupMembers} — not the signing key that added them. Both are
|
|
1357
|
+
* 64 hex, so nothing but the source tells them apart.
|
|
1354
1358
|
*/
|
|
1355
1359
|
async getMemberMetadata(groupId, identity) {
|
|
1356
1360
|
const response = await this.httpClient.get(
|
|
@@ -1504,7 +1508,8 @@ var AdminApiClient = class {
|
|
|
1504
1508
|
* /admin-api/groups/:group_id/members/:identity/auto-follow).
|
|
1505
1509
|
*
|
|
1506
1510
|
* `identity` is the member's ACCOUNT (64 hex), as returned by
|
|
1507
|
-
* {@link listGroupMembers} — not the
|
|
1511
|
+
* {@link listGroupMembers} — not the signing key that added them. Both are
|
|
1512
|
+
* 64 hex, so nothing but the source tells them apart.
|
|
1508
1513
|
*/
|
|
1509
1514
|
async setMemberAutoFollow(groupId, identity, request) {
|
|
1510
1515
|
await this.httpClient.put(`/admin-api/groups/${groupId}/members/${identity}/auto-follow`, request);
|
|
@@ -2698,7 +2703,6 @@ var PKCS8_ED25519_PREFIX = new Uint8Array([
|
|
|
2698
2703
|
4,
|
|
2699
2704
|
32
|
|
2700
2705
|
]);
|
|
2701
|
-
var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2702
2706
|
function hex(bytes) {
|
|
2703
2707
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
2704
2708
|
}
|
|
@@ -2715,47 +2719,6 @@ function fromHex2(value, label, expectedBytes) {
|
|
|
2715
2719
|
}
|
|
2716
2720
|
return bytes;
|
|
2717
2721
|
}
|
|
2718
|
-
function fromBase58(value, label) {
|
|
2719
|
-
const clean = value.trim();
|
|
2720
|
-
let n = 0n;
|
|
2721
|
-
for (const char of clean) {
|
|
2722
|
-
const digit = B58.indexOf(char);
|
|
2723
|
-
if (digit < 0) {
|
|
2724
|
-
throw new Error(`${label} is not base58: unexpected character '${char}'`);
|
|
2725
|
-
}
|
|
2726
|
-
n = n * 58n + BigInt(digit);
|
|
2727
|
-
}
|
|
2728
|
-
const out = new Uint8Array(32);
|
|
2729
|
-
for (let i = 31; i >= 0; i -= 1) {
|
|
2730
|
-
out[i] = Number(n & 0xffn);
|
|
2731
|
-
n >>= 8n;
|
|
2732
|
-
}
|
|
2733
|
-
if (n !== 0n) {
|
|
2734
|
-
throw new Error(`${label} decodes to more than 32 bytes`);
|
|
2735
|
-
}
|
|
2736
|
-
if (toBase58(out) !== clean) {
|
|
2737
|
-
throw new Error(
|
|
2738
|
-
`${label} is not a canonical base58 32-byte id. If you have it in hex, note that ${label} is base58 here while accounts are hex`
|
|
2739
|
-
);
|
|
2740
|
-
}
|
|
2741
|
-
return out;
|
|
2742
|
-
}
|
|
2743
|
-
function toBase58(bytes) {
|
|
2744
|
-
let n = 0n;
|
|
2745
|
-
for (const byte of bytes) {
|
|
2746
|
-
n = n << 8n | BigInt(byte);
|
|
2747
|
-
}
|
|
2748
|
-
let out = "";
|
|
2749
|
-
while (n > 0n) {
|
|
2750
|
-
out = B58[Number(n % 58n)] + out;
|
|
2751
|
-
n /= 58n;
|
|
2752
|
-
}
|
|
2753
|
-
let leadingZeros = 0;
|
|
2754
|
-
while (leadingZeros < bytes.length && bytes[leadingZeros] === 0) {
|
|
2755
|
-
leadingZeros += 1;
|
|
2756
|
-
}
|
|
2757
|
-
return "1".repeat(leadingZeros) + out;
|
|
2758
|
-
}
|
|
2759
2722
|
function u64le(value) {
|
|
2760
2723
|
const out = new Uint8Array(8);
|
|
2761
2724
|
new DataView(out.buffer).setBigUint64(0, BigInt(value), true);
|
|
@@ -2802,7 +2765,7 @@ async function importSigningKey(secretHex) {
|
|
|
2802
2765
|
}
|
|
2803
2766
|
}
|
|
2804
2767
|
async function signWarrant(input) {
|
|
2805
|
-
const context =
|
|
2768
|
+
const context = fromHex2(input.context, "context", 32);
|
|
2806
2769
|
const authorAccount = fromHex2(input.authorAccount, "authorAccount", 32);
|
|
2807
2770
|
const executor = fromHex2(input.executor, "executor", 32);
|
|
2808
2771
|
const key = await importSigningKey(input.deviceSecret);
|