sonr/pkl/ORM.pkl
Prad Nukala 279ab6e5e3
feature/1129 integrate webauthn controller (#1135)
* **refactor: remove nebula static file serving**
* **feat: Add login, register, and authorize sections**
* **feat: implement registration form UI**
* **refactor: abstract template rendering to ctx module**
* **feat: add deployment target for Highway gateway**
* **feat: migrate Highway gateway to Cloudflare Workers**
* **feat: refactor nebula routes to components**
* **chore(deps): remove unused dependencies**
* **chore(deps): remove unused dependencies**
* **feat: add user and relaying party entities**
* **refactor: remove unused imports**
* 
* **feat: add motion scale-in and opacity-in animations**
* **refactor: move dwn and orm packages to internal**
* **refactor: update imports to use relative paths**
* **refactor: rename build targets for clarity**
* **feat: add RelayingPartyEntity model**
* **refactor: rename creds templates to credentials**
* **refactor: remove unused entity model**
* **refactor: move models to internal package**
* **refactor: move models package to internal/orm**
* **feat: implement broadcast channel context**
* **feat: remove config upload step**
* **feat: remove unused configuration files**
* **feat: migrate authentication logic to workers**
* **feat: remove cloudflared dependency**
* **refactor: move client related routes to 'routes/client.go'**
* **feat: implement macaroon middleware**
* **refactor: move fetch package to cmd/motr**
* **feat: remove auth and grant endpoints**
* **docs: add conceptual descriptions to did module**

<sub><a
href="https://huly.app/guest/sonrhq?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsaW5rSWQiOiI2NzA4MTIyNmM3ZDZhNTZhOGY4ZGFjOTciLCJndWVzdCI6InRydWUiLCJlbWFpbCI6IiNndWVzdEBoYy5lbmdpbmVlcmluZyIsIndvcmtzcGFjZSI6InctcHJhZC1zb25yaHEtNjVlZjcyZDQtY2UyOGQ0ODJjNi00ZWY4ZDAifQ.j-w5jk5Ji-0vCkaxVaK8pDMIOhRsXmG7o6oZictoHYE">Huly&reg;:
<b>ENG-1057</b></a></sub>
2024-10-10 13:44:17 -04:00

274 lines
3.7 KiB
Plaintext

@go.Package { name = "github.com/onsonr/sonr/internal/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