sonr/x/did/README.md

142 lines
3.5 KiB
Markdown
Raw Normal View History

2024-07-05 22:20:13 -04:00
# `x/did`
The Decentralized Identity module is responsible for managing native Sonr Accounts, their derived wallets, and associated user identification information.
## State
2024-10-21 16:59:29 -04:00
The DID module maintains several key state structures:
### Controller State
The Controller state represents a Sonr DWN Vault. It includes:
- Unique identifier (number)
- DID
- Sonr address
- Ethereum address
- Bitcoin address
- Public key
- Keyshares pointer
- Claimed block
- Creation block
### Assertion State
The Assertion state includes:
- DID
- Controller
- Subject
- Public key
- Assertion type
- Accumulator (metadata)
- Creation block
### Authentication State
The Authentication state includes:
- DID
- Controller
- Subject
- Public key
- Credential ID
- Metadata
- Creation block
### Verification State
The Verification state includes:
- DID
- Controller
- DID method
- Issuer
- Subject
- Public key
- Verification type
- Metadata
- Creation block
2024-07-05 22:20:13 -04:00
## State Transitions
2024-10-21 16:59:29 -04:00
State transitions are triggered by the following messages:
- LinkAssertion
- LinkAuthentication
- UnlinkAssertion
- UnlinkAuthentication
- ExecuteTx
- UpdateParams
2024-07-05 22:20:13 -04:00
## Messages
2024-10-21 16:59:29 -04:00
The DID module defines the following messages:
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
1. MsgLinkAuthentication
2. MsgLinkAssertion
3. MsgExecuteTx
4. MsgUnlinkAssertion
5. MsgUnlinkAuthentication
6. MsgUpdateParams
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
Each message triggers specific state machine behaviors related to managing DIDs, authentications, assertions, and module parameters.
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
## Query
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
The DID module provides the following query endpoints:
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
1. Params: Query all parameters of the module
2. Resolve: Query the DID document by its ID
3. Sign: Sign a message with the DID document
4. Verify: Verify a message with the DID document
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
## Params
2024-07-05 22:20:13 -04:00
2024-10-21 16:59:29 -04:00
The module parameters include:
- Allowed public keys (map of KeyInfo)
- Conveyance preference
- Attestation formats
2024-07-05 22:20:13 -04:00
## Client
2024-10-21 16:59:29 -04:00
The module provides gRPC and REST endpoints for all defined messages and queries.
2024-07-05 22:20:13 -04:00
## Future Improvements
2024-10-21 16:59:29 -04:00
Potential future improvements could include:
1. Enhanced privacy features for DID operations
2. Integration with more blockchain networks
3. Support for additional key types and cryptographic algorithms
4. Improved revocation mechanisms for credentials and assertions
2024-07-05 22:20:13 -04:00
## Tests
2024-10-21 16:59:29 -04:00
Acceptance tests should cover all major functionality, including:
- Creating and managing DIDs
- Linking and unlinking assertions and authentications
- Executing transactions with DIDs
- Querying and resolving DIDs
- Parameter updates
2024-07-05 22:20:13 -04:00
## Appendix
feature/1129 integrate webauthn controller (#1135) * **refactor: remove nebula static file serving** * **feat: Add login, register, and authorize sections** * **feat: implement registration form UI** * **refactor: abstract template rendering to ctx module** * **feat: add deployment target for Highway gateway** * **feat: migrate Highway gateway to Cloudflare Workers** * **feat: refactor nebula routes to components** * **chore(deps): remove unused dependencies** * **chore(deps): remove unused dependencies** * **feat: add user and relaying party entities** * **refactor: remove unused imports** * * **feat: add motion scale-in and opacity-in animations** * **refactor: move dwn and orm packages to internal** * **refactor: update imports to use relative paths** * **refactor: rename build targets for clarity** * **feat: add RelayingPartyEntity model** * **refactor: rename creds templates to credentials** * **refactor: remove unused entity model** * **refactor: move models to internal package** * **refactor: move models package to internal/orm** * **feat: implement broadcast channel context** * **feat: remove config upload step** * **feat: remove unused configuration files** * **feat: migrate authentication logic to workers** * **feat: remove cloudflared dependency** * **refactor: move client related routes to 'routes/client.go'** * **feat: implement macaroon middleware** * **refactor: move fetch package to cmd/motr** * **feat: remove auth and grant endpoints** * **docs: add conceptual descriptions to did module** <sub><a href="https://huly.app/guest/sonrhq?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsaW5rSWQiOiI2NzA4MTIyNmM3ZDZhNTZhOGY4ZGFjOTciLCJndWVzdCI6InRydWUiLCJlbWFpbCI6IiNndWVzdEBoYy5lbmdpbmVlcmluZyIsIndvcmtzcGFjZSI6InctcHJhZC1zb25yaHEtNjVlZjcyZDQtY2UyOGQ0ODJjNi00ZWY4ZDAifQ.j-w5jk5Ji-0vCkaxVaK8pDMIOhRsXmG7o6oZictoHYE">Huly&reg;: <b>ENG-1057</b></a></sub>
2024-10-10 13:44:17 -04:00
### Account
An Account represents a user's identity within the Sonr ecosystem. It includes information such as the user's public key, associated wallets, and other identification details.
### Decentralized Identifier (DID)
A Decentralized Identifier (DID) is a unique identifier that is created, owned, and controlled by the user. It is used to establish a secure and verifiable digital identity.
### Verifiable Credential (VC)
A Verifiable Credential (VC) is a digital statement that can be cryptographically verified. It contains claims about a subject (e.g., a user) and is issued by a trusted authority.
2024-10-21 16:59:29 -04:00
### Key Types
The module supports various key types, including:
- Role
- Algorithm (e.g., ES256, EdDSA, ES256K)
- Encoding (e.g., hex, base64, multibase)
- Curve (e.g., P256, P384, P521, X25519, X448, Ed25519, Ed448, secp256k1)
### JSON Web Key (JWK)
The module supports JSON Web Keys (JWK) for representing cryptographic keys, including properties such as key type (kty), curve (crv), and coordinates (x, y) for EC and OKP keys, as well as modulus (n) and exponent (e) for RSA keys.