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;
+3 -3
View File
@@ -10,7 +10,7 @@ option go_package = "github.com/onsonr/sonr/x/macaroon/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.
@@ -54,12 +54,12 @@ message Caveats {
repeated string supported_third_party = 2;
}
// Transactions defines the allowlist,denylist for transactions which can be
// Transactions defines the allowlist,denylist for transactions which can be
// broadcasted to the network with the Sonr DWN Signed macaroon.
message Transactions {
option (amino.name) = "macaroon/transactions";
option (gogoproto.equal) = true;
repeated string allowlist = 1;
repeated string denylist = 2;
}
+4 -2
View File
@@ -14,12 +14,14 @@ service Query {
}
// RefreshToken refreshes a macaroon token as post authentication.
rpc RefreshToken(QueryRefreshTokenRequest) returns (QueryRefreshTokenResponse) {
rpc RefreshToken(QueryRefreshTokenRequest)
returns (QueryRefreshTokenResponse) {
option (google.api.http).post = "/macaroon/v1/refresh";
}
// ValidateToken validates a macaroon token as pre authentication.
rpc ValidateToken(QueryValidateTokenRequest) returns (QueryValidateTokenResponse) {
rpc ValidateToken(QueryValidateTokenRequest)
returns (QueryValidateTokenResponse) {
option (google.api.http).post = "/macaroon/v1/validate";
}
}
+6 -20
View File
@@ -9,16 +9,9 @@ option go_package = "github.com/onsonr/sonr/x/macaroon/types";
message Grant {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "subject,origin"
unique: true
}
id : 1
primary_key : {fields : "id" auto_increment : true}
index : {id : 1 fields : "subject,origin" unique : true}
};
uint64 id = 1;
@@ -30,16 +23,9 @@ message Grant {
message Macaroon {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "subject,origin"
unique: true
}
id : 2
primary_key : {fields : "id" auto_increment : true}
index : {id : 1 fields : "subject,origin" unique : true}
};
uint64 id = 1;
+3 -3
View File
@@ -29,12 +29,12 @@ 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.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
@@ -48,7 +48,7 @@ message MsgIssueMacaroon {
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" ];
// Origin is the origin of the request in wildcard form.
string origin = 2;
+1 -1
View File
@@ -9,7 +9,7 @@ option go_package = "github.com/onsonr/sonr/x/service/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.
+6 -17
View File
@@ -9,16 +9,9 @@ option go_package = "github.com/onsonr/sonr/x/service/types";
message Metadata {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "origin"
unique: true
}
id : 1
primary_key : {fields : "id" auto_increment : true}
index : {id : 1 fields : "origin" unique : true}
};
uint64 id = 1;
@@ -33,13 +26,9 @@ message Metadata {
// Profile represents a DID alias
message Profile {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
index: {
id: 1
fields: "subject,origin"
unique: true
}
id : 2
primary_key : {fields : "id"}
index : {id : 1 fields : "subject,origin" unique : true}
};
// The unique identifier of the alias
+3 -3
View File
@@ -29,12 +29,12 @@ 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.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
@@ -48,7 +48,7 @@ message MsgRegisterService {
option (cosmos.msg.v1.signer) = "controller";
// authority is the address of the governance account.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string controller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// origin is the origin of the request in wildcard form. Requires valid TXT
// record in DNS.
+1 -1
View File
@@ -9,7 +9,7 @@ option go_package = "github.com/onsonr/sonr/x/vault/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.
+2 -33
View File
@@ -13,11 +13,6 @@ service Query {
option (google.api.http).get = "/vault/v1/params";
}
// BuildTx builds an unsigned transaction message for the given PKL.
rpc BuildTx(BuildTxRequest) returns (BuildTxResponse) {
option (google.api.http).post = "/vault/v1/buildtx";
}
// Schema queries the DID document by its id. And returns the required PKL
// information
rpc Schema(QuerySchemaRequest) returns (QuerySchemaResponse) {
@@ -39,16 +34,6 @@ 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 is the IPFS client status.
bool ipfs = 1;
}
// QuerySchemaRequest is the request type for the Query/Schema RPC method.
message QuerySchemaRequest {}
@@ -59,23 +44,7 @@ message QuerySchemaResponse {
}
// SyncRequest is the request type for the Sync RPC method.
message SyncRequest {
string did = 1;
}
message SyncRequest { string did = 1; }
// SyncResponse is the response type for the Sync RPC method.
message SyncResponse {
bool success = 1;
}
// BuildTxRequest is the request type for the BuildTx RPC method.
message BuildTxRequest {
string did = 1;
string pkl = 2;
}
// BuildTxResponse is the response type for the BuildTx RPC method.
message BuildTxResponse {
bool success = 1;
string tx = 2;
}
message SyncResponse { bool success = 1; }
+4 -15
View File
@@ -9,21 +9,10 @@ option go_package = "github.com/onsonr/sonr/x/vault/types";
message DWN {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "alias"
unique: true
}
index: {
id: 2
fields: "cid"
unique: true
}
id : 1
primary_key : {fields : "id" auto_increment : true}
index : {id : 1 fields : "alias" unique : true}
index : {id : 2 fields : "cid" unique : true}
};
uint64 id = 1;
string alias = 2;
+3 -3
View File
@@ -32,12 +32,12 @@ 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.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false];
Params params = 2 [ (gogoproto.nullable) = false ];
}
// MsgUpdateParamsResponse defines the response structure for executing a
@@ -51,7 +51,7 @@ message MsgAllocateVault {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the service account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// subject is a unique human-defined identifier to associate with the vault.
string subject = 2;