@calimero-network/mero-react 9.11.1 → 9.11.3
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/README.md +5 -0
- package/dist/index.cjs +230 -325
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -31
- package/dist/index.d.ts +30 -31
- package/dist/index.js +231 -326
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,12 +121,17 @@ const {
|
|
|
121
121
|
contextId, // string | null — from auth callback
|
|
122
122
|
contextIdentity, // string | null — executor public key from auth callback
|
|
123
123
|
connectToNode, // (url: string) => void — starts auth redirect
|
|
124
|
+
admin, // AdminApiClient | null — the session's admin: node admin on a node, account admin on an account
|
|
124
125
|
logout, // () => void — clears tokens and state
|
|
125
126
|
} = useMero();
|
|
126
127
|
```
|
|
127
128
|
|
|
129
|
+
Every hook in this package goes through that `admin`, never the raw `mero.admin`: on a node it is the node's own admin API; on an account (delegated session) it is the account admin, whose reads go to the relay and whose writes are the account's own form of the call (invitations signed with the device key, joins through the admit route, group changes as governance ops under warrants). An app gets the same result from `useCreateNamespaceInvitation`, `useJoinNamespace`, `useAddGroupMembers` and the rest on a node and on an account; a call an account has no form of (`useUpgradeGroup`, `useDeleteNamespace`, `useJoinGroup`, ...) surfaces `NotForAccountError` through `error`.
|
|
130
|
+
|
|
128
131
|
How an account (delegated session) learns its `applicationId`: `packageName` decides. When the app passes one, the id is derived from the registry: `sha256(borsh((package, signerId)))` of the newest non-yanked bundle, exactly as merod computes it at install, so a brand-new account can found its first namespace (`admin.createNamespace({ applicationId })`) and an account already used in other apps is never handed one of THEIR ids. The account's own contexts on the relay are consulted only when the app passes no `packageName` (or the registry did not answer, after one `console.warn`): one distinct application across them is the answer; several leaves it `null` on purpose (nothing says which the tab is for). When the registry lists the package under more than one publisher, it stays `null`. `applicationIdForBundle` and `resolveApplicationIdFromRegistry` are exported for apps that need the same derivation.
|
|
129
132
|
|
|
133
|
+
On an account, `admin.createContext(request)` (and `useCreateContext`) signs a creation warrant the relay acts on: `applicationId`, `groupId`, `serviceName` (which service of a multi-service bundle, e.g. mero-docs' `registry`), `name`, `contextSeed` and `initializationParams` are all carried into it; `identitySecret` is not, since the account itself is the new context's member identity.
|
|
134
|
+
|
|
130
135
|
Through `mero` you access the full MeroJs API:
|
|
131
136
|
|
|
132
137
|
```tsx
|