mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/1110 abstract connected wallet operations (#1166)
- **refactor: refactor DID module types and move to controller package** - **refactor: move controller creation and resolution logic to keeper** - **refactor: update imports to reflect controller package move** - **refactor: update protobuf definitions for DID module** - **docs: update proto README to reflect changes** - **refactor: move hway to gateway, update node modules, and refactor pkl generation** - **build: update pkl-gen task to use new pkl file paths** - **refactor: refactor DWN WASM build and deployment process** - **refactor: refactor DID controller implementation to use account-based storage** - **refactor: move DID controller interface to base file and update implementation** - **chore: migrate to google protobuf** - **feat: Add v0.52.0 Interfaces for Acc Abstraction** - **refactor: replace public_key with public_key_hex in Assertion message** - **refactor: remove unused PubKey, JSONWebKey, and RawKey message types and related code**
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package onsonr.sonr.did.module.v1;
|
||||
package did.module.v1;
|
||||
|
||||
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/onsonr/sonr/x/did"};
|
||||
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/onsonr/sonr"};
|
||||
}
|
||||
|
||||
+11
-57
@@ -2,6 +2,7 @@ syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
import "amino/amino.proto";
|
||||
import "did/v1/params.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/did/types";
|
||||
@@ -9,63 +10,16 @@ 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.
|
||||
message Params {
|
||||
option (amino.name) = "did/params";
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Whitelisted Assets
|
||||
|
||||
// Whitelisted Key Types
|
||||
map<string, KeyInfo> allowed_public_keys = 2;
|
||||
|
||||
// ConveyancePreference defines the conveyance preference
|
||||
string conveyance_preference = 3;
|
||||
|
||||
// AttestationFormats defines the attestation formats
|
||||
repeated string attestation_formats = 4;
|
||||
}
|
||||
|
||||
// KeyInfo defines information for accepted PubKey types
|
||||
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",
|
||||
// "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;
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
import "amino/amino.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/did/types";
|
||||
|
||||
// Params defines the set of module parameters.
|
||||
message Params {
|
||||
option (amino.name) = "did/params";
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Whitelisted Assets
|
||||
|
||||
// Whitelisted Key Types
|
||||
map<string, KeyInfo> allowed_public_keys = 2;
|
||||
|
||||
// ConveyancePreference defines the conveyance preference
|
||||
string conveyance_preference = 3;
|
||||
|
||||
// AttestationFormats defines the attestation formats
|
||||
repeated string attestation_formats = 4;
|
||||
}
|
||||
|
||||
// KeyInfo defines information for accepted PubKey types
|
||||
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",
|
||||
// "Ed25519", "Ed448", "secp256k1"
|
||||
}
|
||||
@@ -2,6 +2,7 @@ syntax = "proto3";
|
||||
package did.v1;
|
||||
|
||||
import "did/v1/genesis.proto";
|
||||
import "did/v1/params.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/did/types";
|
||||
@@ -18,11 +19,6 @@ service Query {
|
||||
option (google.api.http).get = "/did/v1/{did}";
|
||||
}
|
||||
|
||||
// Sign signs a message with the DID document
|
||||
rpc Sign(QuerySignRequest) returns (QuerySignResponse) {
|
||||
option (google.api.http).post = "/did/v1/{did}/sign";
|
||||
}
|
||||
|
||||
// Verify verifies a message with the DID document
|
||||
rpc Verify(QueryVerifyRequest) returns (QueryVerifyResponse) {
|
||||
option (google.api.http).post = "/did/v1/{did}/verify";
|
||||
@@ -79,14 +75,3 @@ message QueryVerifyResponse {
|
||||
// valid is the validity of the signature
|
||||
bool valid = 1;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
+86
-55
@@ -9,9 +9,13 @@ option go_package = "github.com/onsonr/sonr/x/did/types";
|
||||
|
||||
message Assertion {
|
||||
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 assertion
|
||||
@@ -23,8 +27,8 @@ message Assertion {
|
||||
// Origin of the authentication
|
||||
string subject = 3;
|
||||
|
||||
// PubKey is the verification method
|
||||
PubKey public_key = 4;
|
||||
// string is the verification method
|
||||
string public_key_hex = 4;
|
||||
|
||||
// AssertionType is the assertion type
|
||||
string assertion_type = 5;
|
||||
@@ -38,9 +42,13 @@ message Assertion {
|
||||
|
||||
message Authentication {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 2
|
||||
primary_key : {fields : "did"}
|
||||
index : {id : 1 fields : "controller,subject" unique : true}
|
||||
id: 2
|
||||
primary_key: {fields: "did"}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "controller,subject"
|
||||
unique: true
|
||||
}
|
||||
};
|
||||
|
||||
// The unique identifier of the authentication
|
||||
@@ -52,8 +60,8 @@ message Authentication {
|
||||
// Origin of the authentication
|
||||
string subject = 3;
|
||||
|
||||
// PubKey is the verification method
|
||||
PubKey public_key = 4;
|
||||
// string is the verification method
|
||||
string public_key_hex = 4;
|
||||
|
||||
// CredentialID is the byte representation of the credential ID
|
||||
bytes credential_id = 5;
|
||||
@@ -65,15 +73,57 @@ message Authentication {
|
||||
int64 creation_block = 7;
|
||||
}
|
||||
|
||||
// Macaroon is a Macaroon message type.
|
||||
message Biscuit {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id: 5
|
||||
primary_key: {
|
||||
fields: "id"
|
||||
auto_increment: true
|
||||
}
|
||||
index: {
|
||||
id: 1
|
||||
fields: "subject,origin"
|
||||
unique: true
|
||||
}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
string macaroon = 6;
|
||||
}
|
||||
|
||||
// Controller represents a Sonr DWN Vault
|
||||
message Controller {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 3
|
||||
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: 3
|
||||
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
|
||||
@@ -91,8 +141,8 @@ message Controller {
|
||||
// The DID of the controller
|
||||
string btc_address = 5;
|
||||
|
||||
// PubKey is the verification method
|
||||
PubKey public_key = 6;
|
||||
// string is the verification method
|
||||
string public_key_hex = 6;
|
||||
|
||||
// Pointer to the Keyshares
|
||||
string ks_val = 7;
|
||||
@@ -104,45 +154,26 @@ message Controller {
|
||||
int64 creation_block = 9;
|
||||
}
|
||||
|
||||
// Grant is a Grant message type.
|
||||
message Grant {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 4
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
}
|
||||
|
||||
// Macaroon is a Macaroon message type.
|
||||
message Macaroon {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 5
|
||||
primary_key : {fields : "id" auto_increment : true}
|
||||
index : {id : 1 fields : "subject,origin" unique : true}
|
||||
};
|
||||
|
||||
uint64 id = 1;
|
||||
string controller = 2;
|
||||
string subject = 3;
|
||||
string origin = 4;
|
||||
int64 expiry_height = 5;
|
||||
string macaroon = 6;
|
||||
}
|
||||
|
||||
// Verification represents a verification method
|
||||
message Verification {
|
||||
option (cosmos.orm.v1.table) = {
|
||||
id : 6
|
||||
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: 6
|
||||
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
|
||||
@@ -161,7 +192,7 @@ message Verification {
|
||||
string subject = 5;
|
||||
|
||||
// The public key of the verification
|
||||
PubKey public_key = 6;
|
||||
string public_key_hex = 6;
|
||||
|
||||
// The verification method type
|
||||
string verification_type = 7;
|
||||
|
||||
+11
-14
@@ -5,6 +5,7 @@ package did.v1;
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "did/v1/genesis.proto";
|
||||
import "did/v1/params.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/x/did/types";
|
||||
@@ -21,16 +22,13 @@ service Msg {
|
||||
rpc LinkAssertion(MsgLinkAssertion) returns (MsgLinkAssertionResponse);
|
||||
|
||||
// LinkAuthentication links an authentication to a controller.
|
||||
rpc LinkAuthentication(MsgLinkAuthentication)
|
||||
returns (MsgLinkAuthenticationResponse);
|
||||
rpc LinkAuthentication(MsgLinkAuthentication) returns (MsgLinkAuthenticationResponse);
|
||||
|
||||
// UnlinkAssertion unlinks an assertion from a controller.
|
||||
rpc UnlinkAssertion(MsgUnlinkAssertion)
|
||||
returns (MsgUnlinkAssertionResponse);
|
||||
rpc UnlinkAssertion(MsgUnlinkAssertion) returns (MsgUnlinkAssertionResponse);
|
||||
|
||||
// UnlinkAuthentication unlinks an authentication from a controller.
|
||||
rpc UnlinkAuthentication(MsgUnlinkAuthentication)
|
||||
returns (MsgUnlinkAuthenticationResponse);
|
||||
rpc UnlinkAuthentication(MsgUnlinkAuthentication) returns (MsgUnlinkAuthenticationResponse);
|
||||
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
@@ -41,7 +39,7 @@ message MsgLinkAuthentication {
|
||||
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"];
|
||||
|
||||
// Subject is the subject of the authentication.
|
||||
string subject = 2;
|
||||
@@ -72,7 +70,7 @@ message MsgLinkAssertion {
|
||||
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"];
|
||||
|
||||
// Subject is the subject of the authentication.
|
||||
string subject = 2;
|
||||
@@ -95,13 +93,12 @@ message MsgLinkAssertionResponse {
|
||||
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" ];
|
||||
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// Messages is the list of messages to execute.
|
||||
map<string, bytes> messages = 2;
|
||||
@@ -121,7 +118,7 @@ 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" ];
|
||||
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// Assertion is the assertion of the authentication.
|
||||
string assertion_did = 2;
|
||||
@@ -146,7 +143,7 @@ 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" ];
|
||||
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// Subject is the subject of the authentication.
|
||||
string authentication_did = 2;
|
||||
@@ -173,10 +170,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;
|
||||
|
||||
Reference in New Issue
Block a user