mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 18:01:39 +00:00
feature/refactor did state (#10)
* feat(did): remove account types * feat: Refactor Property to Proof in zkprop.go * feat: add ZKP proof mechanism for verifications * fix: return bool and error from pinInitialVault * feat: implement KeyshareSet for managing user and validator keyshares * feat: Update Credential type in protobuf * feat: update credential schema with sign count * feat: migrate and modules to middleware * refactor: rename vault module to ORM * chore(dwn): add service worker registration to index template * feat: integrate service worker for offline functionality * refactor(did): use DIDNamespace enum for verification method in proto reflection * refactor: update protobuf definitions to support Keyshare * feat: expose did keeper in app keepers * Add Motr Web App * refactor: rename motr/handlers/discovery.go to motr/handlers/openid.go * refactor: move session related code to middleware * feat: add database operations for managing assets, chains, and credentials * feat: add htmx support for UI updates * refactor: extract common helper scripts * chore: remove unused storage GUI components * refactor: Move frontend rendering to dedicated handlers * refactor: rename to * refactor: move alert implementation to templ * feat: add alert component with icon, title, and message * feat: add new RequestHeaders struct to store request headers * Feature/create home view (#9) * refactor: move view logic to new htmx handler * refactor: remove unnecessary dependencies * refactor: remove unused dependencies * feat(devbox): integrate air for local development * feat: implement openid connect discovery document * refactor: rename to * refactor(did): update service handling to support DNS discovery * feat: add support for user and validator keyshares * refactor: move keyshare signing logic to signer
This commit is contained in:
+309
@@ -0,0 +1,309 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/db/orm" }
|
||||
|
||||
module orm
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
class PrimaryKey extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "primaryKey,autoIncrement"
|
||||
["json"] = "%{name},omitempty"
|
||||
["query"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class Unique extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "unique"
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class Default extends go.Field {
|
||||
defaultValue: String
|
||||
structTags {
|
||||
["gorm"] = "default:%{defaultValue}"
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class NotNull extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "not null"
|
||||
}
|
||||
}
|
||||
|
||||
class ForeignKey extends go.Field {
|
||||
references: String
|
||||
structTags {
|
||||
["gorm"] = "foreignKey:%{references}"
|
||||
}
|
||||
}
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
["param"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class Account {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
address: String
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Asset {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
symbol: String
|
||||
|
||||
@JsonField
|
||||
decimals: Int
|
||||
|
||||
@JsonField
|
||||
chainId: Int?
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Chain {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
networkId: String
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Credential {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: String
|
||||
|
||||
@JsonField
|
||||
attestationType: String
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
credentialId: String
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
|
||||
@JsonField
|
||||
transport: 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 Profile {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: String
|
||||
|
||||
@JsonField
|
||||
originUri: String?
|
||||
|
||||
@JsonField
|
||||
publicMetadata: String?
|
||||
|
||||
@JsonField
|
||||
privateMetadata: String?
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Property {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
profileId: String
|
||||
|
||||
@JsonField
|
||||
key: String
|
||||
|
||||
@JsonField
|
||||
accumulator: String
|
||||
|
||||
@JsonField
|
||||
propertyKey: String
|
||||
}
|
||||
|
||||
class Keyshare {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
metadata: String
|
||||
|
||||
@JsonField
|
||||
payloads: String
|
||||
|
||||
@JsonField
|
||||
protocol: String
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
version: Int
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class PublicKey {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
algorithm: Int
|
||||
|
||||
@JsonField
|
||||
encoding: Int
|
||||
|
||||
@JsonField
|
||||
jwk: String
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Permission {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
serviceId: String
|
||||
|
||||
@JsonField
|
||||
grants: String
|
||||
|
||||
@JsonField
|
||||
scopes: String
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
//
|
||||
// OpenID Connect
|
||||
//
|
||||
|
||||
class DiscoveryDocument {
|
||||
@JsonField
|
||||
issuer: String
|
||||
|
||||
@JsonField
|
||||
authorization_endpoint: String
|
||||
|
||||
@JsonField
|
||||
token_endpoint: String
|
||||
|
||||
@JsonField
|
||||
userinfo_endpoint: String
|
||||
|
||||
@JsonField
|
||||
jwks_uri: String
|
||||
|
||||
@JsonField
|
||||
registration_endpoint: String
|
||||
|
||||
@JsonField
|
||||
scopes_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
response_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
response_modes_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
subject_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
id_token_signing_alg_values_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
claims_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
grant_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
acr_values_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
token_endpoint_auth_methods_supported: List<String>
|
||||
}
|
||||
Reference in New Issue
Block a user