feat: add PubKey fast reflection

This commit is contained in:
Prad Nukala
2024-10-08 16:43:59 -04:00
parent c3e8fcc3d3
commit f6879f1c12
31 changed files with 4605 additions and 14444 deletions
+34 -3
View File
@@ -9,7 +9,7 @@ option go_package = "github.com/onsonr/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];
Params params = 1 [ (gogoproto.nullable) = false ];
}
// Params defines the set of module parameters.
@@ -34,7 +34,38 @@ message Params {
message KeyInfo {
string role = 1;
string algorithm = 2; // e.g., "ES256", "EdDSA", "ES256K"
string encoding = 3; // e.g., "hex", "base64", "multibase"
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448",
string encoding = 3; // e.g., "hex", "base64", "multibase"
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448",
// "Ed25519", "Ed448", "secp256k1"
}
message Keyshares {
string validator_cid = 1;
string user_cid = 2;
int64 last_updated_block = 3;
}
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string key_type = 2;
RawKey raw_key = 3;
JSONWebKey jwk = 4;
}
// JWK represents a JSON Web Key
message JSONWebKey {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
message RawKey {
string algorithm = 1;
string encoding = 2;
string curve = 3;
bytes key = 4;
}
+15 -80
View File
@@ -3,18 +3,15 @@ syntax = "proto3";
package did.v1;
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/did/types";
message Authentication {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
id : 1
primary_key : {fields : "did"}
index : {id : 1 fields : "controller,subject" unique : true}
};
// The unique identifier of the authentication
@@ -42,31 +39,12 @@ message Authentication {
// Controller represents a Sonr DWN Vault
message Controller {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {
fields: "number"
auto_increment: true
}
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"
unique: true
}
id : 2
primary_key : {fields : "number" auto_increment : true}
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" unique : true}
};
// The unique identifier of the controller
@@ -100,23 +78,11 @@ message Controller {
// Verification represents a verification method
message Verification {
option (cosmos.orm.v1.table) = {
id: 4
primary_key: {fields: "did"}
index: {
id: 1
fields: "issuer,subject"
unique: true
}
index: {
id: 2
fields: "controller,did_method,issuer"
unique: true
}
index: {
id: 3
fields: "verification_type,subject,issuer"
unique: true
}
id : 4
primary_key : {fields : "did"}
index : {id : 1 fields : "issuer,subject" unique : true}
index : {id : 2 fields : "controller,did_method,issuer" unique : true}
index : {id : 3 fields : "verification_type,subject,issuer" unique : true}
};
// The unique identifier of the verification
@@ -146,34 +112,3 @@ message Verification {
// CreationBlock is the block number of the creation of the controller
int64 creation_block = 9;
}
message Keyshares {
string validator_cid = 1;
string user_cid = 2;
int64 last_updated_block = 3;
}
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string key_type = 2;
RawKey raw_key = 3;
JSONWebKey jwk = 4;
}
// JWK represents a JSON Web Key
message JSONWebKey {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
message RawKey {
string algorithm = 1;
string encoding = 2;
string curve = 3;
bytes key = 4;
}
+7 -6
View File
@@ -19,7 +19,8 @@ service Msg {
// RegisterController initializes a controller with the given authentication
// set, address, cid, publicKey, and user-defined alias.
rpc RegisterController(MsgRegisterController) returns (MsgRegisterControllerResponse);
rpc RegisterController(MsgRegisterController)
returns (MsgRegisterControllerResponse);
// UpdateParams defines a governance operation for updating the parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
@@ -30,7 +31,7 @@ message MsgRegisterController {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Assertions is the list of assertions to initialize the controller with.
repeated bytes assertions = 2;
@@ -51,7 +52,7 @@ message MsgRegisterControllerResponse {
bool success = 1;
// Controller is the address of the initialized controller.
string controller = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string controller = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Accounts are a Address Map and Supported coin Denoms for the controller
map<string, string> accounts = 3;
@@ -62,7 +63,7 @@ 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"];
string controller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Messages is the list of messages to execute.
map<string, bytes> messages = 2;
@@ -84,10 +85,10 @@ message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// params defines the parameters to update.
Params params = 2 [(gogoproto.nullable) = false];
Params params = 2 [ (gogoproto.nullable) = false ];
// token is the macron token to authenticate the operation.
string token = 3;