mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/migrate models (#16)
* feat: add new supported attestation formats to genesis * feat: refactor keyType to keytype enum * refactor: remove unused imports and code * refactor: update main.go to use src package * refactor: move web-related structs from to * refactor: move client middleware package to root * refactor: remove unused IndexedDB dependency * feat: update worker implementation to use * feat: add Caddyfile and Caddy configuration for vault service * refactor(config): move keyshare and address to Motr config * fix: validate service origin in AllocateVault * chore: remove IndexedDB configuration * feat: add support for IPNS-based vault access
This commit is contained in:
+25
-12
@@ -20,30 +20,43 @@ class Config {
|
||||
sonr: Sonr
|
||||
|
||||
@JsonField
|
||||
keyshare: JSON?
|
||||
|
||||
@JsonField
|
||||
address: String?
|
||||
|
||||
@JsonField
|
||||
vault: IndexedDB
|
||||
}
|
||||
|
||||
class IndexedDB {
|
||||
name: String = "vault"
|
||||
version: Int = 1
|
||||
motr: Motr
|
||||
}
|
||||
|
||||
class IPFS {
|
||||
@JsonField
|
||||
apiUrl: String
|
||||
|
||||
@JsonField
|
||||
gatewayUrl: String
|
||||
}
|
||||
|
||||
class Motr {
|
||||
@JsonField
|
||||
keyshare: JSON
|
||||
|
||||
@JsonField
|
||||
address: String
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
}
|
||||
|
||||
class Sonr {
|
||||
@JsonField
|
||||
apiUrl: String
|
||||
|
||||
@JsonField
|
||||
grpcUrl: String
|
||||
|
||||
@JsonField
|
||||
rpcUrl: String
|
||||
|
||||
@JsonField
|
||||
webSocketUrl: String
|
||||
|
||||
@JsonField
|
||||
chainId: String
|
||||
}
|
||||
|
||||
|
||||
|
||||
+60
-4
@@ -1,6 +1,6 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/vfs/models" }
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/orm" }
|
||||
|
||||
module models
|
||||
module orm
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
@@ -15,7 +15,6 @@ typealias ChainCode = UInt
|
||||
typealias Scope = String
|
||||
|
||||
typealias Hex = String
|
||||
typealias UTF8 = String
|
||||
|
||||
class PrimaryKey extends go.Field {
|
||||
structTags {
|
||||
@@ -30,6 +29,28 @@ class JsonField extends go.Field {
|
||||
}
|
||||
}
|
||||
|
||||
// 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: DID
|
||||
@@ -109,6 +130,12 @@ class Credential {
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
label: String?
|
||||
|
||||
@JsonField
|
||||
deviceId: String?
|
||||
|
||||
@JsonField
|
||||
credentialId: Base64
|
||||
|
||||
@@ -143,6 +170,26 @@ class Credential {
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
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
|
||||
@@ -188,7 +235,13 @@ class Keyshare {
|
||||
|
||||
class PublicKey {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
role: KeyRole
|
||||
algorithm: KeyAlgorithm
|
||||
encoding: KeyEncoding
|
||||
curve: KeyCurve
|
||||
key_type: KeyType
|
||||
raw: Base58
|
||||
jwk: JWK
|
||||
}
|
||||
|
||||
class Profile {
|
||||
@@ -218,3 +271,6 @@ class Profile {
|
||||
}
|
||||
|
||||
|
||||
db_name: String = "vault"
|
||||
db_version: Int = 1
|
||||
|
||||
|
||||
+2
-11
@@ -1,6 +1,6 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/vfs/txns" }
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/orm/transactions" }
|
||||
|
||||
module txns
|
||||
module transactions
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
@@ -25,15 +25,6 @@ class Proposal {
|
||||
description: String
|
||||
}
|
||||
|
||||
class SWT {
|
||||
origin: String
|
||||
location: String
|
||||
identifier: String
|
||||
scopes: List<String>
|
||||
properties: Map<String, String>
|
||||
expiryBlock: Int
|
||||
}
|
||||
|
||||
/// Gov module messages
|
||||
class MsgGovSubmitProposal extends Msg {
|
||||
typeUrl = "/cosmos.gov.v1beta1.MsgSubmitProposal"
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/orm/browser" }
|
||||
|
||||
module browser
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class PublicKeyCredentialRequestOptions {
|
||||
challenge: String
|
||||
timeout: Int
|
||||
rpId: String
|
||||
allowCredentials: List<PublicKeyCredentialDescriptor>
|
||||
userVerification: String
|
||||
extensions: List<PublicKeyCredentialParameters>
|
||||
}
|
||||
|
||||
class PublicKeyCredentialDescriptor {
|
||||
id: String
|
||||
transports: List<String>
|
||||
type: String
|
||||
}
|
||||
|
||||
class PublicKeyCredentialParameters {
|
||||
type: String
|
||||
alg: Int?
|
||||
}
|
||||
|
||||
class AuthenticatorSelectionCriteria {
|
||||
authenticatorAttachment: String
|
||||
requireResidentKey: Boolean
|
||||
userVerification: String
|
||||
}
|
||||
|
||||
|
||||
class PublicKeyCredentialCreationOptions {
|
||||
rp: RpEntity
|
||||
user: UserEntity
|
||||
challenge: String
|
||||
pubKeyCredParams: List<PublicKeyCredentialParameters>
|
||||
timeout: Int
|
||||
excludeCredentials: List<PublicKeyCredentialDescriptor>
|
||||
authenticatorSelection: AuthenticatorSelectionCriteria?
|
||||
attestation: String
|
||||
extensions: List<PublicKeyCredentialParameters>
|
||||
}
|
||||
|
||||
class RpEntity {
|
||||
id: String
|
||||
name: String?
|
||||
icon: String?
|
||||
}
|
||||
|
||||
class UserEntity {
|
||||
id: String
|
||||
displayName: String?
|
||||
name: String?
|
||||
}
|
||||
|
||||
class SWT {
|
||||
origin: String
|
||||
location: String
|
||||
identifier: String
|
||||
scopes: List<String>
|
||||
properties: Map<String, String>
|
||||
expiryBlock: Int
|
||||
}
|
||||
Reference in New Issue
Block a user