mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/implement wss routes (#1196)
* feat(database): create schema for hway and motr * fix(gateway): correct naming inconsistencies in handlers * build: update schema file to be compatible with postgresql syntax * fix: update schema to be compatible with PostgreSQL syntax * chore: update query_hway.sql to follow sqlc syntax * ```text refactor: update query_hway.sql for PostgreSQL and sqlc ``` * feat: add vaults table to store encrypted data * refactor: Update vaults table schema for sqlc compatibility * chore(deps): Upgrade dependencies and add pgx/v5 * refactor(Makefile): move sqlc generate to internal/models * docs(foundations): remove outdated pages * chore(build): add Taskfile for build tasks * refactor(embed): move embed files to internal package * docs: add documentation for Cosmos SDK ORM
This commit is contained in:
@@ -30,9 +30,6 @@ class Config {
|
||||
|
||||
@JsonField
|
||||
sonrChainId: String
|
||||
|
||||
@JsonField
|
||||
vaultSchema: Schema
|
||||
}
|
||||
|
||||
class Environment {
|
||||
@@ -52,30 +49,3 @@ class Environment {
|
||||
wasmPath: String
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/models" }
|
||||
|
||||
module sonr.orm.Models
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
|
||||
// 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"
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user