| Crates.io | calimero-server |
| lib.rs | calimero-server |
| version | 0.2.5 |
| created_at | 2025-08-31 15:42:04.826353+00 |
| updated_at | 2025-09-09 14:06:26.229093+00 |
| description | Core Calimero infrastructure and tools |
| homepage | |
| repository | https://github.com/calimero-network/core |
| max_upload_size | |
| id | 1818655 |
| size | 307,703 |
Node Server is a component in node that facilitates node administration and enables communication with the logic of an application (loaded wasm) in participating contexts.
Node Server component is split into 3 parts:
The Admin API component of the Node Server exposes API for connection with the node and its functionalities. It is primarily utilized by the Admin Dashboard to query and manage various aspects of the node, including:
Data Querying: The Admin API allows the Admin Dashboard to fetch important data from the node, such as identity details, root and client keys, and information about installed and active applications.
Application Management: The API provides functionalities for managing applications and contexts, allowing for the installation and uninstallation of applications and starting contexts.
Key Management: Administrators can manage root and client keys through the API, ensuring secure access and control over the node.
Authentication: The Admin API facilitates user authentication via selected wallets, currently supporting MetaMask and NEAR networks. Authentication details will be explained in later sections.
Integration with Web Applications: The authentication mechanism is also used by web applications designed for applications (loaded wasm) in participating context, ensuring secure and authenticated access.
The JSON rpc component of the Node Server facilitates communication between the clients and the context. This allows seamless interaction and data management for applications.
The JSON rpc interface provides two primary methods:
The Query method retrieves data from the application in participating context.
For instance, in the Only Peers forum application, posts and comments stored in
the application's storage can be queried using the JSON rpc interface. This
enables users to fetch and display content from the forum.
The Mutate method allows modification of the application's data in
participating context. For example, in the Only Peers forum application, users
can create new posts or comments. The Mutate method updates the application's
storage with these new entries, facilitating dynamic content creation and
interaction within the application.
The WebSocket is used for subscribing to and unsubscribing from certain context running in the Node Server. Defined handlers manage subscription states for WebSocket connections, allowing clients to receive updates about specific contexts they are interested in. WebSocket handlers are essential for managing real-time subscriptions within the Node Server. They allow clients to dynamically subscribe to and unsubscribe from updates about various application contexts.
Websocket handles requests to subscribe to specific contexts and send responses back to the client with the subscribed context IDs.
Websocket handle requests to unsubscribe from specific contexts and send responses back to the client with the unsubscribed context IDs.
sequenceDiagram
title Client Login Workflow
participant User
participant Admin Dashboard / Application
participant Crypto Wallet
participant Admin API
participant Node
User->>Admin Dashboard / Application: login
Admin Dashboard / Application->>Admin API: API call to request-challenge endpoint
Admin API-->>Admin Dashboard / Application: Return challenge object
Admin Dashboard / Application->>Crypto Wallet: Request to sign received challenge
Crypto Wallet-->>User: Request to sign challenge
User->>Crypto Wallet: Sign challenge
Crypto Wallet-->>Crypto Wallet: Sign challenge
Crypto Wallet-->>Admin Dashboard / Application: Signed challenge
Admin Dashboard / Application-->>Admin Dashboard / Application: Create auth headers
Admin Dashboard / Application->>Admin API: call add-client-key endpoint with signed challenge + auth header
Admin API->>Admin API: Verify auth headers
Admin API->>Admin API: Verify signature
Admin API->>Node: Check if any root key are stored
alt No root keys are stored
Admin API->>Node: Save root key
else Root key exists
Admin API->>Node: Save client key
end
Node->>Admin API: Key Stored response
Admin API->>Admin Dashboard / Application: Login successful response
Admin Dashboard / Application-->>Admin Dashboard / Application: Authorise user
sequenceDiagram
title JSON rpc Workflow
participant User
participant Client
participant JSON rpc
participant Node
User->>Client: Query/Mutate action
Client->>JSON rpc: Request (query/mutate)
JSON rpc-->>JSON rpc: Processes request
JSON rpc->>Node: Request for JSON rpc action
Node->>Node: Perform action (query/mutate)
Node-->>JSON rpc: Response
JSON rpc-->>Client: Response for request
sequenceDiagram
title WebSocket Subscription Workflow
participant Client
participant WebSocket
participant Node
Client->>WebSocket: Subscribe/Unsubscribe request
WebSocket->>Node: Handle subscribe/unsubscribe
Node-->>WebSocket: Subscription response
WebSocket-->>Client: Subscription messages (context application updates)
The Admin API endpoints are split into protected and unprotected routes, where protected routes require authentication.
Base path: /admin-api
These routes require authentication using auth headers. Auth headers are
generated using createAuthHeader function from the calimero sdk library.
Parts of the Auth Headers
wallet_type: Specifies the type of wallet used (e.g., NEAR).signing_key: Encoded public key used for signing the request.signature: Encoded signature generated from the payload hash.challenge: Encoded hash of the payload, serving as a challenge.context_id: Context identifier for additional request context. Optional
for Admin Dashboard but mandatory for applications.1. Create Root Key
/root-keyPOST2. Install Application
/install-applicationPOST3. List Applications
/applicationsGET4. Fetch DID
/didGET5. Create Context
/contextsPOST6. Delete Context
/contexts/:context_idDELETE7. Get Context
/contexts/:context_idGET8. Get Context Users
/contexts/:context_id/usersGET9. Get Context Client Keys
/contexts/:context_id/client-keysGET10. Get Context Storage
/contexts/:context_id/storageGET11. List Contexts
/contextsGET12. Delete Auth Keys
/identity/keysDELETEThese routes do not require authentication.
1. Health Check
/healthGET2. Request Challenge
/request-challengePOST3. Add Client Key
/add-client-keyPOST4. Install Dev Application
/dev/install-applicationPOST5. Manage Dev Contexts
/dev/contextsGET, POSTGET) and creates (POST) development contexts.6. List Dev Applications
/dev/applicationsGETThe JSON-rpc server endpoint is structured to handle various request types.
Base path: /jsonrpc
1. Handle JSON-rpc Request
/jsonrpcPOSTquery or
mutate requests, processes them, and returns the appropriate response.The WebSocket, accessible at /ws, allows clients to dynamically subscribe to and unsubscribe from real-time updates about specific contexts within the Node Server.
1. Handle WebSocket Request
/wsGETExamples of Node Server usage can be found within the Admin Dashboard and the Only Peers example application. All communication with the node is exposed through calimero sdk library.