Update proto types

This commit is contained in:
Prad Nukala
2024-08-31 12:49:44 -04:00
parent b579212464
commit e668d5f2cb
25 changed files with 19556 additions and 10547 deletions
+8
View File
@@ -2,3 +2,11 @@ syntax = "proto3";
package did.v1;
option go_package = "github.com/onsonr/hway/x/did/types";
message BtcAccount {}
message EthAccount {}
message IBCAccount {}
message SnrAccount {}
-24
View File
@@ -1,24 +0,0 @@
syntax = "proto3";
package did.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// PermissionScope define the Capabilities Controllers can grant for Services
enum PermissionScope {
PERMISSION_SCOPE_UNSPECIFIED = 0;
PERMISSION_SCOPE_PROFILE_NAME = 1;
PERMISSION_SCOPE_IDENTIFIERS_EMAIL = 2;
PERMISSION_SCOPE_IDENTIFIERS_PHONE = 3;
PERMISSION_SCOPE_TRANSACTIONS_READ = 4;
PERMISSION_SCOPE_TRANSACTIONS_WRITE = 5;
PERMISSION_SCOPE_WALLETS_READ = 6;
PERMISSION_SCOPE_WALLETS_CREATE = 7;
PERMISSION_SCOPE_WALLETS_SUBSCRIBE = 8;
PERMISSION_SCOPE_WALLETS_UPDATE = 9;
PERMISSION_SCOPE_TRANSACTIONS_VERIFY = 10;
PERMISSION_SCOPE_TRANSACTIONS_BROADCAST = 11;
PERMISSION_SCOPE_ADMIN_USER = 12;
PERMISSION_SCOPE_ADMIN_VALIDATOR = 13;
}
+46 -18
View File
@@ -25,7 +25,7 @@ message Params {
repeated ChainInfo whitelisted_chains = 2;
// Whitelisted Key Types
repeated KeyInfo whitelisted_keys = 3;
repeated KeyInfo allowed_public_keys = 3;
}
// AssetInfo defines the asset info
@@ -81,27 +81,55 @@ message ChainInfo {
}
}
// KeyInfo defines information for accepted PubKey types
message KeyInfo {
KeyKind kind = 1;
KeyType kind = 1;
string algorithm = 2; // e.g., "ES256", "EdDSA", "ES256K"
string curve = 3; // e.g., "P-256", "Ed25519", "secp256k1"
bool is_cbor = 4; // true for WebAuthn CBOR-encoded keys, false for others
string encoding = 5; // e.g., "hex", "base64", "multibase"
string encoding = 4; // e.g., "hex", "base64", "multibase"
}
// KeyKind defines the kind of key
enum KeyKind {
KEY_KIND_UNSPECIFIED = 0;
// Blockchain key types
KEY_KIND_SECP256K1 = 1;
KEY_KIND_ED25519 = 2;
KEY_KIND_P256 = 3;
KEY_KIND_BLS12381 = 4;
KEY_KIND_X25519 = 5;
KEY_KIND_SCHNORR = 6;
// Webauthn and FIDO key types
KEY_KIND_WEBAUTHN = 7;
KEY_KIND_FIDO = 8;
// DIDNamespace define the different namespaces of DID
enum DIDNamespace {
DID_NAMESPACE_UNSPECIFIED = 0;
DID_NAMESPACE_IPFS = 1;
DID_NAMESPACE_SONR = 2;
DID_NAMESPACE_BITCOIN = 3;
DID_NAMESPACE_ETHEREUM = 4;
DID_NAMESPACE_IBC = 5;
}
// KeyKTind defines the kind of key
enum KeyType {
KEY_TYPE_UNSPECIFIED = 0;
// Blockchain key types
KEY_TYPE_SECP256K1 = 1; // cross-chain
KEY_TYPE_ED25519 = 2; // validators
KEY_TYPE_KECCAK = 3; // ethereum addresses
KEY_TYPE_BLS12381 = 4; // zero-knowledge
KEY_TYPE_X25519 = 5; // multisig
KEY_TYPE_SCHNORR = 6; // mpc
// Webauthn and FIDO key types
KEY_TYPE_WEBAUTHN = 7; // passkey authentication
KEY_TYPE_FIDO = 8; // fido2 authentication
}
// PermissionScope define the Capabilities Controllers can grant for Services
enum PermissionScope {
PERMISSION_SCOPE_UNSPECIFIED = 0;
PERMISSION_SCOPE_BASIC_INFO = 1;
PERMISSION_SCOPE_RECORDS_READ = 2;
PERMISSION_SCOPE_RECORDS_WRITE = 3;
PERMISSION_SCOPE_TRANSACTIONS_READ = 4;
PERMISSION_SCOPE_TRANSACTIONS_WRITE = 5;
PERMISSION_SCOPE_WALLETS_READ = 6;
PERMISSION_SCOPE_WALLETS_CREATE = 7;
PERMISSION_SCOPE_WALLETS_SUBSCRIBE = 8;
PERMISSION_SCOPE_WALLETS_UPDATE = 9;
PERMISSION_SCOPE_TRANSACTIONS_VERIFY = 10;
PERMISSION_SCOPE_TRANSACTIONS_BROADCAST = 11;
PERMISSION_SCOPE_ADMIN_USER = 12;
PERMISSION_SCOPE_ADMIN_VALIDATOR = 13;
}
-52
View File
@@ -1,52 +0,0 @@
syntax = "proto3";
package did.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// DIDNamespace define the different namespaces of DID
enum DIDNamespace {
DID_NAMESPACE_UNSPECIFIED = 0;
DID_NAMESPACE_IPFS = 1;
DID_NAMESPACE_SONR = 2;
DID_NAMESPACE_BITCOIN = 3;
DID_NAMESPACE_ETHEREUM = 4;
DID_NAMESPACE_IBC = 5;
}
enum KeyType {
KEY_TYPE_UNSPECIFIED = 0;
// Blockchain key types
KEY_TYPE_SECP256K1 = 1;
KEY_TYPE_ED25519 = 2;
KEY_TYPE_P256 = 3;
KEY_TYPE_BLS12381 = 4;
KEY_TYPE_X25519 = 5;
KEY_TYPE_SCHNORR = 6;
// Webauthn and FIDO key types
KEY_TYPE_WEBAUTHN = 7;
KEY_TYPE_FIDO = 8;
// MPC key type
KEY_TYPE_MPC = 9;
// ZK key type
KEY_TYPE_ZK = 10;
}
// PermissionScope define the Capabilities Controllers can grant for Services
enum PermissionScope {
PERMISSION_SCOPE_UNSPECIFIED = 0;
PERMISSION_SCOPE_BASIC_INFO = 1;
PERMISSION_SCOPE_RECORDS_READ = 2;
PERMISSION_SCOPE_RECORDS_WRITE = 3;
PERMISSION_SCOPE_TRANSACTIONS_READ = 4;
PERMISSION_SCOPE_TRANSACTIONS_WRITE = 5;
PERMISSION_SCOPE_WALLETS_READ = 6;
PERMISSION_SCOPE_WALLETS_CREATE = 7;
PERMISSION_SCOPE_WALLETS_SUBSCRIBE = 8;
PERMISSION_SCOPE_WALLETS_UPDATE = 9;
PERMISSION_SCOPE_TRANSACTIONS_VERIFY = 10;
PERMISSION_SCOPE_TRANSACTIONS_BROADCAST = 11;
PERMISSION_SCOPE_ADMIN_USER = 12;
PERMISSION_SCOPE_ADMIN_VALIDATOR = 13;
}
+84
View File
@@ -0,0 +1,84 @@
syntax = "proto3";
package did.v1;
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// DID defines a parsed DID string
message DID {
string id = 1;
DIDNamespace method = 2;
string network = 3;
string identifier = 4;
repeated string paths = 5;
}
// Credential defines a WebAuthn credential
message Credential {
string id = 1;
string credential_type = 2;
bytes credential_id = 3;
repeated string transport = 4;
string subject = 6;
string controller = 7;
}
// Document defines a DID document
message Document {
string id = 1;
repeated VerificationMethod verification_methods = 2;
repeated string authentication = 4;
repeated string assertion_method = 5;
repeated string capability_delegation = 7;
repeated string capability_invocation = 8;
}
// Metadata defines additional information provided to a did
message Metadata {
string origin_uri = 1;
map<string, string> public = 2;
map<string, Property> private = 3;
}
// Permissions contains a list of grants and access control rules for
// a Service.
message Permissions {
repeated DIDNamespace grants = 1;
repeated PermissionScope scopes = 2;
}
// Profile defines an associated public identity for a did subject
message Profile {
string id = 1;
string subject = 2;
string controller = 3;
repeated Credential credentials = 4;
repeated VerificationMethod attestations = 5;
Metadata metadata = 6;
}
// Property defines a Zero-Knowledge accumulator which can be used to
// anonymously prove a given value to a DID subject
message Property {
bytes accumulator = 1;
bytes key = 2;
}
// PubKey defines a public key for a did
message PubKey {
DIDNamespace namespace = 1;
bytes key = 2;
KeyType kind = 3;
string multibase = 5;
map<string, string> jwks = 6;
}
// VerificationMethod defines a verification method
message VerificationMethod {
string id = 1;
string controller = 2;
PubKey public_key = 3;
}
+1 -1
View File
@@ -3,7 +3,7 @@ package did.v1;
import "google/api/annotations.proto";
import "did/v1/genesis.proto";
import "did/v1/types.proto";
import "did/v1/models.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
+19 -38
View File
@@ -5,7 +5,7 @@ option go_package = "github.com/onsonr/hway/x/did/types";
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
import "did/v1/enums.proto";
import "did/v1/models.proto";
// Aliases represents the `alsoKnownAs` property associated with a DID Controller
message Aliases {
@@ -41,20 +41,19 @@ message Assertion {
// The unique identifier of the attestation
string id = 1;
// The controller of the attestation
string controller = 2;
// Key type (e.g., "passkey", "ssh", "gpg", "native-secure-enclave")
string key_type = 2;
PubKey public_key = 3;
// The value of the linked identifier
bytes credential = 3;
bytes credential_id = 4;
// Metadata is optional additional information about the assertion
map<string, string> metadata = 4;
// The controller of the attestation
string controller = 5;
Metadata metadata = 5;
}
// Attestation represents linked identifiers (e.g., Crypto Accounts, Github, Email, Phone)
message Attestation {
option (cosmos.orm.v1.table) = {
@@ -66,16 +65,13 @@ message Attestation {
string id = 1;
// The type of the linked identifier (e.g., "crypto", "github", "email", "phone")
string key_type = 2;
string controller = 2;
// The value of the linked identifier
string value = 3;
// The proof or verification method for this attestation
string proof = 4;
PubKey public_key = 3;
// The controller of the attestation
string controller = 5;
Metadata metadata = 4;
}
@@ -90,16 +86,13 @@ message Controller {
string id = 1;
// The DID of the controller
string did = 2;
string address = 2;
// The public key of the controller
string public_key_multibase = 3;
// PubKey is the verification method
PubKey public_key = 4;
// The vault address or identifier
string vault_cid = 4;
// Fingerprint is the Accumulator of discrete credential identifiers
bytes fingerprint = 5;
string vault_cid = 5;
}
// Delegation represents IBC Account Controllers for various chains (e.g., ETH, BTC)
@@ -113,25 +106,13 @@ message Delegation {
string id = 1;
// The Decentralized Identifier of the delegated account
string did = 2;
string controller = 2;
// The chain type (e.g., "ETH", "BTC")
string chain_type = 3;
// The address on the target chain
string chain_address = 4;
// The controller DID
string controller_did = 5;
// Resolved from module parameters
string chain_info_id = 3;
// The delegation proof or verification method
string public_key_multibase = 6;
// Public Key JWKS is a map of the associated public keys
map<string, string> public_key_jwks = 7;
// IBC Channel ID
uint64 channel_id = 8;
PubKey public_key = 4;
}
// Service represents a service in a DID Document
@@ -157,5 +138,5 @@ message Service {
map<string, string> service_endpoints = 5;
// Scopes is the Authorization Grants of the service
repeated PermissionScope scopes = 6;
Permissions permissions = 6;
}
+2 -2
View File
@@ -3,7 +3,7 @@ syntax = "proto3";
package did.v1;
import "cosmos/msg/v1/msg.proto";
import "did/v1/enums.proto";
import "did/v1/models.proto";
import "did/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
@@ -121,7 +121,7 @@ message MsgRegisterController {
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Assertions is the list of assertions to initialize the controller with.
repeated bytes assertions = 2;
string cid = 2;
// Keyshares is the list of keyshares to initialize the controller with.
repeated bytes keyshares = 3;
-114
View File
@@ -1,114 +0,0 @@
syntax = "proto3";
package did.v1;
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/onsonr/hway/x/did/types";
// AssetInfo defines the asset info
message AssetInfo {
string id = 1;
string denom = 2;
string symbol = 3;
string asset_type = 4;
string origin_chain = 5;
string origin_denom = 6;
int32 decimals = 7;
string description = 8;
string image_url = 9;
string coingecko_id = 10;
bool is_enabled = 11;
string ibc_path = 12;
string ibc_channel = 13;
string ibc_port = 14;
}
// ChainInfo defines the chain info
message ChainInfo {
string id = 1;
string chain_id = 2;
string name = 3;
string symbol = 4;
string bech32_prefix = 5;
string genesis_time = 6;
repeated Endpoint grpc_endpoints = 7;
repeated Endpoint rest_endpoints = 8;
ExplorerInfo explorer = 9;
FeeInfo fee_info = 10;
}
// Credential defines a WebAuthn credential
message Credential {
string id = 1;
string credential_type = 2;
bytes credential_id = 3;
repeated string transport = 4;
string attestation_type = 5;
string display_name = 6;
string controller = 7;
}
// Document defines a DID document
message Document {
string id = 1;
repeated VerificationMethod verification_methods = 2;
repeated string authentication = 4;
repeated string assertion_method = 5;
repeated string capability_delegation = 7;
repeated string capability_invocation = 8;
}
// Endpoint defines an endpoint
message Endpoint {
string url = 1;
bool is_primary = 2;
}
// ExplorerInfo defines the explorer info
message ExplorerInfo {
string name = 1;
string url = 2;
}
// FeeInfo defines a fee info
message FeeInfo {
string base_denom = 1;
repeated string fee_rates = 2;
int32 init_gas_limit = 3;
bool is_simulable = 4;
double gas_multiply = 5;
}
// Identity defines an associated profile for a did subject
message Identity {
string id = 1;
string subject = 2;
string controller = 3;
repeated Credential credentials = 4;
repeated VerificationMethod verification_methods = 5;
}
// PubKey defines a public key for a did
message PubKey {
string id = 1;
bytes key = 2;
string key_type = 3;
string controller = 4;
}
// VerificationMethod defines a verification method
message VerificationMethod {
string id = 1;
string controller = 2;
// The delegation proof or verification method
string public_key_multibase = 3;
// Public Key JWKS is a map of the associated public keys
map<string, string> public_key_jwks = 4;
}