mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 02:11:40 +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:
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/pkg/motr/config" }
|
||||
|
||||
module dwn
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias JSON = String
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class Config {
|
||||
@JsonField
|
||||
ipfsGatewayUrl: String
|
||||
|
||||
@JsonField
|
||||
motrKeyshare: String
|
||||
|
||||
@JsonField
|
||||
motrAddress: String
|
||||
|
||||
@JsonField
|
||||
sonrApiUrl: String
|
||||
|
||||
@JsonField
|
||||
sonrRpcUrl: String
|
||||
|
||||
@JsonField
|
||||
sonrChainId: String
|
||||
|
||||
@JsonField
|
||||
vaultSchema: Schema
|
||||
}
|
||||
|
||||
class Schema {
|
||||
version: Int
|
||||
|
||||
@JsonField
|
||||
account: String
|
||||
|
||||
@JsonField
|
||||
asset: String
|
||||
|
||||
@JsonField
|
||||
chain: String
|
||||
|
||||
@JsonField
|
||||
credential: String
|
||||
|
||||
@JsonField
|
||||
jwk: String
|
||||
|
||||
@JsonField
|
||||
grant: String
|
||||
|
||||
@JsonField
|
||||
keyshare: String
|
||||
|
||||
@JsonField
|
||||
profile: String
|
||||
}
|
||||
|
||||
+274
@@ -0,0 +1,274 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/pkg/motr/types/orm" }
|
||||
|
||||
module orm
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias Base58 = String
|
||||
typealias Base64 = String
|
||||
|
||||
typealias Bech32 = String
|
||||
typealias Keccak = String
|
||||
|
||||
typealias ChainCode = UInt
|
||||
typealias Scope = String
|
||||
|
||||
typealias Hex = String
|
||||
|
||||
class PrimaryKey extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
["query"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
// Enums
|
||||
typealias AssetType = "native"|"wrapped"|"staking"|"pool"|"ibc"|"cw20"
|
||||
|
||||
typealias DIDMethod = "ipfs"|"sonr"|"bitcoin"|"ethereum"|"ibc"|"webauthn"|"dwn"|"service"
|
||||
|
||||
typealias KeyAlgorithm = "es256"|"es384"|"es512"|"eddsa"|"es256k"|"ecdsa"
|
||||
|
||||
typealias KeyCurve = "p256"|"p384"|"p521"|"x25519"|"x448"|"ed25519"|"ed448"|"secp256k1"|"bls12381"|"keccak256"
|
||||
|
||||
typealias KeyEncoding = "raw"|"hex"|"multibase"
|
||||
|
||||
typealias KeyRole = "authentication"|"assertion"|"delegation"|"invocation"
|
||||
|
||||
typealias KeyType = "octet"|"elliptic"|"rsa"|"symmetric"|"hmac"|"mpc"|"zk"|"webauthn"|"bip32"
|
||||
|
||||
typealias KeyShareRole = "user"|"validator"
|
||||
|
||||
typealias PermissionGrant = "none"|"read"|"write"|"verify"|"broadcast"|"admin"
|
||||
|
||||
typealias PermissionScope = "profile"|"metadata"|"permissions"|"wallets"|"transactions"|"user"|"validator"
|
||||
|
||||
|
||||
class Account {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
address: Bech32|Keccak|String
|
||||
|
||||
@JsonField
|
||||
publicKey: Base58
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
index: Int
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Asset {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
symbol: String
|
||||
|
||||
@JsonField
|
||||
decimals: Int
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Chain {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
networkId: String
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Credential {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
attestationType: String
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
label: String?
|
||||
|
||||
@JsonField
|
||||
deviceId: String?
|
||||
|
||||
@JsonField
|
||||
credentialId: Base64
|
||||
|
||||
@JsonField
|
||||
publicKey: Base64
|
||||
|
||||
@JsonField
|
||||
transport: List<String>
|
||||
|
||||
@JsonField
|
||||
signCount: UInt
|
||||
|
||||
@JsonField
|
||||
userPresent: Boolean
|
||||
|
||||
@JsonField
|
||||
userVerified: Boolean
|
||||
|
||||
@JsonField
|
||||
backupEligible: Boolean
|
||||
|
||||
@JsonField
|
||||
backupState: Boolean
|
||||
|
||||
@JsonField
|
||||
cloneWarning: Boolean
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class DID {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
role: KeyRole
|
||||
algorithm: KeyAlgorithm
|
||||
encoding: KeyEncoding
|
||||
curve: KeyCurve
|
||||
key_type: KeyType
|
||||
raw: Base64
|
||||
jwk: JWK
|
||||
}
|
||||
|
||||
class JWK {
|
||||
@JsonField
|
||||
kty: String
|
||||
|
||||
@JsonField
|
||||
crv: String
|
||||
|
||||
@JsonField
|
||||
x: String
|
||||
|
||||
@JsonField
|
||||
y: String
|
||||
|
||||
@JsonField
|
||||
n: String
|
||||
|
||||
@JsonField
|
||||
e: String
|
||||
}
|
||||
|
||||
class Grant {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
token: String
|
||||
|
||||
@JsonField
|
||||
scopes: List<String>
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Keyshare {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
data: Base64
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
lastRefreshed: String?
|
||||
}
|
||||
|
||||
class Profile {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
originUri: String?
|
||||
|
||||
@JsonField
|
||||
publicMetadata: String?
|
||||
|
||||
@JsonField
|
||||
privateMetadata: String?
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
db_name: String = "vault"
|
||||
db_version: Int = 1
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
# Sonr Third Party Protobuf
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains the protobuf definitions for packages that are not part of the Sonr blockchain.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
### `hway`
|
||||
|
||||
The `hway` directory contains the protobuf definitions for the Highway gateway.
|
||||
|
||||
### `ipfs`
|
||||
|
||||
The `ipfs` directory contains the protobuf definitions for the IPFS Network.
|
||||
|
||||
### `motr`
|
||||
|
||||
The `motr` directory contains the protobuf definitions for the Motr client.
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
version: v1
|
||||
plugins:
|
||||
- name: go
|
||||
out: ../..
|
||||
- name: grpc-gateway
|
||||
out: ../..
|
||||
opt: logtostderr=true,allow_colon_final_segments=true
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
# Generated by buf. DO NOT EDIT.
|
||||
version: v1
|
||||
deps:
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 04467658e59e44bbb22fe568206e1f70
|
||||
digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: 05419252bcc241ea8023acf1ed4cadc5
|
||||
digest: shake256:1e54a48c19a8b59d35e0a7efa76402939f515f2d8005df099856f24c37c20a52800308f025abb8cffcd014d437b49707388aaca4865d9d063d8f25d5d4eb77d5
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 88ef6483f90f478fb938c37dde52ece3
|
||||
digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: c0913f24652a4cfc95f77d97443a5005
|
||||
digest: shake256:0ef3248c6235d420fe61f373154adcde6b94e3297f82472b1d8d8c3747240b61b4a10405e2a6f8ac1c98816ac6e690ea7871024aa5ae0e035cd540214667ceed
|
||||
- remote: buf.build
|
||||
owner: onsonr
|
||||
repository: sonr
|
||||
commit: e2a05b1a59154da6be3fe148cf01a375
|
||||
digest: shake256:0714d88978fe9a1d7b438b13ee1e95aeaef24c7f3667957da60b9a9d8f2ad55f40c2fb84409e21d47738969bff02fa16682340449653508a2ce6196ac2aec36b
|
||||
- remote: buf.build
|
||||
owner: protocolbuffers
|
||||
repository: wellknowntypes
|
||||
commit: 657250e6a39648cbb169d079a60bd9ba
|
||||
digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb
|
||||
- remote: buf.build
|
||||
owner: tendermint
|
||||
repository: tendermint
|
||||
commit: 33ed361a90514289beabf3189e1d7665
|
||||
digest: shake256:038267e06294714fd883610626554b04a127b576b4e253befb4206cb72d5d3c1eeccacd4b9ec8e3fb891f7c14e1cb0f770c077d2989638995b0a61c85afedb1d
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
version: v1
|
||||
name: buf.build/onsonr/thirdparty
|
||||
deps:
|
||||
- buf.build/onsonr/sonr
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
- COMMENTS
|
||||
- FILE_LOWER_SNAKE_CASE
|
||||
except:
|
||||
- UNARY_RPC
|
||||
- COMMENT_FIELD
|
||||
- SERVICE_SUFFIX
|
||||
- PACKAGE_VERSION_SUFFIX
|
||||
- RPC_REQUEST_STANDARD_NAME
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package common.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/common/types;commonv1";
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package common.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/common/types;commonv1";
|
||||
|
||||
// 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;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package common.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/common/types;commonv1";
|
||||
|
||||
message URI {
|
||||
enum URIProtocol {
|
||||
HTTPS = 0;
|
||||
IPFS = 1;
|
||||
IPNS = 2;
|
||||
DID = 3;
|
||||
}
|
||||
URIProtocol protocol = 1;
|
||||
string value = 2;
|
||||
}
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package hway.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/hway/types";
|
||||
|
||||
service Highway {
|
||||
rpc GetJWKS(GetJWKSRequest) returns (GetJWKSResponse);
|
||||
rpc GetToken(GetTokenRequest) returns (GetTokenResponse);
|
||||
rpc GrantAuthorization(GrantAuthorizationRequest) returns (GrantAuthorizationResponse);
|
||||
}
|
||||
|
||||
message GetJWKSRequest {}
|
||||
|
||||
message GetJWKSResponse {
|
||||
string jwks = 1;
|
||||
}
|
||||
|
||||
message GetTokenRequest {
|
||||
string subject = 1;
|
||||
string origin = 2;
|
||||
string key = 3;
|
||||
string asset = 4;
|
||||
}
|
||||
|
||||
message GetTokenResponse {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
message GrantAuthorizationRequest {
|
||||
string subject = 1;
|
||||
string origin = 2;
|
||||
string key = 3;
|
||||
string asset = 4;
|
||||
string assertion = 5;
|
||||
}
|
||||
|
||||
message GrantAuthorizationResponse {
|
||||
string token = 1;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package hway.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/hway/types";
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package motr.v1;
|
||||
|
||||
option go_package = "github.com/onsonr/sonr/pkg/motr/types";
|
||||
|
||||
service Motr {
|
||||
rpc Pin(PinRequest) returns (PinResponse);
|
||||
rpc Unpin(UnpinRequest) returns (UnpinResponse);
|
||||
}
|
||||
|
||||
message PinRequest {
|
||||
string cid = 1;
|
||||
}
|
||||
|
||||
message PinResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
message UnpinRequest {
|
||||
string cid = 1;
|
||||
}
|
||||
|
||||
message UnpinResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user