mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/1214 session fetch refactor (#1215)
* chore(docs): remove token economy guide * refactor(context): update GatewayContext to use Querier interface * chore(database): update schema path * docs: Update READMEs for x/did, x/dwn, and x/svc with UCAN integration * chore(pkg): update database scope name * refactor(did): optimize GenesisState proto methods * refactor(svc): update Service proto to use repeated fields * refactor(api): rename MsgSpawn to MsgInitialize
This commit is contained in:
+29
-6
@@ -1,12 +1,13 @@
|
||||
# `x/svc`
|
||||
|
||||
The svc module is responsible for managing the registration and authorization of services within the Sonr ecosystem. It provides a secure and verifiable mechanism for registering and authorizing services using Decentralized Identifiers (DIDs).
|
||||
The svc module is responsible for managing the registration and authorization of services within the Sonr ecosystem. It provides a secure and verifiable mechanism for registering and authorizing services using Decentralized Identifiers (DIDs) and now incorporates UCAN (User Controlled Authorization Networks) for enhanced authorization capabilities.
|
||||
|
||||
## Concepts
|
||||
|
||||
- **Service**: A decentralized svc on the Sonr Blockchain with properties such as ID, authority, origin, name, description, category, tags, and expiry height.
|
||||
- **Profile**: Represents a DID alias with properties like ID, subject, origin, and controller.
|
||||
- **Metadata**: Contains information about a svc, including name, description, category, icon, and tags.
|
||||
- **UCAN Authorization**: The module utilizes UCANs for a decentralized and user-centric authorization mechanism.
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -38,11 +39,11 @@ Stores DID alias information:
|
||||
|
||||
### MsgUpdateParams
|
||||
|
||||
Updates the module parameters. Can only be executed by the governance account.
|
||||
Updates the module parameters, including UCAN-related parameters. Can only be executed by the governance account.
|
||||
|
||||
### MsgRegisterService
|
||||
|
||||
Registers a new svc on the blockchain. Requires a valid TXT record in DNS for the origin.
|
||||
Registers a new svc on the blockchain. Requires a valid TXT record in DNS for the origin and may be subject to UCAN authorization checks.
|
||||
|
||||
## Params
|
||||
|
||||
@@ -50,6 +51,7 @@ The module has the following parameters:
|
||||
|
||||
- `categories`: List of allowed svc categories
|
||||
- `types`: List of allowed svc types
|
||||
- `UcanPermissions`: Specifies the required UCAN permissions for various actions within the module, such as registering a service.
|
||||
|
||||
## Query
|
||||
|
||||
@@ -57,7 +59,7 @@ The module provides the following query:
|
||||
|
||||
### Params
|
||||
|
||||
Retrieves all parameters of the module.
|
||||
Retrieves all parameters of the module, including UCAN-related parameters.
|
||||
|
||||
## Client
|
||||
|
||||
@@ -65,7 +67,7 @@ Retrieves all parameters of the module.
|
||||
|
||||
The module provides a gRPC Query svc with the following RPC:
|
||||
|
||||
- `Params`: Get all parameters of the module
|
||||
- `Params`: Get all parameters of the module, including UCAN-related parameters.
|
||||
|
||||
### CLI
|
||||
|
||||
@@ -73,7 +75,28 @@ The module provides a gRPC Query svc with the following RPC:
|
||||
|
||||
## Events
|
||||
|
||||
(TODO: List and describe event tags used by the module)
|
||||
(TODO: List and describe event tags used by the module, including those related to UCAN authorization)
|
||||
|
||||
## UCAN Authorization
|
||||
|
||||
This module utilizes UCAN (User Controlled Authorization Networks) to provide a decentralized and user-centric authorization mechanism. UCANs are self-contained authorization tokens that allow users to delegate specific capabilities to other entities without relying on a central authority.
|
||||
|
||||
### UCAN Integration
|
||||
|
||||
- The module parameters include a `UcanPermissions` field that defines the default UCAN permissions required for actions within the module.
|
||||
- Message handlers in the `MsgServer` perform UCAN authorization checks by:
|
||||
- Retrieving the UCAN permissions from the context (injected by a middleware).
|
||||
- Retrieving the required UCAN permissions from the module parameters.
|
||||
- Verifying that the provided UCAN permissions satisfy the required permissions.
|
||||
- A dedicated middleware is responsible for:
|
||||
- Parsing incoming requests for UCAN tokens.
|
||||
- Verifying UCAN token signatures and validity.
|
||||
- Extracting UCAN permissions.
|
||||
- Injecting UCAN permissions into the context.
|
||||
- UCAN verification logic involves:
|
||||
- Checking UCAN token signatures against the issuer's public key (resolved via the `x/did` module).
|
||||
- Validating token expiration and other constraints.
|
||||
- Parsing token capabilities and extracting relevant permissions.
|
||||
|
||||
## Future Improvements
|
||||
|
||||
|
||||
Reference in New Issue
Block a user