* clear

* feat: Add everything

* fix: Commenht
This commit is contained in:
Prad Nukala
2025-10-03 14:45:52 -04:00
committed by GitHub
parent 43b4a11c06
commit 13e6c3e84d
1935 changed files with 655061 additions and 40058 deletions
Regular → Executable
+1 -1
View File
@@ -7,5 +7,5 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
message Module {
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/sonr-io/snrd"};
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/sonr-io/sonr"};
}
+90
View File
@@ -0,0 +1,90 @@
## Overview
Query endpoints for the DID module provide read access to decentralized identifiers, verifiable credentials, and identity metadata.
## Request: {{.RequestType.Name}}
| Field ID | Name | Type | Description |
| -------- | ---- | ---- | ----------- | {{range .RequestType.Fields}}
| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
## Response: {{.ResponseType.Name}}
| Field ID | Name | Type | Description |
| -------- | ---- | ---- | ----------- | {{range .ResponseType.Fields}}
| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
## Query Details
{{if eq .MethodDescriptorProto.Name "Params"}}
- Returns module parameters
- Includes WebAuthn configuration settings
- Shows supported signature algorithms
{{else if eq .MethodDescriptorProto.Name "ResolveDID"}}
- Resolves a DID to its complete document
- Returns verification methods and service endpoints
- Includes document metadata and version info
{{else if eq .MethodDescriptorProto.Name "GetDIDDocument"}}
- Retrieves a specific DID document by identifier
- Returns full W3C-compliant DID document
- Includes creation and update timestamps
{{else if eq .MethodDescriptorProto.Name "ListDIDDocuments"}}
- Lists all DID documents in the system
- Supports pagination for large result sets
- Returns documents in creation order
{{else if eq .MethodDescriptorProto.Name "GetDIDDocumentsByController"}}
- Finds all DIDs controlled by an address
- Useful for identity management interfaces
- Returns paginated results
{{else if eq .MethodDescriptorProto.Name "GetVerificationMethod"}}
- Retrieves specific verification method details
- Returns public key and algorithm information
- Shows associated verification relationships
{{else if eq .MethodDescriptorProto.Name "GetService"}}
- Gets specific service endpoint information
- Returns service type and endpoint URLs
- Includes service metadata
{{else if eq .MethodDescriptorProto.Name "GetVerifiableCredential"}}
- Retrieves a verifiable credential by ID
- Returns complete credential with proofs
- Shows issuance and expiration dates
{{else if eq .MethodDescriptorProto.Name "ListVerifiableCredentials"}}
- Lists verifiable credentials with filters
- Can filter by issuer or holder DID
- Optionally includes revoked credentials
{{else if eq .MethodDescriptorProto.Name "GetCredentialsByDID"}}
- Gets all credentials associated with a DID
- Includes both verifiable and WebAuthn credentials
- Shows vault storage status if applicable
{{end}}
## Usage Examples
```bash
# Query module parameters
snrd query did params
# Resolve a DID
snrd query did resolve did:sonr:123abc
# Get DID document
snrd query did document did:sonr:123abc
# List DIDs by controller
snrd query did documents-by-controller sonr1abc...
# Get verification method
snrd query did verification-method did:sonr:123abc key-1
# Query verifiable credential
snrd query did credential cred-123
# List credentials for a DID
snrd query did credentials-by-did did:sonr:123abc
```
## Response Formats
All responses follow W3C standards:
- DID Documents conform to W3C DID Core v1.0
- Verifiable Credentials follow W3C VC Data Model v1.1
- WebAuthn credentials comply with WebAuthn Level 2
+84
View File
@@ -0,0 +1,84 @@
## Overview
The DID module implements W3C Decentralized Identifiers (DIDs) with support for WebAuthn, verifiable credentials, and external wallet linking.
## Request: {{.RequestType.Name}}
| Field ID | Name | Type | Description |
| -------- | ---- | ---- | ----------- | {{range .RequestType.Fields}}
| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
## Response: {{.ResponseType.Name}}
| Field ID | Name | Type | Description |
| -------- | ---- | ---- | ----------- | {{range .ResponseType.Fields}}
| {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
## Implementation Details
{{if eq .MethodDescriptorProto.Name "CreateDID"}}
- Creates a new W3C-compliant DID document
- Automatically generates unique DID identifier
- Can optionally create an associated vault for secure storage
- Supports multiple verification methods and service endpoints
{{else if eq .MethodDescriptorProto.Name "UpdateDID"}}
- Updates an existing DID document
- Maintains version history for auditability
- Only controller can perform updates
- Preserves immutable fields like creation timestamp
{{else if eq .MethodDescriptorProto.Name "DeactivateDID"}}
- Permanently deactivates a DID document
- Cannot be reversed once deactivated
- Maintains deactivated state for historical reference
- Revokes all associated credentials
{{else if eq .MethodDescriptorProto.Name "AddVerificationMethod"}}
- Adds new cryptographic verification methods
- Supports Ed25519, ECDSA, RSA, and WebAuthn
- Can specify verification relationships (authentication, assertion, etc.)
- Enables multi-signature capabilities
{{else if eq .MethodDescriptorProto.Name "RemoveVerificationMethod"}}
- Removes verification methods from DID document
- Cannot remove the last remaining verification method
- Updates all related verification relationships
{{else if eq .MethodDescriptorProto.Name "AddService"}}
- Adds service endpoints to DID document
- Enables discovery of services associated with DID
- Supports multiple service types and endpoints
{{else if eq .MethodDescriptorProto.Name "RemoveService"}}
- Removes service endpoints from DID document
- Cleans up service discovery metadata
{{else if eq .MethodDescriptorProto.Name "IssueVerifiableCredential"}}
- Issues W3C Verifiable Credentials
- Cryptographically signed by issuer's DID
- Supports custom credential schemas
- Includes issuance and expiration dates
{{else if eq .MethodDescriptorProto.Name "RevokeVerifiableCredential"}}
- Revokes previously issued credentials
- Maintains revocation registry on-chain
- Includes revocation reason for audit trail
{{else if eq .MethodDescriptorProto.Name "LinkExternalWallet"}}
- Links external blockchain wallets to DID
- Requires cryptographic proof of wallet ownership
- Supports Ethereum, Cosmos, and other chains
- Enables cross-chain identity bridging
{{else if eq .MethodDescriptorProto.Name "RegisterWebAuthnCredential"}}
- Registers WebAuthn credentials for passwordless authentication
- Creates new DID with WebAuthn as primary verification method
- Supports gasless onboarding for new users
- Can automatically create associated vault
- Enables biometric authentication (Face ID, Touch ID, etc.)
{{end}}
## Security Considerations
- All DID operations require controller authorization
- Cryptographic signatures validate all changes
- WebAuthn provides phishing-resistant authentication
- External wallet linking requires ownership proofs
- Verifiable credentials include tamper-evident signatures
## Standards Compliance
- W3C DID Core Specification v1.0
- W3C Verifiable Credentials Data Model v1.1
- WebAuthn Level 2 Specification
- DID Method Specification: did:sonr
+191
View File
@@ -0,0 +1,191 @@
syntax = "proto3";
package did.v1;
option go_package = "github.com/sonr-io/sonr/x/did/types";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
// EventDIDCreated is emitted when a new DID is created
message EventDIDCreated {
// DID identifier
string did = 1;
// Creator address
string creator = 2;
// Public keys added
repeated string public_keys = 3;
// Services added
repeated string services = 4;
// Creation timestamp
google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Block height
uint64 block_height = 6;
}
// EventDIDUpdated is emitted when a DID is updated
message EventDIDUpdated {
// DID identifier
string did = 1;
// Updater address
string updater = 2;
// Fields that were updated
repeated string fields_updated = 3;
// Update timestamp
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Block height
uint64 block_height = 5;
}
// EventDIDDeactivated is emitted when a DID is deactivated
message EventDIDDeactivated {
// DID identifier
string did = 1;
// Deactivator address
string deactivator = 2;
// Deactivation timestamp
google.protobuf.Timestamp deactivated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Block height
uint64 block_height = 4;
}
// EventVerificationMethodAdded is emitted when a verification method is added
message EventVerificationMethodAdded {
// DID identifier
string did = 1;
// Method ID
string method_id = 2;
// Key type
string key_type = 3;
// Public key (encoded)
string public_key = 4;
// Block height
uint64 block_height = 5;
}
// EventVerificationMethodRemoved is emitted when a verification method is removed
message EventVerificationMethodRemoved {
// DID identifier
string did = 1;
// Method ID
string method_id = 2;
// Block height
uint64 block_height = 3;
}
// EventServiceAdded is emitted when a service is added to a DID
message EventServiceAdded {
// DID identifier
string did = 1;
// Service ID
string service_id = 2;
// Service type
string type = 3;
// Service endpoint
string endpoint = 4;
// Block height
uint64 block_height = 5;
}
// EventServiceRemoved is emitted when a service is removed from a DID
message EventServiceRemoved {
// DID identifier
string did = 1;
// Service ID
string service_id = 2;
// Block height
uint64 block_height = 3;
}
// EventCredentialIssued is emitted when a verifiable credential is issued
message EventCredentialIssued {
// Credential ID
string credential_id = 1;
// Issuer DID
string issuer = 2;
// Subject DID
string subject = 3;
// Credential type
string type = 4;
// Issuance timestamp
google.protobuf.Timestamp issued_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Block height
uint64 block_height = 6;
}
// EventCredentialRevoked is emitted when a credential is revoked
message EventCredentialRevoked {
// Credential ID
string credential_id = 1;
// Revoker DID
string revoker = 2;
// Revocation reason
string reason = 3;
// Revocation timestamp
google.protobuf.Timestamp revoked_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Block height
uint64 block_height = 5;
}
// EventWebAuthnRegistered is emitted when a WebAuthn credential is registered
message EventWebAuthnRegistered {
// DID identifier
string did = 1;
// WebAuthn credential ID
string credential_id = 2;
// Attestation type
string attestation_type = 3;
// Block height
uint64 block_height = 4;
}
// EventExternalWalletLinked is emitted when an external wallet is linked
message EventExternalWalletLinked {
// DID identifier
string did = 1;
// Wallet type (ethereum, bitcoin, etc.)
string wallet_type = 2;
// Wallet address
string wallet_address = 3;
// Block height
uint64 block_height = 4;
}
+69 -29
View File
@@ -4,12 +4,15 @@ package did.v1;
import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/sonr-io/snrd/x/did/types";
option go_package = "github.com/sonr-io/sonr/x/did/types";
// GenesisState defines the module genesis state
message GenesisState {
// Params defines all the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
// Export format version for future migrations
uint32 export_version = 2;
}
// Params defines the set of module parameters.
@@ -18,37 +21,74 @@ message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated Attenuation attenuations = 1;
DocumentParams document = 1;
WebauthnParams webauthn = 2;
}
// Attenuation defines the attenuation of a resource
message Attenuation {
Resource resource = 1;
repeated Capability capabilities = 2;
// DocumentParams defines the parameters for the DID module.
message DocumentParams {
option (gogoproto.equal) = true;
// AutoCreateVault enables automatic vault creation upon DID registration
bool auto_create_vault = 1;
// MaxVerificationMethods limits the number of verification methods
int32 max_verification_methods = 2;
// MaxServiceEndpoints limits the number of service endpoints
int32 max_service_endpoints = 3;
// MaxControllers limits the number of controllers per DID document
int32 max_controllers = 4;
// DidDocumentMaxSize limits the maximum size of a DID document in bytes
int64 did_document_max_size = 5;
// DidResolutionTimeout is the timeout for resolution operations in seconds
int64 did_resolution_timeout = 6;
// KeyRotationInterval is the recommended interval for key rotation in seconds
int64 key_rotation_interval = 7;
// CredentialLifetime is the default lifetime in seconds
int64 credential_lifetime = 8;
// Supported Assertion methods
repeated string supported_assertion_methods = 9;
// Supported Authentication methods
repeated string supported_authentication_methods = 10;
// Supported Invocation methods
repeated string supported_invocation_methods = 11;
// Supported Delegation methods
repeated string supported_delegation_methods = 12;
}
// Capability reprensents the available capabilities of a decentralized web node
message Capability {
string name = 1;
string parent = 2;
string description = 3;
repeated string resources = 4;
// WebauthnParams defines the parameters for the WebAuthn module.
message WebauthnParams {
option (gogoproto.equal) = true;
// ChallengeTimeout is the default timeout in seconds
int64 challenge_timeout = 1;
// AllowedOrigins are the allowed WebAuthn origins for credential creation
repeated string allowed_origins = 2;
// SupportedAlgorithms are the supported signature for WebAuthn credentials
repeated string supported_algorithms = 3;
// RequireUserVerification enforces verification for WebAuthn credentials
bool require_user_verification = 4;
// MaxCredentialsPerDID limits the number of WebAuthn credentials per DID
int32 max_credentials_per_did = 5;
// DefaultRPID is the default Relying Party ID for WebAuthn operations
string default_rp_id = 6;
// DefaultRPName is the default Relying Party name for WebAuthn operations
string default_rp_name = 7;
}
// Resource reprensents the available resources of a decentralized web node
message Resource {
string kind = 1;
string template = 2;
}
// Document defines a DID document
message Document {
string id = 1;
string controller = 2; // The DID of the controller
repeated string authentication = 3;
repeated string assertion_method = 4;
repeated string capability_delegation = 5;
repeated string capability_invocation = 6;
repeated string service = 7;
}
+286 -43
View File
@@ -1,36 +1,86 @@
syntax = "proto3";
package did.v1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "did/v1/genesis.proto";
import "google/api/annotations.proto";
import "did/v1/state.proto";
import "did/v1/types.proto";
option go_package = "github.com/sonr-io/snrd/x/did/types";
import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/sonr-io/sonr/x/did/types";
// Query provides defines the gRPC querier service.
service Query {
// Params queries all parameters of the module.
rpc Params(QueryRequest) returns (QueryParamsResponse) {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/did/v1/params";
}
// Resolve queries the DID document by its id.
rpc Resolve(QueryRequest) returns (QueryResolveResponse) {
option (google.api.http).get = "/did/v1/{did}";
// ResolveDID resolves a DID to its DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_query_docs.md"}}
rpc ResolveDID(QueryResolveDIDRequest) returns (QueryResolveDIDResponse) {
option (google.api.http).get = "/did/v1/resolve/{did}";
}
// Verify verifies a message with the DID document
rpc Verify(QueryVerifyRequest) returns (QueryVerifyResponse) {
option (google.api.http).post = "/did/v1/{did}/verify";
// GetDIDDocument retrieves a DID document by its ID
rpc GetDIDDocument(QueryGetDIDDocumentRequest) returns (QueryGetDIDDocumentResponse) {
option (google.api.http).get = "/did/v1/document/{did}";
}
// ListDIDDocuments lists all DID documents with pagination
rpc ListDIDDocuments(QueryListDIDDocumentsRequest) returns (QueryListDIDDocumentsResponse) {
option (google.api.http).get = "/did/v1/documents";
}
// GetDIDDocumentsByController retrieves DID documents by controller
rpc GetDIDDocumentsByController(QueryGetDIDDocumentsByControllerRequest) returns (QueryGetDIDDocumentsByControllerResponse) {
option (google.api.http).get = "/did/v1/documents/controller/{controller}";
}
// GetVerificationMethod retrieves a specific verification method
rpc GetVerificationMethod(QueryGetVerificationMethodRequest) returns (QueryGetVerificationMethodResponse) {
option (google.api.http).get = "/did/v1/verification-method/{did}/{method_id}";
}
// GetService retrieves a specific service endpoint
rpc GetService(QueryGetServiceRequest) returns (QueryGetServiceResponse) {
option (google.api.http).get = "/did/v1/service/{did}/{service_id}";
}
// GetVerifiableCredential retrieves a verifiable credential by ID
rpc GetVerifiableCredential(QueryGetVerifiableCredentialRequest) returns (QueryGetVerifiableCredentialResponse) {
option (google.api.http).get = "/did/v1/credential/{credential_id}";
}
// ListVerifiableCredentials lists all verifiable credentials with filtering options
rpc ListVerifiableCredentials(QueryListVerifiableCredentialsRequest) returns (QueryListVerifiableCredentialsResponse) {
option (google.api.http).get = "/did/v1/credentials";
}
// GetCredentialsByDID retrieves all credentials (verifiable and WebAuthn) associated with a DID
rpc GetCredentialsByDID(QueryGetCredentialsByDIDRequest) returns (QueryGetCredentialsByDIDResponse) {
option (google.api.http).get = "/did/v1/credentials/did/{did}";
}
// RegisterStart represents the start of the registration process
rpc RegisterStart(QueryRegisterStartRequest) returns (QueryRegisterStartResponse) {
option (google.api.http).post = "/did/v1/register/start";
}
// LoginStart represents the start of the login process
rpc LoginStart(QueryLoginStartRequest) returns (QueryLoginStartResponse) {
option (google.api.http).post = "/did/v1/login/start";
}
}
// Queryequest is the request type for the Query/Params RPC method.
message QueryRequest {
string did = 1;
string origin = 2;
string key = 3;
string asset = 4;
}
// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
@@ -38,39 +88,232 @@ message QueryParamsResponse {
Params params = 1;
}
// QueryResolveResponse is the response type for the Query/Resolve RPC method.
message QueryResolveResponse {
// document is the DID document
Document document = 1;
}
// QuerySignRequest is the request type for the Query/Sign RPC method.
message QuerySignRequest {
// QueryResolveDIDRequest is the request type for the Query/ResolveDID RPC
// method.
message QueryResolveDIDRequest {
// did is the DID to resolve
string did = 1;
string origin = 2;
string key = 3;
string asset = 4;
string message = 5;
}
// QuerySignResponse is the response type for the Query/Sign RPC method.
message QuerySignResponse {
// signature is the signature of the message
string signature = 1;
// QueryResolveDIDResponse is the response type for the Query/ResolveDID RPC
// method.
message QueryResolveDIDResponse {
// did_document is the resolved DID document
DIDDocument did_document = 1;
// did_document_metadata contains metadata about the DID document
DIDDocumentMetadata did_document_metadata = 2;
}
// QueryVerifyRequest is the request type for the Query/Verify RPC method.
message QueryVerifyRequest {
// QueryGetDIDDocumentRequest is the request type for the
// Query/GetDIDDocument RPC method.
message QueryGetDIDDocumentRequest {
// did is the DID to retrieve
string did = 1;
string origin = 2;
string key = 3;
string asset = 4;
string message = 5;
string signature = 6;
}
// QueryVerifyResponse is the response type for the Query/Verify RPC method.
message QueryVerifyResponse {
// valid is the validity of the signature
bool valid = 1;
// QueryGetDIDDocumentResponse is the response type for the
// Query/GetDIDDocument RPC method.
message QueryGetDIDDocumentResponse {
// did_document is the retrieved DID document
DIDDocument did_document = 1;
// did_document_metadata contains metadata about the DID document
DIDDocumentMetadata did_document_metadata = 2;
}
// QueryListDIDDocumentsRequest is the request type for the
// Query/ListDIDDocuments RPC method.
message QueryListDIDDocumentsRequest {
// pagination defines an optional pagination for the request
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryListDIDDocumentsResponse is the response type for the
// Query/ListDIDDocuments RPC method.
message QueryListDIDDocumentsResponse {
// did_documents is the list of DID documents
repeated DIDDocument did_documents = 1;
// pagination defines the pagination in the response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGetDIDDocumentsByControllerRequest is the request type for the
// Query/GetDIDDocumentsByController RPC method.
message QueryGetDIDDocumentsByControllerRequest {
// controller is the controller to search for
string controller = 1;
// pagination defines an optional pagination for the request
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGetDIDDocumentsByControllerResponse is the response type for the
// Query/GetDIDDocumentsByController RPC method.
message QueryGetDIDDocumentsByControllerResponse {
// did_documents is the list of DID documents controlled by the controller
repeated DIDDocument did_documents = 1;
// pagination defines the pagination in the response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGetVerificationMethodRequest is the request type for the
// Query/GetVerificationMethod RPC method.
message QueryGetVerificationMethodRequest {
// did is the DID that contains the verification method
string did = 1;
// method_id is the ID of the verification method
string method_id = 2;
}
// QueryGetVerificationMethodResponse is the response type for the
// Query/GetVerificationMethod RPC method.
message QueryGetVerificationMethodResponse {
// verification_method is the retrieved verification method
VerificationMethod verification_method = 1;
}
// QueryGetServiceRequest is the request type for the Query/GetService RPC
// method.
message QueryGetServiceRequest {
// did is the DID that contains the service
string did = 1;
// service_id is the ID of the service
string service_id = 2;
}
// QueryGetServiceResponse is the response type for the Query/GetService
// RPC method.
message QueryGetServiceResponse {
// service is the retrieved service
Service service = 1;
}
// QueryGetVerifiableCredentialRequest is the request type for the
// Query/GetVerifiableCredential RPC method.
message QueryGetVerifiableCredentialRequest {
// credential_id is the ID of the credential to retrieve
string credential_id = 1;
}
// QueryGetVerifiableCredentialResponse is the response type for the
// Query/GetVerifiableCredential RPC method.
message QueryGetVerifiableCredentialResponse {
// credential is the retrieved verifiable credential
VerifiableCredential credential = 1;
}
// QueryListVerifiableCredentialsRequest is the request type for the
// Query/ListVerifiableCredentials RPC method.
message QueryListVerifiableCredentialsRequest {
// pagination defines an optional pagination for the request
cosmos.base.query.v1beta1.PageRequest pagination = 1;
// issuer filters by issuer DID (optional)
string issuer = 2;
// holder filters by holder DID (optional)
string holder = 3;
// include_revoked includes revoked credentials (default: false)
bool include_revoked = 4;
}
// QueryListVerifiableCredentialsResponse is the response type for the
// Query/ListVerifiableCredentials RPC method.
message QueryListVerifiableCredentialsResponse {
// credentials is the list of verifiable credentials
repeated VerifiableCredential credentials = 1;
// pagination defines the pagination in the response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// CredentialInfo wraps credential data with vault status
message CredentialInfo {
// credential can be either verifiable or WebAuthn
oneof credential {
VerifiableCredential verifiable_credential = 1;
WebAuthnCredential webauthn_credential = 2;
}
// vault_id indicates if stored in vault (empty if not)
string vault_id = 3;
// is_encrypted indicates if encrypted in vault
bool is_encrypted = 4;
}
// QueryGetCredentialsByDIDRequest is the request type for the
// Query/GetCredentialsByDID RPC method.
message QueryGetCredentialsByDIDRequest {
// did is the DID to retrieve all credentials for
string did = 1;
// include_verifiable includes verifiable credentials (default: true)
bool include_verifiable = 2;
// include_webauthn includes WebAuthn credentials (default: true)
bool include_webauthn = 3;
// include_revoked includes revoked credentials (default: false)
bool include_revoked = 4;
// pagination defines an optional pagination for the request
cosmos.base.query.v1beta1.PageRequest pagination = 5;
}
// QueryGetCredentialsByDIDResponse is the response type for the
// Query/GetCredentialsByDID RPC method.
message QueryGetCredentialsByDIDResponse {
// credentials is the list of all credentials associated with the DID
repeated CredentialInfo credentials = 1;
// pagination defines the pagination in the response
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryRegisterStartRequest is the request type for the
// Query/RegisterStart RPC method.
message QueryRegisterStartRequest {
// assertion_did is the DID to register (did:sonr:email:<blake3> or did:sonr:phone:<blake3>)
string assertion_did = 1;
}
// QueryRegisterStartResponse is the response type for the
// Query/RegisterStart RPC method.
message QueryRegisterStartResponse {
// challenge for the attestation ceremony (32 bytes)
bytes challenge = 1;
// relying_party_id identifier
string relying_party_id = 2;
// user information (id, name, displayName)
map<string, string> user = 3;
}
// QueryLoginStartRequest is the request type for the
// Query/LoginStart RPC method.
message QueryLoginStartRequest {
// assertion_did is the assertion DID (did:sonr:email:<blake3> or did:sonr:phone:<blake3>)
string assertion_did = 1;
}
// QueryLoginStartResponse is the response type for the
// Query/LoginStart RPC method.
message QueryLoginStartResponse {
// credential_ids associated with this assertion
repeated string credential_ids = 1;
// challenge for the assertion ceremony (32 bytes)
bytes challenge = 2;
// relying_party_id identifier
string relying_party_id = 3;
}
+293 -71
View File
@@ -4,10 +4,12 @@ package did.v1;
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
import "did/v1/types.proto";
option go_package = "github.com/sonr-io/snrd/x/did/types";
option go_package = "github.com/sonr-io/sonr/x/did/types";
message Account {
// Authentication is the authentication method to be used by the DID.
message Authentication {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "did"}
@@ -28,122 +30,342 @@ message Account {
string subject = 3;
// string is the verification method
string public_key_hex = 4;
string public_key_base64 = 4;
// AssertionType is the assertion type
string assertion_type = 5;
// Metadata of the authentication
map<string, bytes> accumulator = 6;
// AssertionKind is the assertion type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 7;
int64 creation_block = 6;
}
// PublicKey represents a public key
message PublicKey {
// Assertion is the assertion method to be used by the DID.
message Assertion {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {
fields: "number"
auto_increment: true
}
primary_key: {fields: "did"}
index: {
id: 1
fields: "sonr_address"
unique: true
}
index: {
id: 2
fields: "eth_address"
unique: true
}
index: {
id: 3
fields: "btc_address"
unique: true
}
index: {
id: 4
fields: "did"
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the controller
uint64 number = 1;
// The unique identifier of the assertion
string did = 1;
// The unique identifier of the controller
string did = 2;
// The authentication of the DID
string controller = 2;
// The DID of the controller
string sonr_address = 3;
// The DID of the controller
string eth_address = 4;
// The DID of the controller
string btc_address = 5;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_hex = 6;
string public_key_base64 = 4;
// Pointer to the Keyshares
string ks_val = 7;
// DIDKind is the DID type
string did_kind = 5;
// The block number of when a user claimed the controller
int64 claimed_block = 8;
// CreationBlock is the block number of the creation of the controller
int64 creation_block = 9;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Verification represents a verification method
message Verification {
// Controller is the controller method to be used by the DID.
message Controller {
option (cosmos.orm.v1.table) = {
id: 3
primary_key: {fields: "did"}
index: {
id: 1
fields: "issuer,subject"
fields: "address"
unique: true
}
index: {
id: 2
fields: "controller,did_method,issuer"
fields: "subject"
unique: true
}
index: {
id: 3
fields: "verification_type,subject,issuer"
fields: "public_key_base64"
unique: true
}
};
// The unique identifier of the verification
// The unique identifier of the assertion
string did = 1;
// The controller of the verification
// The authentication of the DID
string address = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Delegation is usually an external blockchain account that is used to sign
// transactions on behalf of the DID
message Delegation {
option (cosmos.orm.v1.table) = {
id: 4
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// The DIDNamespace of the verification
string did_method = 3;
// Origin of the authentication
string subject = 3;
// The value of the linked identifier
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Invocation is usually a smart contract that is used to sign transactions on
// behalf of the DID
message Invocation {
option (cosmos.orm.v1.table) = {
id: 5
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// DIDDocument represents a W3C compliant DID Document
message DIDDocument {
option (cosmos.orm.v1.table) = {
id: 6
primary_key: {fields: "id"}
index: {
id: 1
fields: "primary_controller"
unique: false
}
};
// id is the DID that is the subject of this DID Document (REQUIRED)
string id = 1;
// primary_controller identifies the primary entity that controls the DID
// document (OPTIONAL)
string primary_controller = 2;
// alsoKnownAs expresses other identifiers for the DID subject (OPTIONAL)
repeated string also_known_as = 3;
// verificationMethod expresses verification methods (OPTIONAL)
repeated VerificationMethod verification_method = 4;
// authentication expresses authentication verification relationships
// (OPTIONAL)
repeated VerificationMethodReference authentication = 5;
// assertionMethod expresses assertion verification relationships (OPTIONAL)
repeated VerificationMethodReference assertion_method = 6;
// keyAgreement expresses key agreement verification relationships (OPTIONAL)
repeated VerificationMethodReference key_agreement = 7;
// capabilityInvocation expresses capability invocation verification
// relationships (OPTIONAL)
repeated VerificationMethodReference capability_invocation = 8;
// capabilityDelegation expresses capability delegation verification
// relationships (OPTIONAL)
repeated VerificationMethodReference capability_delegation = 9;
// service expresses service endpoints (OPTIONAL)
repeated Service service = 10;
// Block height when the DID document was created
int64 created_at = 11;
// Block height when the DID document was last updated
int64 updated_at = 12;
// Whether the DID document is deactivated
bool deactivated = 13;
// Version number for the DID document
uint64 version = 14;
}
// DIDDocumentMetadata contains metadata about the DID document
message DIDDocumentMetadata {
option (cosmos.orm.v1.table) = {
id: 7
primary_key: {fields: "did"}
};
// did is the DID this metadata belongs to
string did = 1;
// created is when the DID was created
int64 created = 2;
// updated is when the DID was last updated
int64 updated = 3;
// deactivated is when the DID was deactivated (if applicable)
int64 deactivated = 4;
// version_id is the version identifier
string version_id = 5;
// next_update is when the next update is scheduled (if applicable)
int64 next_update = 6;
// next_version_id is the next version identifier (if applicable)
string next_version_id = 7;
// equivalentId lists equivalent DIDs
repeated string equivalent_id = 8;
// canonicalId is the canonical DID
string canonical_id = 9;
}
// VerifiableCredential represents a W3C Verifiable Credential
message VerifiableCredential {
option (cosmos.orm.v1.table) = {
id: 8
primary_key: {fields: "id"}
index: {
id: 1
fields: "issuer"
unique: false
}
index: {
id: 2
fields: "subject"
unique: false
}
index: {
id: 3
fields: "issuer,subject"
unique: true
}
};
// id is the credential identifier
string id = 1;
// context is the JSON-LD contexts
repeated string context = 2;
// credential_kinds is the credential types
repeated string credential_kinds = 3;
// issuer is the DID of the credential issuer
string issuer = 4;
// The subject of the verification
string subject = 5;
// issuanceDate is when the credential was issued
string issuance_date = 5;
// The public key of the verification
string public_key_hex = 6;
// expirationDate is when the credential expires (optional)
string expiration_date = 6;
// The verification method type
string verification_type = 7;
// credentialSubject contains the claims about the subject as JSON
bytes credential_subject = 7;
// Metadata of the verification
map<string, string> metadata = 8;
// proof contains the cryptographic proof
repeated CredentialProof proof = 8;
// CreationBlock is the block number of the creation of the controller
int64 creation_block = 9;
// credentialStatus contains information about credential revocation
// (optional)
CredentialStatus credential_status = 9;
// subject is the DID of the credential subject (for indexing)
string subject = 10;
// Block height when issued
int64 issued_at = 11;
// Block height when expires (0 if no expiration)
int64 expires_at = 12;
// Whether the credential is revoked
bool revoked = 13;
}
// DIDController represents additional controllers for a DID document
message DIDController {
option (cosmos.orm.v1.table) = {
id: 9
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "did"
unique: true
}
index: {
id: 2
fields: "controller_did"
unique: true
}
index: {
id: 3
fields: "did,controller_did"
unique: true
}
};
// id is the auto-incrementing primary key
uint64 id = 1;
// did is the DID this controller belongs to
string did = 2;
// controller_did is the controller DID
string controller_did = 3;
// added_at is when this controller was added
int64 added_at = 4;
}
+283 -139
View File
@@ -1,165 +1,71 @@
syntax = "proto3";
package did.v1;
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "did/v1/genesis.proto";
import "did/v1/state.proto";
import "did/v1/types.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/sonr-io/snrd/x/did/types";
option go_package = "github.com/sonr-io/sonr/x/did/types";
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse);
// LinkAssertion links an assertion to a controller.
rpc LinkAssertion(MsgLinkAssertion) returns (MsgLinkAssertionResponse);
// LinkAuthentication links an authentication to a controller.
rpc LinkAuthentication(MsgLinkAuthentication) returns (MsgLinkAuthenticationResponse);
// UnlinkAssertion unlinks an assertion from a controller.
rpc UnlinkAssertion(MsgUnlinkAssertion) returns (MsgUnlinkAssertionResponse);
// UnlinkAuthentication unlinks an authentication from a controller.
rpc UnlinkAuthentication(MsgUnlinkAuthentication) returns (MsgUnlinkAuthenticationResponse);
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgLinkAuthentication is the message type for the LinkAuthentication RPC.
message MsgLinkAuthentication {
option (cosmos.msg.v1.signer) = "controller";
// CreateDID creates a new DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
rpc CreateDID(MsgCreateDID) returns (MsgCreateDIDResponse);
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// UpdateDID updates an existing DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
rpc UpdateDID(MsgUpdateDID) returns (MsgUpdateDIDResponse);
// Subject is the subject of the authentication.
string subject = 2;
// DeactivateDID deactivates a DID document
rpc DeactivateDID(MsgDeactivateDID) returns (MsgDeactivateDIDResponse);
// Assertion is the assertion of the authentication.
string assertion = 3;
// AddVerificationMethod adds a new verification method to a DID document
rpc AddVerificationMethod(MsgAddVerificationMethod) returns (MsgAddVerificationMethodResponse);
// Authentication is the authentication of the authentication.
bytes credential_id = 4;
// RemoveVerificationMethod removes a verification method from a DID document
rpc RemoveVerificationMethod(MsgRemoveVerificationMethod) returns (MsgRemoveVerificationMethodResponse);
// token is the macron token to authenticate the operation.
string macaroon_token = 5;
}
// AddService adds a new service endpoint to a DID document
rpc AddService(MsgAddService) returns (MsgAddServiceResponse);
// MsgLinkAuthenticationResponse is the response type for the
// LinkAuthentication RPC.
message MsgLinkAuthenticationResponse {
// Success returns true if the specified cid is valid and not already
// encrypted.
bool success = 1;
// RemoveService removes a service endpoint from a DID document
rpc RemoveService(MsgRemoveService) returns (MsgRemoveServiceResponse);
// Controller is the address of the initialized controller.
string did = 2;
}
// IssueVerifiableCredential issues a new verifiable credential
rpc IssueVerifiableCredential(MsgIssueVerifiableCredential) returns (MsgIssueVerifiableCredentialResponse);
// MsgLinkAssertion is the message type for the LinkAssertion RPC.
message MsgLinkAssertion {
option (cosmos.msg.v1.signer) = "controller";
// RevokeVerifiableCredential revokes a verifiable credential
rpc RevokeVerifiableCredential(MsgRevokeVerifiableCredential) returns (MsgRevokeVerifiableCredentialResponse);
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// LinkExternalWallet links an external wallet as an assertion method
rpc LinkExternalWallet(MsgLinkExternalWallet) returns (MsgLinkExternalWalletResponse);
// Subject is the subject of the authentication.
string subject = 2;
// Assertion is the assertion of the authentication.
string assertion = 3;
// token is the macron token to authenticate the operation.
string macaroon_token = 4;
}
// MsgLinkAssertionResponse is the response type for the
// LinkAssertion RPC.
message MsgLinkAssertionResponse {
// Success returns true if the specified cid is valid and not already
// encrypted.
bool success = 1;
// Controller is the address of the initialized controller.
string did = 2;
}
// MsgExecuteTx is the message type for the ExecuteTx RPC.
message MsgExecuteTx {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Messages is the list of messages to execute.
map<string, bytes> messages = 2;
// MacaroonToken is the macaroon token to authenticate the operation.
string macaroon_token = 3;
}
// MsgExecuteTxResponse is the response type for the ExecuteTx RPC.
message MsgExecuteTxResponse {
bool success = 1;
string tx_hash = 2;
}
// MsgUnlinkAssertion is the message type for the UnlinkAssertion RPC.
message MsgUnlinkAssertion {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Assertion is the assertion of the authentication.
string assertion_did = 2;
// token is the macron token to authenticate the operation.
string macaroon_token = 3;
}
// MsgUnlinkAssertionResponse is the response type for the
// UnlinkAssertion RPC.
message MsgUnlinkAssertionResponse {
// Success returns true if the specified cid is valid and not already
// encrypted.
bool success = 1;
// Controller is the address of the initialized controller.
string did = 2;
}
// MsgUnlinkAuthentication is the message type for the UnlinkAuthentication RPC.
message MsgUnlinkAuthentication {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Subject is the subject of the authentication.
string authentication_did = 2;
// token is the macron token to authenticate the operation.
string macaroon_token = 3;
}
// MsgUnlinkAuthenticationResponse is the response type for the
// UnlinkAuthentication RPC.
message MsgUnlinkAuthenticationResponse {
// Success returns true if the specified cid is valid and not already
// encrypted.
bool success = 1;
// Controller is the address of the initialized controller.
string did = 2;
// RegisterWebAuthnCredential registers a new WebAuthn credential and creates a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
rpc RegisterWebAuthnCredential(MsgRegisterWebAuthnCredential) returns (MsgRegisterWebAuthnCredentialResponse);
}
// MsgUpdateParams is the Msg/UpdateParams request type.
@@ -172,10 +78,9 @@ message MsgUpdateParams {
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
// token is the macron token to authenticate the operation.
string token = 3;
}
// MsgUpdateParamsResponse defines the response structure for executing a
@@ -183,3 +88,242 @@ message MsgUpdateParams {
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgCreateDID creates a new DID document
message MsgCreateDID {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address creating the DID
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did_document is the DID document to create
DIDDocument did_document = 2 [(gogoproto.nullable) = false];
}
// MsgCreateDIDResponse defines the response for MsgCreateDID
message MsgCreateDIDResponse {
// did is the created DID identifier
string did = 1;
// vault_id is the ID of the auto-created vault (optional)
string vault_id = 2;
// vault_public_key is the public key of the auto-created vault (optional)
bytes vault_public_key = 3;
// enclave_id is the enclave ID of the auto-created vault (optional)
string enclave_id = 4;
}
// MsgUpdateDID updates an existing DID document
message MsgUpdateDID {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address updating the DID
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to update
string did = 2;
// did_document is the updated DID document
DIDDocument did_document = 3 [(gogoproto.nullable) = false];
}
// MsgUpdateDIDResponse defines the response for MsgUpdateDID
message MsgUpdateDIDResponse {}
// MsgDeactivateDID deactivates a DID document
message MsgDeactivateDID {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address deactivating the DID
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to deactivate
string did = 2;
}
// MsgDeactivateDIDResponse defines the response for MsgDeactivateDID
message MsgDeactivateDIDResponse {}
// MsgAddVerificationMethod adds a verification method to a DID document
message MsgAddVerificationMethod {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address adding the verification method
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to add the verification method to
string did = 2;
// verification_method is the verification method to add
VerificationMethod verification_method = 3 [(gogoproto.nullable) = false];
// relationships specifies which verification relationships to add
repeated string relationships = 4;
}
// MsgAddVerificationMethodResponse defines the response for
// MsgAddVerificationMethod
message MsgAddVerificationMethodResponse {}
// MsgRemoveVerificationMethod removes a verification method from a DID document
message MsgRemoveVerificationMethod {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address removing the verification method
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to remove the verification method from
string did = 2;
// verification_method_id is the ID of the verification method to remove
string verification_method_id = 3;
}
// MsgRemoveVerificationMethodResponse defines the response for
// MsgRemoveVerificationMethod
message MsgRemoveVerificationMethodResponse {}
// MsgAddService adds a service endpoint to a DID document
message MsgAddService {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address adding the service
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to add the service to
string did = 2;
// service is the service to add
Service service = 3 [(gogoproto.nullable) = false];
}
// MsgAddServiceResponse defines the response for MsgAddService
message MsgAddServiceResponse {}
// MsgRemoveService removes a service endpoint from a DID document
message MsgRemoveService {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address removing the service
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to remove the service from
string did = 2;
// service_id is the ID of the service to remove
string service_id = 3;
}
// MsgRemoveServiceResponse defines the response for MsgRemoveService
message MsgRemoveServiceResponse {}
// MsgIssueVerifiableCredential issues a new verifiable credential
message MsgIssueVerifiableCredential {
option (cosmos.msg.v1.signer) = "issuer";
// issuer is the address issuing the credential
string issuer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// credential is the verifiable credential to issue
VerifiableCredential credential = 2 [(gogoproto.nullable) = false];
}
// MsgIssueVerifiableCredentialResponse defines the response for
// MsgIssueVerifiableCredential
message MsgIssueVerifiableCredentialResponse {
// credential_id is the ID of the issued credential
string credential_id = 1;
}
// MsgRevokeVerifiableCredential revokes a verifiable credential
message MsgRevokeVerifiableCredential {
option (cosmos.msg.v1.signer) = "issuer";
// issuer is the address revoking the credential
string issuer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// credential_id is the ID of the credential to revoke
string credential_id = 2;
// revocation_reason is the reason for revocation
string revocation_reason = 3;
}
// MsgRevokeVerifiableCredentialResponse defines the response for
// MsgRevokeVerifiableCredential
message MsgRevokeVerifiableCredentialResponse {}
// MsgLinkExternalWallet links an external wallet to a DID as an assertion method
message MsgLinkExternalWallet {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address that controls the DID
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// did is the DID to link the wallet to
string did = 2;
// wallet_address is the external wallet address
string wallet_address = 3;
// chain_id identifies the blockchain (e.g., "1" for Ethereum mainnet, "cosmoshub-4")
string wallet_chain_id = 4;
// wallet_type specifies the wallet type ("ethereum", "cosmos")
string wallet_type = 5;
// ownership_proof is the signature proving ownership of the wallet
bytes ownership_proof = 6;
// challenge is the message that was signed to create the ownership_proof
bytes challenge = 7;
// verification_method_id is the ID for the new verification method
string verification_method_id = 8;
}
// MsgLinkExternalWalletResponse defines the response for MsgLinkExternalWallet
message MsgLinkExternalWalletResponse {
// verification_method_id is the ID of the created verification method
string verification_method_id = 1;
}
// MsgRegisterWebAuthnCredential registers a new WebAuthn credential and creates a DID
message MsgRegisterWebAuthnCredential {
option (cosmos.msg.v1.signer) = "controller";
// controller is the address that will control the created DID
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// username is the human-readable identifier for the DID
string username = 2;
// webauthn_credential contains the WebAuthn credential data
WebAuthnCredential webauthn_credential = 3 [(gogoproto.nullable) = false];
// verification_method_id is the ID for the WebAuthn verification method
string verification_method_id = 4;
// auto_create_vault indicates whether to automatically create a vault
bool auto_create_vault = 5;
}
// MsgRegisterWebAuthnCredentialResponse defines the response for MsgRegisterWebAuthnCredential
message MsgRegisterWebAuthnCredentialResponse {
// did is the created DID identifier
string did = 1;
// verification_method_id is the ID of the created verification method
string verification_method_id = 2;
// vault_id is the ID of the auto-created vault (if requested)
string vault_id = 3;
// vault_public_key is the public key of the auto-created vault (if requested)
bytes vault_public_key = 4;
// enclave_id is the enclave ID of the auto-created vault (if requested)
string enclave_id = 5;
}
+161
View File
@@ -0,0 +1,161 @@
syntax = "proto3";
package did.v1;
import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/sonr-io/sonr/x/did/types";
// VerificationMethod represents a verification method in a DID document
message VerificationMethod {
// id is the verification method identifier (REQUIRED)
string id = 1;
// verification_method_kind is the verification method type (REQUIRED)
string verification_method_kind = 2;
// controller is the DID that controls this verification method (REQUIRED)
string controller = 3;
// Public key material (optional, only one should be set)
// publicKeyJwk represents the public key as a JSON Web Key
string public_key_jwk = 4;
// publicKeyMultibase represents the public key as multibase
string public_key_multibase = 5;
// publicKeyBase58 represents the public key in Base58 (legacy)
string public_key_base58 = 6;
// publicKeyBase64 represents the public key in Base64 (legacy)
string public_key_base64 = 7;
// publicKeyPem represents the public key in PEM format (legacy)
string public_key_pem = 8;
// publicKeyHex represents the public key in hexadecimal (legacy)
string public_key_hex = 9;
// WebAuthn credential information (for WebAuthn integration)
WebAuthnCredential webauthn_credential = 10;
// blockchain_account_id for external wallet linking (CAIP-10 format)
// Format: "eip155:1:0x89a932207c485f85226d86f7cd486a89a24fcc12" for Ethereum
// Format: "cosmos:cosmoshub-4:cosmos1..." for Cosmos chains
string blockchain_account_id = 11;
}
// VerificationMethodReference can be either an embedded verification method
// or a reference
message VerificationMethodReference {
// verification_method_id is a reference to a verification method by ID (optional)
string verification_method_id = 1;
// embedded_verification_method is an embedded verification method (optional)
VerificationMethod embedded_verification_method = 2;
}
// Service represents a service endpoint in a DID document
message Service {
// id is the service identifier (REQUIRED)
string id = 1;
// service_kind is the service type (REQUIRED)
string service_kind = 2;
// single_endpoint for a single URL
string single_endpoint = 3;
// multiple_endpoints for multiple URLs
ServiceEndpoints multiple_endpoints = 4;
// complex_endpoint for complex endpoint objects as JSON
bytes complex_endpoint = 5;
// Additional properties for the service
map<string, string> properties = 6;
}
// ServiceEndpoints represents multiple service endpoints
message ServiceEndpoints {
repeated string endpoints = 1;
}
// WebAuthnCredential represents WebAuthn credential information
message WebAuthnCredential {
// credential_id is the WebAuthn credential ID
string credential_id = 1;
// public_key is the WebAuthn public key
bytes public_key = 2;
// algorithm is the signing algorithm
int32 algorithm = 3;
// attestation_type is the attestation type
string attestation_type = 4;
// origin is the origin where the credential was created
string origin = 5;
// created_at is when the credential was created
int64 created_at = 6;
// rp_id is the Relying Party ID
string rp_id = 7;
// rp_name is the Relying Party Name
string rp_name = 8;
// transports are the authenticator transports
repeated string transports = 9;
// user_verified indicates whether user verification was performed
bool user_verified = 10;
// signature_algorithm provides detailed algorithm information
string signature_algorithm = 11;
// raw_id is the base64url encoded raw credential ID
string raw_id = 12;
// client_data_json is the base64url encoded client data JSON
string client_data_json = 13;
// attestation_object is the base64url encoded attestation object
string attestation_object = 14;
}
// CredentialProof represents a cryptographic proof for a verifiable
// credential
message CredentialProof {
// proof_kind is the proof type
string proof_kind = 1;
// created is when the proof was created
string created = 2;
// verificationMethod is the verification method used
string verification_method = 3;
// proofPurpose is the purpose of the proof
string proof_purpose = 4;
// signature is the cryptographic signature
string signature = 5;
// Additional proof properties
map<string, string> properties = 6;
}
// CredentialStatus represents the revocation status of a credential
message CredentialStatus {
// id is the status identifier
string id = 1;
// status_kind is the status type
string status_kind = 2;
// Additional status properties
map<string, string> properties = 3;
}