- db.Open: delegate to mcdsl/db.Open - db.Migrate: convert to mcdsl/db.Migration format, delegate - auth: type aliases for TokenInfo/Authenticator/Config from mcdsl, re-export error sentinels, Logout helper - cmd/server: construct auth.Authenticator from Config (not mcias.Client) - server/routes.go logout: use auth.Logout(authenticator, token) - grpcserver/auth.go: same logout pattern, fix Login return type (time.Time not string) - webserver: replace mcias.Client with mcdsl/auth for service token validation; resolveUser degrades to raw UUID (TODO: restore when mcias client library is properly tagged) - Dockerfiles: bump to golang:1.25-alpine, remove gcc/musl-dev, add VERSION build arg - Deploy: add docker-compose-rift.yml with localhost-only port mapping - Remove git.wntrmute.dev/kyle/mcias/clients/go dependency entirely - All tests pass, net -185 lines Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package db
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
mcdsldb "git.wntrmute.dev/kyle/mcdsl/db"
|
|
)
|
|
|
|
// Migrations is the ordered list of metacrypt schema migrations.
|
|
var Migrations = []mcdsldb.Migration{
|
|
{
|
|
Version: 1,
|
|
Name: "initial schema",
|
|
SQL: `CREATE TABLE IF NOT EXISTS seal_config (
|
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
encrypted_mek BLOB NOT NULL,
|
|
kdf_salt BLOB NOT NULL,
|
|
argon2_time INTEGER NOT NULL,
|
|
argon2_memory INTEGER NOT NULL,
|
|
argon2_threads INTEGER NOT NULL,
|
|
initialized_at DATETIME NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS barrier_entries (
|
|
path TEXT PRIMARY KEY,
|
|
value BLOB NOT NULL,
|
|
created_at DATETIME NOT NULL DEFAULT (datetime('now')),
|
|
updated_at DATETIME NOT NULL DEFAULT (datetime('now'))
|
|
);`,
|
|
},
|
|
{
|
|
Version: 2,
|
|
Name: "barrier key registry",
|
|
SQL: `CREATE TABLE IF NOT EXISTS barrier_keys (
|
|
key_id TEXT PRIMARY KEY,
|
|
version INTEGER NOT NULL DEFAULT 1,
|
|
encrypted_dek BLOB NOT NULL,
|
|
created_at DATETIME NOT NULL DEFAULT (datetime('now')),
|
|
rotated_at DATETIME NOT NULL DEFAULT (datetime('now'))
|
|
);`,
|
|
},
|
|
}
|
|
|
|
// Migrate applies all pending migrations.
|
|
func Migrate(database *sql.DB) error {
|
|
return mcdsldb.Migrate(database, Migrations)
|
|
}
|