@calimero-network/mero-js 23.0.0 → 23.1.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 +3 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +100 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +100 -1
- package/dist/index.mjs.map +2 -2
- package/dist/warrant/governance-op.d.ts +36 -0
- package/dist/warrant/governance-op.js +115 -0
- package/dist/warrant/index.d.ts +1 -1
- package/dist/warrant/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -81,6 +81,10 @@ __export(index_exports, {
|
|
|
81
81
|
completeDeviceEnrolment: () => completeDeviceEnrolment,
|
|
82
82
|
connectCloud: () => connectCloud,
|
|
83
83
|
connectCloudWithAccount: () => connectCloudWithAccount,
|
|
84
|
+
contextCapabilityGrantedOp: () => contextCapabilityGrantedOp,
|
|
85
|
+
contextCapabilityRevokedOp: () => contextCapabilityRevokedOp,
|
|
86
|
+
contextDetachedOp: () => contextDetachedOp,
|
|
87
|
+
contextMetadataSetOp: () => contextMetadataSetOp,
|
|
84
88
|
createAccountRootSigner: () => createAccountRootSigner,
|
|
85
89
|
createAdminApiClient: () => createAdminApiClient,
|
|
86
90
|
createAdminApiClientFromHttpClient: () => createAdminApiClientFromHttpClient,
|
|
@@ -130,6 +134,7 @@ __export(index_exports, {
|
|
|
130
134
|
groupDeleteOp: () => groupDeleteOp,
|
|
131
135
|
groupDeletedOp: () => groupDeletedOp,
|
|
132
136
|
groupInvitationHash: () => groupInvitationHash,
|
|
137
|
+
groupMetadataSetOp: () => groupMetadataSetOp,
|
|
133
138
|
groupReparentedOp: () => groupReparentedOp,
|
|
134
139
|
hasCap: () => hasCap,
|
|
135
140
|
hexEncodeUtf8: () => hexEncodeUtf8,
|
|
@@ -139,7 +144,10 @@ __export(index_exports, {
|
|
|
139
144
|
localNodeUrl: () => localNodeUrl,
|
|
140
145
|
login: () => login,
|
|
141
146
|
memberAddedOp: () => memberAddedOp,
|
|
147
|
+
memberCapabilitySetOp: () => memberCapabilitySetOp,
|
|
148
|
+
memberJoinedOpenOp: () => memberJoinedOpenOp,
|
|
142
149
|
memberLeftOp: () => memberLeftOp,
|
|
150
|
+
memberMetadataSetOp: () => memberMetadataSetOp,
|
|
143
151
|
memberRemovedOp: () => memberRemovedOp,
|
|
144
152
|
memberRoleSetOp: () => memberRoleSetOp,
|
|
145
153
|
mintDeviceId: () => mintDeviceId,
|
|
@@ -182,6 +190,7 @@ __export(index_exports, {
|
|
|
182
190
|
signerFromCryptoKey: () => signerFromCryptoKey,
|
|
183
191
|
signerFromSecret: () => signerFromSecret,
|
|
184
192
|
subgroupCreation: () => subgroupCreation,
|
|
193
|
+
subgroupVisibilitySetOp: () => subgroupVisibilitySetOp,
|
|
185
194
|
teeAdmissionPolicyOp: () => teeAdmissionPolicyOp,
|
|
186
195
|
teeAuthoringPolicyOp: () => teeAuthoringPolicyOp,
|
|
187
196
|
teeReleaseAdmissionPolicyOp: () => teeReleaseAdmissionPolicyOp,
|
|
@@ -7589,12 +7598,21 @@ var GROUP_OP = {
|
|
|
7589
7598
|
MemberRemoved: 2,
|
|
7590
7599
|
MemberLeft: 3,
|
|
7591
7600
|
MemberRoleSet: 4,
|
|
7592
|
-
|
|
7601
|
+
MemberCapabilitySet: 5,
|
|
7602
|
+
DefaultCapabilitiesSet: 6,
|
|
7603
|
+
ContextDetached: 9,
|
|
7604
|
+
SubgroupVisibilitySet: 10,
|
|
7605
|
+
GroupMetadataSet: 11,
|
|
7606
|
+
MemberMetadataSet: 12,
|
|
7607
|
+
ContextMetadataSet: 13,
|
|
7608
|
+
ContextCapabilityGranted: 16,
|
|
7609
|
+
ContextCapabilityRevoked: 17
|
|
7593
7610
|
};
|
|
7594
7611
|
var ROOT_OP = {
|
|
7595
7612
|
GroupCreated: 0,
|
|
7596
7613
|
GroupReparented: 1,
|
|
7597
7614
|
GroupDeleted: 2,
|
|
7615
|
+
MemberJoinedOpen: 7,
|
|
7598
7616
|
NamespaceCreatedV2: 9
|
|
7599
7617
|
};
|
|
7600
7618
|
var NAMESPACE_ID_DOMAIN = new TextEncoder().encode("calimero.namespace.id.v1");
|
|
@@ -7726,6 +7744,87 @@ function namespaceCreatedOp(input) {
|
|
|
7726
7744
|
)
|
|
7727
7745
|
};
|
|
7728
7746
|
}
|
|
7747
|
+
function str(value) {
|
|
7748
|
+
const bytes = new TextEncoder().encode(value);
|
|
7749
|
+
return concat(u32le(bytes.length), bytes);
|
|
7750
|
+
}
|
|
7751
|
+
function optionalStr(value) {
|
|
7752
|
+
return value === void 0 ? tag(0) : concat(tag(1), str(value));
|
|
7753
|
+
}
|
|
7754
|
+
function stringMap(data = {}) {
|
|
7755
|
+
const enc = new TextEncoder();
|
|
7756
|
+
const entries = Object.entries(data).map(([k, v]) => [enc.encode(k), v, k]).sort(([a], [b]) => {
|
|
7757
|
+
for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
|
|
7758
|
+
return a.length - b.length;
|
|
7759
|
+
});
|
|
7760
|
+
return concat(u32le(entries.length), ...entries.flatMap(([, v, k]) => [str(k), str(v)]));
|
|
7761
|
+
}
|
|
7762
|
+
function relayableMask(capabilities, what) {
|
|
7763
|
+
if (!Number.isInteger(capabilities) || capabilities < 0 || capabilities > 4294967295) {
|
|
7764
|
+
throw new Error(`${what} must be a u32 bit mask, got ${String(capabilities)}`);
|
|
7765
|
+
}
|
|
7766
|
+
if (hasCap(capabilities, CAPABILITIES.CAN_AUTHOR_ON_BEHALF)) {
|
|
7767
|
+
throw new Error(`${what} may not include CAN_AUTHOR_ON_BEHALF (512): a relay never carries a change to it`);
|
|
7768
|
+
}
|
|
7769
|
+
return capabilities;
|
|
7770
|
+
}
|
|
7771
|
+
function memberCapabilitySetOp(member, capabilities) {
|
|
7772
|
+
return {
|
|
7773
|
+
kind: "group",
|
|
7774
|
+
bytes: concat(tag(GROUP_OP.MemberCapabilitySet), fromHex(member, "member", 32), u32le(relayableMask(capabilities, "capabilities")))
|
|
7775
|
+
};
|
|
7776
|
+
}
|
|
7777
|
+
function contextDetachedOp(contextId) {
|
|
7778
|
+
return { kind: "group", bytes: concat(tag(GROUP_OP.ContextDetached), fromHex(contextId, "contextId", 32)) };
|
|
7779
|
+
}
|
|
7780
|
+
function subgroupVisibilitySetOp(mode) {
|
|
7781
|
+
if (mode !== "open" && mode !== "restricted") throw new Error(`mode must be open or restricted, got ${String(mode)}`);
|
|
7782
|
+
return { kind: "group", bytes: concat(tag(GROUP_OP.SubgroupVisibilitySet), tag(mode === "open" ? 0 : 1)) };
|
|
7783
|
+
}
|
|
7784
|
+
function groupMetadataSetOp(input = {}) {
|
|
7785
|
+
return { kind: "group", bytes: concat(tag(GROUP_OP.GroupMetadataSet), optionalStr(input.name), stringMap(input.data)) };
|
|
7786
|
+
}
|
|
7787
|
+
function memberMetadataSetOp(member, input = {}) {
|
|
7788
|
+
return {
|
|
7789
|
+
kind: "group",
|
|
7790
|
+
bytes: concat(tag(GROUP_OP.MemberMetadataSet), fromHex(member, "member", 32), optionalStr(input.name), stringMap(input.data))
|
|
7791
|
+
};
|
|
7792
|
+
}
|
|
7793
|
+
function contextMetadataSetOp(contextId, input = {}) {
|
|
7794
|
+
return {
|
|
7795
|
+
kind: "group",
|
|
7796
|
+
bytes: concat(tag(GROUP_OP.ContextMetadataSet), fromHex(contextId, "contextId", 32), optionalStr(input.name), stringMap(input.data))
|
|
7797
|
+
};
|
|
7798
|
+
}
|
|
7799
|
+
function contextCapability(capability) {
|
|
7800
|
+
if (!Number.isInteger(capability) || capability < 1 || capability > 255) {
|
|
7801
|
+
throw new Error(`capability must be a non-zero u8, got ${String(capability)}`);
|
|
7802
|
+
}
|
|
7803
|
+
return tag(capability);
|
|
7804
|
+
}
|
|
7805
|
+
function contextCapabilityGrantedOp(contextId, member, capability) {
|
|
7806
|
+
return {
|
|
7807
|
+
kind: "group",
|
|
7808
|
+
bytes: concat(tag(GROUP_OP.ContextCapabilityGranted), fromHex(contextId, "contextId", 32), fromHex(member, "member", 32), contextCapability(capability))
|
|
7809
|
+
};
|
|
7810
|
+
}
|
|
7811
|
+
function contextCapabilityRevokedOp(contextId, member, capability) {
|
|
7812
|
+
return {
|
|
7813
|
+
kind: "group",
|
|
7814
|
+
bytes: concat(tag(GROUP_OP.ContextCapabilityRevoked), fromHex(contextId, "contextId", 32), fromHex(member, "member", 32), contextCapability(capability))
|
|
7815
|
+
};
|
|
7816
|
+
}
|
|
7817
|
+
function memberJoinedOpenOp(input) {
|
|
7818
|
+
return {
|
|
7819
|
+
kind: "root",
|
|
7820
|
+
bytes: concat(
|
|
7821
|
+
tag(ROOT_OP.MemberJoinedOpen),
|
|
7822
|
+
fromHex(input.member, "member", 32),
|
|
7823
|
+
fromHex(input.groupId, "groupId", 32),
|
|
7824
|
+
fromHexUnsized(input.credential, "credential")
|
|
7825
|
+
)
|
|
7826
|
+
};
|
|
7827
|
+
}
|
|
7729
7828
|
|
|
7730
7829
|
// src/relay/relay-client.ts
|
|
7731
7830
|
var DEFAULT_TTL_SECONDS = 300;
|