Capabilities
A group member’s capabilities are stored as a single unsigned 32-bit bitmask.
The SDK exports the bit constants that core assigns, plus small helpers for
reading and editing a mask. These are used with the group capability methods on
sdk.admin
(getMemberCapabilities, setMemberCapabilities, getDefaultCapabilities,
setDefaultCapabilities). The
groups & governance guide shows them in a full
flow.
CAPABILITIES
Section titled “CAPABILITIES”The assigned bits (core MemberCapabilities, bits 0–8):
const CAPABILITIES = { CAN_CREATE_CONTEXT: 1 << 0, CAN_INVITE_MEMBERS: 1 << 1, CAN_JOIN_OPEN_SUBGROUPS: 1 << 2, MANAGE_MEMBERS: 1 << 3, MANAGE_APPLICATION: 1 << 4, CAN_CREATE_SUBGROUP: 1 << 5, CAN_DELETE_SUBGROUP: 1 << 6, CAN_MANAGE_VISIBILITY: 1 << 7, CAN_MANAGE_METADATA: 1 << 8,} as const;
type CapabilityName = keyof typeof CAPABILITIES; // 'CAN_CREATE_CONTEXT' | …type CapabilityBit = (typeof CAPABILITIES)[CapabilityName];Helpers
Section titled “Helpers”All three normalize to unsigned 32-bit (>>> 0), so high bits like 1 << 31
behave correctly.
// True if `mask` has every bit of `cap` set.hasCap(mask: number, cap: number): boolean;
// `mask` with every bit of `cap` set.withCap(mask: number, cap: number): number;
// `mask` with every bit of `cap` cleared.withoutCap(mask: number, cap: number): number;Example
Section titled “Example”import { CAPABILITIES, hasCap, withCap, withoutCap } from '@calimero-network/mero-js';
const current = await sdk.admin.getMemberCapabilities(groupId, identity);
if (!hasCap(current.capabilities, CAPABILITIES.CAN_INVITE_MEMBERS)) { // grant invite + subgroup creation, revoke metadata management let next = withCap(current.capabilities, CAPABILITIES.CAN_INVITE_MEMBERS); next = withCap(next, CAPABILITIES.CAN_CREATE_SUBGROUP); next = withoutCap(next, CAPABILITIES.CAN_MANAGE_METADATA); await sdk.admin.setMemberCapabilities(groupId, identity, { capabilities: next });}