mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
295 lines
4.0 KiB
Plaintext
295 lines
4.0 KiB
Plaintext
@go.Package { name = "github.com/onsonr/sonr/pkg/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?
|
|
}
|
|
|
|
class Session {
|
|
@PrimaryKey
|
|
id: String
|
|
|
|
@JsonField
|
|
subject: String
|
|
|
|
@JsonField
|
|
controller: Bech32
|
|
|
|
@JsonField
|
|
origin: String
|
|
|
|
@JsonField
|
|
createdAt: String?
|
|
|
|
@JsonField
|
|
updatedAt: String?
|
|
}
|
|
|
|
db_name: String = "vault"
|
|
db_version: Int = 1
|