ident
All repositories: gitoria
3.8 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')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 = 'http://127.0.0.1:8396' 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 = 'http://127.0.0.1:8397' 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 = 'http://127.0.0.1:8396/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
- d6da2d02tests: delivery and migration gate ports from env (DELIVERY_GATE_PORT, DELIVERY_GATE_CHROME, MIGRATION_GATE_CHROME) — hard-coded 8700-8719 collided with a worker during deploymre
- 7276a008ident mission 013: re-vendor Hybriel master f9614007 (#200, #202 mpackdb copy fix); gates and e2e rerunmre
- e13e30c3ident mission 013: report, mission, repro, LOGmre
- eff734f3ident mission 013: in-place sign-out also closes the code step (no leftover code form); checksmre
- b7a61546ident mission 013: e2e — in-place main-menu mark kept as a known gapmre
- 59b43d81ident mission 013: sign out everywhere keeps this browser's own (signed-out) session so the page goes on in placemre
- 716e14ffident mission 013: browser gate — Bob signs out everywhere (no second code request)mre
- 5885f1c9ident mission 013 step 2: stopgap reload removed (in-place sign-in/out reach the shell via emit, notices back, route-marked main menu), gates updatedmre
- 734ac0a9ident mission 013 step 1: re-vendor Hybriel ce6f2e0a (plugins whole; bin/ is git-ignored)mre
- b37875ccident mission 012 part 3: real-Chrome fixes (brand 44 px, identity form width), e2e walk, report, logmre
- f989c2ebident mission 012: stopgap reload after in-place sign-in/sign-out (until hybriel#193), gates wait for cold start, welcome end reloadsmre
- 443291d4ident mission 012: /start on its own shell (no account), browser gate 152/0, reportmre
- 021dd0fcident mission 012: browser gate waits cold start (IDENT_COLD_MS), header selectors, e2e checks; shell events from a page do not reach it (probe), current not marked, account-bar link 44 pxmre
- 97f77b07ident mission 012 (WIP): onto the layouts theme dbe3de7, shell on AppHeader/MainMenu/UserMenu/Sidebar + ContentFirst, styles cut, check-theme gatemre
- 8e4f435bpaths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- fa288f63ident mission 011: report wording (Intl zone names)mre
- 961fae01ident mission 011: report, LOG, STATUSmre
- 65348039ident#7: delivery gate — console check split at the gate's own server restart (49 checks)mre
- dfa7b783ident#7: README (Delivery, env, gate, files, data), deploy.sh runs tests/delivery.mjsmre
- ab6331f4ident#7: tests/delivery.mjs — fake clock gate: Vienna/New York/Tokyo/UTC 17:00, urgent, mail off, restart, DST days, zone changemre