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:
Prad Nukala
2024-09-11 15:10:54 -04:00
committed by GitHub
parent 4f2d342649
commit bbfe2a2329
197 changed files with 14668 additions and 27810 deletions
+9 -22
View File
@@ -4,11 +4,12 @@ import (
"crypto/rand"
"github.com/ncruces/go-sqlite3/gormlite"
"github.com/ncruces/go-sqlite3/vfs"
"golang.org/x/crypto/argon2"
"gorm.io/gorm"
"lukechampine.com/adiantum/hbsh"
"lukechampine.com/adiantum/hpolyc"
_ "github.com/ncruces/go-sqlite3/embed"
)
type DBOption func(config *DBConfig)
@@ -19,46 +20,32 @@ func WithDir(dir string) DBOption {
}
}
func WithInMemory() DBOption {
return func(config *DBConfig) {
config.InMemory = true
}
}
func WithSecretKey(secretKey string) DBOption {
return func(config *DBConfig) {
config.SecretKey = secretKey
}
}
func WithOpenFlag(flag vfs.OpenFlag) DBOption {
return func(config *DBConfig) {
config.OpenFlag = flag
}
}
type DBConfig struct {
Dir string
InMemory bool
SecretKey string
OpenFlag vfs.OpenFlag
fileName string
}
func (config *DBConfig) ConnectionString() string {
connStr := "file:"
if config.InMemory {
connStr += ":memory:"
} else {
connStr += config.Dir + "/" + config.fileName
}
connStr += config.Dir + "/" + config.fileName
return connStr
}
// GormDialector creates a gorm dialector for the database.
func (config *DBConfig) GormDialector() (*gorm.DB, error) {
return gorm.Open(gormlite.Open(config.ConnectionString()))
func (config *DBConfig) Open() (*DB, error) {
db, err := gorm.Open(gormlite.Open(config.ConnectionString()))
if err != nil {
return nil, err
}
return createInitialTables(db)
}
// HBSH creates an HBSH cipher given a key.