ident
All repositories: gitoria
4.0 KB
// tests/oldstore-009.hl — THE MIGRATION FIXTURE (tests/migration.mjs): an ident store in the// OLD format (before mission 009: `*id` tables `<prefix>-<table>.*`, public ids = id + 1),// with known keys, secret hashes and per-app ids. OLD_PREFIX=/abs/dir/ident// The ids are EXPLICIT (id = 0, 1, …) since hybriel 5bb08628 (#4): a fresh `*id` table counts from 1// now, the old tables counted from 0 (mission 048).import { MPackDB } from 'hl:mpackdb'import { env } from 'hl:proc'import { now } from 'hl:time'import { sha256 } from 'hl:crypto'p = env('OLD_PREFIX')ta = env('OLD_TESTAPP') != null && env('OLD_TESTAPP') != '' ? env('OLD_TESTAPP') : 'http://127.0.0.1:8396' // the fixture app's origin (migration.mjs passes its TA)bob = env('OLD_BOBAPP') != null && env('OLD_BOBAPP') != '' ? env('OLD_BOBAPP') : 'http://127.0.0.1:8397' // Bob's app origin (migration.mjs passes its BOB)accounts = new MPackDB(file = p + '-accounts.db', primaryKey = '*id', indexes = ['!email'])identities = new MPackDB(file = p + '-identities.db', primaryKey = '*id', indexes = ['account'])otp = new MPackDB(file = p + '-otp.db', primaryKey = '*id', indexes = ['email'])sends = new MPackDB(file = p + '-sends.db', primaryKey = '*id', indexes = ['email'])apps = new MPackDB(file = p + '-apps.db', primaryKey = '*id', indexes = ['owner' '!apiKey'])conns = new MPackDB(file = p + '-connections.db', primaryKey = '*id', indexes = ['!pair' 'app' '!appIdentity'])requests = new MPackDB(file = p + '-requests.db', primaryKey = '*id', indexes = ['!rid'])grants = new MPackDB(file = p + '-grants.db', primaryKey = '*id', indexes = ['!hash'])t = now()x = (c, n) => {let s = ''while (s.length < n) { s = s + c }return s}accounts.put({ id = 0 email = '[email protected]' timeZone = 'Europe/Vienna' created = t - 90000 }) // public 1accounts.put({ id = 1 email = '[email protected]' timeZone = 'Asia/Tokyo' created = t - 80000 }) // public 2identities.put({ id = 0 account = 1 identityName = 'Default' nickname = 'Al' firstname = 'Alice' lastname = 'Example' created = t - 89000 updated = t - 1000 }) // 1identities.put({ id = 1 account = 1 identityName = 'Work' nickname = '' firstname = '' lastname = '' created = t - 70000 updated = t - 70000 }) // 2identities.put({ id = 2 account = 2 identityName = 'Default' nickname = '' firstname = '' lastname = '' created = t - 79000 updated = t - 79000 }) // 3gone = identities.put({ id = 3 account = 1 identityName = 'Old' nickname = '' firstname = '' lastname = '' created = t - 60000 updated = t - 60000 }) // 4, deleted belowapps.put({ id = 0 owner = 1 name = 'Fixture app' origins = ta apiKey = 'pk_' + x('1', 32) secretHash = sha256('sk_' + x('2', 48)) created = t - 50000 updated = t - 50000 }) // 1apps.put({ id = 1 owner = 2 name = 'Bob app' origins = bob apiKey = 'pk_' + x('3', 32) secretHash = sha256('sk_' + x('4', 48)) created = t - 40000 updated = t - 40000 }) // 2conns.put({ id = 0 pair = '1:1' app = 1 identity = 1 appIdentity = x('a', 32) created = t - 49000 })conns.put({ id = 1 pair = '1:2' app = 1 identity = 2 appIdentity = x('b', 32) created = t - 48000 })conns.put({ id = 2 pair = '1:4' app = 1 identity = 4 appIdentity = x('c', 32) created = t - 47000 })conns.put({ id = 3 pair = '2:3' app = 2 identity = 3 appIdentity = x('d', 32) created = t - 39000 })identities.delete(gone)sends.put({ id = 0 email = '[email protected]' at = t - 1000 })otp.put({ id = 0 email = '[email protected]' hash = sha256('[email protected]:123456') expires = t + 600000 tries = 0 })requests.put({ id = 0 rid = x('f', 32) app = 1 returnUrl = ta + '/callback' expires = t + 1800000 })grants.put({ id = 0 hash = sha256(x('e', 48)) app = 1 identity = 2 appIdentity = x('b', 32) expires = t + 3600000 })console.log('oldstore: accounts ' + accounts.count() + ' identities ' + identities.count() + ' apps ' + apps.count() + ' connections ' + conns.count() + ' otp ' + otp.count() + ' sends ' + sends.count() + ' requests ' + requests.count() + ' grants ' + grants.count())
Branches
Latest commits
- 45f7e4daident: the user menu's Sign out waits for the server before it reloads (the apps gate failed because the session could still be signed in)mre
- f07658c7ident: home page shows the account once (account bar removed, the user menu carries email, Sign out, Sign out everywhere); wildcard origins https://*.domain for apps on many subdomains; gates follow (WIP: gates not re-run after the last edits)mre
- f2c43bbbtheme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 6d4f996esessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 029eb5e5deploy: security gate (tests/security.mjs)mre
- d3c065a8security audit (SI): uploadMax 0, Secure __Host- cookie behind https, headers on function routes/files, page CSP+referrer meta, app/identity caps, tests/security.mjs, reportmre
- 5561a0cbreport I4-mobilemre
- 4ca2ed20404 page in the shell (viewport, status 404, way home); phone: account actions live in the user menu so the open menu covers nothing; mobile gate; signoutall waits for a cold startmre
- 9baad745tests: browser gate waits for the reloaded document (offline reload race under CPU throttle); HL_CPU_THROTTLE knobmre
- b96796bdtests: wait for hydration before real clicks after a navigation (H2)mre
- 9722964fre-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- c9b196c9tests/iplimit: wait for the welcome form itself after B's first login (identities list renders before it); mission 017 reportmre
- 72e0f587ident#26: identity page with "Used in" (app, since, last use, Notif. chip, empty state); lastLogin recorded at exchange; gates + lisbeth E2E; mission 016 reportmre
- 94576fbcident#26 WIP: identity page /identity/:iid with "Used in" (app, since, last use, Notif. chip), lastLogin recorded at exchange, "Used in…" link on the identities list; apps gate 4b, e2e-usedin.mjsmre
- 349cb502tests/invites: wait for hydration on the code page before entering the code (native GET submit raced the welcome form); mission 015 reportmre
- d1bf4720tests: no hard-coded ports — every gate's ports and fixture origins come from <GATE>_PORT / _CHROME env (defaults unchanged; Bob/fixture origins follow, selector cookie name too)mre
- 6280c92fre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 147744bftests/migration: the fixture app origin follows MIGRATION_GATE_TESTAPP_PORT (oldstore-009 OLD_TESTAPP)mre
- 48cd36bctests/migration: ports from env (MIGRATION_GATE_PORT, MIGRATION_GATE_TESTAPP_PORT); 8395/8396 were taken by a foreign servermre
- 3d9b2fd8docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre