mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
Regular → Executable
+1
-3
@@ -7,7 +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"};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
## Overview
|
||||
The DWN (Decentralized Web Node) module provides decentralized data storage with encryption, permissions, and protocol management.
|
||||
|
||||
## 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 "RecordsWrite"}}
|
||||
- Creates or updates records in decentralized storage
|
||||
- Supports encryption for sensitive data
|
||||
- Stores data on IPFS with CID references
|
||||
- Enables protocol-based data organization
|
||||
{{else if eq .MethodDescriptorProto.Name "RecordsDelete"}}
|
||||
- Removes records from DWN storage
|
||||
- Can prune descendant records recursively
|
||||
- Maintains deletion history for audit
|
||||
{{else if eq .MethodDescriptorProto.Name "ProtocolsConfigure"}}
|
||||
- Defines custom protocols for data organization
|
||||
- Establishes schema and validation rules
|
||||
- Enables structured data interactions
|
||||
{{else if eq .MethodDescriptorProto.Name "PermissionsGrant"}}
|
||||
- Grants access permissions to other DIDs
|
||||
- Supports fine-grained access control
|
||||
- Can scope permissions to specific protocols or records
|
||||
{{else if eq .MethodDescriptorProto.Name "PermissionsRevoke"}}
|
||||
- Revokes previously granted permissions
|
||||
- Immediate effect on access control
|
||||
{{else if eq .MethodDescriptorProto.Name "RotateVaultKeys"}}
|
||||
- Rotates encryption keys for vaults
|
||||
- Maintains data accessibility during rotation
|
||||
- Supports scheduled and forced rotations
|
||||
{{else if eq .MethodDescriptorProto.Name "Records"}}
|
||||
- Queries records with flexible filters
|
||||
- Supports filtering by protocol, schema, parent
|
||||
- Returns paginated results
|
||||
{{else if eq .MethodDescriptorProto.Name "Vault"}}
|
||||
- Retrieves vault encryption status
|
||||
- Shows key rotation history
|
||||
- Returns vault metadata
|
||||
{{else if eq .MethodDescriptorProto.Name "IPFS"}}
|
||||
- Returns IPFS node status and connectivity
|
||||
- Shows peer count and storage metrics
|
||||
{{else if eq .MethodDescriptorProto.Name "CID"}}
|
||||
- Retrieves data by IPFS Content Identifier
|
||||
- Returns raw data from distributed storage
|
||||
{{end}}
|
||||
|
||||
## Storage Architecture
|
||||
|
||||
- **IPFS Integration**: Large data stored on IPFS network
|
||||
- **On-chain References**: Blockchain stores CIDs and metadata
|
||||
- **Vault Encryption**: Sensitive data encrypted before storage
|
||||
- **Protocol Organization**: Data structured by custom protocols
|
||||
|
||||
## Security Features
|
||||
|
||||
- End-to-end encryption for private data
|
||||
- JWT-based authorization for operations
|
||||
- Granular permission system
|
||||
- Cryptographic attestations for data integrity
|
||||
@@ -0,0 +1,155 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package dwn.v1;
|
||||
|
||||
option go_package = "github.com/sonr-io/sonr/x/dwn/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// EventRecordWritten is emitted when a record is written to DWN
|
||||
message EventRecordWritten {
|
||||
// Record ID
|
||||
string record_id = 1;
|
||||
|
||||
// Target DID
|
||||
string target = 2;
|
||||
|
||||
// Protocol URI
|
||||
string protocol = 3;
|
||||
|
||||
// Schema URI
|
||||
string schema = 4;
|
||||
|
||||
// Data CID
|
||||
string data_cid = 5;
|
||||
|
||||
// Data size in bytes
|
||||
uint64 data_size = 6;
|
||||
|
||||
// Whether data is encrypted
|
||||
bool encrypted = 7;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 8;
|
||||
}
|
||||
|
||||
// EventRecordDeleted is emitted when a record is deleted from DWN
|
||||
message EventRecordDeleted {
|
||||
// Record ID
|
||||
string record_id = 1;
|
||||
|
||||
// Target DID
|
||||
string target = 2;
|
||||
|
||||
// Deleter address
|
||||
string deleter = 3;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 4;
|
||||
}
|
||||
|
||||
// EventProtocolConfigured is emitted when a protocol is configured
|
||||
message EventProtocolConfigured {
|
||||
// Target DID
|
||||
string target = 1;
|
||||
|
||||
// Protocol URI
|
||||
string protocol_uri = 2;
|
||||
|
||||
// Whether protocol is published
|
||||
bool published = 3;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 4;
|
||||
}
|
||||
|
||||
// EventPermissionGranted is emitted when a permission is granted
|
||||
message EventPermissionGranted {
|
||||
// Permission ID
|
||||
string permission_id = 1;
|
||||
|
||||
// Grantor DID
|
||||
string grantor = 2;
|
||||
|
||||
// Grantee DID
|
||||
string grantee = 3;
|
||||
|
||||
// Interface name
|
||||
string interface_name = 4;
|
||||
|
||||
// Method name
|
||||
string method = 5;
|
||||
|
||||
// Expiration timestamp
|
||||
google.protobuf.Timestamp expires_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 7;
|
||||
}
|
||||
|
||||
// EventPermissionRevoked is emitted when a permission is revoked
|
||||
message EventPermissionRevoked {
|
||||
// Permission ID
|
||||
string permission_id = 1;
|
||||
|
||||
// Revoker DID
|
||||
string revoker = 2;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 3;
|
||||
}
|
||||
|
||||
// EventVaultCreated is emitted when a vault is created
|
||||
message EventVaultCreated {
|
||||
// Vault ID
|
||||
string vault_id = 1;
|
||||
|
||||
// Owner DID
|
||||
string owner = 2;
|
||||
|
||||
// Vault public key
|
||||
string public_key = 3;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 4;
|
||||
}
|
||||
|
||||
// EventVaultKeysRotated is emitted when vault keys are rotated
|
||||
message EventVaultKeysRotated {
|
||||
// Vault ID
|
||||
string vault_id = 1;
|
||||
|
||||
// Owner DID
|
||||
string owner = 2;
|
||||
|
||||
// New public key
|
||||
string new_public_key = 3;
|
||||
|
||||
// Rotation height
|
||||
uint64 rotation_height = 4;
|
||||
|
||||
// Block height
|
||||
uint64 block_height = 5;
|
||||
}
|
||||
|
||||
// EventKeyRotation is emitted when encryption keys are rotated
|
||||
message EventKeyRotation {
|
||||
// Previous key version (0 if first rotation)
|
||||
uint64 old_key_version = 1;
|
||||
|
||||
// New key version
|
||||
uint64 new_key_version = 2;
|
||||
|
||||
// Reason for rotation
|
||||
string reason = 3;
|
||||
|
||||
// Block height when rotation occurred
|
||||
uint64 block_height = 4;
|
||||
|
||||
// Whether running in single node mode
|
||||
bool single_node_mode = 5;
|
||||
|
||||
// Number of validators at time of rotation
|
||||
uint32 validator_count = 6;
|
||||
}
|
||||
+53
-24
@@ -1,44 +1,73 @@
|
||||
syntax = "proto3";
|
||||
package dwn.v1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "amino/amino.proto";
|
||||
import "dwn/v1/state.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/sonr-io/snrd/x/dwn/types";
|
||||
option go_package = "github.com/sonr-io/sonr/x/dwn/types";
|
||||
|
||||
// GenesisState defines the module genesis state
|
||||
message GenesisState {
|
||||
// Params defines all the parameters of the module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
|
||||
// DWN Records
|
||||
repeated DWNRecord records = 2 [(gogoproto.nullable) = false];
|
||||
|
||||
// DWN Protocols
|
||||
repeated DWNProtocol protocols = 3 [(gogoproto.nullable) = false];
|
||||
|
||||
// DWN Permissions
|
||||
repeated DWNPermission permissions = 4 [(gogoproto.nullable) = false];
|
||||
|
||||
// Vaults
|
||||
repeated VaultState vaults = 5 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Params defines the set of module parameters.
|
||||
message Params {
|
||||
option (amino.name) = "vault/params";
|
||||
option (amino.name) = "dwn/params";
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Attenuation defines the available attenuations
|
||||
repeated Attenuation attenuations = 1;
|
||||
repeated string allowed_operators = 2;
|
||||
// Maximum size for DWN record data in bytes
|
||||
uint64 max_record_size = 1;
|
||||
|
||||
// Maximum number of protocols per DWN
|
||||
uint32 max_protocols_per_dwn = 2;
|
||||
|
||||
// Maximum number of permissions per DWN
|
||||
uint32 max_permissions_per_dwn = 3;
|
||||
|
||||
// Enable vault creation
|
||||
bool vault_creation_enabled = 4;
|
||||
|
||||
// Minimum vault refresh interval in blocks
|
||||
uint64 min_vault_refresh_interval = 5;
|
||||
|
||||
// Encryption configuration
|
||||
bool encryption_enabled = 6;
|
||||
|
||||
// Key rotation interval in days
|
||||
uint32 key_rotation_days = 7;
|
||||
|
||||
// Minimum validators required for key generation (percentage of active set)
|
||||
uint32 min_validators_for_key_gen = 8;
|
||||
|
||||
// Protocols that require encryption
|
||||
repeated string encrypted_protocols = 9;
|
||||
|
||||
// Schemas that require encryption
|
||||
repeated string encrypted_schemas = 10;
|
||||
|
||||
// Enable single-node fallback for development
|
||||
bool single_node_fallback = 11;
|
||||
}
|
||||
|
||||
// Attenuation defines the attenuation of a resource
|
||||
message Attenuation {
|
||||
Resource resource = 1;
|
||||
repeated Capability capabilities = 2;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Resource reprensents the available resources of a decentralized web node
|
||||
message Resource {
|
||||
string kind = 1;
|
||||
string template = 2;
|
||||
message IPFSStatus {
|
||||
string peer_id = 1;
|
||||
string peer_name = 2;
|
||||
string peer_type = 3;
|
||||
string version = 4;
|
||||
}
|
||||
|
||||
Regular → Executable
+280
-11
@@ -1,27 +1,87 @@
|
||||
syntax = "proto3";
|
||||
package dwn.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "dwn/v1/genesis.proto";
|
||||
import "dwn/v1/state.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/sonr-io/snrd/x/dwn/types";
|
||||
|
||||
// ╭─────────────────────────────────────────────────────────╮
|
||||
// │ RPC Query Service │
|
||||
// ╰─────────────────────────────────────────────────────────╯
|
||||
option go_package = "github.com/sonr-io/sonr/x/dwn/types";
|
||||
|
||||
// Query provides defines the gRPC querier service.
|
||||
service Query {
|
||||
// Params queries all parameters of the module.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/vault/v1/params";
|
||||
option (google.api.http).get = "/dwn/v1/params";
|
||||
}
|
||||
|
||||
// IPFS queries the status of the IPFS node
|
||||
rpc IPFS(QueryIPFSRequest) returns (QueryIPFSResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/ipfs";
|
||||
}
|
||||
|
||||
// CID returns the data for a given CID
|
||||
rpc CID(QueryCIDRequest) returns (QueryCIDResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/ipfs/{cid}";
|
||||
}
|
||||
|
||||
// Records queries DWN records with filters
|
||||
//
|
||||
// {{.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 "dwn_docs.md"}}
|
||||
rpc Records(QueryRecordsRequest) returns (QueryRecordsResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/records/{target}";
|
||||
}
|
||||
|
||||
// Record queries a specific DWN record by ID
|
||||
rpc Record(QueryRecordRequest) returns (QueryRecordResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/records/{target}/{record_id}";
|
||||
}
|
||||
|
||||
// Protocols queries DWN protocols
|
||||
rpc Protocols(QueryProtocolsRequest) returns (QueryProtocolsResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/protocols/{target}";
|
||||
}
|
||||
|
||||
// Protocol queries a specific DWN protocol
|
||||
rpc Protocol(QueryProtocolRequest) returns (QueryProtocolResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/protocols/{target}/{protocol_uri}";
|
||||
}
|
||||
|
||||
// Permissions queries DWN permissions
|
||||
rpc Permissions(QueryPermissionsRequest) returns (QueryPermissionsResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/permissions/{target}";
|
||||
}
|
||||
|
||||
// Vault queries a specific vault
|
||||
rpc Vault(QueryVaultRequest) returns (QueryVaultResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/vaults/{vault_id}";
|
||||
}
|
||||
|
||||
// Vaults queries vaults by owner
|
||||
rpc Vaults(QueryVaultsRequest) returns (QueryVaultsResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/vaults";
|
||||
}
|
||||
|
||||
// EncryptedRecord queries a specific encrypted record with automatic decryption
|
||||
rpc EncryptedRecord(QueryEncryptedRecordRequest) returns (QueryEncryptedRecordResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/encrypted-records/{target}/{record_id}";
|
||||
}
|
||||
|
||||
// EncryptionStatus queries current encryption key state and version
|
||||
rpc EncryptionStatus(QueryEncryptionStatusRequest) returns (QueryEncryptionStatusResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/encryption/status";
|
||||
}
|
||||
|
||||
// VRFContributions lists VRF contributions for current consensus round
|
||||
rpc VRFContributions(QueryVRFContributionsRequest) returns (QueryVRFContributionsResponse) {
|
||||
option (google.api.http).get = "/dwn/v1/encryption/vrf-contributions";
|
||||
}
|
||||
}
|
||||
|
||||
// ╭──────────────────────────────────────────────────────────╮
|
||||
// │ RPC Query Messages │
|
||||
// ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
// QueryParamsRequest is the request type for the Query/Params RPC method.
|
||||
message QueryParamsRequest {}
|
||||
|
||||
@@ -30,3 +90,212 @@ message QueryParamsResponse {
|
||||
// params defines the parameters of the module.
|
||||
Params params = 1;
|
||||
}
|
||||
|
||||
// QueryIPFSRequest is the request type for the Query/IPFS RPC method.
|
||||
message QueryIPFSRequest {}
|
||||
|
||||
// QueryIPFSResponse is the response type for the Query/IPFS RPC method.
|
||||
message QueryIPFSResponse {
|
||||
// IPFS status
|
||||
IPFSStatus status = 1;
|
||||
}
|
||||
|
||||
// QueryCIDRequest is the request type for the Query/CID RPC method.
|
||||
message QueryCIDRequest {
|
||||
// CID to query
|
||||
string cid = 1;
|
||||
}
|
||||
|
||||
// QueryCIDResponse is the response type for the Query/CID RPC method.
|
||||
message QueryCIDResponse {
|
||||
// Status code
|
||||
int32 status_code = 1;
|
||||
|
||||
// CID data
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
// QueryRecordsRequest is the request type for querying DWN records
|
||||
message QueryRecordsRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Optional protocol filter
|
||||
string protocol = 2;
|
||||
// Optional schema filter
|
||||
string schema = 3;
|
||||
// Optional parent ID filter
|
||||
string parent_id = 4;
|
||||
// Filter by published status
|
||||
bool published_only = 5;
|
||||
// Pagination
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 6;
|
||||
}
|
||||
|
||||
// QueryRecordsResponse is the response type for querying DWN records
|
||||
message QueryRecordsResponse {
|
||||
// List of records
|
||||
repeated DWNRecord records = 1 [(gogoproto.nullable) = false];
|
||||
// Pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryRecordRequest is the request type for querying a specific DWN record
|
||||
message QueryRecordRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Record ID
|
||||
string record_id = 2;
|
||||
}
|
||||
|
||||
// QueryRecordResponse is the response type for querying a specific DWN record
|
||||
message QueryRecordResponse {
|
||||
// The record
|
||||
DWNRecord record = 1;
|
||||
}
|
||||
|
||||
// QueryProtocolsRequest is the request type for querying DWN protocols
|
||||
message QueryProtocolsRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Filter by published status
|
||||
bool published_only = 2;
|
||||
// Pagination
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
||||
}
|
||||
|
||||
// QueryProtocolsResponse is the response type for querying DWN protocols
|
||||
message QueryProtocolsResponse {
|
||||
// List of protocols
|
||||
repeated DWNProtocol protocols = 1 [(gogoproto.nullable) = false];
|
||||
// Pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryProtocolRequest is the request type for querying a specific DWN protocol
|
||||
message QueryProtocolRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Protocol URI
|
||||
string protocol_uri = 2;
|
||||
}
|
||||
|
||||
// QueryProtocolResponse is the response type for querying a specific DWN protocol
|
||||
message QueryProtocolResponse {
|
||||
// The protocol
|
||||
DWNProtocol protocol = 1;
|
||||
}
|
||||
|
||||
// QueryPermissionsRequest is the request type for querying DWN permissions
|
||||
message QueryPermissionsRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Optional grantor filter
|
||||
string grantor = 2;
|
||||
// Optional grantee filter
|
||||
string grantee = 3;
|
||||
// Optional interface filter
|
||||
string interface_name = 4;
|
||||
// Optional method filter
|
||||
string method = 5;
|
||||
// Include revoked permissions
|
||||
bool include_revoked = 6;
|
||||
// Pagination
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 7;
|
||||
}
|
||||
|
||||
// QueryPermissionsResponse is the response type for querying DWN permissions
|
||||
message QueryPermissionsResponse {
|
||||
// List of permissions
|
||||
repeated DWNPermission permissions = 1 [(gogoproto.nullable) = false];
|
||||
// Pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryVaultRequest is the request type for querying a specific vault
|
||||
message QueryVaultRequest {
|
||||
// Vault ID
|
||||
string vault_id = 1;
|
||||
}
|
||||
|
||||
// QueryVaultResponse is the response type for querying a specific vault
|
||||
message QueryVaultResponse {
|
||||
// The vault
|
||||
VaultState vault = 1;
|
||||
}
|
||||
|
||||
// QueryVaultsRequest is the request type for querying vaults by owner
|
||||
message QueryVaultsRequest {
|
||||
// Optional owner filter
|
||||
string owner = 1;
|
||||
// Pagination
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryVaultsResponse is the response type for querying vaults
|
||||
message QueryVaultsResponse {
|
||||
// List of vaults
|
||||
repeated VaultState vaults = 1 [(gogoproto.nullable) = false];
|
||||
// Pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryEncryptedRecordRequest is the request type for querying encrypted records
|
||||
message QueryEncryptedRecordRequest {
|
||||
// Target DWN (DID)
|
||||
string target = 1;
|
||||
// Record ID
|
||||
string record_id = 2;
|
||||
// Optional: return encrypted data instead of decrypting
|
||||
bool return_encrypted = 3;
|
||||
}
|
||||
|
||||
// QueryEncryptedRecordResponse is the response type for querying encrypted records
|
||||
message QueryEncryptedRecordResponse {
|
||||
// The record with decrypted data (if requested)
|
||||
DWNRecord record = 1;
|
||||
// Encryption metadata for the record
|
||||
EncryptionMetadata encryption_metadata = 2;
|
||||
// Whether data was decrypted
|
||||
bool was_decrypted = 3;
|
||||
}
|
||||
|
||||
// QueryEncryptionStatusRequest is the request type for querying encryption status
|
||||
message QueryEncryptionStatusRequest {}
|
||||
|
||||
// QueryEncryptionStatusResponse is the response type for querying encryption status
|
||||
message QueryEncryptionStatusResponse {
|
||||
// Current encryption key version
|
||||
uint64 current_key_version = 1;
|
||||
// Current validator set participating in consensus
|
||||
repeated string validator_set = 2;
|
||||
// Whether running in single-node mode
|
||||
bool single_node_mode = 3;
|
||||
// Last key rotation timestamp
|
||||
int64 last_rotation = 4;
|
||||
// Next scheduled rotation timestamp
|
||||
int64 next_rotation = 5;
|
||||
// Total encrypted records in the system
|
||||
uint64 total_encrypted_records = 6;
|
||||
}
|
||||
|
||||
// QueryVRFContributionsRequest is the request type for querying VRF contributions
|
||||
message QueryVRFContributionsRequest {
|
||||
// Optional: filter by validator address
|
||||
string validator_address = 1;
|
||||
// Optional: filter by block height
|
||||
int64 block_height = 2;
|
||||
// Pagination
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 3;
|
||||
}
|
||||
|
||||
// QueryVRFContributionsResponse is the response type for querying VRF contributions
|
||||
message QueryVRFContributionsResponse {
|
||||
// List of VRF contributions
|
||||
repeated VRFContribution contributions = 1 [(gogoproto.nullable) = false];
|
||||
// Current consensus round information
|
||||
VRFConsensusRound current_round = 2;
|
||||
// Pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+363
-23
@@ -3,31 +3,371 @@ package dwn.v1;
|
||||
|
||||
import "cosmos/orm/v1/orm.proto";
|
||||
|
||||
option go_package = "github.com/sonr-io/snrd/x/dwn/types";
|
||||
option go_package = "github.com/sonr-io/sonr/x/dwn/types";
|
||||
|
||||
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
|
||||
|
||||
message Credential {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 1;
|
||||
primary_key: { fields: "id" }
|
||||
};
|
||||
|
||||
bytes id = 1; // The credential ID as a byte array
|
||||
string kind = 2; // The credential type (e.g. "public-key")
|
||||
repeated string transports = 3; // Optional transport hints (usb, nfc, ble, internal)
|
||||
bytes public_key = 4; // The credential's public key
|
||||
string attestation_type = 5; // The attestation type used (e.g. "none", "indirect", etc)
|
||||
uint64 created_at = 6; // Timestamp of when the credential was created
|
||||
// EncryptionMetadata contains metadata for consensus-based encryption
|
||||
message EncryptionMetadata {
|
||||
// Encryption algorithm used (e.g., "AES-256-GCM")
|
||||
string algorithm = 1;
|
||||
// Input used for VRF consensus key derivation
|
||||
bytes consensus_input = 2;
|
||||
// Nonce used for encryption
|
||||
bytes nonce = 3;
|
||||
// Authentication tag from AES-GCM
|
||||
bytes auth_tag = 4;
|
||||
// Block height when encryption was performed
|
||||
int64 encryption_height = 5;
|
||||
// Validator set participating in consensus
|
||||
repeated string validator_set = 6;
|
||||
// Key rotation version
|
||||
uint64 key_version = 7;
|
||||
// Single node development mode flag
|
||||
bool single_node_mode = 8;
|
||||
// HMAC-SHA256 authentication tag for data integrity
|
||||
bytes data_hmac = 9;
|
||||
// Salt used for key derivation
|
||||
bytes key_derivation_salt = 10;
|
||||
// Additional authenticated data (AAD) for AES-GCM
|
||||
bytes additional_data = 11;
|
||||
}
|
||||
|
||||
message Profile {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 2;
|
||||
primary_key: { fields: "account" }
|
||||
index: { id: 1 fields: "amount" }
|
||||
};
|
||||
// EncryptionKeyState contains the current key and contributions for a given key version
|
||||
message EncryptionKeyState {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 6
|
||||
primary_key: {fields: "key_version"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "last_rotation"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 2
|
||||
fields: "next_rotation"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
bytes account = 1;
|
||||
uint64 amount = 2;
|
||||
// Current encryption key (stored encrypted or as reference)
|
||||
bytes current_key = 1;
|
||||
// Key version/epoch identifier
|
||||
uint64 key_version = 2;
|
||||
// Validator set participating in consensus
|
||||
repeated string validator_set = 3;
|
||||
// VRF contributions for this key generation round
|
||||
repeated VRFContribution contributions = 4;
|
||||
// Last rotation timestamp (Unix timestamp)
|
||||
int64 last_rotation = 5;
|
||||
// Next scheduled rotation timestamp (Unix timestamp)
|
||||
int64 next_rotation = 6;
|
||||
// Single node development mode flag
|
||||
bool single_node_mode = 7;
|
||||
// Usage count for this key (for usage-based rotation)
|
||||
uint64 usage_count = 8;
|
||||
// Maximum usage count before rotation
|
||||
uint64 max_usage_count = 9;
|
||||
// Rotation interval in seconds (for time-based rotation)
|
||||
int64 rotation_interval = 10;
|
||||
// Key creation timestamp (Unix timestamp)
|
||||
int64 created_at = 11;
|
||||
// Previous key version for migration support
|
||||
uint64 previous_key_version = 12;
|
||||
}
|
||||
|
||||
// VRFConsensusRound tracks a specific consensus round for key generation
|
||||
message VRFConsensusRound {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 7
|
||||
primary_key: {fields: "round_number"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "status"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 2
|
||||
fields: "expiry_height"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Round number for this consensus round
|
||||
uint64 round_number = 1;
|
||||
// Key version this round is generating
|
||||
uint64 key_version = 2;
|
||||
// Number of contributions required for consensus
|
||||
uint32 required_contributions = 3;
|
||||
// Number of contributions received so far
|
||||
uint32 received_contributions = 4;
|
||||
// Current status: "waiting_for_contributions", "complete", "expired", "single_node_mode"
|
||||
string status = 5;
|
||||
// Block height when this round expires
|
||||
int64 expiry_height = 6;
|
||||
// Block height when round was initiated
|
||||
int64 initiated_height = 7;
|
||||
// Consensus input used for this round
|
||||
bytes consensus_input = 8;
|
||||
// Whether this round completed successfully
|
||||
bool completed = 9;
|
||||
}
|
||||
|
||||
// EncryptionStats contains encryption statistics for monitoring
|
||||
message EncryptionStats {
|
||||
// Total number of encrypted records
|
||||
int64 total_encrypted_records = 1;
|
||||
// Total number of decryption errors
|
||||
int64 total_decryption_errors = 2;
|
||||
// Last encryption height
|
||||
int64 last_encryption_height = 3;
|
||||
}
|
||||
|
||||
// SaltStore contains salt management for encryption operations
|
||||
message SaltStore {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 8
|
||||
primary_key: {fields: "record_id"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "created_at"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Unique identifier for the encrypted record
|
||||
string record_id = 1;
|
||||
// Salt value used for key derivation
|
||||
bytes salt_value = 2;
|
||||
// Creation timestamp (Unix timestamp)
|
||||
int64 created_at = 3;
|
||||
// Key version associated with this salt
|
||||
uint64 key_version = 4;
|
||||
// Algorithm used with this salt (e.g., "PBKDF2-SHA256")
|
||||
string algorithm = 5;
|
||||
}
|
||||
|
||||
// VRFContribution contains a VRF contribution for a given validator
|
||||
message VRFContribution {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 5
|
||||
primary_key: {fields: "validator_address,block_height"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "block_height"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 2
|
||||
fields: "timestamp"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Validator address
|
||||
string validator_address = 1;
|
||||
// VRF randomness output
|
||||
bytes randomness = 2;
|
||||
// VRF proof for verification
|
||||
bytes proof = 3;
|
||||
// Block height when contribution was made
|
||||
int64 block_height = 4;
|
||||
// Unix timestamp when contribution was submitted
|
||||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
// EncryptedDWNRecord contains an encrypted DWN record
|
||||
message EncryptedDWNRecord {
|
||||
// Unique identifier for the record
|
||||
string record_id = 1;
|
||||
// Encrypted data
|
||||
bytes encrypted_data = 2;
|
||||
// Nonce used for encryption
|
||||
bytes nonce = 3;
|
||||
// Key version
|
||||
uint64 key_version = 4;
|
||||
// IPFS hash of the record data
|
||||
string ipfs_hash = 5;
|
||||
}
|
||||
|
||||
// EnclaveData represents encrypted private key material within a secure enclave
|
||||
message EnclaveData {
|
||||
// Encrypted private key material from the WASM enclave
|
||||
bytes private_data = 1;
|
||||
// Public key corresponding to the private key
|
||||
bytes public_key = 2;
|
||||
// Unique identifier for the enclave instance
|
||||
string enclave_id = 3;
|
||||
// Version number for refresh tracking
|
||||
int64 version = 4;
|
||||
}
|
||||
|
||||
// DWNMessageDescriptor contains metadata about a DWN message
|
||||
message DWNMessageDescriptor {
|
||||
// Interface type (e.g., "Records", "Protocols", "Permissions")
|
||||
string interface_name = 1;
|
||||
// Method name (e.g., "Write", "Query", "Configure")
|
||||
string method = 2;
|
||||
// ISO 8601 timestamp of when the message was created
|
||||
string message_timestamp = 3;
|
||||
// CID of the message data
|
||||
string data_cid = 4;
|
||||
// Size of the data in bytes
|
||||
int64 data_size = 5;
|
||||
// MIME type of the data
|
||||
string data_format = 6;
|
||||
}
|
||||
|
||||
// DWNRecord represents a record stored in a Decentralized Web Node
|
||||
message DWNRecord {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 1
|
||||
primary_key: {fields: "record_id"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "target,protocol"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 2
|
||||
fields: "target,schema"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 3
|
||||
fields: "parent_id"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Unique identifier for the record
|
||||
string record_id = 1;
|
||||
// DID of the DWN target
|
||||
string target = 2;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 3;
|
||||
// Authorization JWT or signature
|
||||
string authorization = 4;
|
||||
// Record data payload
|
||||
bytes data = 5;
|
||||
// Optional protocol URI this record conforms to
|
||||
string protocol = 6;
|
||||
// Optional protocol path
|
||||
string protocol_path = 7;
|
||||
// Optional schema URI for data validation
|
||||
string schema = 8;
|
||||
// Optional parent record ID for threading
|
||||
string parent_id = 9;
|
||||
// Published flag for public visibility
|
||||
bool published = 10;
|
||||
// Attestation signature
|
||||
string attestation = 11;
|
||||
// Encryption details (legacy field)
|
||||
string encryption = 12;
|
||||
// Key derivation scheme (legacy field)
|
||||
string key_derivation_scheme = 13;
|
||||
// Creation timestamp (Unix timestamp)
|
||||
int64 created_at = 14;
|
||||
// Last update timestamp (Unix timestamp)
|
||||
int64 updated_at = 15;
|
||||
// Block height when created
|
||||
int64 created_height = 16;
|
||||
// Encryption metadata for consensus-based encryption
|
||||
EncryptionMetadata encryption_metadata = 17;
|
||||
// Flag indicating if the record is encrypted
|
||||
bool is_encrypted = 18;
|
||||
}
|
||||
|
||||
// DWNProtocol represents a configured protocol in a DWN
|
||||
message DWNProtocol {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 2
|
||||
primary_key: {fields: "target,protocol_uri"}
|
||||
};
|
||||
|
||||
// DID of the DWN target
|
||||
string target = 1;
|
||||
// Protocol URI identifier
|
||||
string protocol_uri = 2;
|
||||
// Protocol definition JSON
|
||||
bytes definition = 3;
|
||||
// Published flag for discoverability
|
||||
bool published = 4;
|
||||
// Creation timestamp (Unix timestamp)
|
||||
int64 created_at = 5;
|
||||
// Block height when created
|
||||
int64 created_height = 6;
|
||||
}
|
||||
|
||||
// DWNPermission represents a permission grant in a DWN
|
||||
message DWNPermission {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 3
|
||||
primary_key: {fields: "permission_id"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "grantor,grantee"
|
||||
unique: false
|
||||
}
|
||||
index: {
|
||||
id: 2
|
||||
fields: "target,interface_name,method"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Unique identifier for the permission
|
||||
string permission_id = 1;
|
||||
// DID of the permission grantor
|
||||
string grantor = 2;
|
||||
// DID of the permission grantee
|
||||
string grantee = 3;
|
||||
// DID of the DWN target
|
||||
string target = 4;
|
||||
// Interface scope (e.g., "Records", "Protocols")
|
||||
string interface_name = 5;
|
||||
// Method scope (e.g., "Write", "Query")
|
||||
string method = 6;
|
||||
// Optional protocol scope
|
||||
string protocol = 7;
|
||||
// Optional record scope
|
||||
string record_id = 8;
|
||||
// Permission conditions JSON
|
||||
bytes conditions = 9;
|
||||
// Expiration timestamp (Unix timestamp)
|
||||
int64 expires_at = 10;
|
||||
// Creation timestamp (Unix timestamp)
|
||||
int64 created_at = 11;
|
||||
// Revoked flag
|
||||
bool revoked = 12;
|
||||
// Block height when created
|
||||
int64 created_height = 13;
|
||||
}
|
||||
|
||||
// VaultState represents a vault instance for enclave-based operations
|
||||
message VaultState {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 4
|
||||
primary_key: {fields: "vault_id"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "owner"
|
||||
unique: false
|
||||
}
|
||||
};
|
||||
|
||||
// Unique identifier for the vault
|
||||
string vault_id = 1;
|
||||
// Owner DID or address
|
||||
string owner = 2;
|
||||
// Enclave data containing encrypted keys
|
||||
EnclaveData enclave_data = 3;
|
||||
// Public key for verification
|
||||
bytes public_key = 4;
|
||||
// Creation timestamp (Unix timestamp)
|
||||
int64 created_at = 5;
|
||||
// Last refresh timestamp (Unix timestamp)
|
||||
int64 last_refreshed = 6;
|
||||
// Block height when created
|
||||
int64 created_height = 7;
|
||||
// Encryption metadata for consensus-based encryption
|
||||
EncryptionMetadata encryption_metadata = 8;
|
||||
}
|
||||
|
||||
+188
-31
@@ -2,28 +2,41 @@ syntax = "proto3";
|
||||
package dwn.v1;
|
||||
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "dwn/v1/genesis.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "dwn/v1/genesis.proto";
|
||||
import "dwn/v1/state.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/sonr-io/snrd/x/dwn/types";
|
||||
option go_package = "github.com/sonr-io/sonr/x/dwn/types";
|
||||
|
||||
// Msg defines the Msg service.
|
||||
service Msg {
|
||||
option (cosmos.msg.v1.service) = true;
|
||||
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// DWN Records Operations
|
||||
//
|
||||
// {{.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 "dwn_docs.md"}}
|
||||
rpc RecordsWrite(MsgRecordsWrite) returns (MsgRecordsWriteResponse);
|
||||
rpc RecordsDelete(MsgRecordsDelete) returns (MsgRecordsDeleteResponse);
|
||||
|
||||
// Spawn spawns a new Vault
|
||||
rpc Initialize(MsgInitialize) returns (MsgInitializeResponse);
|
||||
// DWN Protocols Operations
|
||||
rpc ProtocolsConfigure(MsgProtocolsConfigure) returns (MsgProtocolsConfigureResponse);
|
||||
|
||||
// DWN Permissions Operations
|
||||
rpc PermissionsGrant(MsgPermissionsGrant) returns (MsgPermissionsGrantResponse);
|
||||
rpc PermissionsRevoke(MsgPermissionsRevoke) returns (MsgPermissionsRevokeResponse);
|
||||
|
||||
// DWN Vault Operations
|
||||
rpc RotateVaultKeys(MsgRotateVaultKeys) returns (MsgRotateVaultKeysResponse);
|
||||
}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParams {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
@@ -31,35 +44,179 @@ 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];
|
||||
}
|
||||
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
// MsgSpawn spawns a New Vault with Unclaimed State. This is a one-time
|
||||
// operation that must be performed interacting with the Vault.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgInitialize {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
// MsgRecordsWrite creates or updates a record in the DWN
|
||||
message MsgRecordsWrite {
|
||||
option (cosmos.msg.v1.signer) = "author";
|
||||
|
||||
// authority is the address of the governance account.
|
||||
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];
|
||||
// Author of the record (DID or cosmos address)
|
||||
string author = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Target DWN (DID)
|
||||
string target = 2;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 3;
|
||||
// Authorization JWT/signature
|
||||
string authorization = 4;
|
||||
// Record data
|
||||
bytes data = 5;
|
||||
// Optional protocol URI
|
||||
string protocol = 6;
|
||||
// Optional protocol path
|
||||
string protocol_path = 7;
|
||||
// Optional schema URI
|
||||
string schema = 8;
|
||||
// Optional parent record ID
|
||||
string parent_id = 9;
|
||||
// Published flag
|
||||
bool published = 10;
|
||||
// Optional encryption details
|
||||
string encryption = 11;
|
||||
// Optional attestation
|
||||
string attestation = 12;
|
||||
}
|
||||
|
||||
// MsgSpawnResponse defines the response structure for executing a
|
||||
// MsgSpawn message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgInitializeResponse {}
|
||||
// MsgRecordsWriteResponse defines the response for RecordsWrite
|
||||
message MsgRecordsWriteResponse {
|
||||
// Record ID of the created/updated record
|
||||
string record_id = 1;
|
||||
// CID of the data
|
||||
string data_cid = 2;
|
||||
}
|
||||
|
||||
// MsgRecordsDelete deletes a record from the DWN
|
||||
message MsgRecordsDelete {
|
||||
option (cosmos.msg.v1.signer) = "author";
|
||||
|
||||
// Author requesting deletion (DID or cosmos address)
|
||||
string author = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Target DWN (DID)
|
||||
string target = 2;
|
||||
// Record ID to delete
|
||||
string record_id = 3;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 4;
|
||||
// Authorization JWT/signature
|
||||
string authorization = 5;
|
||||
// Prune descendants flag
|
||||
bool prune = 6;
|
||||
}
|
||||
|
||||
// MsgRecordsDeleteResponse defines the response for RecordsDelete
|
||||
message MsgRecordsDeleteResponse {
|
||||
// Success flag
|
||||
bool success = 1;
|
||||
// Number of records deleted (including pruned)
|
||||
int32 deleted_count = 2;
|
||||
}
|
||||
|
||||
// MsgProtocolsConfigure configures a protocol in the DWN
|
||||
message MsgProtocolsConfigure {
|
||||
option (cosmos.msg.v1.signer) = "author";
|
||||
|
||||
// Author configuring the protocol (DID or cosmos address)
|
||||
string author = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Target DWN (DID)
|
||||
string target = 2;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 3;
|
||||
// Authorization JWT/signature
|
||||
string authorization = 4;
|
||||
// Protocol URI
|
||||
string protocol_uri = 5;
|
||||
// Protocol definition JSON
|
||||
bytes definition = 6;
|
||||
// Published flag
|
||||
bool published = 7;
|
||||
}
|
||||
|
||||
// MsgProtocolsConfigureResponse defines the response for ProtocolsConfigure
|
||||
message MsgProtocolsConfigureResponse {
|
||||
// Protocol URI that was configured
|
||||
string protocol_uri = 1;
|
||||
// Success flag
|
||||
bool success = 2;
|
||||
}
|
||||
|
||||
// MsgPermissionsGrant grants permissions in the DWN
|
||||
message MsgPermissionsGrant {
|
||||
option (cosmos.msg.v1.signer) = "grantor";
|
||||
|
||||
// Grantor of the permission (DID or cosmos address)
|
||||
string grantor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Grantee receiving the permission (DID)
|
||||
string grantee = 2;
|
||||
// Target DWN (DID)
|
||||
string target = 3;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 4;
|
||||
// Authorization JWT/signature
|
||||
string authorization = 5;
|
||||
// Interface scope
|
||||
string interface_name = 6;
|
||||
// Method scope
|
||||
string method = 7;
|
||||
// Optional protocol scope
|
||||
string protocol = 8;
|
||||
// Optional record scope
|
||||
string record_id = 9;
|
||||
// Permission conditions JSON
|
||||
bytes conditions = 10;
|
||||
// Expiration timestamp (Unix timestamp)
|
||||
int64 expires_at = 11;
|
||||
}
|
||||
|
||||
// MsgPermissionsGrantResponse defines the response for PermissionsGrant
|
||||
message MsgPermissionsGrantResponse {
|
||||
// Permission ID of the created grant
|
||||
string permission_id = 1;
|
||||
}
|
||||
|
||||
// MsgPermissionsRevoke revokes permissions in the DWN
|
||||
message MsgPermissionsRevoke {
|
||||
option (cosmos.msg.v1.signer) = "grantor";
|
||||
|
||||
// Grantor revoking the permission (DID or cosmos address)
|
||||
string grantor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Permission ID to revoke
|
||||
string permission_id = 2;
|
||||
// Message descriptor
|
||||
DWNMessageDescriptor descriptor = 3;
|
||||
// Authorization JWT/signature
|
||||
string authorization = 4;
|
||||
}
|
||||
|
||||
// MsgPermissionsRevokeResponse defines the response for PermissionsRevoke
|
||||
message MsgPermissionsRevokeResponse {
|
||||
// Success flag
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// MsgRotateVaultKeys rotates encryption keys for existing vaults
|
||||
message MsgRotateVaultKeys {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Authority performing the rotation (governance or validator)
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Vault ID to rotate keys for (empty means all vaults)
|
||||
string vault_id = 2;
|
||||
// Reason for rotation
|
||||
string reason = 3;
|
||||
// Force rotation even if not due
|
||||
bool force = 4;
|
||||
}
|
||||
|
||||
// MsgRotateVaultKeysResponse defines the response for RotateVaultKeys
|
||||
message MsgRotateVaultKeysResponse {
|
||||
// Number of vaults affected
|
||||
uint32 vaults_rotated = 1;
|
||||
// New key version after rotation
|
||||
uint64 new_key_version = 2;
|
||||
// Success flag
|
||||
bool success = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user