The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Sign in to the web by QR, approved from a phone (backend + web) (#447)
0xken1561830fcafec2
diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prismaindex e266f53b1..775dd8433 100644--- a/backend/prisma/schema.prisma+++ b/backend/prisma/schema.prisma@@ -715,8 +715,15 @@ model HarnessSession {/// Slides forward on every refresh: a phone in use stays signed in, one left in a drawer does not.expiresAt DateTimerevokedAt DateTime?+ /// "viewer" (a phone, signed in by a handoff) or "daemon" (a machine, signed in by a phone approving+ /// its QR). Only a daemon session may open `/api/adapter-ws`, and only for its own computer.+ kind String @default("viewer")+ /// Daemon sessions only: the machine the approval bound, and the computer it was approved for.+ machineId String?+ computerId String?@@index([userId])+ @@index([machineId])@@map("harness_sessions")}diff --git a/backend/src/lib/adapterWs.ts b/backend/src/lib/adapterWs.tsindex f1c06aa3b..666744f61 100644--- a/backend/src/lib/adapterWs.ts+++ b/backend/src/lib/adapterWs.ts@@ -170,7 +170,7 @@ export function handleAdapterUpgrade(req: IncomingMessage, socket: Duplex, head:const countryCode = countryCodeFromHeaders(req.headers)void (async () => {let user- try { user = await authenticateAccessToken(accessToken, autonomousEnv, { allowHarnessSession: false }) } catch (err) {+ try { user = await authenticateAccessToken(accessToken, autonomousEnv, { allowHarnessSession: false, allowDaemonSessionFor: computerId }) } catch (err) {if (err instanceof SsoAuthError && (err.code === 'AUTONOMOUS_ENV_MISMATCH' || err.code === 'AUTONOMOUS_ENV_NOT_ALLOWED')) {try { socket.write('HTTP/1.1 403 Forbidden\r\nConnection: close\r\nContent-Length: 0\r\n\r\n') } catch { /* ignore */ }socket.destroy()diff --git a/backend/src/lib/bus.ts b/backend/src/lib/bus.tsindex f8bf563c4..b3ff88e48 100644--- a/backend/src/lib/bus.ts+++ b/backend/src/lib/bus.ts@@ -574,6 +574,22 @@ export async function consumeNewIdQuota(kind: NewIdKind, userId: string): Promis}}+/**+ * A plain fixed-window limiter: at most [limit] calls per [windowSec] for [key]. Fails OPEN — a Redis+ * blip must not lock people out of signing in — and says so in the log.+ */+export async function consumeRateLimit(key: string, limit: number, windowSec: number): Promise<boolean> {+ if (limit <= 0) return true+ try {+ const k = `rl:${key}:${Math.floor(Date.now() / 1000 / windowSec)}`+ const [[, n]] = (await pub.multi().incr(k).expire(k, windowSec).exec()) as [[unknown, number], [unknown, number]]+ return n <= limit+ } catch (err) {+ logger.error('[bus] consumeRateLimit failed — allowing', err, { key })+ return true+ }+}+// ── device presence (is a paired device's socket currently connected?) ─────────────────────────────// One key PER DEVICE (`device:{deviceId}:conn`) — a user with many devices has one independent key,// refresh loop and supersede scope per device. The VALUE is the connection's own token so that whendiff --git a/backend/src/lib/deviceAuth.ts b/backend/src/lib/deviceAuth.tsindex 480a78dbd..3d1afcf44 100644--- a/backend/src/lib/deviceAuth.ts+++ b/backend/src/lib/deviceAuth.ts@@ -1,40 +1,67 @@import { randomBytes, createHash } from 'crypto'import { pub } from './bus.js'import { logger } from '../utils/logger.js'+import type { HarnessTokens } from './harnessSession.js'/**- * Device-authorization grant (RFC 8628-shaped) for the `harness` CLI and the desktop app.+ * Machine sign-in approved from a phone (RFC 8628-shaped): `harness login` and the desktop app's+ * sign-in show a QR; a phone already signed in scans it, sees which computer is asking, and approves.*- * Neither can do a browser OAuth redirect: `/api/auth/authorize` pins `redirect_uri` to the WEB- * callback page, and registering a native/loopback redirect with the SSO client is not something this- * repo controls. So instead of inventing a second auth path, the client never sees a credential of the- * user's at all — it shows a short code, the user approves it in a browser where they are ALREADY- * signed in, and the client polls until a machine key comes back.+ * machine → POST /api/device-auth/start (no auth) → { userCode, deviceCode } userCode → the QR+ * phone → GET /api/device-auth/lookup (signed in) → what is asking, for the confirm screen+ * phone → POST /api/device-auth/approve (signed in) → the machine is bound, a DAEMON session minted+ * machine → POST /api/device-auth/poll (no auth) → that session's tokens, handed over once*- * What the client receives is a machine apiKey, not an SSO token: it is a machine, and that is the only- * credential a machine ever needs. Nothing user-scoped is minted for it.+ * The machine receives a Harness daemon session (lib/harnessSession.ts `createDaemonSession`): a+ * sign-in of its own, bound to the computer that asked, which `/api/adapter-ws` accepts for that+ * computer only. It never sees the phone's credential.*- * Redis, not Mongo: every record here is dead within ten minutes and a crashed worker losing one costs- * the user a retry, not data.+ * The user code travels in the QR, not a person's typing, so it is long (128 bits) and dies in+ * [TTL_SEC]. The QR also carries the machine's E2EE pairing code and fingerprint, which never reach+ * this server: it can sign a machine in, but not join the machine's end-to-end link.+ *+ * Redis, not Mongo: every record here is dead within minutes and a crashed worker losing one costs+ * the user a rescan, not data.*/-const TTL_SEC = 600 // 10 minutes to walk to a browser and type six characters+const TTL_SEC = 180 // a QR on a screen: long enough to find the phone, short enough to go staleconst POLL_MIN_INTERVAL_SEC = 2+const USER_CODE_LENGTH = 26 // 26 × 5 bits = 130 bits-// Crockford base32 minus I/L/O/U — same alphabet the device pairing code uses, for the same reason:-// these get read off one screen and typed into another.+// Crockford base32 minus I/L/O/U, so a code read off a screen by hand still normalises.const ALPHABET = '0123456789ABCDEFGHJKMNPQRSTVWXYZ'export type DeviceAuthState = 'pending' | 'approved' | 'denied'+/**+ * Who is asking. `machine`: a computer (`harness login`, the desktop app) — approval binds it to a+ * machine and mints a daemon session. `viewer`: a browser's sign-in page — approval mints a viewer+ * session, and the phone names one of its machines for the browser to E2EE-link through.+ */+export type DeviceAuthKind = 'machine' | 'viewer'+export interface DeviceAuthRecord {state: DeviceAuthState+ /** Absent on records from before viewers could ask: a machine. */+ kind?: DeviceAuthKind+ /** The asking computer; empty for a viewer. */computerId: stringlabel: string- /** Set once approved: the machine the user chose for this computer. */+ /** The asking machine's E2EE identity fingerprint, for the phone to compare with its screen. */+ fingerprint?: string+ /** Where the request came from (Cloudflare country), for the phone's "requested from" line. */+ country?: string+ requestedAt?: number+ /** Set once approved: the machine bound to this computer, and the sign-in minted for it. */machineId?: string- apiKey?: stringuserId?: string+ session?: HarnessTokens+ /** A viewer's E2EE public key (base64), which the approving phone checks against the QR's+ * fingerprint before it takes the browser into its trust group. */+ pub?: string+ /** A viewer's approval: the phone's trust-group roster, sealed under the QR's pairing code — which+ * never reaches this server, so it can neither read nor alter what the browser is handed. */+ sealedRoster?: stringerror?: string}@@ -45,8 +72,9 @@ const claimKey = (deviceHash: string): string => `devauth:claim:${deviceHash}`/** The device code is a bearer secret, so only its hash is stored — a Redis dump must not be a key store. */const hash = (s: string): string => createHash('sha256').update(s).digest('hex')+/** 256 is a multiple of 32, so `byte % 32` is unbiased. */function newUserCode(): string {- const b = randomBytes(6)+ const b = randomBytes(USER_CODE_LENGTH)return Array.from(b, (x) => ALPHABET[x % ALPHABET.length]).join('')}@@ -57,13 +85,24 @@ export interface StartResult {intervalSec: number}-export async function startDeviceAuth(computerId: string, label: string): Promise<StartResult> {+export async function startDeviceAuth(+ computerId: string,+ label: string,+ extra: { fingerprint?: string; country?: string; kind?: DeviceAuthKind; pub?: string } = {},+): Promise<StartResult> {const deviceCode = randomBytes(32).toString('hex')- // One retry on collision; the space is 32^6 and records live ten minutes, so a second clash is noise.- let userCode = newUserCode()- if (await pub.exists(codeKey(userCode))) userCode = newUserCode()-- const record: DeviceAuthRecord = { state: 'pending', computerId, label }+ const userCode = newUserCode() // 130 bits: a collision is not a case worth code++ const record: DeviceAuthRecord = {+ state: 'pending',+ ...(extra.kind === 'viewer' ? { kind: 'viewer' as const } : {}),+ ...(extra.pub ? { pub: extra.pub } : {}),+ computerId,+ label,+ requestedAt: Date.now(),+ ...(extra.fingerprint ? { fingerprint: extra.fingerprint } : {}),+ ...(extra.country ? { country: extra.country } : {}),+ }const payload = JSON.stringify(record)await pub.set(deviceKey(hash(deviceCode)), payload, 'EX', TTL_SEC)// The user-facing code maps to the device record, so approving by code can find it.@@ -120,8 +159,8 @@ export async function releaseDeviceAuthClaim(deviceHash: string): Promise<void>}/**- * Poll. A successful read is DESTRUCTIVE — the apiKey is handed over exactly once, so a leaked device- * code cannot be replayed later to fetch the same machine key again.+ * Poll. A settled read is DESTRUCTIVE — the session is handed over exactly once, so a leaked device+ * code cannot be replayed later to fetch the same sign-in again.*/export async function pollDeviceAuth(deviceCode: string): Promise<DeviceAuthRecord | null> {const dh = hash(deviceCode)diff --git a/backend/src/lib/deviceWs.ts b/backend/src/lib/deviceWs.tsindex 1594fb851..5c5627fbf 100644--- a/backend/src/lib/deviceWs.ts+++ b/backend/src/lib/deviceWs.ts@@ -339,7 +339,7 @@ export function handleDeviceUpgrade(req: IncomingMessage, socket: Duplex, head:void (async () => {let usertry {- user = await authenticateAccessToken(accessToken, autonomousEnv, { allowHarnessSession: false })+ user = await authenticateAccessToken(accessToken, autonomousEnv, { allowHarnessSession: false, allowDaemonSessionFor: computerId })} catch (err) {if (err instanceof SsoAuthError && (err.code === 'AUTONOMOUS_ENV_MISMATCH' || err.code === 'AUTONOMOUS_ENV_NOT_ALLOWED')) {denyWith(403, 'Forbidden')diff --git a/backend/src/lib/harnessSession.test.ts b/backend/src/lib/harnessSession.test.tsindex 1c1d24c2d..93d2451b5 100644--- a/backend/src/lib/harnessSession.test.ts+++ b/backend/src/lib/harnessSession.test.ts@@ -63,7 +63,7 @@ vi.mock('../services/UserService.js', () => ({vi.mock('../services/index.js', () => ({ userService: { get: fakes.get, toPublic: (u: unknown) => u } }))import { authenticateAccessToken, SsoAuthError } from './ssoAuth.js'-import { HANDOFF_TTL_SEC, redeemHandoff, startHandoff } from './harnessSession.js'+import { HANDOFF_TTL_SEC, createDaemonSession, redeemHandoff, revokeMachineSessions, startHandoff } from './harnessSession.js'import { authRoutes } from '../routes/auth.js'import { registerAuthMiddleware } from '../middlewares/authMiddleware.js'import { errorHandler } from '../middlewares/errorHandler.js'@@ -136,6 +136,40 @@ describe('scan to sign in — the handoff', () => {})})+describe('a machine signed in by a phone — the daemon session', () => {+ const COMPUTER = 'c'.repeat(32)+ const MACHINE = 'm'.repeat(32)++ it('opens the machine socket for its own computer, and only that one', async () => {+ const { token, refreshToken } = await createDaemonSession({ userId: USER.id, machineId: MACHINE, computerId: COMPUTER, label: 'box' })+ expect(token).toMatch(/^hna_/)+ expect(refreshToken).toMatch(/^hnr_/)+ expect(fakes.sessions[0]).toMatchObject({ kind: 'daemon', machineId: MACHINE, computerId: COMPUTER })+ await expect(authenticateAccessToken(token, 'prod', { allowHarnessSession: false, allowDaemonSessionFor: COMPUTER }))+ .resolves.toMatchObject({ sub: USER.id, harnessSessionKind: 'daemon', harnessComputerId: COMPUTER })+ await expect(authenticateAccessToken(token, 'prod', { allowHarnessSession: false, allowDaemonSessionFor: 'd'.repeat(32) }))+ .rejects.toMatchObject({ code: 'INVALID_TOKEN' })+ await expect(authenticateAccessToken(token, 'prod', { allowHarnessSession: false }))+ .rejects.toMatchObject({ code: 'INVALID_TOKEN' })+ // The relay and REST still take it, as any Harness session.+ await expect(authenticateAccessToken(token)).resolves.toMatchObject({ sub: USER.id })+ })++ it("a phone's session is still refused on a machine socket, whatever computer it names", async () => {+ const { code } = await startHandoff(USER.id)+ const { token } = (await redeemHandoff(code, 'phone'))!+ await expect(authenticateAccessToken(token, 'prod', { allowHarnessSession: false, allowDaemonSessionFor: COMPUTER }))+ .rejects.toMatchObject({ code: 'INVALID_TOKEN' })+ })++ it('deleting the machine ends its sign-in at once', async () => {+ const { token } = await createDaemonSession({ userId: USER.id, machineId: MACHINE, computerId: COMPUTER, label: 'box' })+ expect(await revokeMachineSessions(MACHINE)).toBe(1)+ await expect(authenticateAccessToken(token, 'prod', { allowHarnessSession: false, allowDaemonSessionFor: COMPUTER }))+ .rejects.toMatchObject({ code: 'INVALID_TOKEN' })+ })+})+describe('scan to sign in — the routes', () => {let app: FastifyInstanceconst signedIn = { sub: USER.id, email: USER.email, role: 'user', autonomousEnv: 'prod' as const }diff --git a/backend/src/lib/harnessSession.ts b/backend/src/lib/harnessSession.tsindex 2a2453d1a..218804b1b 100644--- a/backend/src/lib/harnessSession.ts+++ b/backend/src/lib/harnessSession.ts@@ -76,25 +76,77 @@ export async function redeemHandoff(code: string, label: string): Promise<Harnesif (!read || read[0]) throw read?.[0] ?? new Error('handoff redeem: no reply from Redis')const userId = read[1]if (typeof userId !== 'string' || !userId) return null- const user = await userService.get(userId)+ return createViewerSession({ userId, label })+}++/**+ * Sign a VIEWER in — a phone or a browser: the session a handoff redeem mints, and the one a phone's+ * approval of a browser's sign-in QR hands that browser (`/api/device-auth/approve`, kind `viewer`).+ * It reads and drives through the relay; it never opens a machine socket. Null for a user gone since.+ */+export async function createViewerSession(p: { userId: string; label: string }): Promise<HarnessTokens | null> {+ const user = await userService.get(p.userId)if (!user) return nullconst refreshToken = newHarnessToken(HARNESS_REFRESH_PREFIX)const session = await prisma.harnessSession.create({data: {- userId,+ userId: p.userId,+ refreshHash: harnessTokenHash(refreshToken),+ label: p.label.slice(0, 80),+ expiresAt: sessionExpiry(),+ },+ })+ return {+ token: await issueAccess(session.id, p.userId),+ refreshToken,+ expiresIn: HARNESS_ACCESS_TTL_SEC,+ autonomousEnv: storedAutonomousEnvironment(user.autonomousEnv),+ }+}++/**+ * Sign a MACHINE in: the session a phone's approval of a machine's QR hands that machine+ * (`/api/device-auth/approve`, lib/deviceAuth.ts). Unlike a phone's, it may open the machine socket —+ * but only for [computerId], the computer the approval was for (see `authenticateAccessToken`'s+ * `allowDaemonSessionFor`). Deleting the machine revokes it ([revokeMachineSessions]).+ */+export async function createDaemonSession(p: {+ userId: string+ machineId: string+ computerId: string+ label: string+}): Promise<HarnessTokens> {+ const user = await userService.get(p.userId)+ if (!user) throw new Error('daemon session: no such user')+ const refreshToken = newHarnessToken(HARNESS_REFRESH_PREFIX)+ const session = await prisma.harnessSession.create({+ data: {+ userId: p.userId,refreshHash: harnessTokenHash(refreshToken),- label,+ label: p.label.slice(0, 80),expiresAt: sessionExpiry(),+ kind: 'daemon',+ machineId: p.machineId,+ computerId: p.computerId,},})return {- token: await issueAccess(session.id, userId),+ token: await issueAccess(session.id, p.userId),refreshToken,expiresIn: HARNESS_ACCESS_TTL_SEC,autonomousEnv: storedAutonomousEnvironment(user.autonomousEnv),}}+/** A deleted machine's daemon sessions stop at once: its access tokens are checked against the row. */+export async function revokeMachineSessions(machineId: string): Promise<number> {+ const out = await prisma.harnessSession.updateMany({+ where: { machineId, kind: 'daemon', revokedAt: null },+ data: { revokedAt: new Date() },+ })+ return out.count+}+/*** A new access token for the session [refreshToken] belongs to, or null when that session is gone* (unknown, revoked, idle past its lifetime, or its user deleted) — the caller's 401.@@ -154,6 +206,8 @@ export async function authenticateHarnessAccessToken(token: string): Promise<Autconst invalid = (): SsoAuthError => new SsoAuthError('Invalid or expired access token', 'INVALID_TOKEN')let user: Awaited<ReturnType<typeof userService.get>>let sessionId: string+ let kind: 'viewer' | 'daemon' = 'viewer'+ let computerId: string | undefinedtry {const raw = await pub.get(accessKey(harnessTokenHash(token)))if (!raw) throw invalid()@@ -162,6 +216,10 @@ export async function authenticateHarnessAccessToken(token: string): Promise<AutsessionId = held.sessionIdconst session = await prisma.harnessSession.findUnique({ where: { id: sessionId } })if (!session || session.revokedAt || session.userId !== held.userId) throw invalid()+ if (session.kind === 'daemon') {+ kind = 'daemon'+ computerId = session.computerId ?? undefined+ }user = await userService.get(held.userId)} catch (err) {if (err instanceof SsoAuthError) throw err@@ -174,5 +232,7 @@ export async function authenticateHarnessAccessToken(token: string): Promise<Autrole: user.role,autonomousEnv: storedAutonomousEnvironment(user.autonomousEnv),harnessSessionId: sessionId,+ // Only a machine's session says what it is: a phone's reads exactly as it always has.+ ...(kind === 'daemon' ? { harnessSessionKind: 'daemon' as const, harnessComputerId: computerId } : {}),}}diff --git a/backend/src/lib/ssoAuth.ts b/backend/src/lib/ssoAuth.tsindex 9566ff32c..479d2bca2 100644--- a/backend/src/lib/ssoAuth.ts+++ b/backend/src/lib/ssoAuth.ts@@ -20,6 +20,10 @@ export interface AuthUser {autonomousEnv: AutonomousEnvironment/** Set when the token is one Harness issued itself (lib/harnessSession.ts), not an Autonomous one. */harnessSessionId?: string+ /** Which kind of Harness session: a phone's ('viewer') or a machine's ('daemon'). */+ harnessSessionKind?: 'viewer' | 'daemon'+ /** Daemon sessions: the computer the phone approved this machine sign-in for. */+ harnessComputerId?: string}export interface SsoProfile {@@ -185,15 +189,33 @@ function accessTokenMetadata(token: string): { name?: string; roles?: string[] }export async function authenticateAccessToken(token: string,autonomousEnv: AutonomousEnvironment = 'prod',- { enforceEnv = true, allowHarnessSession = true }: { enforceEnv?: boolean; allowHarnessSession?: boolean } = {},+ {+ enforceEnv = true,+ allowHarnessSession = true,+ allowDaemonSessionFor,+ }: {+ enforceEnv?: boolean+ allowHarnessSession?: boolean+ /**+ * Where `allowHarnessSession` is false (the machine sockets): still accept a DAEMON session —+ * a machine a phone signed in by approving its QR — when it was approved for exactly this+ * computer. A phone's viewer session stays refused.+ */+ allowDaemonSessionFor?: string+ } = {},): Promise<AuthUser> {- // A sign-in Harness issued itself — a phone signed in by scanning a computer's QR. It names its- // user outright, so there is no account plane to choose and nothing to ask the account service.- // Loaded on first use: that module holds Redis, which connects on import (see the store above).+ // A sign-in Harness issued itself — a phone signed in by scanning a computer's QR, or a machine a+ // phone approved. It names its user outright, so there is no account plane to choose and nothing to+ // ask the account service. Loaded on first use: that module holds Redis, which connects on import.if (isHarnessAccessToken(token)) {- if (!allowHarnessSession) throw new SsoAuthError('This connection needs an Autonomous sign-in', 'INVALID_TOKEN')+ if (!allowHarnessSession && !allowDaemonSessionFor) throw new SsoAuthError('This connection needs an Autonomous sign-in', 'INVALID_TOKEN')const { authenticateHarnessAccessToken } = await import('./harnessSession.js')- return authenticateHarnessAccessToken(token)+ const user = await authenticateHarnessAccessToken(token)+ if (!allowHarnessSession) {+ const own = user.harnessSessionKind === 'daemon' && !!user.harnessComputerId && user.harnessComputerId === allowDaemonSessionFor+ if (!own) throw new SsoAuthError('This connection needs an Autonomous sign-in', 'INVALID_TOKEN')+ }+ return user}const profile = await profileCache.resolve(token, autonomousEnv, () => fetchSsoProfile(token, autonomousEnv))const metadata = accessTokenMetadata(token)diff --git a/backend/src/routes/deviceAuth.test.ts b/backend/src/routes/deviceAuth.test.tsnew file mode 100644index 000000000..0494938ab--- /dev/null+++ b/backend/src/routes/deviceAuth.test.ts@@ -0,0 +1,206 @@+import { beforeEach, describe, expect, it, vi } from 'vitest'+import Fastify, { type FastifyInstance } from 'fastify'++// A machine signs in by a phone approving its QR. Redis, the machine store and the session mint are+// in-memory stand-ins; the routes and lib/deviceAuth.ts run for real.+const fakes = vi.hoisted(() => {+ const redis = new Map<string, string>()+ let allow = true+ const pub = {+ set: vi.fn(async (key: string, value: string, ..._rest: unknown[]) => {+ if (_rest.includes('NX') && redis.has(key)) return null+ redis.set(key, value); return 'OK'+ }),+ get: vi.fn(async (key: string) => redis.get(key) ?? null),+ exists: vi.fn(async (key: string) => (redis.has(key) ? 1 : 0)),+ ttl: vi.fn(async (key: string) => (redis.has(key) ? 100 : -2)),+ del: vi.fn(async (...keys: string[]) => keys.filter((k) => redis.delete(k)).length),+ }+ const machine = { machineId: 'm'.repeat(32), userId: 'u1', name: 'box-2', hostname: 'box-2', apiKey: 'k', computerId: 'c'.repeat(32) }+ return {+ redis, pub, machine,+ setAllow: (v: boolean) => { allow = v },+ consumeRateLimit: vi.fn(async () => allow),+ resolveOrCreate: vi.fn(async () => ({ machine, created: true })),+ createDaemonSession: vi.fn(async (p: Record<string, unknown>) => ({+ token: 'hna_token', refreshToken: 'hnr_refresh', expiresIn: 3600, autonomousEnv: 'prod', bound: p,+ })),+ createViewerSession: vi.fn(async () => ({+ token: 'hna_viewer', refreshToken: 'hnr_viewer', expiresIn: 3600, autonomousEnv: 'prod',+ })),+ }+})++vi.mock('../lib/bus.js', () => ({ pub: fakes.pub, consumeRateLimit: fakes.consumeRateLimit }))+vi.mock('../lib/prisma.js', () => ({+ prisma: { machine: { findMany: vi.fn(async () => [fakes.machine]), findFirst: vi.fn(), update: vi.fn() } },+ machineAlive: {},+}))+vi.mock('../services/MachineService.js', () => ({ machineService: { resolveOrCreateForComputer: fakes.resolveOrCreate } }))+vi.mock('../services/UserService.js', () => ({ userService: { get: vi.fn(async () => ({ id: 'u1', autonomousEnv: 'prod' })) } }))+vi.mock('../lib/harnessSession.js', () => ({+ createDaemonSession: fakes.createDaemonSession, createViewerSession: fakes.createViewerSession,+}))++import { deviceAuthRoutes } from './deviceAuth.js'+import { registerAuthMiddleware } from '../middlewares/authMiddleware.js'+import { errorHandler } from '../middlewares/errorHandler.js'++const COMPUTER = 'c'.repeat(32)+const phone = { authorization: 'Bearer phone' }++let app: FastifyInstance+beforeEach(async () => {+ fakes.redis.clear(); fakes.setAllow(true); vi.clearAllMocks()+ app = Fastify()+ app.setErrorHandler(errorHandler)+ registerAuthMiddleware(app, async (token) => {+ if (token !== 'phone') throw Object.assign(new Error('no'), { code: 'INVALID_TOKEN' })+ return { sub: 'u1', email: '[email protected]', role: 'user', autonomousEnv: 'prod' }+ })+ await app.register(deviceAuthRoutes)+ await app.ready()+})++async function start(): Promise<{ userCode: string; deviceCode: string }> {+ const res = await app.inject({+ method: 'POST', url: '/api/device-auth/start',+ headers: { 'cf-ipcountry': 'VN' },+ payload: { computerId: COMPUTER, label: 'box-2', fingerprint: '5f80·61c4·6142·adcf' },+ })+ expect(res.statusCode).toBe(200)+ return res.json().data+}++describe('machine sign-in approved from a phone', () => {+ it('start → lookup → approve → poll hands the machine a daemon session for its own computer, once', async () => {+ const { userCode, deviceCode } = await start()+ expect(userCode).toMatch(/^[0-9A-HJKMNP-TV-Z]{26}$/)++ const pending = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(pending.json().data).toEqual({ status: 'pending' })++ const lookup = await app.inject({ method: 'GET', url: `/api/device-auth/lookup?userCode=${userCode}`, headers: phone })+ expect(lookup.json().data).toMatchObject({+ label: 'box-2', computerId: COMPUTER, fingerprint: '5F8061C46142ADCF', country: 'VN',+ existingMachine: { machineId: fakes.machine.machineId, name: 'box-2' },+ })++ const approved = await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode } })+ expect(approved.statusCode).toBe(200)+ expect(approved.json().data).toMatchObject({ machineId: fakes.machine.machineId })+ expect(fakes.createDaemonSession).toHaveBeenCalledWith({+ userId: 'u1', machineId: fakes.machine.machineId, computerId: COMPUTER, label: 'box-2',+ })++ const polled = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(polled.json().data).toEqual({+ status: 'approved', kind: 'machine', machineId: fakes.machine.machineId,+ token: 'hna_token', refreshToken: 'hnr_refresh', expiresIn: 3600, autonomousEnv: 'prod',+ })+ // Handed over exactly once.+ const again = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(again.json().data).toEqual({ status: 'expired' })+ })++ it('a code is approved once; a second approval is refused', async () => {+ const { userCode } = await start()+ expect((await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode } })).statusCode).toBe(200)+ expect((await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode } })).statusCode).toBe(410)+ expect(fakes.createDaemonSession).toHaveBeenCalledTimes(1)+ })++ it('"Not me" denies a waiting request, but cannot take back an approved one', async () => {+ const first = await start()+ await app.inject({ method: 'POST', url: '/api/device-auth/deny', headers: phone, payload: { userCode: first.userCode } })+ const denied = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode: first.deviceCode } })+ expect(denied.json().data.status).toBe('denied')++ const second = await start()+ await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode: second.userCode } })+ const late = await app.inject({ method: 'POST', url: '/api/device-auth/deny', headers: phone, payload: { userCode: second.userCode } })+ expect(late.statusCode).toBe(410)+ const polled = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode: second.deviceCode } })+ expect(polled.json().data.status).toBe('approved')+ })++ it('lookup, approve and deny need a signed-in phone; start and poll do not', async () => {+ const { userCode } = await start()+ expect((await app.inject({ method: 'GET', url: `/api/device-auth/lookup?userCode=${userCode}` })).statusCode).toBe(401)+ expect((await app.inject({ method: 'POST', url: '/api/device-auth/approve', payload: { userCode } })).statusCode).toBe(401)+ })++ it('rate limits start per address and approve per account', async () => {+ fakes.setAllow(false)+ const res = await app.inject({ method: 'POST', url: '/api/device-auth/start', payload: { computerId: COMPUTER, label: 'x' } })+ expect(res.statusCode).toBe(429)+ const ok = await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode: 'X' } })+ expect(ok.statusCode).toBe(429)+ })++ it('a browser (kind viewer) gets a viewer session and the phone\'s sealed roster, once', async () => {+ const pub = 'A'.repeat(43) + '='+ const started = await app.inject({+ method: 'POST', url: '/api/device-auth/start',+ payload: { kind: 'viewer', label: 'Chrome on macOS', fingerprint: 'ab12·cd34·ef56·7890', pub },+ })+ expect(started.statusCode).toBe(200)+ const { userCode, deviceCode } = started.json().data++ const lookup = await app.inject({ method: 'GET', url: `/api/device-auth/lookup?userCode=${userCode}`, headers: phone })+ expect(lookup.json().data).toMatchObject({ kind: 'viewer', pub, label: 'Chrome on macOS', existingMachine: null })++ const approved = await app.inject({+ method: 'POST', url: '/api/device-auth/approve', headers: phone,+ payload: { userCode, sealedRoster: 'c2VhbGVk' },+ })+ expect(approved.statusCode).toBe(200)+ expect(fakes.createViewerSession).toHaveBeenCalledWith({ userId: 'u1', label: 'Chrome on macOS' })+ expect(fakes.createDaemonSession).not.toHaveBeenCalled()+ expect(fakes.resolveOrCreate).not.toHaveBeenCalled()++ const polled = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(polled.json().data).toEqual({+ status: 'approved', kind: 'viewer', sealedRoster: 'c2VhbGVk',+ token: 'hna_viewer', refreshToken: 'hnr_viewer', expiresIn: 3600, autonomousEnv: 'prod',+ })+ const again = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(again.json().data).toEqual({ status: 'expired' })+ })++ it('a machine hands over its key, and gets the phone\'s sealed roster with its daemon session', async () => {+ const pub = 'B'.repeat(43) + '='+ const started = await app.inject({+ method: 'POST', url: '/api/device-auth/start',+ payload: { computerId: COMPUTER, label: 'box-2', fingerprint: '5f80·61c4', pub },+ })+ const { userCode, deviceCode } = started.json().data+ const lookup = await app.inject({ method: 'GET', url: `/api/device-auth/lookup?userCode=${userCode}`, headers: phone })+ expect(lookup.json().data).toMatchObject({ kind: 'machine', pub })+ const approved = await app.inject({+ method: 'POST', url: '/api/device-auth/approve', headers: phone,+ payload: { userCode, sealedRoster: 'cm9zdGVy' },+ })+ expect(approved.json().data).toMatchObject({ machineId: fakes.machine.machineId })+ const polled = await app.inject({ method: 'POST', url: '/api/device-auth/poll', payload: { deviceCode } })+ expect(polled.json().data).toMatchObject({ status: 'approved', kind: 'machine', sealedRoster: 'cm9zdGVy', token: 'hna_token' })+ })++ it('a malformed roster is refused, and the code can be approved again', async () => {+ const started = await app.inject({ method: 'POST', url: '/api/device-auth/start', payload: { kind: 'viewer', label: 'x' } })+ const { userCode } = started.json().data+ const res = await app.inject({+ method: 'POST', url: '/api/device-auth/approve', headers: phone,+ payload: { userCode, sealedRoster: '<not base64>' },+ })+ expect(res.statusCode).toBe(400)+ expect(fakes.createViewerSession).not.toHaveBeenCalled()+ const retry = await app.inject({ method: 'POST', url: '/api/device-auth/approve', headers: phone, payload: { userCode } })+ expect(retry.statusCode).toBe(200)+ })++ it('a machine request still needs its computer id', async () => {+ const res = await app.inject({ method: 'POST', url: '/api/device-auth/start', payload: { label: 'x' } })+ expect(res.statusCode).toBe(400)+ })+})diff --git a/backend/src/routes/deviceAuth.ts b/backend/src/routes/deviceAuth.tsindex ec2898497..e3af3f95d 100644--- a/backend/src/routes/deviceAuth.ts+++ b/backend/src/routes/deviceAuth.ts@@ -7,6 +7,9 @@ import { storedAutonomousEnvironment } from '../lib/autonomousEnvironment.js'import { AppError } from '../errors/index.js'import { sendSuccess, sendError } from '../utils/response.js'import { logger } from '../utils/logger.js'+import { consumeRateLimit } from '../lib/bus.js'+import { countryCodeFromHeaders } from '../lib/clientGeo.js'+import { createDaemonSession, createViewerSession } from '../lib/harnessSession.js'import {startDeviceAuth, pollDeviceAuth, findByUserCode, resolveDeviceAuth, normalizeUserCode,normalizeComputerId, claimDeviceAuth, releaseDeviceAuthClaim,@@ -29,15 +32,39 @@ import {* They are safe because neither reveals anything: `start` returns codes it just minted, and `poll`* requires the 32-byte device code and hands its payload over exactly once.*/+const RATE_WINDOW_SEC = 10 * 60+const START_PER_WINDOW = 30+const APPROVE_PER_WINDOW = 20+/** A phone's sealed roster: 256 members at most, each well under 300 bytes of JSON. */+const MAX_SEALED_ROSTER = 128 * 1024+/** Mirrors lib/deviceAuth.ts TTL_SEC, for the confirm screen's countdown. */+const DEVICE_AUTH_TTL_SEC = 180+export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {// ── app: begin ───────────────────────────────────────────────────────────────────────────────────- app.post<{ Body: { computerId?: string; label?: string } }>('/api/device-auth/start', async (req, reply) => {- const computerId = normalizeComputerId(String(req.body?.computerId ?? ''))+ app.post<{ Body: { computerId?: string; label?: string; fingerprint?: string; kind?: string; pub?: string } }>('/api/device-auth/start', async (req, reply) => {+ // A browser's sign-in page asks as a viewer: there is no computer to bind, only a session to mint.+ const viewer = req.body?.kind === 'viewer'+ const computerId = viewer ? '' : normalizeComputerId(String(req.body?.computerId ?? ''))const label = String(req.body?.label ?? '').trim().slice(0, 120)- if (!computerId) {+ if (!viewer && !computerId) {return sendError(reply, 'computerId must be a hex computer fingerprint', 'BAD_REQUEST', 400)}- const out = await startDeviceAuth(computerId, label || 'computer')+ // Unauthenticated by design, so bounded per address: a QR is redrawn every few minutes, not per second.+ if (!(await consumeRateLimit(`devauth:start:${req.ip}`, START_PER_WINDOW, RATE_WINDOW_SEC))) {+ return sendError(reply, 'too many sign-in requests — wait a few minutes', 'RATE_LIMITED', 429)+ }+ const fp = String(req.body?.fingerprint ?? '').toUpperCase().replace(/[^0-9A-Z]/g, '')+ // The asker's E2EE public key: 32 bytes of base64, which the approving phone checks against the QR's+ // fingerprint and takes into its trust group.+ const pub = String(req.body?.pub ?? '')+ const pubOk = /^[A-Za-z0-9+/]{43}=$/.test(pub)+ const out = await startDeviceAuth(computerId ?? '', label || (viewer ? 'browser' : 'computer'), {+ ...(viewer ? { kind: 'viewer' as const } : {}),+ ...(pubOk ? { pub } : {}),+ ...(/^[0-9A-Z]{8,64}$/.test(fp) ? { fingerprint: fp } : {}),+ ...(countryCodeFromHeaders(req.headers) ? { country: countryCodeFromHeaders(req.headers) } : {}),+ })return sendSuccess(reply, {userCode: out.userCode,deviceCode: out.deviceCode,@@ -56,7 +83,18 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {if (!record) return sendSuccess(reply, { status: 'expired' })if (record.state === 'pending') return sendSuccess(reply, { status: 'pending' })if (record.state === 'denied') return sendSuccess(reply, { status: 'denied', error: record.error })- return sendSuccess(reply, { status: 'approved', apiKey: record.apiKey, machineId: record.machineId })+ const session = record.session+ if (!session) return sendSuccess(reply, { status: 'expired' })+ return sendSuccess(reply, {+ status: 'approved',+ kind: record.kind ?? 'machine',+ ...(record.sealedRoster ? { sealedRoster: record.sealedRoster } : {}),+ machineId: record.machineId,+ token: session.token,+ refreshToken: session.refreshToken,+ expiresIn: session.expiresIn,+ autonomousEnv: session.autonomousEnv,+ })})// ── web: what am I approving? (SSO-authed) ───────────────────────────────────────────────────────@@ -71,9 +109,21 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {where: { userId: req.user!.sub, authMode: 'remote', ...machineAlive },orderBy: { createdAt: 'asc' },})+ const existing = found.record.kind === 'viewer'+ ? undefined+ : machines.find((m) => !!m.computerId && m.computerId === found.record.computerId)return sendSuccess(reply, {+ kind: found.record.kind ?? 'machine',+ ...(found.record.pub ? { pub: found.record.pub } : {}),label: found.record.label,computerId: found.record.computerId,+ fingerprint: found.record.fingerprint ?? null,+ country: found.record.country ?? null,+ requestedAt: found.record.requestedAt ?? null,+ expiresAt: found.record.requestedAt ? found.record.requestedAt + DEVICE_AUTH_TTL_SEC * 1000 : null,+ existingMachine: existing+ ? { machineId: existing.machineId, name: existing.name?.trim() || existing.hostname || existing.machineId.slice(0, 8) }+ : null,machines: machines.map((m) => ({machineId: m.machineId,name: m.name?.trim() || m.hostname || m.machineId.slice(0, 8),@@ -87,7 +137,15 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {})// ── web: approve (SSO-authed) ────────────────────────────────────────────────────────────────────- app.post<{ Body: { userCode?: string; machineId?: string } }>('/api/device-auth/approve', async (req, reply) => {+ app.post<{ Body: { userCode?: string; machineId?: string; sealedRoster?: string } }>('/api/device-auth/approve', async (req, reply) => {+ // Either kind may carry the phone's trust group, sealed under the QR's code: stored, never read.+ const sealed = String(req.body?.sealedRoster ?? '')+ if (sealed && (sealed.length > MAX_SEALED_ROSTER || !/^[A-Za-z0-9+/=]+$/.test(sealed))) {+ return sendError(reply, 'bad roster', 'BAD_REQUEST', 400)+ }+ if (!(await consumeRateLimit(`devauth:approve:${req.user!.sub}`, APPROVE_PER_WINDOW, RATE_WINDOW_SEC))) {+ return sendError(reply, 'too many approvals — wait a few minutes', 'RATE_LIMITED', 429)+ }const found = await findByUserCode(String(req.body?.userCode ?? ''))if (!found) return sendError(reply, 'that code is not valid or has expired', 'NOT_FOUND', 404)if (found.record.state !== 'pending') return sendError(reply, 'that code has already been used', 'GONE', 410)@@ -109,6 +167,31 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {return sendError(reply, message, code, status)}+ // ── a browser (kind viewer) ──────────────────────────────────────────────────────────────────+ // A phone's session minting another session: `/api/auth/handoff` refuses that, and this is the+ // deliberate exception — behind a confirm screen naming the browser, its country and its key.+ // Nothing is created or bound. The phone hands the browser its trust group: the roster, sealed+ // under the QR's pairing code, which this server stores and passes on without being able to read.+ async function approveViewer(deviceHash: string, label: string): Promise<void> {+ let session+ try {+ session = await createViewerSession({ userId: req.user!.sub, label })+ } catch (err) {+ await releaseDeviceAuthClaim(deviceHash)+ throw err+ }+ if (!session) return giveUp('user not found', 'NOT_FOUND', 404)+ await resolveDeviceAuth(deviceHash, {+ state: 'approved',+ userId: req.user!.sub,+ session,+ ...(sealed ? { sealedRoster: sealed } : {}),+ })+ logger.info('device-auth approved (viewer)', { userId: req.user!.sub, roster: !!sealed })+ return sendSuccess(reply, { kind: 'viewer' })+ }+ if (found.record.kind === 'viewer') return approveViewer(found.deviceHash, found.record.label)+if (machineId) {// ── explicit pick (the Mac app) ────────────────────────────────────────────────────────────// This branch deliberately NEVER creates a machine. Picking one from a list must not be able to@@ -155,11 +238,25 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {}}+ // The machine's own sign-in, bound to the computer that asked — see lib/harnessSession.ts.+ let session+ try {+ session = await createDaemonSession({+ userId: req.user!.sub,+ machineId: machine.machineId,+ computerId: found.record.computerId,+ label: found.record.label,+ })+ } catch (err) {+ await releaseDeviceAuthClaim(found.deviceHash)+ throw err+ }await resolveDeviceAuth(found.deviceHash, {state: 'approved',machineId: machine.machineId,- apiKey: machine.apiKey,userId: req.user!.sub,+ session,+ ...(sealed ? { sealedRoster: sealed } : {}),})logger.info('device-auth approved', {userId: req.user!.sub, machineId: machine.machineId, computerId: found.record.computerId, created,@@ -175,7 +272,10 @@ export async function deviceAuthRoutes(app: FastifyInstance): Promise<void> {app.post<{ Body: { userCode?: string } }>('/api/device-auth/deny', async (req, reply) => {const found = await findByUserCode(String(req.body?.userCode ?? ''))if (!found) return sendError(reply, 'that code is not valid or has expired', 'NOT_FOUND', 404)- await resolveDeviceAuth(found.deviceHash, { state: 'denied', error: 'declined on the web' })+ // "Not me": only a request still waiting. An approved one is the machine's already, and this must+ // not let anyone who holds the code snatch its sign-in back out from under it.+ if (found.record.state !== 'pending') return sendError(reply, 'that code has already been used', 'GONE', 410)+ await resolveDeviceAuth(found.deviceHash, { state: 'denied', error: 'declined on the phone' })return sendSuccess(reply, { ok: true })})}diff --git a/backend/src/services/MachineService.ts b/backend/src/services/MachineService.tsindex db53f02f7..5efc0adb1 100644--- a/backend/src/services/MachineService.ts+++ b/backend/src/services/MachineService.ts@@ -625,6 +625,10 @@ export const machineService = {await publishDeviceMachineListChanged(binding.userId, { reason: 'deleted' }).catch(() => { /* best effort */ })}+ // A machine signed in by a phone's approval holds a daemon session of its own; it ends with the machine.+ const { revokeMachineSessions } = await import('../lib/harnessSession.js')+ await revokeMachineSessions(machineId).catch(() => { /* best effort — the socket is refused anyway */ })+if (binding.managerId === '') {// Remote agents have no node/container — just drop presence so the list goes offline immediately.// Also PUSH a machine_revoked down-frame so a LIVE adapter clears its saved token and stops now,diff --git a/desktop/lib/api/api_client.dart b/desktop/lib/api/api_client.dartindex 6b06e36da..cd18f4dc5 100644--- a/desktop/lib/api/api_client.dart+++ b/desktop/lib/api/api_client.dart@@ -255,6 +255,97 @@ class ApiClient {}}+ // -- a machine asking to be signed in (`harness login`'s QR, /api/device-auth) --++ /// What the sign-in request [userCode] is: the asking computer, its fingerprint, where it asked+ /// from, and whether the account already has a machine for that computer.+ Future<MachineSignInRequest> lookupMachineSignIn(String userCode) async {+ final res = await _dio.get(+ '/api/device-auth/lookup',+ queryParameters: {'userCode': userCode},+ );+ return MachineSignInRequest.fromJson(+ unwrapApiResponse(res) as Map<String, dynamic>,+ );+ }++ /// Sign that machine in to this account. Answers the machine id it is now.+ ///+ /// [sealedRoster]: this device's trust group, sealed under the QR's pairing code+ /// (`viewer/group_sync.dart` `sealHandedRoster`), for the machine to open — it joins the group+ /// without either side dialling the other first.+ Future<String> approveMachineSignIn(+ String userCode, {+ String? sealedRoster,+ }) async {+ final res = await _dio.post(+ '/api/device-auth/approve',+ data: {'userCode': userCode, 'sealedRoster': ?sealedRoster},+ );+ return (unwrapApiResponse(res) as Map<String, dynamic>)['machineId']+ as String;+ }++ /// Sign a BROWSER in to this account (its sign-in QR, `k=v`), handing it this device's trust+ /// group sealed under the QR's pairing code (`viewer/group_sync.dart` `sealHandedRoster`).+ Future<void> approveBrowserSignIn(+ String userCode, {+ required String sealedRoster,+ }) async {+ unwrapApiResponse(+ await _dio.post(+ '/api/device-auth/approve',+ data: {'userCode': userCode, 'sealedRoster': sealedRoster},+ ),+ );+ }++ /// "Not me": the request is refused, and the machine is told so.+ Future<void> denyMachineSignIn(String userCode) async {+ unwrapApiResponse(+ await _dio.post('/api/device-auth/deny', data: {'userCode': userCode}),+ );+ }++ /// This computer's E2EE identity fingerprint (`GET /api/status`), which the+ /// Add Phone QR carries so the phone can refuse a machine that proves a+ /// different key. Null when the daemon cannot say.+ Future<String?> machineFingerprint() async {+ try {+ final res = await _dio.get('/api/status');+ final data = res.data;+ final fp = data is Map ? data['fingerprint'] : null;+ return res.statusCode == 200 && fp is String && fp.isNotEmpty ? fp : null;+ } catch (_) {+ return null;+ }+ }++ /// The other machines in this computer's trust group (`GET /api/group`), as the daemon's+ /// roster has them: each one this computer now reaches, and that reaches it. Null when the+ /// daemon cannot say.+ Future<List<({String machineId, String label})>?> groupMachines() async {+ try {+ final res = await _dio.get('/api/group');+ final data = res.data;+ final members = data is Map ? data['members'] : null;+ if (res.statusCode != 200 || members is! List) return null;+ return [+ for (final m in members)+ if (m is Map &&+ m['kind'] == 'machine' &&+ m['machineId'] is String &&+ (m['machineId'] as String).isNotEmpty)+ (+ machineId: m['machineId'] as String,+ label: m['label'] is String ? m['label'] as String : '',+ ),+ ];+ } catch (_) {+ return null;+ }+ }+/// What this computer trusts to read and drive its terminals — every phone/// paired by QR or password, and every computer linked to it — as the/// daemon keeps them (`GET /api/pairs`, the list `harness pairings` prints).@@ -541,3 +632,39 @@ class PairedDevice {);}}++/// `GET /api/device-auth/lookup`: a machine asking this account to sign it in.+class MachineSignInRequest {+ const MachineSignInRequest({+ required this.label,+ this.viewer = false,+ this.pub,+ this.fingerprint,+ this.country,+ this.existingMachineName,+ });++ final String label;++ /// A browser asking (kind `viewer`), not a machine.+ final bool viewer;++ /// A browser's E2EE public key (base64), to check against its QR and take into the group.+ final String? pub;+ final String? fingerprint;+ final String? country;+ final String? existingMachineName;++ factory MachineSignInRequest.fromJson(Map<String, dynamic> json) {+ final existing = json['existingMachine'];+ final label = json['label'];+ return MachineSignInRequest(+ viewer: json['kind'] == 'viewer',+ pub: json['pub'] is String ? json['pub'] as String : null,+ label: label is String && label.trim().isNotEmpty ? label : 'computer',+ fingerprint: json['fingerprint'] as String?,+ country: json['country'] as String?,+ existingMachineName: existing is Map ? existing['name'] as String? : null,+ );+ }+}diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dartindex 6720627df..c6d708fec 100644--- a/desktop/lib/app_shell.dart+++ b/desktop/lib/app_shell.dart@@ -25,6 +25,8 @@ import 'widgets/environment_setup_screen.dart';import 'widgets/export_logs_dialog.dart';import 'widgets/flash_firmware_dialog.dart';import 'core/startup.dart';+import 'core/test_run.dart';+import 'core/web_form_factor.dart';import 'logging/app_log.dart';import 'logging/install.dart';import 'shortcuts/app_keymap.dart';@@ -34,6 +36,9 @@ import 'widgets/update_notice.dart';import 'widgets/window_chrome.dart';import 'sharing/shared_agent_location.dart';import 'sharing/shared_agent_page.dart';+import 'viewer/pending_pair.dart';+import 'viewer/pending_pair_store.dart';+import 'widgets/add_machine_dialog.dart';/// The screen an app puts up once someone is signed in — the desktop's swarm of/// panes, or the phone's one-agent-at-a-time shell. It is the only thing the two@@ -182,14 +187,87 @@ class _RootShellState extends ConsumerState<RootShell>bool _menuDialogOpen = false;SharedAgentLocation? _sharedLocation;+ /// A machine's QR opened here by a phone's camera (`/pair#…`), held across sign-in+ /// (`viewer/pending_pair_store.dart`) and asked about once this tab is signed in.+ PendingPair? _pendingPair;+ bool _pendingPairAsked = false;+@overridevoid initState() {super.initState();+ if (kIsWeb) {+ // Before anything else reads the URL: the code leaves the address bar here.+ _pendingPair = const PendingPairStore().capture(DateTime.now());+ }if (kIsWeb) _sharedLocation = SharedAgentLocation.parse(Uri.base);WidgetsBinding.instance.addObserver(this);_appMenuChannel.setMethodCallHandler(_onAppMenu);}+ ({String name, String? fingerprint})? _pairingWith() {+ final pending = _pendingPair;+ if (pending == null || pending.isExpired(DateTime.now())) return null;+ final fp = pending.code.fingerprint;+ return (+ name: pending.code.hostname ?? 'this machine',+ fingerprint: fp == null ? null : spacedFingerprint(fp),+ );+ }++ /// Whether this visit to the web sign-in page already began a sign-in by phone. Once per visit:+ /// someone who cancels, or picks SSO, is not sent back to the QR behind their back.+ bool _webQrStarted = false;++ /// A web desktop's sign-in page opens on its QR — nothing to press first. Not a phone's browser+ /// (it approves, and cannot scan itself), not a tab opened by a machine's QR or a shared link+ /// (those arrive to do something else), and never under `flutter test`.+ void _startWebQr(AppNotifier app) {+ if (_webQrStarted || !kIsWeb || isMobileWeb || kUnderTest) return;+ if (_pairingWith() != null || _sharedLocation != null) return;+ if (app.signingIn || app.signingOut || app.lastError != null) return;+ _webQrStarted = true;+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted && app.status == AppStatus.unauthenticated) {+ unawaited(app.login(qr: true));+ }+ });+ }++ /// The group join after a web sign-in by phone has settled: the page moves on to home by itself —+ /// a moment to read "reaches N machines", a little longer for a problem, which the Machines list+ /// can still fix from there.+ bool _phoneLinkHolding = false;+ void _holdPhoneLink(AppNotifier app) {+ final link = app.phoneLink;+ if (_phoneLinkHolding || link == null || !link.settled) return;+ _phoneLinkHolding = true;+ final failed = link.stage == PhoneLinkStage.failed;+ Timer(Duration(milliseconds: failed ? 4000 : 1500), () {+ _phoneLinkHolding = false;+ if (mounted) app.dismissPhoneLink();+ });+ }++ /// Signed in (or just back from SSO) with a scanned machine code waiting: ask about it, once.+ void _askAboutPendingPair(AppNotifier app) {+ final pending = _pendingPair;+ if (pending == null || _pendingPairAsked) return;+ _pendingPairAsked = true;+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (!mounted) return;+ const PendingPairStore().clear();+ _pendingPair = null;+ unawaited(+ showAddMachineDialog(+ context,+ app,+ pending.code,+ expired: pending.isExpired(DateTime.now()),+ ),+ );+ });+ }+@overridevoid dispose() {WidgetsBinding.instance.removeObserver(this);@@ -271,7 +349,7 @@ class _RootShellState extends ConsumerState<RootShell>// the user's own screen away twice per sign-in: once on the click// and again on success.screen = app.signingIn- ? LoginScreen(notifier: app)+ ? LoginScreen(notifier: app, pairingWith: _pairingWith()): BootstrappingScreen(statusMessage: app.bootStatusMessage);case AppStatus.checkingEnvironment:screen = EnvironmentPreflightScreen(@@ -280,9 +358,17 @@ class _RootShellState extends ConsumerState<RootShell>case AppStatus.preparingEnvironment:screen = EnvironmentSetupScreen(notifier: app);case AppStatus.unauthenticated:- screen = LoginScreen(notifier: app);+ screen = LoginScreen(notifier: app, pairingWith: _pairingWith());+ _startWebQr(app);+ case AppStatus.authenticated when kIsWeb && app.phoneLink != null:+ // Signed in by phone: the sign-in page stays up through the link that follows and+ // moves on once it is done — as the desktop app's sign-in sheet does.+ screen = LoginScreen(notifier: app, onClose: app.dismissPhoneLink);+ _holdPhoneLink(app);case AppStatus.authenticated:+ _webQrStarted = false;screen = widget.authenticatedScreen(app);+ _askAboutPendingPair(app);}// Preserve the fragment pin while dialogs navigate; an OAuth callback can restore it later.if (kIsWeb) _sharedLocation ??= SharedAgentLocation.parse(Uri.base);diff --git a/desktop/lib/auth/cli_link.dart b/desktop/lib/auth/cli_link.dartindex cd18f174b..e8ff11b3b 100644--- a/desktop/lib/auth/cli_link.dart+++ b/desktop/lib/auth/cli_link.dart@@ -150,6 +150,18 @@ class CliLink implements PeerLinkClient {/// `verifying`) as the handshake proceeds; best-effort UI feedback only, never required for/// correctness. [displayName], when given, is how the CLI's error messages name the machine —/// otherwise they show the raw [machineId], which is all a terminal user would have.+ /// A CLI-backed build is a machine: it shows the QR (`harness link qr`), it does not scan one.+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(+ error: 'Scan the code with Harness on your phone or in a browser.',+ );+@overrideFuture<CliLinkConnectResult> connect(String machineId,diff --git a/desktop/lib/auth/cli_login.dart b/desktop/lib/auth/cli_login.dartindex 38ed6f12c..c376e90bf 100644--- a/desktop/lib/auth/cli_login.dart+++ b/desktop/lib/auth/cli_login.dart@@ -1,5 +1,8 @@import 'dart:async';import 'dart:convert';++import 'package:flutter/foundation.dart' show immutable;+import 'dart:io';import '../core/harness_cli_runner.dart';@@ -76,6 +79,7 @@ class CliLogin implements SignInClient {@overrideFuture<void> login({required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,}) async {// A cancelled spawn can finish after a replacement login has started.// Each process owns only its attempt, including its eventual cleanup.@@ -89,6 +93,9 @@ class CliLogin implements SignInClient {'--force','--json','--entry-point=desktop',+ // By phone: the CLI shows a QR instead of opening SSO, and once signed in links the phone+ // and joins its trust group in the same process.+ if (qr != null) '--qr',]);} catch (error) {throw CliNotAvailableException('Could not run the harness CLI: $error');@@ -110,25 +117,65 @@ class CliLogin implements SignInClient {var gotResult = false;var success = false;String? message;- await for (final raw in lines) {- if (revision != _loginRevision) continue;- final line = raw.trim();- if (line.isEmpty) continue;- Map<String, dynamic> json;- try {- json = jsonDecode(line) as Map<String, dynamic>;- } catch (_) {- continue;+ // A sign-in by phone is done at its `result`: the process stays on to link the phone and+ // join the trust group, reporting that through [SignInQrListener.onProgress] — the app does+ // not wait for it.+ final signedIn = Completer<void>();+ final reading = () async {+ await for (final raw in lines) {+ if (revision != _loginRevision) continue;+ final line = raw.trim();+ if (line.isEmpty) continue;+ Map<String, dynamic> json;+ try {+ json = jsonDecode(line) as Map<String, dynamic>;+ } catch (_) {+ continue;+ }+ switch (json['type']) {+ case 'authorize_url':+ final url = json['url'];+ if (url is String) onAuthorizeUrl(url);+ case 'qr':+ final url = json['url'], expires = json['expiresAt'];+ if (url is String && qr != null) {+ qr.onQr(+ SignInQr(+ url: url,+ fingerprint: json['fingerprint'] as String?,+ expiresAt: expires is int+ ? DateTime.fromMillisecondsSinceEpoch(expires)+ : null,+ ),+ );+ }+ case 'result' when !gotResult:+ gotResult = true;+ success = json['status'] == 'success';+ message = json['message'] as String?;+ if (qr != null && success && !signedIn.isCompleted) {+ signedIn.complete();+ }+ case final String type:+ qr?.onProgress?.call(type, json);+ }}- switch (json['type']) {- case 'authorize_url':- final url = json['url'];- if (url is String) onAuthorizeUrl(url);- case 'result':- gotResult = true;- success = json['status'] == 'success';- message = json['message'] as String?;+ }();+ if (qr != null) {+ await Future.any([signedIn.future, reading]);+ if (signedIn.isCompleted) {+ // Signed in; the rest belongs to the process, not to this attempt.+ if (identical(_activeProcess, process)) _activeProcess = null;+ // The link leg's end is news too: a process that stops before `synced` did not link.+ unawaited(+ reading+ .catchError((Object _) {})+ .whenComplete(() => qr.onProgress?.call('ended', const {})),+ );+ return;}+ } else {+ await reading;}final exitCode = await process.exitCode;if (revision != _loginRevision) {@@ -202,3 +249,27 @@ class CliLogin implements SignInClient {return lines.isEmpty ? null : lines.last.trim();}}++/// The QR a sign-in by phone shows (`harness login --qr --json`'s `qr` event).+@immutable+class SignInQr {+ const SignInQr({required this.url, this.fingerprint, this.expiresAt});++ /// The link the QR encodes (`…/pair#s=…&c=…&f=…&n=…`).+ final String url;++ /// This computer's E2EE fingerprint, for the phone to compare with.+ final String? fingerprint;+ final DateTime? expiresAt;+}++/// Asks [SignInClient.login] for a sign-in by phone rather than the browser: [onQr] gets each QR to+/// show (a fresh one replaces an expired one), [onProgress] the stages after it — `approved`, then,+/// once signed in and in the background, `waiting`, `linked`, `syncing`, `synced`, the link leg's+/// own `result`, and `ended` when the process is gone.+class SignInQrListener {+ const SignInQrListener({required this.onQr, this.onProgress});++ final void Function(SignInQr qr) onQr;+ final void Function(String stage, Map<String, dynamic> event)? onProgress;+}diff --git a/desktop/lib/auth/peer_link_client.dart b/desktop/lib/auth/peer_link_client.dartindex eb0976fa3..faab52ceb 100644--- a/desktop/lib/auth/peer_link_client.dart+++ b/desktop/lib/auth/peer_link_client.dart@@ -14,6 +14,18 @@ abstract interface class PeerLinkClient {String? displayName,});+ /// Pairing by the one-time code a machine's QR carries (`harness link qr`, or Add Phone):+ /// `viewer/code_link.dart` — no remote password. [label] is how the machine lists this device.+ /// [expectedFingerprint] is the machine fingerprint the QR carried: a machine proving a+ /// different key is not pinned. A build that cannot says so in the error.+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ });+Future<CliLinkListResult> list();/// Null on success.diff --git a/desktop/lib/auth/sign_in_client.dart b/desktop/lib/auth/sign_in_client.dartindex 70c80835c..bbb9d660a 100644--- a/desktop/lib/auth/sign_in_client.dart+++ b/desktop/lib/auth/sign_in_client.dart@@ -8,7 +8,11 @@ abstract interface class SignInClient {Future<CliAuthStatus> checkStatus();/// Resolves once signed in; throws on failure or [cancel]. [onAuthorizeUrl] gets the SSO page.- Future<void> login({required void Function(String url) onAuthorizeUrl});+ /// With [qr], a sign-in by phone instead (a CLI-backed build only; others ignore it).+ Future<void> login({+ required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,+ });void cancel();diff --git a/desktop/lib/core/browser_lock.dart b/desktop/lib/core/browser_lock.dartindex e644948b3..74d41763c 100644--- a/desktop/lib/core/browser_lock.dart+++ b/desktop/lib/core/browser_lock.dart@@ -1,11 +1,15 @@import 'dart:async';import 'dart:js_interop';+import 'dart:js_interop_unsafe';import 'package:web/web.dart' as web;/// One writer across all tabs on this origin. The browser releases the lock/// when the callback settles or its tab closes; no expiring lease to race.Future<T> withBrowserLock<T>(String name, Future<T> Function() action) async {+ // Web Locks exist only in a secure context. A plain-HTTP origin (a LAN preview on a phone) has+ // none: run unlocked there rather than fail every sign-in. Production is HTTPS, which has them.+ if (!web.window.navigator.has('locks')) return action();final zone = Zone.current;late T result;Object? failure;diff --git a/desktop/lib/core/web_form_factor.dart b/desktop/lib/core/web_form_factor.dartnew file mode 100644index 000000000..95e6ff2e6--- /dev/null+++ b/desktop/lib/core/web_form_factor.dart@@ -0,0 +1,67 @@+import 'package:flutter/foundation.dart';++import 'web_form_factor_native.dart'+ if (dart.library.js_interop) 'web_form_factor_web.dart'+ as impl;++/// Which kind of browser this web build is running in — the same build plays two parts:+///+/// * **Web desktop** (a laptop's or desktop's browser, and tablets): the one BEING signed in. Its+/// sign-in page opens on a QR that a phone approves.+/// * **Web mobile** (a phone's browser): the APPROVER, like the Harness app. A phone cannot scan its+/// own screen, so it signs in by SSO and scans other devices' codes.+///+/// Always false in a native build.+bool get isMobileWeb => debugMobileWebOverride ?? (_detected ??= impl.detectMobileWeb());+bool? _detected;++/// Tests pick a form factor; null is the real one.+@visibleForTesting+bool? debugMobileWebOverride;++/// What this browser calls itself on the account's devices and on the approving phone:+/// "Chrome on macOS". Native: "Harness".+String browserLabel() => impl.browserLabel();++/// "Chrome on macOS" from a user agent — pure, so it is tested without a browser.+String browserLabelFrom(String ua) {+ String? browser;+ if (ua.contains('Edg/')) {+ browser = 'Edge';+ } else if (ua.contains('OPR/')) {+ browser = 'Opera';+ } else if (ua.contains('Firefox/') || ua.contains('FxiOS/')) {+ browser = 'Firefox';+ } else if (ua.contains('Chrome/') || ua.contains('CriOS/')) {+ browser = 'Chrome';+ } else if (ua.contains('Safari/')) {+ browser = 'Safari';+ }+ String? os;+ if (ua.contains('iPhone')) {+ os = 'iPhone';+ } else if (ua.contains('iPad')) {+ os = 'iPad';+ } else if (ua.contains('Android')) {+ os = 'Android';+ } else if (ua.contains('CrOS')) {+ os = 'ChromeOS';+ } else if (ua.contains('Mac OS X') || ua.contains('Macintosh')) {+ os = 'macOS';+ } else if (ua.contains('Windows')) {+ os = 'Windows';+ } else if (ua.contains('Linux')) {+ os = 'Linux';+ }+ if (browser == null && os == null) return 'Web browser';+ if (browser == null) return 'Browser on $os';+ return os == null ? browser : '$browser on $os';+}++/// A phone's browser by its user agent — the mobile token every phone browser sends, which tablets+/// (iPadOS asks for the desktop site; Android tablets drop "Mobile") do not.+bool mobileUserAgent(String ua) =>+ ua.contains('iPhone') ||+ ua.contains('iPod') ||+ (ua.contains('Android') && ua.contains('Mobile')) ||+ ua.contains('Mobi');diff --git a/desktop/lib/core/web_form_factor_native.dart b/desktop/lib/core/web_form_factor_native.dartnew file mode 100644index 000000000..7322c83dd--- /dev/null+++ b/desktop/lib/core/web_form_factor_native.dart@@ -0,0 +1,3 @@+bool detectMobileWeb() => false;++String browserLabel() => 'Harness';diff --git a/desktop/lib/core/web_form_factor_web.dart b/desktop/lib/core/web_form_factor_web.dartnew file mode 100644index 000000000..6c29801fa--- /dev/null+++ b/desktop/lib/core/web_form_factor_web.dart@@ -0,0 +1,13 @@+import 'package:web/web.dart' as web;++import 'web_form_factor.dart' show browserLabelFrom, mobileUserAgent;++bool detectMobileWeb() {+ final ua = web.window.navigator.userAgent;+ if (mobileUserAgent(ua)) return true;+ // A touch-only screen the width of a phone, whatever it claims to be.+ return web.window.matchMedia('(pointer: coarse)').matches &&+ web.window.innerWidth < 600;+}++String browserLabel() => browserLabelFrom(web.window.navigator.userAgent);diff --git a/desktop/lib/e2ee/code_pake.dart b/desktop/lib/e2ee/code_pake.dartnew file mode 100644index 000000000..27d08661d--- /dev/null+++ b/desktop/lib/e2ee/code_pake.dart@@ -0,0 +1,31 @@+import 'bytes.dart';+import 'ristretto.dart';++/// core.ts's live-code pairing — the generator and channel binding of the one-time code the desktop+/// app shows in its "Add phone" QR. The same CPace as the remote password ([password_pake.dart]),+/// over the code itself: it is random and used once, so there is nothing to stretch.++const _cpaceDsi = 'e2e-cpace-ristretto255-v1';++/// core.ts `pairContext`. The joiner is a `web` client — a full viewer, as a browser was, which is+/// what the daemon pins it as (`addPaired(…, 'web')`), exactly like a password link.+String pairContext(String machineId, {String role = 'web'}) =>+ 'autonomous-e2e-pair|agent:$machineId|a:adapter|b:$role';++/// core.ts `normalizeCode`, exactly: case and separators do not matter, and the letters a person+/// misreads for digits are folded (I and L to 1, O to 0, U to V). ⚠️ Every mapping must match the+/// daemon's, or a code holding one of those letters fails as a wrong code.+String normalizePairCode(String code) => code+ .toUpperCase()+ .replaceAll(RegExp(r'[\s\-·_]'), '')+ .replaceAll('I', '1')+ .replaceAll('L', '1')+ .replaceAll('O', '0')+ .replaceAll('U', 'V');++/// core.ts `cpaceGenerator`: g = hashToGroup(DSI, code, sid, ci).+RistrettoPoint codeCpaceGenerator(String code, List<int> sid, String ci) =>+ hashToRistretto255(+ lvCat([_cpaceDsi, normalizePairCode(code), sid, ci]),+ utf8Bytes(_cpaceDsi),+ );diff --git a/desktop/lib/e2ee/pair_code.dart b/desktop/lib/e2ee/pair_code.dartnew file mode 100644index 000000000..dde0403ce--- /dev/null+++ b/desktop/lib/e2ee/pair_code.dart@@ -0,0 +1,31 @@+import 'dart:math' as math;++/// The characters a pairing code is drawn from: no `0 O 1 I L`, which read+/// alike — and no `U` either.+///+/// ⚠️ `U` is left out on purpose, although it reads fine. The daemon feeds+/// the code through core.ts `normalizeCode`, which maps `U` to `V` (Crockford+/// base32); the phone's `normalizePairCode` only uppercases and strips+/// separators. A code with a `U` in it would therefore reach CPace as two+/// different secrets and fail as `CODE_MISMATCH` every time — for a 16-letter+/// code, about four scans in ten. Without it both sides agree whatever either+/// normaliser does, at 30 symbols: 78 bits over 16 characters, far past what+/// three guesses per five minutes (the daemon's rate limit) could dent.+const kPhonePairCodeAlphabet = 'ABCDEFGHJKMNPQRSTVWXYZ23456789';+const kPhonePairCodeLength = 16;++/// A fresh one-time pairing code, from a cryptographically secure source.+///+/// It is the whole secret the pairing rests on — the backend relays the+/// handshake and must learn nothing from it — so never `Random()`.+/// [random] exists for tests; `Random.secure().nextInt` is uniform, so no+/// symbol is likelier than another.+String newPhonePairCode({math.Random? random}) {+ final source = random ?? math.Random.secure();+ return String.fromCharCodes([+ for (var i = 0; i < kPhonePairCodeLength; i++)+ kPhonePairCodeAlphabet.codeUnitAt(+ source.nextInt(kPhonePairCodeAlphabet.length),+ ),+ ]);+}diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dartindex e8a1880ac..de6f9efd0 100644--- a/desktop/lib/screens/login_screen.dart+++ b/desktop/lib/screens/login_screen.dart@@ -1,9 +1,13 @@+import 'dart:async';+import 'package:flutter/material.dart';-import 'package:flutter/foundation.dart' show kIsWeb;+import 'package:flutter/foundation.dart' show kIsWeb, visibleForTesting;import 'package:flutter/services.dart';+import '../core/web_form_factor.dart';import '../shared/theme/app_theme.dart' as grid;import '../state/app_state.dart';+import '../widgets/add_phone_dialog.dart' show PhonePairQr;import '../widgets/login_fleet_map.dart';import '../widgets/login_relay_diagram.dart';import '../widgets/web_download_button.dart';@@ -44,7 +48,16 @@ class LoginScreen extends StatelessWidget {/// 2026-09-23).final VoidCallback? onClose;- const LoginScreen({super.key, required this.notifier, this.onClose});+ /// A machine's QR was opened here by a phone's camera (`/pair#…`) before signing in: the page+ /// says what signing in is for — adding that machine — and shows its fingerprint to compare.+ final ({String name, String? fingerprint})? pairingWith;++ const LoginScreen({+ super.key,+ required this.notifier,+ this.onClose,+ this.pairingWith,+ });/// Matches `EnvironmentSetupScreen` (560) and `LinkMachineScreen` (460) —/// wide enough for the diagram to breathe, still centred at the 880×560@@ -64,8 +77,17 @@ class LoginScreen extends StatelessWidget {final gap = compact ? 16.0 : 24.0;// Preserve room for the primary action and its explanation at the minimum// window size with enlarged text. The illustration is supplementary.+ // The QR of a sign-in by phone takes the illustration's place: at the minimum window both do not fit.+ final linking = notifier.phoneLink != null;+ final byPhone =+ (notifier.signingInByPhone &&+ (notifier.pendingSignInQr != null ||+ notifier.pendingAuthorizeUrl == null)) ||+ notifier.pendingSignInQr != null ||+ linking;final showFleet =- !compact || MediaQuery.textScalerOf(context).scale(16) <= 20;+ !byPhone &&+ (!compact || MediaQuery.textScalerOf(context).scale(16) <= 20);return CallbackShortcuts(bindings: {@@ -84,7 +106,12 @@ class LoginScreen extends StatelessWidget {// themes, which is the same trick the app plays everywhere else.backgroundColor: grid.AppPalette.panelBg,body: kIsWeb- ? _webPage(context, waiting: waiting)+ ? _webPage(+ context,+ waiting: waiting,+ byPhone: byPhone,+ linking: linking,+ ): Stack(children: [const Positioned.fill(child: LoginAurora()),@@ -128,14 +155,25 @@ class LoginScreen extends StatelessWidget {const _AppMark(),SizedBox(height: gap),Text(- 'Your agents, wherever they run',+ linking+ ? 'Adding this computer to your devices'+ : byPhone+ ? 'Sign in with your phone'+ : 'Your agents, wherever they run',+ key: const Key('login-title'),textAlign: TextAlign.center,style: grid.AppType.title(),),const SizedBox(height: 8),Text(- 'At home, at the office, in the cloud — every machine you '- 'sign in to becomes part of one desk, here.',+ linking+ ? 'Your phone approved it. Linking the two, then every machine '+ 'you have — this closes when it is done.'+ : byPhone+ ? 'Scan this code with your phone and approve. This computer '+ 'joins your devices — no password.'+ : 'At home, at the office, in the cloud — every machine you '+ 'sign in to becomes part of one desk, here.',textAlign: TextAlign.center,style: Theme.of(context).textTheme@@ -146,7 +184,11 @@ class LoginScreen extends StatelessWidget {const LoginFleetMap(),SizedBox(height: gap),],- _Action(notifier: notifier, waiting: waiting),+ _Action(+ notifier: notifier,+ waiting: waiting,+ onClose: onClose,+ ),if (notifier.lastError != null &&!notifier.sessionExpired) ...[const SizedBox(height: 16),@@ -171,7 +213,12 @@ class LoginScreen extends StatelessWidget {);}- Widget _webPage(BuildContext context, {required bool waiting}) => Stack(+ Widget _webPage(+ BuildContext context, {+ required bool waiting,+ required bool byPhone,+ required bool linking,+ }) => Stack(children: [const Positioned.fill(child: LoginAurora()),SafeArea(@@ -216,7 +263,14 @@ class LoginScreen extends StatelessWidget {maxWidth: 820,),child: Text(- 'Your agents, wherever they run',+ pairingWith != null+ ? 'Sign in to add ${pairingWith!.name} to your devices'+ : linking+ ? 'Adding this browser to your devices'+ : byPhone+ ? 'Sign in with your phone'+ : 'Your agents, wherever they run',+ key: const Key('login-title'),textAlign: TextAlign.center,style: grid.AppType.display().copyWith(fontSize:@@ -233,8 +287,17 @@ class LoginScreen extends StatelessWidget {maxWidth: 650,),child: Text(- 'At home, at the office, in the cloud — every machine you '- 'sign in to becomes part of one desk, here.',+ pairingWith != null+ ? 'Then approve it, and it reaches your other machines — no password.'+ '${pairingWith!.fingerprint != null ? '\nFingerprint ${pairingWith!.fingerprint}' : ''}'+ : linking+ ? 'Your phone approved it. Linking this browser to your machines — '+ 'this page moves on when it is done.'+ : byPhone+ ? 'Scan this code with your phone and approve. This browser joins '+ 'your devices — no password.'+ : 'At home, at the office, in the cloud — every machine you '+ 'sign in to becomes part of one desk, here.',textAlign: TextAlign.center,style: grid.AppType.body().copyWith(fontSize: 16,@@ -242,13 +305,16 @@ class LoginScreen extends StatelessWidget {),),),- SizedBox(height: gap),- ConstrainedBox(- constraints: BoxConstraints(- maxWidth: compact ? 560 : 960,+ // The QR takes the illustration's place, as on the desktop card.+ if (!byPhone) ...[+ SizedBox(height: gap),+ ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: compact ? 560 : 960,+ ),+ child: const LoginFleetMap(seamless: true),),- child: const LoginFleetMap(seamless: true),- ),+ ],SizedBox(height: gap),ConstrainedBox(constraints: const BoxConstraints(@@ -258,6 +324,7 @@ class LoginScreen extends StatelessWidget {notifier: notifier,waiting: waiting,prominent: true,+ onClose: onClose,),),if (notifier.lastError != null &&@@ -302,12 +369,16 @@ class _Action extends StatefulWidget {required this.notifier,required this.waiting,this.prominent = false,+ this.onClose,});final AppNotifier notifier;final bool waiting;final bool prominent;+ /// The sheet's close, for the link steps' own button once there is nothing left to wait for.+ final VoidCallback? onClose;+@overrideState<_Action> createState() => _ActionState();}@@ -315,6 +386,9 @@ class _Action extends StatefulWidget {class _ActionState extends State<_Action> {AppNotifier get notifier => widget.notifier;final _signInFocus = FocusNode(debugLabel: 'Sign in');++ /// The QR link last copied, so the button says so for that code and not a fresh one.+ String? _qrLinkCopied;String? _copiedUrl;String? _copyFailureUrl;bool _copying = false;@@ -369,6 +443,12 @@ class _ActionState extends State<_Action> {): null;+ // Signed in by phone: the same scan goes on to link that phone and bring this computer into its+ // trust group. The sheet stays up through it and closes itself once it is done.+ if (notifier.phoneLink case final link?) {+ return _PhoneLinkSteps(link: link, onClose: widget.onClose);+ }+if (!widget.waiting) {final signingOutFailed = notifier.signOutError != null;return Column(@@ -390,13 +470,136 @@ class _ActionState extends State<_Action> {child: Text(notifier.signOutError ??(notifier.sessionExpired ? notifier.lastError : null) ??- (kIsWeb- ? 'Sign in to open your workspace.'+ (kIsWeb && isMobileWeb+ // The phone's own browser approves others; it cannot scan its own screen.+ ? 'Sign in to open your workspace. Signing in a computer or '+ 'another browser? Sign in here first, then scan its code with '+ 'your camera — or in the Harness app: ⋯ → Scan a QR code.'+ : kIsWeb+ ? 'Sign in with your phone — scan a QR, no password.': 'Sign in through your browser to continue.'),+ key: const Key('login-idle-hint'),textAlign: TextAlign.center,style: Theme.of(context).textTheme.bodySmall,),),+ // A web desktop without a phone to hand keeps the SSO page one click away.+ if (kIsWeb && !isMobileWeb && !signingOutFailed) ...[+ const SizedBox(height: 4),+ TextButton(+ key: const Key('login-sso'),+ onPressed: () => notifier.login(qr: false),+ child: const Text('Continue with SSO'),+ ),+ ],+ ],+ );+ }++ // Signing in by phone: the QR is the whole screen's job — scan, approve on the phone. Its+ // square is held from the first frame, so the code lands in place rather than pushing in.+ final qr = notifier.pendingSignInQr;+ // A CLI that predates the QR sign-in ignores `--qr` and opens the browser's SSO instead: once+ // its page is out, this is a browser sign-in, and the wait below says so.+ final browserInstead = qr == null && notifier.pendingAuthorizeUrl != null;+ if (!browserInstead &&+ (notifier.signingInByPhone && !notifier.signingOut || qr != null)) {+ final approved = notifier.signInQrStage == 'approved';+ return Column(+ key: const Key('login-qr'),+ children: [+ Container(+ padding: const EdgeInsets.all(10),+ decoration: BoxDecoration(+ color: Colors.white,+ borderRadius: BorderRadius.circular(10),+ ),+ child: qr == null+ ? const SizedBox(+ width: 220,+ height: 220,+ child: Center(+ child: SizedBox(+ width: 22,+ height: 22,+ child: CircularProgressIndicator(+ strokeWidth: 2,+ color: Colors.black54,+ ),+ ),+ ),+ )+ : Opacity(+ opacity: approved ? .25 : 1,+ child: PhonePairQr(data: qr.url, side: 220),+ ),+ ),+ const SizedBox(height: 12),+ Semantics(+ liveRegion: true,+ child: Text(+ qr == null+ ? 'Preparing your code…'+ : approved+ ? 'Approved on your phone — signing in…'+ : 'Waiting for your phone…',+ key: const Key('login-qr-status'),+ textAlign: TextAlign.center,+ style: Theme.of(context).textTheme.bodyMedium,+ ),+ ),+ if (qr?.fingerprint case final fp?) ...[+ const SizedBox(height: 6),+ Text(+ 'fingerprint $fp — check your phone shows the same',+ textAlign: TextAlign.center,+ style: grid.AppType.monoMeta(),+ ),+ ],+ if (!approved) ...[const SizedBox(height: 14), const _ScanSteps()],+ const SizedBox(height: 12),+ Wrap(+ spacing: 8,+ runSpacing: 8,+ alignment: WrapAlignment.center,+ children: [+ // The link the QR encodes, for a phone that cannot scan it — sent to it by message+ // or AirDrop and opened there.+ if (qr != null && !approved)+ TextButton.icon(+ key: const Key('login-copy-link'),+ onPressed: () async {+ try {+ await Clipboard.setData(ClipboardData(text: qr.url));+ } catch (_) {+ return;+ }+ if (!mounted) return;+ setState(() => _qrLinkCopied = qr.url);+ },+ icon: Icon(+ _qrLinkCopied == qr.url ? Icons.check : Icons.link,+ size: 16,+ ),+ label: Text(+ _qrLinkCopied == qr.url ? 'Link copied' : 'Copy link',+ ),+ ),+ TextButton.icon(+ key: const Key('login-use-browser'),+ onPressed: approved ? null : notifier.useBrowserSignIn,+ icon: const Icon(Icons.open_in_new, size: 16),+ label: Text(+ kIsWeb ? 'Continue with SSO' : 'Use browser instead',+ ),+ ),+ if (notifier.canCancelLogin)+ TextButton(+ onPressed: notifier.cancelLogin,+ child: const Text('Cancel'),+ ),+ ],+ ),],);}@@ -672,6 +875,11 @@ class _SignInSheet extends StatefulWidget {State<_SignInSheet> createState() => _SignInSheetState();}+/// Whether the sign-in sheet opens straight onto its phone QR. Off until the harness CLI's QR+/// sign-in is released: an older CLI would take the browser anyway. Tests turn it on.+@visibleForTesting+bool signInSheetStartsQr = false; // on once the harness CLI's QR sign-in is released+class _SignInSheetState extends State<_SignInSheet> {AppNotifier get notifier => widget.notifier;bool _popped = false;@@ -680,6 +888,18 @@ class _SignInSheetState extends State<_SignInSheet> {void initState() {super.initState();notifier.addListener(_onChange);+ // The sheet opens on the QR — there is nothing to press first. A phone that is signed in+ // scans it and approves; "Use browser instead" is one click away for anyone without one.+ if (signInSheetStartsQr &&+ notifier.viewer == null &&+ !notifier.signingIn &&+ !notifier.signingOut) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted && !notifier.signedIn && !notifier.signingIn) {+ unawaited(notifier.login(qr: true));+ }+ });+ }}@override@@ -694,6 +914,30 @@ class _SignInSheetState extends State<_SignInSheet> {/// keeps the person from clicking into a grid that is being rebuilt.void _onChange() {if (_popped || !mounted || !notifier.signedIn) return;+ // Signed in by phone: stay up while the two exchange keys, then hold the result a moment so it+ // can be read — a little longer for a problem, which Add Phone can still fix from the desk.+ final link = notifier.phoneLink;+ if (link != null) {+ if (!link.settled || _holding) return;+ _holding = true;+ final failed = link.stage == PhoneLinkStage.failed;+ Future<void>.delayed(failed ? _failedHold : _doneHold, () {+ if (mounted && !_popped) _pop();+ // A timer, not a build: nothing else may schedule the frame the pop waits for.+ WidgetsBinding.instance.scheduleFrame();+ });+ return;+ }+ _pop();+ }++ /// How long "reaches N machines" stays up before the sheet goes.+ static const _doneHold = Duration(milliseconds: 2500);+ static const _failedHold = Duration(seconds: 4);+ bool _holding = false;++ void _pop() {+ if (_popped) return;_popped = true;// ⚠️ AFTER the frame. The account arrives in the middle of a rebuild — the// notification that carries it comes from work started during one — and@@ -703,6 +947,7 @@ class _SignInSheetState extends State<_SignInSheet> {// cleanly.WidgetsBinding.instance.addPostFrameCallback((_) {if (!mounted) return;+ notifier.dismissPhoneLink();Navigator.of(context).pop(true);});}@@ -722,12 +967,242 @@ class _SignInSheetState extends State<_SignInSheet> {const SingleActivator(LogicalKeyboardKey.escape, includeRepeats: false):_dismiss,},- child: LoginScreen(notifier: notifier, onClose: _dismiss),+ // A route is not rebuilt by the shell beneath it: it listens for itself, or the QR that+ // arrives after the sheet opened never reaches the screen.+ child: ListenableBuilder(+ listenable: notifier,+ builder: (_, _) => LoginScreen(notifier: notifier, onClose: _dismiss),+ ),);}void _dismiss() {+ if (_popped) return;+ if (notifier.signedIn) {+ // Closed mid-link: the link goes on behind the desk, nothing left to show it.+ _pop();+ return;+ }+ _popped = true;if (notifier.canCancelLogin) notifier.cancelLogin();Navigator.of(context).pop(false);}}++/// After a sign-in by phone: what the same scan is still doing — linking that phone, then bringing+/// this computer into its trust group — one line per step, ticked off as the CLI reports them.+class _PhoneLinkSteps extends StatelessWidget {+ const _PhoneLinkSteps({required this.link, this.onClose});++ final PhoneLinkStatus link;+ final VoidCallback? onClose;++ @override+ Widget build(BuildContext context) {+ grid.AppTheme.watch(context);+ final phone = link.phone ?? 'your phone';+ final stage = link.stage;+ final linked =+ stage == PhoneLinkStage.linking || stage == PhoneLinkStage.done;+ final failed = stage == PhoneLinkStage.failed;+ final n = link.machines.length;+ return Column(+ key: const Key('login-phone-link'),+ children: [+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 380),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const _Step(+ state: _StepState.done,+ text: 'Approved on your phone',+ ),+ const _Step(state: _StepState.done, text: 'Signed in'),+ _Step(+ state: linked+ ? _StepState.done+ : failed && link.phone == null+ ? _StepState.failed+ : _StepState.busy,+ text: linked || link.phone != null+ ? 'Linked with $phone'+ : failed+ ? (kIsWeb ? 'Link to your machines' : 'Link your phone')+ : (kIsWeb+ ? 'Linking to your machines…'+ : 'Linking your phone…'),+ ),+ if (linked || (failed && link.phone != null))+ _Step(+ state: stage == PhoneLinkStage.done+ ? _StepState.done+ : failed+ ? _StepState.failed+ : _StepState.busy,+ text: stage != PhoneLinkStage.done+ ? 'Adding this ${kIsWeb ? 'browser' : 'computer'} to your devices…'+ : n == 0+ ? 'Added — machines you link later join too'+ : 'Reaches $n ${n == 1 ? 'machine' : 'machines'}: '+ '${link.machines.join(' · ')}',+ ),+ ],+ ),+ ),+ if (failed) ...[+ const SizedBox(height: 12),+ Semantics(+ liveRegion: true,+ child: Text(+ "Couldn't finish linking${link.error == null ? '' : ' (${link.error})'}. "+ '${kIsWeb ? 'You are signed in — link your machines from Machines.' : 'You are signed in — add your phone again from Harness ▸ Add Phone….'}',+ key: const Key('login-phone-link-error'),+ textAlign: TextAlign.center,+ style: Theme.of(context).textTheme.bodySmall+ ?.copyWith(color: grid.AppPalette.warn),+ ),+ ),+ ],+ if (link.settled && onClose != null) ...[+ const SizedBox(height: 12),+ TextButton(+ key: const Key('login-phone-link-close'),+ onPressed: onClose,+ child: Text(failed ? 'Close' : 'Done'),+ ),+ ],+ ],+ );+ }+}++enum _StepState { done, busy, failed }++class _Step extends StatelessWidget {+ const _Step({required this.state, required this.text});++ final _StepState state;+ final String text;++ @override+ Widget build(BuildContext context) {+ final color = switch (state) {+ _StepState.done => grid.AppPalette.accentOnSurface,+ _StepState.busy => grid.AppPalette.textSecondary,+ _StepState.failed => grid.AppPalette.warn,+ };+ return Padding(+ padding: const EdgeInsets.symmetric(vertical: 4),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ SizedBox(+ width: 18,+ height: 18,+ child: state == _StepState.busy+ ? Padding(+ padding: const EdgeInsets.all(2),+ child: CircularProgressIndicator(+ strokeWidth: 2,+ color: color,+ ),+ )+ : Icon(+ state == _StepState.done+ ? Icons.check_circle+ : Icons.error_outline,+ size: 18,+ color: color,+ ),+ ),+ const SizedBox(width: 10),+ Expanded(+ child: Text(+ text,+ style: Theme.of(context).textTheme.bodyMedium?.copyWith(+ color: state == _StepState.busy+ ? grid.AppPalette.textSecondary+ : grid.AppPalette.textPrimary,+ ),+ ),+ ),+ ],+ ),+ );+ }+}++/// How to scan a sign-in QR, spelled out: nobody should have to guess which app does it.+///+/// ```+/// Scan it with your phone, either:+/// 1 Camera — point it at the code and tap the link. Harness opens in+/// your phone's browser: sign in if asked, then tap Approve.+/// 2 The Harness app — ⋯ → Scan a QR code, then Approve.+/// ```+class _ScanSteps extends StatelessWidget {+ const _ScanSteps();++ @override+ Widget build(BuildContext context) {+ grid.AppTheme.watch(context);+ final body = Theme.of(context).textTheme.bodySmall;+ Widget step(String n, String title, String text) => Padding(+ padding: const EdgeInsets.symmetric(vertical: 4),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ SizedBox(+ width: 22,+ child: Text(+ n,+ style: grid.AppType.monoLabel(+ color: grid.AppPalette.accentOnSurface,+ ),+ ),+ ),+ Expanded(+ child: Text.rich(+ TextSpan(+ children: [+ TextSpan(+ text: title,+ style: const TextStyle(fontWeight: FontWeight.w600),+ ),+ TextSpan(text: ' — $text'),+ ],+ ),+ style: body,+ ),+ ),+ ],+ ),+ );+ return ConstrainedBox(+ key: const Key('login-scan-steps'),+ constraints: const BoxConstraints(maxWidth: 420),+ child: Container(+ padding: const EdgeInsets.fromLTRB(14, 10, 14, 10),+ decoration: BoxDecoration(+ color: grid.AppPalette.textPrimary.withValues(alpha: .05),+ borderRadius: BorderRadius.circular(10),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text('Scan it with your phone, either:', style: body),+ const SizedBox(height: 4),+ step(+ '1',+ 'Camera',+ 'point it at the code and tap the link. Harness opens in your '+ "phone's browser: sign in if asked, then tap Approve.",+ ),+ step('2', 'The Harness app', '⋯ → Scan a QR code, then Approve.'),+ ],+ ),+ ),+ );+ }+}diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 6cc532a5d..cff7aa044 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -2408,6 +2408,13 @@ class _SwarmScreenState extends State<SwarmScreen> {app,keymap: _keymap,onConnectMachine: () => unawaited(_openMachines()),+ // The QR's `f`: the phone refuses a machine proving a different key.+ machineFingerprint: app.viewer == null+ ? null+ : (remote) => machineFingerprintOf(app, remote),+ // This computer's daemon keeps the group; a viewer's lives in the browser.+ // The desktop app keeps its Add Phone as it was until the harness CLI's QR work is released.+ groupMachines: null,),);diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex 0a2b9c273..bfabb4c7a 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -20,7 +20,18 @@ import '../api/api_client.dart';import '../viewer/sign_in_browser.dart';import '../viewer/direct_link.dart';import '../viewer/viewer_services.dart';-import '../viewer/group_sync.dart' show GroupSyncOutcome;+import '../e2ee/bytes.dart' show b64d;+import '../e2ee/keys.dart' show fingerprint;+import '../viewer/group_sync.dart'+ show+ GroupMember,+ GroupRoster,+ GroupSyncOutcome,+ adoptHandedRoster,+ admitGroupMember,+ handoffRoster,+ openHandedRoster,+ sealHandedRoster;import '../auth/auth_session.dart';import '../auth/peer_link_client.dart';import '../auth/sign_in_client.dart';@@ -38,6 +49,7 @@ import '../core/engine_availability.dart';import '../core/local_hostname.dart';import '../core/local_git_projects.dart';import '../core/test_run.dart';+import '../core/web_form_factor.dart';import '../core/models.dart';import '../core/machine_resources.dart';import '../core/project_folder.dart';@@ -3534,6 +3546,7 @@ class AppNotifier extends ChangeNotifier {}) async {_guestDeskRestorePending = true;signedIn = false;+ phoneLink = null;currentUser = null;analyticsAccount.clear();if (banner != null) {@@ -4234,16 +4247,88 @@ class AppNotifier extends ChangeNotifier {}}- Future<void> login() async {+ /// The QR a sign-in by phone is showing (`harness login --qr`), or null. See [login].+ SignInQr? pendingSignInQr;++ /// The sign-in in progress was started for the phone (`login(qr: true)`), so its QR square is+ /// held before the code arrives.+ bool signingInByPhone = false;++ /// Where a sign-in by phone is: `approved`, then (after the window is signed in) `linked`,+ /// `synced`. Null otherwise.+ String? signInQrStage;++ /// Once signed in by phone, the link that follows it: the phone joining this computer and this+ /// computer joining the phone's trust group. The sign-in sheet shows its steps and closes once+ /// it is done (`showSignInSheet`); null otherwise.+ PhoneLinkStatus? phoneLink;++ void dismissPhoneLink() {+ if (phoneLink == null) return;+ phoneLink = null;+ notifyListeners();+ }++ /// One event of a sign-in by phone's link leg (`harness login --qr --json` after its first result).+ void _phoneLinkProgress(String stage, Map<String, dynamic> event) {+ final now = phoneLink;+ switch (stage) {+ case 'linked':+ final label = event['label'];+ phoneLink = PhoneLinkStatus.linking(+ label is String && label.trim().isNotEmpty ? label.trim() : null,+ );+ case 'synced':+ final machines = event['machines'];+ phoneLink = PhoneLinkStatus.done(now?.phone, [+ if (machines is List)+ for (final m in machines)+ if (m is Map && m['name'] is String) m['name'] as String,+ ]);+ case 'result' when event['status'] != 'success':+ final message = event['message'];+ phoneLink = PhoneLinkStatus.failed(+ now?.phone,+ message is String && message.isNotEmpty ? message : null,+ );+ case 'ended' when now != null && !now.settled:+ phoneLink = PhoneLinkStatus.failed(now.phone, null);+ default:+ return;+ }+ notifyListeners();+ }++ /// Switch a sign-in by phone to the browser's SSO page instead.+ Future<void> useBrowserSignIn() async {+ if (signingIn) cancelLogin();+ await login(qr: false);+ }++ /// Signs in. A CLI-backed build signs in **by phone** unless [qr] is false: the CLI shows a QR+ /// ([pendingSignInQr]) that a phone already signed in scans and approves — no browser — and the+ /// same scan links the phone and brings this computer into its trust group. A viewer build (web,+ /// mobile) signs in with SSO; it is the thing that approves, not the thing approved.+ Future<void> login({bool? qr}) async {if (_disposed || signingIn || signingOut || signOutError != null) return;+ // By phone: a CLI-backed window, and a web desktop. A phone's own browser (web mobile) is the+ // approver, and signs itself in by SSO.+ // A CLI-backed desktop signs in through the browser until the harness CLI's QR sign-in is+ // released; asked for explicitly (`qr: true`), it is already understood here.+ final byPhone = qr ?? (kIsWeb && !isMobileWeb);final wasGuest = isGuest;+ ({String code, String userCode, String? sealedRoster})? browserJoin;final revision = _invalidateAuthWork();_closedHistory.clear();_monitorHarnesses.clear();_lastError = null;status = AppStatus.bootstrapping;signingIn = true;+ signingInByPhone = qr == true; // the QR square is held from the startpendingAuthorizeUrl = null;+ pendingSignInQr = null;+ signInQrStage = null;+ phoneLink = null;notifyListeners();try {if (_workspaceCleanup case final cleanup?) {@@ -4251,6 +4336,35 @@ class AppNotifier extends ChangeNotifier {if (!_authWorkCurrent(revision)) return;}await cliLogin.login(+ qr: byPhone+ ? SignInQrListener(+ onQr: (shown) {+ if (!_authWorkCurrent(revision)) return;+ pendingSignInQr = shown;+ notifyListeners();+ },+ onProgress: (stage, event) {+ if (_disposed || !_authWorkCurrent(revision)) return;+ // A browser's approval carries the phone's group, sealed under the QR's code.+ if (stage == 'approved' &&+ event['code'] is String &&+ event['userCode'] is String) {+ final sealed = event['sealedRoster'];+ browserJoin = (+ code: event['code'] as String,+ userCode: event['userCode'] as String,+ sealedRoster: sealed is String ? sealed : null,+ );+ }+ if (stage == 'approved') {+ signInQrStage = stage;+ notifyListeners();+ } else {+ _phoneLinkProgress(stage, event);+ }+ },+ )+ : null,onAuthorizeUrl: (url) {if (!_authWorkCurrent(revision)) return;if (pendingAuthorizeUrl == url) return;@@ -4266,7 +4380,15 @@ class AppNotifier extends ChangeNotifier {);if (!_authWorkCurrent(revision)) return;_loginAuthorized = true;+ // Signed in by phone: the CLI goes on to link that phone and join its group (see+ // [_phoneLinkProgress]) — unless it already reported, which a fast phone can.+ if (byPhone && phoneLink == null) {+ phoneLink = viewer == null || browserJoin != null+ ? const PhoneLinkStatus.waiting()+ : null;+ }pendingAuthorizeUrl = null;+ pendingSignInQr = null;_resetLoginBrowser();notifyListeners();// The CLI has just restarted its daemon onto the account's machineId, so a@@ -4280,6 +4402,9 @@ class AppNotifier extends ChangeNotifier {return;}_guestDeskRestorePending = false;+ if (browserJoin case final join?) {+ unawaited(_joinGroupFromPhone(join, revision));+ }analytics.signedIn();// Restarts the clock even if `_trackAppOpened` already started one: this// person met the login screen, so their wait begins where the launch's@@ -4311,6 +4436,8 @@ class AppNotifier extends ChangeNotifier {_resetLoginBrowser();_loginAuthorized = false;pendingAuthorizeUrl = null;+ pendingSignInQr = null;+ signingInByPhone = false;signingIn = false;}}@@ -4373,7 +4500,11 @@ class AppNotifier extends ChangeNotifier {if (_disposed || !canCancelLogin) return;final revision = _invalidateAuthWork();signingIn = false;+ signingInByPhone = false;pendingAuthorizeUrl = null;+ pendingSignInQr = null;+ signInQrStage = null;+ phoneLink = null;status = isGuest ? AppStatus.authenticated : AppStatus.unauthenticated;_lastError = null;_lastErrorRetryable = false;@@ -5350,6 +5481,123 @@ class AppNotifier extends ChangeNotifier {}}+ /// Pairs with [machineId] by the one-time code in its QR (`harness link qr`, or Add Phone) — no+ /// password — then reconnects it and brings it into the trust group. Viewer builds only: a+ /// CLI-backed build shows the QR rather than scanning one. Null on success, or what to show.+ Future<String?> connectWithCode(+ String machineId,+ String code, {+ String? expectedFingerprint,+ }) async {+ final result = await peerLinks.connectWithCode(+ machineId,+ code,+ label: kIsWeb ? browserLabel() : (localHostnameOrNull() ?? 'Harness'),+ displayName: machineStates[machineId]?.machine.displayName,+ expectedFingerprint: expectedFingerprint,+ );+ if (result.error != null) return result.error;+ final targetId = result.linkedMachineId ?? machineId;+ final state = machineStates[targetId];+ if (state != null) {+ state.needsLink = false;+ state.agentLoadStatus = AgentLoadStatus.idle;+ notifyListeners();+ await _pool?.closeMachine(targetId);+ _connectMachine(state);+ }+ unawaited(_syncGroup(targetId, spread: true));+ return null;+ }++ /// A web desktop just signed in by phone: it and the phone now hold each other's keys — the phone+ /// took this browser into its roster, and handed back its own, sealed under the QR's code. Opening+ /// that is the whole join: every machine is pinned here, and the sign-in page is done. Telling the+ /// machines is background work ([_spreadGroup]), which the phone is doing too.+ Future<void> _joinGroupFromPhone(+ ({String code, String userCode, String? sealedRoster}) join,+ int revision,+ ) async {+ final keys = viewer?.keys;+ final sealed = join.sealedRoster;+ final raw = keys == null || sealed == null+ ? null+ : openHandedRoster(sealed, code: join.code, userCode: join.userCode);+ if (raw == null) {+ phoneLink = const PhoneLinkStatus.failed(+ null,+ 'your phone sent no devices — update Harness there',+ );+ notifyListeners();+ return;+ }+ try {+ await adoptHandedRoster(keys!, raw);+ } catch (_) {+ if (_disposed || !_authWorkCurrent(revision)) return;+ phoneLink = const PhoneLinkStatus.failed(+ null,+ "this browser's keys could not be saved",+ );+ notifyListeners();+ return;+ }+ if (_disposed || !_authWorkCurrent(revision)) return;+ final machines = await _groupMachines();+ for (final id in machines) {+ // The inventory can change under these awaits: a machine gone from it is skipped, not dialled.+ final state = machineStates[id];+ if (state == null || !state.needsLink) continue;+ state.needsLink = false;+ state.agentLoadStatus = AgentLoadStatus.idle;+ await _pool?.closeMachine(id);+ _connectMachine(state);+ }+ if (_disposed || !_authWorkCurrent(revision)) return;+ phoneLink = PhoneLinkStatus.done('your phone', [+ for (final id in machines)+ if (machineStates[id] case final state?) state.machine.displayName,+ ]);+ notifyListeners();+ unawaited(_spreadGroup(retry: true, revision: revision));+ }++ /// The account's machines this device holds a key for: the group members it can reach. A roster+ /// can still name machines from another account; those are not dialled.+ Future<List<String>> _groupMachines() async {+ final keys = viewer?.keys;+ if (keys == null) return const [];+ return [+ for (final p in await keys.peers())+ if (machineStates.containsKey(p.machineId)) p.machineId,+ ];+ }++ /// Background: swap rosters with the group machines that are online, so what this device just+ /// learned — or just became — reaches the whole group. With [retry] (a device that just joined) it+ /// tries again a few times: a machine refuses a key it has not heard of yet, and hears of it from+ /// the approving device's own round moments later.+ Future<void> _spreadGroup({bool retry = false, int? revision}) async {+ const waits = [+ Duration.zero,+ Duration(seconds: 3),+ Duration(seconds: 10),+ Duration(seconds: 30),+ ];+ for (final wait in retry ? waits : waits.take(1)) {+ if (wait > Duration.zero) await Future<void>.delayed(wait);+ if (_disposed || (revision != null && !_authWorkCurrent(revision))) {+ return;+ }+ final online = [+ for (final id in await _groupMachines())+ if (machineStates[id]?.nodeOnline != false) id,+ ];+ if (online.isEmpty) continue;+ await _syncGroup(online.first, spread: true);+ }+ }+final Map<String, DateTime> _groupSyncedAt = {};static const _groupResync = Duration(minutes: 5);@@ -5370,7 +5618,9 @@ class AppNotifier extends ChangeNotifier {// Fire-and-forget from the connection handler: a state file that is locked for a moment must not// surface as an unhandled error. The next session retries.try {- final label = localHostnameOrNull() ?? 'Desktop';+ final label = kIsWeb+ ? browserLabel()+ : (localHostnameOrNull() ?? 'Desktop');final GroupSyncOutcome outcome = await links.syncGroup(machineId,label: label,@@ -7626,6 +7876,104 @@ class AppNotifier extends ChangeNotifier {await _loadMachineData(machine, force: true);}+ /// Approves a sign-in QR — a browser's (`k=v`), or a machine's with [machine] — and takes the asker+ /// into this device's trust group:+ ///+ /// 1. the browser's key, as the backend has it ([pub]), must be the one the QR's fingerprint names+ /// — the camera is the channel the server cannot touch;+ /// 2. the approval hands the browser this device's roster, sealed under the QR's [code], so it can+ /// pin every machine without dialling one first;+ /// 3. the browser joins this device's roster. That exchange is the approval; telling the+ /// machines follows in the background ([_spreadGroup]).+ ///+ /// Returns the machines the browser will reach, or an error code: `FINGERPRINT` (a different+ /// key), `UNSUPPORTED` (no trust group here), `STORAGE` (this device's keys could not be read or+ /// written), or the backend's refusal. Never throws.+ Future<({String? error, int machines, String? machineId})> approveSignInByQr({+ required String userCode,+ required String code,+ required String pub,+ required String label,+ String? qrFingerprint,+ bool machine = false,+ }) async {+ final keys = viewer?.keys;+ if (keys == null) {+ return (error: 'UNSUPPORTED', machines: 0, machineId: null);+ }+ final List<int> pubBytes;+ try {+ pubBytes = b64d(pub);+ } on FormatException {+ return (error: 'FINGERPRINT', machines: 0, machineId: null);+ }+ String plain(String v) =>+ v.toUpperCase().replaceAll(RegExp('[^0-9A-Z]'), '');+ if (pubBytes.length != 32 ||+ (qrFingerprint != null &&+ plain(fingerprint(pubBytes)) != plain(qrFingerprint))) {+ return (error: 'FINGERPRINT', machines: 0, machineId: null);+ }+ final GroupRoster roster;+ try {+ roster = await handoffRoster(+ keys,+ selfLabel: kIsWeb+ ? browserLabel()+ : (localHostnameOrNull() ?? 'Harness'),+ );+ } catch (_) {+ return (error: 'STORAGE', machines: 0, machineId: null);+ }+ String? machineId;+ try {+ final sealed = sealHandedRoster(roster, code: code, userCode: userCode);+ if (machine) {+ machineId = await api.approveMachineSignIn(+ userCode,+ sealedRoster: sealed,+ );+ } else {+ await api.approveBrowserSignIn(userCode, sealedRoster: sealed);+ }+ } catch (e) {+ return (error: '$e', machines: 0, machineId: null);+ }+ try {+ await admitGroupMember(+ keys,+ GroupMember(+ pub: pub,+ kind: machine ? 'machine' : 'viewer',+ label: label,+ at: DateTime.now().millisecondsSinceEpoch,+ machineId: machine ? machineId : null,+ ),+ );+ // A machine is one this device dials: pinned now, by the key the QR vouched for.+ if (machine && machineId != null) {+ await keys.pin(machineId, pubBytes, label: label);+ }+ } catch (_) {+ // Signed in all the same; the browser's own round tells the machines, and this device hears+ // of it from them on its next sync.+ }+ // The two now hold each other's keys: done. Telling the rest of the group is background work —+ // after a machine list that has the new machine on it.+ unawaited(() async {+ if (machine) {+ try {+ await refreshMachines();+ } catch (_) {}+ }+ await _spreadGroup();+ }());+ final reach = (await _groupMachines())+ .where((id) => id != machineId)+ .length;+ return (error: null, machines: reach, machineId: machineId);+ }+/// Arm the selected owner's daemon through an already linked browser. Never queue a QR code/// across reconnection: closing the dialog must end future pairing attempts.Future<Map<String, dynamic>> pairPhone(String machineId, String code) {@@ -13083,3 +13431,36 @@ final appStateProvider = Provider<AppNotifier>((ref) {app.bootstrap();return app;});++/// Where the link after a sign-in by phone stands — see [AppNotifier.phoneLink].+class PhoneLinkStatus {+ const PhoneLinkStatus.waiting()+ : stage = PhoneLinkStage.waiting,+ phone = null,+ machines = const [],+ error = null;+ const PhoneLinkStatus.linking(this.phone)+ : stage = PhoneLinkStage.linking,+ machines = const [],+ error = null;+ const PhoneLinkStatus.done(this.phone, this.machines)+ : stage = PhoneLinkStage.done,+ error = null;+ const PhoneLinkStatus.failed(this.phone, this.error)+ : stage = PhoneLinkStage.failed,+ machines = const [];++ final PhoneLinkStage stage;++ /// The phone's name as it sealed it in the link, once linked.+ final String? phone;++ /// The other machines this computer now reaches, by name.+ final List<String> machines;+ final String? error;++ bool get settled =>+ stage == PhoneLinkStage.done || stage == PhoneLinkStage.failed;+}++enum PhoneLinkStage { waiting, linking, done, failed }diff --git a/desktop/lib/viewer/browser_login.dart b/desktop/lib/viewer/browser_login.dartindex cf931801e..82d3974b6 100644--- a/desktop/lib/viewer/browser_login.dart+++ b/desktop/lib/viewer/browser_login.dart@@ -1,11 +1,17 @@import 'dart:async';import 'dart:convert';-import '../auth/cli_login.dart' show CliAuthStatus;+import '../auth/cli_login.dart' show CliAuthStatus, SignInQrListener;import '../auth/sign_in_client.dart';+import '../core/web_form_factor.dart';+import '../e2ee/bytes.dart' show b64e;+import '../e2ee/keys.dart' show fingerprint;import 'direct_auth.dart';import 'direct_auth_api.dart';import '../sharing/shared_agent_location.dart';+import 'pending_pair_store.dart';+import 'qr_sign_in.dart';+import 'viewer_key_store.dart';/// Browser-only operations behind a seam so OAuth can be tested without a/// browser, a real account, or opening an authorization page.@@ -23,11 +29,15 @@ class BrowserLogin implements SignInClient {BrowserLogin({required this.auth,required this.browser,+ this.keys,DateTime Function()? clock,}) : _clock = clock ?? DateTime.now;final DirectAuth auth;final LoginBrowser browser;++ /// This browser's E2EE identity, whose fingerprint a sign-in by phone shows. Null: no QR sign-in.+ final ViewerKeyStore? keys;final DateTime Function() _clock;int _revision = 0;Completer<void>? _departing;@@ -96,6 +106,25 @@ class BrowserLogin implements SignInClient {throw const DirectAuthException('This sign-in expired. Sign in again.');}}+ // A machine's QR opened by a phone's camera may carry a one-time sign-in code (`h`): with no+ // session yet, it signs this browser in — no SSO page, which a local or LAN-addressed build+ // could not use anyway. The pair itself is asked about once signed in (`app_shell.dart`).+ if (!await auth.hasSession()) {+ final pending = const PendingPairStore().capture(_clock());+ final handoff = pending?.code.signIn;+ if (handoff != null && !pending!.isExpired(_clock())) {+ try {+ final tokens = await auth.api.redeemHandoff(+ handoff,+ label: 'Harness web',+ );+ _requireCurrent(revision);+ await auth.signIn(tokens, stillCurrent: () => revision == _revision);+ } on DirectAuthException {+ // Spent or expired: the sign-in page is the way on, and the pair still waits.+ }+ }+ }final loggedIn = await auth.hasSession();_requireCurrent(revision);return CliAuthStatus(loggedIn: loggedIn);@@ -104,10 +133,14 @@ class BrowserLogin implements SignInClient {@overrideFuture<void> login({required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,}) async {cancel();final revision = _revision;final location = browser.uri;+ if (qr != null && keys != null) {+ return _loginByPhone(qr, revision, location);+ }final origin = location.origin;final callbackPath = _callbackPath(location);// Local previews need their own callback, just like the native app's@@ -158,6 +191,36 @@ class BrowserLogin implements SignInClient {}}+ /// A web desktop signed in by a phone: the QR, the phone's approval, then the session installed+ /// here. The phone's sealed roster goes to the listener (`approved`), for `AppNotifier` to join+ /// this browser to the group once the workspace is up.+ Future<void> _loginByPhone(+ SignInQrListener qr,+ int revision,+ Uri location,+ ) async {+ final identity = await keys!.identity();+ _requireCurrent(revision);+ final result = await WebQrSignIn(+ api: auth.api,+ fingerprint: fingerprint(identity.pub),+ pub: b64e(identity.pub),+ label: browserLabel(),+ linkBase:+ _isLoopback(location) || location.host != 'harness.autonomous.ai'+ ? Uri.parse(location.origin)+ : null,+ ).run(onQr: qr.onQr, current: () => revision == _revision);+ _requireCurrent(revision);+ await auth.signIn(result.tokens, stillCurrent: () => revision == _revision);+ _requireCurrent(revision);+ qr.onProgress?.call('approved', {+ 'code': result.code,+ 'userCode': result.userCode,+ 'sealedRoster': ?result.sealedRoster,+ });+ }+void _requireCurrent(int revision) {if (revision != _revision) {throw const DirectAuthException('Sign-in was cancelled.');diff --git a/desktop/lib/viewer/code_link.dart b/desktop/lib/viewer/code_link.dartnew file mode 100644index 000000000..d3dbecd14--- /dev/null+++ b/desktop/lib/viewer/code_link.dart@@ -0,0 +1,234 @@+import 'dart:async';+import 'dart:convert';+import 'dart:typed_data';++import '../e2ee/bytes.dart';+import '../e2ee/code_pake.dart';+import '../e2ee/cpace.dart';+import '../e2ee/envelope.dart';+import '../e2ee/keys.dart';+import '../e2ee/primitives.dart';+import 'password_link.dart'+ show+ PasswordLinkFailed,+ PasswordLinkResult,+ PasswordLinked,+ RelaySocketFactory,+ defaultRelaySocket;++/// Pairs this phone with [machineId] using the one-time code its desktop app showed in the+/// "Add phone" QR — no remote password.+///+/// The daemon's live-code pairing (`manager.ts` `onPairIntent` / `onPake`): this phone says it is+/// waiting to pair (`e2e_pair_intent`), and the desktop app, which put the code in the QR, hands the+/// same code to its own daemon (`POST /api/pair`) the moment the intent arrives. The two sides then+/// run CPace over it and pin each other's identity, as the password link does. A wrong code fails+/// the MAC; the code is used once and the daemon holds the intent for 60 s.+///+/// [timeout] covers the wait for the desktop to answer: it polls every second or two.+Future<PasswordLinkResult> linkWithCode({+ required String machineId,+ required String code,+ required String label,+ required E2eeIdentity identity,+ required String accessToken,+ required String wsBaseUrl,+ required String autonomousEnv,+ RelaySocketFactory socket = defaultRelaySocket,+ Duration timeout = const Duration(seconds: 50),+}) async {+ final uri = Uri.parse('$wsBaseUrl/api/web-ws')+ .replace(queryParameters: {'autonomousEnv': autonomousEnv});+ final channel = socket(uri, [accessToken]);+ final run = CodeLinkRun(+ machineId: machineId,+ code: code,+ label: label,+ identity: identity,+ send: (type, payload) =>+ channel.sink.add(jsonEncode({'type': type, 'payload': payload})),+ );+ try {+ // The dial is inside the timeout, as in `linkWithPassword`: a network that swallows packets+ // otherwise holds "Pairing…" on screen for the OS's own TCP timeout.+ return await () async {+ await channel.ready;+ return run.drive(+ channel.stream.map(+ (raw) => raw is String ? jsonObjectOf(utf8Bytes(raw)) : null,+ ),+ );+ }().timeout(timeout, onTimeout: () => const PasswordLinkFailed('TIMEOUT'));+ } catch (_) {+ return const PasswordLinkFailed('CONNECTION_ERROR');+ } finally {+ unawaited(channel.sink.close());+ }+}++/// The joiner ('b') side of the machine's live-code state machine, over any stream of frames —+/// the socket in [linkWithCode], a simulated machine in tests.+class CodeLinkRun {+ CodeLinkRun({+ required this.machineId,+ required this.code,+ required this.label,+ required this.identity,+ required this.send,+ Uint8List? pairId,+ }) : _pairId = pairId ?? secureRandomBytes(16);++ final String machineId;+ final String code;+ final String label;+ final E2eeIdentity identity;+ final void Function(String type, Map<String, Object> payload) send;++ final Uint8List _pairId;+ late final String _pairIdB64 = b64e(_pairId);+ final String _requestId = b64e(secureRandomBytes(16));+ late final String _ci = pairContext(machineId);+ bool _selected = false;+ Uint8List? _isk;+ Uint8List? _transcript;+ Uint8List? _machinePub;++ Future<PasswordLinkResult> drive(Stream<Map<String, dynamic>?> frames) async {+ send('machine_select', {'machineId': machineId});+ await for (final frame in frames) {+ if (frame == null) continue;+ final PasswordLinkResult? result;+ try {+ result = await step(frame);+ } catch (_) {+ return const PasswordLinkFailed('PROTOCOL_ERROR');+ }+ if (result != null) return result;+ }+ return const PasswordLinkFailed('CONNECTION_CLOSED');+ }++ /// One frame from the machine; a result once the pairing is decided, else null.+ Future<PasswordLinkResult?> step(Map<String, dynamic> frame) async {+ final type = frame['type'];+ final payload = frame['payload'] is Map<String, dynamic>+ ? frame['payload'] as Map<String, dynamic>+ : const <String, dynamic>{};+ if (!_selected) {+ if (payload['machineId'] != machineId) return null;+ if (type == 'connected') {+ _selected = true;+ send('e2e_pair_intent', {+ 'requestId': _requestId,+ 'pairId': _pairIdB64,+ 'label': label,+ 'role': 'web',+ });+ return null;+ }+ if (type == 'machine_select_error') {+ return PasswordLinkFailed(_codeOr(payload['error'], 'SELECT_FAILED'));+ }+ return null;+ }+ if (type == 'e2e_pair_intent_result' &&+ payload['requestId'] == _requestId) {+ return payload['accepted'] == true+ ? null+ : PasswordLinkFailed(_codeOr(payload['error'], 'PAIR_REFUSED'));+ }+ if (type != 'e2e_pake' || payload['pairId'] != _pairIdB64) return null;+ final error = payload['error'];+ if (error != null) return PasswordLinkFailed('$error');+ return switch (payload['round']) {+ 1 => _answerShare(payload),+ 3 => await _answerIdentity(payload),+ 5 => _finish(payload),+ _ => null,+ };+ }++ /// Round 1 in, round 2 out: our CPace share, and a MAC only the right code could have made.+ PasswordLinkResult? _answerShare(Map<String, dynamic> payload) {+ final theirs = b64d(payload['ya'] as String);+ final ours = cpaceStart(codeCpaceGenerator(code, _pairId, _ci));+ final isk = _isk = cpaceIsk(+ _pairId,+ cpaceShared(theirs, ours.scalar),+ theirs,+ ours.share,+ );+ final transcript = _transcript = transcriptHash(+ _pairId,+ _ci,+ theirs,+ ours.share,+ );+ send('e2e_pake', {+ 'pairId': _pairIdB64,+ 'round': 2,+ 'yb': b64e(ours.share),+ 'mac': b64e(macTag(kcKeys(isk, _ci).web, transcript)),+ });+ return null;+ }++ /// Round 3 in, round 4 out: the machine proves the code too and hands over its identity, bound+ /// to this transcript; ours goes back the same way.+ Future<PasswordLinkResult?> _answerIdentity(+ Map<String, dynamic> payload,+ ) async {+ final isk = _isk, transcript = _transcript;+ if (isk == null || transcript == null) {+ return const PasswordLinkFailed('PROTOCOL_ERROR');+ }+ final mac = b64d(payload['mac'] as String);+ if (!macVerify(kcKeys(isk, _ci).adapter, transcript, mac)) {+ return const PasswordLinkFailed('CODE_MISMATCH');+ }+ final key = pairKey(isk, _ci);+ final opened = aeadOpen(+ key,+ 3,+ utf8Bytes('e2e-id'),+ b64d(payload['enc'] as String),+ );+ final claim = opened == null ? null : jsonObjectOf(opened);+ final id = claim?['id'], sig = claim?['sig'];+ if (id is! String || sig is! String) {+ return const PasswordLinkFailed('CODE_MISMATCH');+ }+ final machinePub = b64d(id);+ if (!await pairBindVerify(machinePub, transcript, b64d(sig))) {+ return const PasswordLinkFailed('CODE_MISMATCH');+ }+ _machinePub = machinePub;+ final ours = jsonEncode({+ 'id': b64e(identity.pub),+ 'sig': b64e(await pairBindSig(identity, transcript)),+ // Sealed beside the identity, as the password link does: the machine files this phone under an+ // authenticated name and, knowing it is a viewer, adds it to its trust group at once. A machine+ // that predates the fields ignores them.+ if (label.trim().isNotEmpty) 'label': label,+ 'kind': 'viewer',+ });+ send('e2e_pake', {+ 'pairId': _pairIdB64,+ 'round': 4,+ 'enc': b64e(aeadSeal(key, 4, utf8Bytes('e2e-id'), utf8Bytes(ours))),+ });+ return null;+ }++ /// The fingerprint is computed here from the pinned key, not taken from the clear frame.+ PasswordLinkResult _finish(Map<String, dynamic> payload) {+ final machinePub = _machinePub;+ if (payload['ok'] != true || machinePub == null) {+ return PasswordLinkFailed(_codeOr(payload['error'], 'PAIR_FAILED'));+ }+ return PasswordLinked(machinePub, fingerprint(machinePub));+ }+}++String _codeOr(Object? value, String fallback) =>+ value is String && value.isNotEmpty ? value : fallback;diff --git a/desktop/lib/viewer/connect_code.dart b/desktop/lib/viewer/connect_code.dartnew file mode 100644index 000000000..3b7dcfc35--- /dev/null+++ b/desktop/lib/viewer/connect_code.dart@@ -0,0 +1,158 @@+/// What the desktop app's **Add phone** QR says — the contract between the two apps:+///+/// ```+/// https://harness.autonomous.ai/pair#e=<email>&m=<machineId>&c=<one-time pairing code>&h=<sign-in code>+/// &f=<machine fingerprint>&n=<hostname>+/// ```+///+/// `f` and `n` come from `harness link qr` (and newer desktops): the machine's identity fingerprint,+/// checked against the key the pairing pins, and its name for the confirm screen.+///+/// A machine that is not signed in yet (`harness login`, the desktop's sign-in) shows the same link+/// with `s` in place of `m` and `e`: its sign-in request, which a signed-in phone approves — that+/// signs the machine in — before the pairing code links the two.+///+/// A BROWSER asking to be signed in (the web sign-in page) adds `k=v`: approving it signs that+/// browser in, and the phone then links it through one of its machines — it is a viewer, like the+/// phone, not a machine to add.+///+/// Any host serving the app is taken (a local build is `http://<ip>:<port>/pair`): the fields are+/// what matter, and the host is only where a phone's camera sends the link.+///+/// A link, so the Camera app lands somewhere sensible: `/pair` on the website says to scan it from+/// the Harness app (`/connect` there is an older, unrelated page). **Everything is in the+/// fragment**, which a browser never sends to the server: the pairing code is the out-of-band+/// secret end-to-end encryption rests on, and it must not reach our backend even when the link is+/// opened in Safari. `m`, `c` and `h` are optional: a QR with only `e`+/// still signs the phone in to the right account, by an emailed code.+class ConnectCode {+ const ConnectCode({+ required this.email,+ this.machineId,+ this.pairCode,+ this.signIn,+ this.fingerprint,+ this.hostname,+ this.signInRequest,+ this.viewer = false,+ });++ final String email;+ final String? machineId;++ /// The one-time code the computer's daemon pairs with (its live-code CPace pairing), so no remote+ /// password is typed. Held until the phone is signed in.+ final String? pairCode;++ /// The one-time code that signs the phone in with no emailed code — minted+ /// for this QR by the computer's own sign-in, good for about a minute, and+ /// spent by the first phone to redeem it (`AppNotifier.signInWithScan`).+ final String? signIn;++ /// The machine's identity fingerprint as the QR spells it (separators dropped), or null from an+ /// older desktop. When present, the pairing refuses a machine that proves a different key.+ final String? fingerprint;++ /// The machine's hostname, for display only — the account's machine list is what names it.+ final String? hostname;++ /// `s`: the sign-in request of a machine that is not signed in yet (`/api/device-auth`). Approving+ /// it signs that machine in to this phone's account; its machine id comes back from the approval.+ final String? signInRequest;++ /// A machine asking to be signed in, rather than one already on the account.+ bool get isSignIn => signInRequest != null;++ /// `k=v`: the sign-in request is a browser's, not a machine's — see the class comment.+ final bool viewer;++ /// A browser asking to be signed in.+ bool get isViewerSignIn => isSignIn && viewer;++ static const host = 'harness.autonomous.ai';+ static const path = '/pair';++ /// The code a scanned string holds, or null when it is not one of ours.+ static ConnectCode? parse(String raw) {+ final uri = Uri.tryParse(raw.trim());+ if (uri == null ||+ (uri.scheme != 'https' && uri.scheme != 'http') ||+ uri.host.isEmpty ||+ uri.path != path) {+ return null;+ }+ final Map<String, String> fields;+ try {+ fields = Uri.splitQueryString(uri.fragment);+ } on FormatException {+ return null;+ }+ String? present(String key) {+ final value = fields[key]?.trim();+ return value == null || value.isEmpty ? null : value;+ }++ final email = fields['e']?.trim() ?? '';+ // An account to sign in to, a machine to pair with, or a machine asking to be signed in.+ final pairs = present('m') != null && present('c') != null;+ if (!email.contains('@') && !pairs && present('s') == null) return null;++ return ConnectCode(+ email: email,+ machineId: present('m'),+ pairCode: present('c'),+ signIn: present('h'),+ fingerprint: present('f'),+ hostname: present('n'),+ signInRequest: present('s'),+ viewer: present('k') == 'v',+ );+ }++ /// The link for [email] — what the desktop app encodes, and what tests scan.+ /// The sign-in QR's link (`harness login`) — what tests scan.+ ///+ /// [viewer] marks a browser's (`k=v`); [base] is where the link lands — a local or LAN build+ /// passes its own origin, so a phone's camera opens the build that can approve it.+ static String signInLink(+ String signInRequest, {+ required String pairCode,+ String? fingerprint,+ String? hostname,+ bool viewer = false,+ Uri? base,+ }) => Uri(+ scheme: base?.scheme ?? 'https',+ host: base?.host ?? host,+ port: base != null && base.hasPort ? base.port : null,+ path: path,+ fragment: [+ 's=${Uri.encodeQueryComponent(signInRequest)}',+ 'c=${Uri.encodeQueryComponent(pairCode)}',+ if (fingerprint != null) 'f=${Uri.encodeQueryComponent(fingerprint)}',+ if (hostname != null) 'n=${Uri.encodeQueryComponent(hostname)}',+ if (viewer) 'k=v',+ ].join('&'),+ ).toString();++ static String link(+ String email, {+ String? machineId,+ String? pairCode,+ String? signIn,+ String? fingerprint,+ String? hostname,+ }) => Uri(+ scheme: 'https',+ host: host,+ path: path,+ fragment: [+ 'e=${Uri.encodeQueryComponent(email)}',+ if (machineId != null) 'm=${Uri.encodeQueryComponent(machineId)}',+ if (pairCode != null) 'c=${Uri.encodeQueryComponent(pairCode)}',+ if (signIn != null) 'h=${Uri.encodeQueryComponent(signIn)}',+ if (fingerprint != null) 'f=${Uri.encodeQueryComponent(fingerprint)}',+ if (hostname != null) 'n=${Uri.encodeQueryComponent(hostname)}',+ ].join('&'),+ ).toString();+}diff --git a/desktop/lib/viewer/direct_auth_api.dart b/desktop/lib/viewer/direct_auth_api.dartindex e969f4fba..dfbd08af4 100644--- a/desktop/lib/viewer/direct_auth_api.dart+++ b/desktop/lib/viewer/direct_auth_api.dart@@ -117,6 +117,93 @@ class DirectAuthApi {return (authorizeUrl: url, tx: tx);}+ /// A one-time code a signed-in machine put in its QR (`h`) — `harness link qr` or Add Phone — traded+ /// for a session of this browser's own: scan to sign in, no SSO page. [label] is what this browser+ /// calls itself in the account's list of devices. A spent or expired code is the backend's 401.+ Future<IssuedTokens> redeemHandoff(+ String code, {+ required String label,+ }) async {+ final Response<dynamic> res;+ try {+ res = await _dio.post(+ '/api/auth/handoff/redeem',+ data: {'code': code, 'label': label},+ );+ } on DioException {+ throw const DirectAuthException(+ 'Could not reach Harness. Check your connection and scan again.',+ );+ }+ final body = res.data is Map ? res.data as Map : const {};+ final tokens = body['success'] == true+ ? IssuedTokens.fromData(body['data'])+ : null;+ if (tokens != null) return tokens;+ throw const DirectAuthException('That code didn’t work. Scan the new one.');+ }++ /// This browser asks to be signed in by a phone (`POST /api/device-auth/start`, kind `viewer`):+ /// [label] and [fingerprint] are what the phone's confirm screen shows. The user code goes in the+ /// QR; the device code is this browser's alone, for [pollSignInRequest].+ Future<SignInRequest> startSignInRequest({+ required String label,+ required String fingerprint,+ required String pub,+ }) async {+ final data = unwrapApiResponse(+ await _dio.post(+ '/api/device-auth/start',+ data: {+ 'kind': 'viewer',+ 'label': label,+ 'fingerprint': fingerprint,+ 'pub': pub,+ },+ ),+ );+ final user = data is Map ? data['userCode'] : null;+ final device = data is Map ? data['deviceCode'] : null;+ final expires = data is Map ? data['expiresIn'] : null;+ if (user is! String || device is! String) {+ throw const DirectAuthException('Could not start a sign-in. Try again.');+ }+ return SignInRequest(+ userCode: user,+ deviceCode: device,+ expiresIn: Duration(+ seconds: expires is int && expires > 0 ? expires : 180,+ ),+ );+ }++ /// Where [deviceCode]'s request stands. Approved hands the session over — once.+ Future<SignInRequestAnswer> pollSignInRequest(String deviceCode) async {+ final data = unwrapApiResponse(+ await _dio.post(+ '/api/device-auth/poll',+ data: {'deviceCode': deviceCode},+ ),+ );+ final status = data is Map ? data['status'] : null;+ switch (status) {+ case 'pending':+ return const SignInRequestAnswer.pending();+ case 'denied':+ return const SignInRequestAnswer.denied();+ case 'approved':+ final tokens = IssuedTokens.fromData(data);+ if (tokens == null) return const SignInRequestAnswer.expired();+ final roster = (data as Map)['sealedRoster'];+ return SignInRequestAnswer.approved(+ tokens,+ sealedRoster: roster is String && roster.isNotEmpty ? roster : null,+ );+ default:+ return const SignInRequestAnswer.expired();+ }+ }+Future<IssuedTokens> exchange({required String code,required String state,@@ -163,3 +250,43 @@ class DirectAuthApi {return tokens ?? (throw const DirectAuthException(_unavailable));}}++/// A browser's sign-in request, as started — see [DirectAuthApi.startSignInRequest].+class SignInRequest {+ const SignInRequest({+ required this.userCode,+ required this.deviceCode,+ required this.expiresIn,+ });++ final String userCode;+ final String deviceCode;+ final Duration expiresIn;+}++enum SignInRequestStatus { pending, approved, denied, expired }++/// One poll's answer. Approved carries the session and the approving phone's trust-group roster,+/// sealed under the QR's pairing code (`viewer/group_sync.dart` `openHandedRoster`).+class SignInRequestAnswer {+ const SignInRequestAnswer.pending()+ : status = SignInRequestStatus.pending,+ tokens = null,+ sealedRoster = null;+ const SignInRequestAnswer.denied()+ : status = SignInRequestStatus.denied,+ tokens = null,+ sealedRoster = null;+ const SignInRequestAnswer.expired()+ : status = SignInRequestStatus.expired,+ tokens = null,+ sealedRoster = null;+ const SignInRequestAnswer.approved(+ IssuedTokens this.tokens, {+ this.sealedRoster,+ }) : status = SignInRequestStatus.approved;++ final SignInRequestStatus status;+ final IssuedTokens? tokens;+ final String? sealedRoster;+}diff --git a/desktop/lib/viewer/direct_link.dart b/desktop/lib/viewer/direct_link.dartindex 977d1c1b0..42dac1176 100644--- a/desktop/lib/viewer/direct_link.dart+++ b/desktop/lib/viewer/direct_link.dart@@ -5,6 +5,7 @@ import '../core/config.dart';import '../e2ee/keys.dart';import 'direct_auth.dart';import 'direct_auth_api.dart';+import 'code_link.dart';import 'group_sync.dart';import 'password_link.dart';import 'viewer_key_store.dart';@@ -65,6 +66,78 @@ class DirectLink implements PeerLinkClient {}}+ /// The QR's one-time code in place of the password (`harness link qr`, or Add Phone): the+ /// same pin, from [linkWithCode], refused when the machine's key is not the fingerprint the QR+ /// named. Answers with a result, never an exception.+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async {+ final String token;+ try {+ token = await auth.accessToken();+ } on DirectAuthException catch (error) {+ return CliLinkConnectResult(error: error.message);+ } catch (_) {+ return const CliLinkConnectResult(error: 'Not signed in.');+ }+ final PasswordLinkResult result;+ try {+ result = await linkWithCode(+ machineId: machineId,+ code: code,+ label: label,+ identity: await keys.identity(),+ accessToken: token,+ wsBaseUrl: config.wsBaseUrl,+ autonomousEnv: config.autonomousEnv,+ socket: socket,+ );+ } catch (_) {+ return const CliLinkConnectResult(+ error: 'This browser couldn’t read its own keys. Try again.',+ );+ }+ final name = displayName == null || displayName.isEmpty+ ? 'the machine'+ : displayName;+ switch (result) {+ case PasswordLinked(:final peerPub, :final fingerprint):+ if (expectedFingerprint != null &&+ !sameFingerprint(fingerprint, expectedFingerprint)) {+ return const CliLinkConnectResult(+ error: 'That machine’s fingerprint doesn’t match its code. Nothing was linked.',+ );+ }+ try {+ await keys.pin(machineId, peerPub);+ } catch (_) {+ return const CliLinkConnectResult(+ error: 'Linked, but this browser couldn’t save it. Try again.',+ );+ }+ return CliLinkConnectResult(+ linkedMachineId: machineId,+ fingerprint: fingerprint,+ );+ case PasswordLinkFailed(:final code):+ return CliLinkConnectResult(+ error: switch (code) {+ 'CODE_MISMATCH' =>+ 'That code didn’t match. Scan the new one on $name.',+ 'TIMEOUT' => 'Keep the QR open on $name, then scan again.',+ 'PAIRING_BUSY' =>+ '$name is pairing with something else. Try again.',+ _ => 'Couldn’t connect to $name ($code).',+ },+ );+ }+ }+/// Swaps trust-group rosters with [machineId] ([syncTrustGroup]): the machines this device learns/// of are pinned — no password for them — and the machine learns this device and whatever it/// linked. [label] is this device's name for itself. Never throws.@@ -111,3 +184,10 @@ String _asCliPrints(DateTime at) {String two(int n) => n.toString().padLeft(2, '0');return '${at.year}-${two(at.month)}-${two(at.day)} ${two(at.hour)}:${two(at.minute)}';}++/// Two fingerprints as the same key, however they are written (`5F80·61C4…`, `5f8061c4…`).+bool sameFingerprint(String a, String b) {+ String norm(String v) => v.toUpperCase().replaceAll(RegExp('[^0-9A-Z]'), '');+ final x = norm(a), y = norm(b);+ return x.isNotEmpty && x == y;+}diff --git a/desktop/lib/viewer/direct_login_native.dart b/desktop/lib/viewer/direct_login_native.dartindex 3ccb8d207..fe7ffd79f 100644--- a/desktop/lib/viewer/direct_login_native.dart+++ b/desktop/lib/viewer/direct_login_native.dart@@ -5,6 +5,7 @@ import '../auth/cli_login.dart';import '../auth/sign_in_client.dart';import 'direct_auth.dart';import 'direct_auth_api.dart';+import 'viewer_key_store.dart';/// Signing in with no harness CLI — cli.ts `loginCommand`, run by the app: a loopback listener for/// the SSO redirect, `authorize-native` for the page to show, `exchange` for the tokens.@@ -12,7 +13,7 @@ import 'direct_auth_api.dart';/// It deliberately skips the CLI's closing `resolve-computer`, which registers the computer as a/// Harness machine. A viewer is not one.class DirectLogin implements SignInClient {- DirectLogin({required this.auth});+ DirectLogin({required this.auth, ViewerKeyStore? keys});final DirectAuth auth;_LoopbackCallback? _pending;@@ -27,6 +28,7 @@ class DirectLogin implements SignInClient {@overrideFuture<void> login({required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,}) async {cancel();final revision = _loginRevision;diff --git a/desktop/lib/viewer/direct_login_web.dart b/desktop/lib/viewer/direct_login_web.dartindex 750d30738..9163a2531 100644--- a/desktop/lib/viewer/direct_login_web.dart+++ b/desktop/lib/viewer/direct_login_web.dart@@ -3,7 +3,8 @@ import 'package:web/web.dart' as web;import 'browser_login.dart';class DirectLogin extends BrowserLogin {- DirectLogin({required super.auth}) : super(browser: _WebLoginBrowser());+ DirectLogin({required super.auth, super.keys})+ : super(browser: _WebLoginBrowser());}class _WebLoginBrowser implements LoginBrowser {diff --git a/desktop/lib/viewer/group_sync.dart b/desktop/lib/viewer/group_sync.dartindex 3c61bca06..9f70bfb5e 100644--- a/desktop/lib/viewer/group_sync.dart+++ b/desktop/lib/viewer/group_sync.dart@@ -1,10 +1,12 @@import 'dart:async';import 'dart:convert';+import 'dart:typed_data';import 'package:web_socket_channel/web_socket_channel.dart';import '../e2ee/bytes.dart';import '../e2ee/envelope.dart';+import '../e2ee/primitives.dart';import '../e2ee/relay_session_crypto.dart';import 'password_link.dart' show RelaySocketFactory, defaultRelaySocket;import 'viewer_key_store.dart';@@ -257,12 +259,16 @@ Future<GroupSyncOutcome> syncTrustGroup({theirs.pub == b64e(pin.pub))theirs,];- final merged = mergeGroupRoster(- local,- GroupRoster(members, incoming.removed),- selfPub,- );- await keys.writeGroupRoster(merged.roster.toJson());+ // Merged into the roster as it is NOW, not as it was sent: something may have joined it while+ // this swap was on the network (a device this one just approved), and must not be written over.+ final merged = await keys.updateGroupRoster((current) async {+ final m = mergeGroupRoster(+ await _seededFrom(keys, current, selfPub),+ GroupRoster(members, incoming.removed),+ selfPub,+ );+ return (m.roster.toJson(), m);+ });return await _apply(keys, merged);} catch (_) {return GroupSyncOutcome.none;@@ -273,8 +279,16 @@ Future<GroupSyncOutcome> syncTrustGroup({/// This phone's roster, with every machine it has pinned folded in — how a machine this phone linked/// by password reaches the rest of the group, and how links made before the group existed join it.-Future<GroupRoster> _seeded(ViewerKeyStore keys, String selfPub) async {- final stored = GroupRoster.parse(await keys.groupRoster());+Future<GroupRoster> _seeded(ViewerKeyStore keys, String selfPub) async =>+ _seededFrom(keys, await keys.groupRoster(), selfPub);++/// [_seeded], from a stored roster already read ([raw]).+Future<GroupRoster> _seededFrom(+ ViewerKeyStore keys,+ Object? raw,+ String selfPub,+) async {+ final stored = GroupRoster.parse(raw);// Only pins the roster does not name yet: a pin's `linkedAt` is when THIS device pinned it (the// group's own pins included), and folding that in again would restamp the member as new on every// swap and push the change around the whole group.@@ -381,3 +395,100 @@ String? _cleanLabel(Object? v) {if (label.isEmpty) return null;return label.length > 60 ? label.substring(0, 60) : label;}++// ── Handing the group to a browser that signs in by phone ────────────────────────────────────────+//+// A web desktop's sign-in QR carries a one-time pairing code that reaches only the approving phone+// (by camera). The phone takes the browser into its roster — the machines hear of it on the phone's+// next sync, which it runs at once — and hands the browser that roster sealed under the code, through+// the backend's sign-in request. The backend carries it but can neither read nor alter it; the browser+// opens it, pins every machine, and is in the group without ever dialling one first.++/// The roster this device hands a browser it approved: everything it knows, and itself.+Future<GroupRoster> handoffRoster(+ ViewerKeyStore keys, {+ required String selfLabel,+}) async {+ final selfPub = b64e((await keys.identity()).pub);+ final seeded = await _seeded(keys, selfPub);+ final me = GroupMember(+ pub: selfPub,+ kind: 'viewer',+ label: selfLabel,+ at: DateTime.now().millisecondsSinceEpoch,+ );+ return GroupRoster([me, ...seeded.members], seeded.removed);+}++/// Takes [member] — the browser this device just approved — into its roster; the next sync spreads it.+Future<void> admitGroupMember(ViewerKeyStore keys, GroupMember member) async {+ final selfPub = b64e((await keys.identity()).pub);+ await keys.updateGroupRoster((current) async {+ final merged = mergeGroupRoster(+ await _seededFrom(keys, current, selfPub),+ GroupRoster([member], const []),+ selfPub,+ );+ return (merged.roster.toJson(), null);+ });+}++/// A browser: the roster its approving phone handed it, merged in with every machine pinned.+Future<GroupSyncOutcome> adoptHandedRoster(+ ViewerKeyStore keys,+ Object? raw,+) async {+ final selfPub = b64e((await keys.identity()).pub);+ final merged = await keys.updateGroupRoster((current) async {+ final m = mergeGroupRoster(+ await _seededFrom(keys, current, selfPub),+ GroupRoster.parse(raw),+ selfPub,+ );+ return (m.roster.toJson(), m);+ });+ return _apply(keys, merged);+}++/// The key a handed roster is sealed under: the QR's pairing [code], bound to the sign-in request it+/// answers ([userCode]) so a sealed roster cannot be replayed into another one.+Uint8List _handoffKey(String code, String userCode) => hkdfSha256(+ utf8Bytes(code.trim().toUpperCase()),+ salt: utf8Bytes('harness/signin-roster/v1'),+ info: utf8Bytes(userCode),+ length: 32,+);++final Uint8List _handoffAad = utf8Bytes('harness signin roster');++String sealHandedRoster(+ GroupRoster roster, {+ required String code,+ required String userCode,+}) => b64e(+ aeadSeal(+ _handoffKey(code, userCode),+ 1,+ _handoffAad,+ utf8Bytes(jsonEncode(roster.toJson())),+ ),+);++/// Null when it does not open — a different code or request, or a byte changed on the way.+Object? openHandedRoster(+ String sealed, {+ required String code,+ required String userCode,+}) {+ try {+ final clear = aeadOpen(+ _handoffKey(code, userCode),+ 1,+ _handoffAad,+ b64d(sealed),+ );+ return clear == null ? null : jsonDecode(utf8.decode(clear));+ } on FormatException {+ return null;+ }+}diff --git a/desktop/lib/viewer/pending_pair.dart b/desktop/lib/viewer/pending_pair.dartnew file mode 100644index 000000000..299df6ff4--- /dev/null+++ b/desktop/lib/viewer/pending_pair.dart@@ -0,0 +1,64 @@+import 'dart:convert';++import 'connect_code.dart';++/// A machine's QR opened by the phone's own camera: `https://harness.autonomous.ai/pair#…` lands in+/// the browser, which is this web app. The code is held — in the tab's sessionStorage, see+/// `pending_pair_store.dart` — across the SSO round trip, which comes back to `/` and would lose the+/// fragment, and it is taken out of the address bar at once so it is not left in history.+///+/// Pure: parsing, expiry and (de)serialising. Where it is kept is the store's business.+class PendingPair {+ const PendingPair(this.code, this.capturedAt, [this.link]);++ final ConnectCode code;+ final DateTime capturedAt;++ /// How long a scanned code is worth holding. The machine keeps its QR up and redraws a fresh one+ /// every few minutes, and a phone's intent lasts a minute once sent; a code older than this is a+ /// stale photo, and "scan it again" is the honest answer.+ static const ttl = Duration(minutes: 3);++ bool isExpired(DateTime now) => now.difference(capturedAt) >= ttl;++ /// The pair a page URL carries, or null. Any host: staging and local builds serve the same app, so+ /// the path and fragment are what matter, and the fragment is parsed as the canonical link.+ static PendingPair? fromUri(Uri base, DateTime now) {+ if (base.path != ConnectCode.path || base.fragment.isEmpty) return null;+ final canonical = Uri(+ scheme: 'https',+ host: ConnectCode.host,+ path: ConnectCode.path,+ fragment: base.fragment,+ ).toString();+ final code = ConnectCode.parse(canonical);+ // Something to link: a machine and its pairing code, or a machine asking to be signed in.+ if (code == null ||+ code.pairCode == null ||+ (code.machineId == null && !code.isSignIn)) {+ return null;+ }+ return PendingPair(code, now, canonical);+ }++ /// The link as read, so every field it carried (`s`, `h`, …) survives the round trip.+ final String? link;++ String encode() =>+ jsonEncode({'link': link, 'at': capturedAt.millisecondsSinceEpoch});++ static PendingPair? decode(String? raw) {+ if (raw == null) return null;+ try {+ final json = jsonDecode(raw);+ if (json is! Map) return null;+ final link = json['link'], at = json['at'];+ if (link is! String || at is! int) return null;+ final code = ConnectCode.parse(link);+ if (code == null) return null;+ return PendingPair(code, DateTime.fromMillisecondsSinceEpoch(at), link);+ } on FormatException {+ return null;+ }+ }+}diff --git a/desktop/lib/viewer/pending_pair_store.dart b/desktop/lib/viewer/pending_pair_store.dartnew file mode 100644index 000000000..e8504115e--- /dev/null+++ b/desktop/lib/viewer/pending_pair_store.dart@@ -0,0 +1,2 @@+export 'pending_pair_store_native.dart'+ if (dart.library.js_interop) 'pending_pair_store_web.dart';diff --git a/desktop/lib/viewer/pending_pair_store_native.dart b/desktop/lib/viewer/pending_pair_store_native.dartnew file mode 100644index 000000000..25ce03059--- /dev/null+++ b/desktop/lib/viewer/pending_pair_store_native.dart@@ -0,0 +1,10 @@+import 'pending_pair.dart';++/// Native builds never open a `/pair` link: the phone app scans with its own camera, and a desktop+/// shows the QR rather than reading one.+class PendingPairStore {+ const PendingPairStore();++ PendingPair? capture(DateTime now) => null;+ void clear() {}+}diff --git a/desktop/lib/viewer/pending_pair_store_web.dart b/desktop/lib/viewer/pending_pair_store_web.dartnew file mode 100644index 000000000..d11b5ae08--- /dev/null+++ b/desktop/lib/viewer/pending_pair_store_web.dart@@ -0,0 +1,48 @@+import 'package:web/web.dart' as web;++import 'pending_pair.dart';++/// The tab's pending machine code: taken from a `/pair#…` URL once, kept in sessionStorage so it+/// survives the SSO redirect (which returns to `/`), and dropped once consumed or stale.+class PendingPairStore {+ const PendingPairStore();++ static const _key = 'harness.pendingPair';++ /// The code this tab is holding: from the URL when it is a `/pair` link (which is then stripped+ /// from the address bar and history), else from before the sign-in redirect. Null when there is+ /// none; an expired one is still returned, so the page can say "scan it again".+ PendingPair? capture(DateTime now) {+ final fromUrl = PendingPair.fromUri(Uri.base, now);+ if (fromUrl != null) {+ _write(fromUrl.encode());+ try {+ web.window.history.replaceState(null, '', '/');+ } catch (_) {}+ return fromUrl;+ }+ return PendingPair.decode(_read());+ }++ void clear() {+ try {+ web.window.sessionStorage.removeItem(_key);+ } catch (_) {}+ }++ // Private mode may refuse storage: the code is then held for this page load only, and a sign-in+ // redirect loses it (the page says to scan again after signing in).+ String? _read() {+ try {+ return web.window.sessionStorage.getItem(_key);+ } catch (_) {+ return null;+ }+ }++ void _write(String value) {+ try {+ web.window.sessionStorage.setItem(_key, value);+ } catch (_) {}+ }+}diff --git a/desktop/lib/viewer/qr_scanner.dart b/desktop/lib/viewer/qr_scanner.dartnew file mode 100644index 000000000..1a983dcd3--- /dev/null+++ b/desktop/lib/viewer/qr_scanner.dart@@ -0,0 +1,2 @@+export 'qr_scanner_native.dart'+ if (dart.library.js_interop) 'qr_scanner_web.dart';diff --git a/desktop/lib/viewer/qr_scanner_native.dart b/desktop/lib/viewer/qr_scanner_native.dartnew file mode 100644index 000000000..fb75e8e95--- /dev/null+++ b/desktop/lib/viewer/qr_scanner_native.dart@@ -0,0 +1,9 @@+import 'package:flutter/widgets.dart';++/// Only the web build scans (a phone's browser camera). Native builds show a QR; they never read one.+bool get qrScanSupported => false;++Future<String?> scanQrCode(+ BuildContext context, {+ bool Function(String)? accept,+}) async => null;diff --git a/desktop/lib/viewer/qr_scanner_web.dart b/desktop/lib/viewer/qr_scanner_web.dartnew file mode 100644index 000000000..868ebdd5e--- /dev/null+++ b/desktop/lib/viewer/qr_scanner_web.dart@@ -0,0 +1,260 @@+import 'dart:async';+import 'dart:js_interop';+import 'dart:js_interop_unsafe';++import 'package:flutter/material.dart';+import 'package:web/web.dart' as web;++import '../shared/widgets/app_dialog.dart';+import '../widgets/box_chrome.dart';+import '../widgets/terminal_text_action.dart';++/// The in-app "Scan its code" on the web: the phone's camera in a dialog, read with the browser's+/// own `BarcodeDetector`, or with jsQR (vendored, `web/vendor/jsQR.js`) where there is none — iOS+/// Safari. Resolves with the first code [accept] takes, or null if closed.+bool get qrScanSupported =>+ web.window.navigator.mediaDevices.isDefinedAndNotNull;++Future<String?> scanQrCode(+ BuildContext context, {+ bool Function(String)? accept,+}) => showAppDialog<String>(+ context: context,+ builder: (context) => Dialog(+ backgroundColor: Colors.transparent,+ elevation: 0,+ insetPadding: const EdgeInsets.all(16),+ child: _Scanner(+ accept: accept ?? (_) => true,+ onFound: (code) => Navigator.of(context).pop(code),+ onClose: () => Navigator.of(context).pop(),+ ),+ ),+);++@JS('BarcodeDetector')+extension type _BarcodeDetector._(JSObject _) implements JSObject {+ external factory _BarcodeDetector(JSObject options);+ external JSPromise<JSArray<_Detected>> detect(JSObject source);+}++extension type _Detected._(JSObject _) implements JSObject {+ external String get rawValue;+}++@JS('jsQR')+external _JsQrResult? _jsQR(JSUint8ClampedArray data, int width, int height);++extension type _JsQrResult._(JSObject _) implements JSObject {+ external String get data;+}++class _Scanner extends StatefulWidget {+ const _Scanner({+ required this.accept,+ required this.onFound,+ required this.onClose,+ });++ final bool Function(String) accept;+ final void Function(String) onFound;+ final VoidCallback onClose;++ @override+ State<_Scanner> createState() => _ScannerState();+}++class _ScannerState extends State<_Scanner> {+ web.HTMLVideoElement? _video;+ web.MediaStream? _stream;+ Timer? _tick;+ bool _busy = false;+ bool _done = false;+ String? _problem;+ _BarcodeDetector? _detector;+ final _canvas = web.HTMLCanvasElement();++ @override+ void initState() {+ super.initState();+ unawaited(_start());+ }++ Future<void> _start() async {+ try {+ if (web.window.has('BarcodeDetector')) {+ _detector = _BarcodeDetector(+ {+ 'formats': ['qr_code'].jsify(),+ }.jsify()+ as JSObject,+ );+ } else {+ await _loadJsQr();+ }+ final constraints =+ {+ 'video': {'facingMode': 'environment'},+ 'audio': false,+ }.jsify()+ as web.MediaStreamConstraints;+ final stream = await web.window.navigator.mediaDevices+ .getUserMedia(constraints)+ .toDart;+ if (!mounted) {+ _stop(stream);+ return;+ }+ _stream = stream;+ final video = _video;+ if (video != null) _attach(video);+ _tick = Timer.periodic(+ const Duration(milliseconds: 250),+ (_) => unawaited(_scan()),+ );+ } catch (_) {+ if (mounted) {+ setState(+ () => _problem =+ 'This browser can’t open the camera. Allow camera access, or scan the QR with the '+ 'phone’s camera app instead.',+ );+ }+ }+ }++ static Future<void>? _jsQrLoading;+ Future<void> _loadJsQr() => _jsQrLoading ??= () {+ final done = Completer<void>();+ final script = web.HTMLScriptElement()+ ..src = 'vendor/jsQR.js'+ ..async = true;+ script.onload = ((web.Event _) => done.complete()).toJS;+ script.onerror = ((web.Event _) => done.completeError(+ StateError('jsQR'),+ )).toJS;+ web.document.head!.append(script);+ return done.future;+ }();++ void _attach(web.HTMLVideoElement video) {+ final stream = _stream;+ if (stream == null) return;+ video+ ..srcObject = stream+ ..muted = true+ ..autoplay = true+ ..setAttribute('playsinline', 'true');+ unawaited(video.play().toDart.catchError((_) => null));+ }++ Future<void> _scan() async {+ final video = _video;+ if (_busy || _done || video == null || video.readyState < 2) return;+ _busy = true;+ try {+ String? found;+ final detector = _detector;+ if (detector != null) {+ final hits = (await detector.detect(video).toDart).toDart;+ for (final hit in hits) {+ if (widget.accept(hit.rawValue)) found = hit.rawValue;+ }+ } else {+ final w = video.videoWidth, h = video.videoHeight;+ if (w > 0 && h > 0) {+ _canvas+ ..width = w+ ..height = h;+ final ctx = _canvas.getContext('2d') as web.CanvasRenderingContext2D;+ ctx.drawImage(video, 0, 0);+ final pixels = ctx.getImageData(0, 0, w, h).data;+ final hit = _jsQR(pixels, w, h);+ if (hit != null && widget.accept(hit.data)) found = hit.data;+ }+ }+ if (found != null && !_done) {+ _done = true;+ widget.onFound(found);+ }+ } catch (_) {+ // One unreadable frame; the next one is 250 ms away.+ } finally {+ _busy = false;+ }+ }++ void _stop(web.MediaStream? stream) {+ final tracks = stream?.getTracks().toDart ?? const [];+ for (final track in tracks) {+ track.stop();+ }+ }++ @override+ void dispose() {+ _tick?.cancel();+ _stop(_stream);+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => SizedBox(+ width: 420,+ child: TerminalBox(+ child: Padding(+ padding: const EdgeInsets.all(12),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ 'Scan the machine’s code',+ style: boxMonoStyle(color: kBoxFaint),+ ),+ const SizedBox(height: 10),+ AspectRatio(+ aspectRatio: 1,+ child: _problem != null+ ? Center(+ child: Text(+ _problem!,+ textAlign: TextAlign.center,+ style: boxMonoStyle(color: Colors.white70),+ ),+ )+ : ClipRRect(+ borderRadius: BorderRadius.circular(8),+ child: HtmlElementView.fromTagName(+ tagName: 'video',+ onElementCreated: (element) {+ final video = element as web.HTMLVideoElement;+ video.style+ ..width = '100%'+ ..height = '100%'+ ..objectFit = 'cover';+ _video = video;+ _attach(video);+ },+ ),+ ),+ ),+ const SizedBox(height: 10),+ Text(+ 'On the machine: harness link qr, or Add Phone in the desktop app.',+ style: boxMonoStyle(color: kBoxFaint),+ ),+ const SizedBox(height: 10),+ Align(+ alignment: Alignment.centerRight,+ child: TerminalTextAction(+ label: 'Cancel',+ onPressed: widget.onClose,+ ),+ ),+ ],+ ),+ ),+ ),+ );+}diff --git a/desktop/lib/viewer/qr_sign_in.dart b/desktop/lib/viewer/qr_sign_in.dartnew file mode 100644index 000000000..354ef18e2--- /dev/null+++ b/desktop/lib/viewer/qr_sign_in.dart@@ -0,0 +1,130 @@+import 'dart:async';++import '../auth/cli_login.dart' show SignInQr;+import '../e2ee/pair_code.dart';+import 'connect_code.dart';+import 'direct_auth_api.dart';++/// What a browser's sign-in by phone came to: the session, and the approving phone's trust group,+/// sealed under the pairing code that was in the QR — which never left this browser except by the+/// phone's camera, so only this browser opens it.+class QrSignInResult {+ const QrSignInResult({+ required this.tokens,+ required this.code,+ required this.userCode,+ this.sealedRoster,+ });++ final IssuedTokens tokens;+ final String code;+ final String userCode;+ final String? sealedRoster;+}++/// A web desktop's sign-in by phone — the browser's counterpart of `harness login --qr`:+///+/// 1. ask the backend for a sign-in request (`kind: viewer`, this browser's name and E2EE+/// fingerprint), and mint the one-time pairing code;+/// 2. show both in a QR (`…/pair#s=…&c=…&f=…&n=…&k=v`), redrawn with a fresh request before the+/// old one expires;+/// 3. poll until a phone approves it (or says "Not me").+///+/// Signing in is the caller's; joining the phone's group after it is `AppNotifier`'s.+class WebQrSignIn {+ WebQrSignIn({+ required this.api,+ required this.fingerprint,+ required this.pub,+ required this.label,+ this.linkBase,+ String Function()? mintCode,+ Future<void> Function(Duration)? sleep,+ }) : _mint = mintCode ?? newPhonePairCode,+ _sleep = sleep ?? ((d) => Future<void>.delayed(d));++ final DirectAuthApi api;++ /// This browser's E2EE identity fingerprint, as `fingerprint()` spells it.+ final String fingerprint;++ /// The same key, whole (base64): the phone checks it against the QR's fingerprint and takes it+ /// into its trust group.+ final String pub;+ final String label;++ /// Where the QR's link lands: this build's own origin, so a phone's camera opens a build that+ /// can approve it. Null: the production site.+ final Uri? linkBase;+ final String Function() _mint;+ final Future<void> Function(Duration) _sleep;++ static const poll = Duration(seconds: 2);++ /// A QR is replaced this long before its request would expire, so a phone never reads a dead one.+ static const _margin = Duration(seconds: 10);++ Future<QrSignInResult> run({+ required void Function(SignInQr qr) onQr,+ required bool Function() current,+ }) async {+ final plain = fingerprint.toUpperCase().replaceAll(RegExp('[^0-9A-Z]'), '');+ while (true) {+ if (!current()) throw _cancelled;+ final code = _mint();+ final request = await api.startSignInRequest(+ label: label,+ fingerprint: plain,+ pub: pub,+ );+ if (!current()) throw _cancelled;+ onQr(+ SignInQr(+ url: ConnectCode.signInLink(+ request.userCode,+ pairCode: code,+ fingerprint: plain,+ hostname: label,+ viewer: true,+ base: linkBase,+ ),+ fingerprint: fingerprint,+ expiresAt: DateTime.now().add(request.expiresIn),+ ),+ );+ final life = request.expiresIn - _margin;+ var waited = Duration.zero;+ while (waited < life) {+ await _sleep(poll);+ waited += poll;+ if (!current()) throw _cancelled;+ SignInRequestAnswer answer;+ try {+ answer = await api.pollSignInRequest(request.deviceCode);+ } catch (_) {+ continue; // A blip: the request is still alive, ask again.+ }+ if (!current()) throw _cancelled;+ switch (answer.status) {+ case SignInRequestStatus.pending:+ continue;+ case SignInRequestStatus.denied:+ throw const DirectAuthException(+ 'Declined on your phone. Refresh to show a new code.',+ );+ case SignInRequestStatus.expired:+ waited = life; // A fresh request, and a fresh QR.+ case SignInRequestStatus.approved:+ return QrSignInResult(+ tokens: answer.tokens!,+ code: code,+ userCode: request.userCode,+ sealedRoster: answer.sealedRoster,+ );+ }+ }+ }+ }++ static const _cancelled = DirectAuthException('Sign-in was cancelled.');+}diff --git a/desktop/lib/viewer/viewer_key_store.dart b/desktop/lib/viewer/viewer_key_store.dartindex 1487fbc3c..378e2b11d 100644--- a/desktop/lib/viewer/viewer_key_store.dart+++ b/desktop/lib/viewer/viewer_key_store.dart@@ -136,9 +136,31 @@ class ViewerKeyStore {}}- Future<void> writeGroupRoster(Map<String, Object> roster) =>+ /// Only through [updateGroupRoster]: a write that skipped its queue could undo one in flight.+ Future<void> _writeGroupRoster(Map<String, Object> roster) =>_storage.write(_groupKey, jsonEncode(roster));+ /// Reads, changes and writes the stored roster as one step. Two changes that overlap — a roster+ /// swap still waiting on the network, and a member taken in meanwhile — must not lose either:+ /// whichever runs second starts from what the first wrote.+ Future<T> updateGroupRoster<T>(+ Future<(Map<String, Object>, T)> Function(Object? current) change,+ ) {+ // In order within this runtime, and under the store's own lock across runtimes (browser tabs).+ final run = _groupChanges.then(+ (_) => _storage.synchronized('viewer_group', () async {+ final (next, out) = await change(await groupRoster());+ await _writeGroupRoster(next);+ return out;+ }),+ );+ // The queue survives a failed change: the next one still runs.+ _groupChanges = run.then<void>((_) {}, onError: (Object _) {});+ return run;+ }++ Future<void> _groupChanges = Future<void>.value();+Future<void> _write(List<MachinePeer> peers) => _storage.write(_peersKey,jsonEncode([for (final peer in peers) peer.toJson()]),diff --git a/desktop/lib/viewer/viewer_services.dart b/desktop/lib/viewer/viewer_services.dartindex 10eb84d9e..2fcfc9ed7 100644--- a/desktop/lib/viewer/viewer_services.dart+++ b/desktop/lib/viewer/viewer_services.dart@@ -45,7 +45,7 @@ class ViewerServices {return ViewerServices._(keys: store,auth: auth,- login: DirectLogin(auth: auth),+ login: DirectLogin(auth: auth, keys: store),links: DirectLink(keys: store, auth: auth, config: config),relayCodecs: viewerRelayCodecs(store),transportPlugins: transportPlugins ?? harnessTransportPlugins,diff --git a/desktop/lib/widgets/add_machine_dialog.dart b/desktop/lib/widgets/add_machine_dialog.dartnew file mode 100644index 000000000..f7fd70262--- /dev/null+++ b/desktop/lib/widgets/add_machine_dialog.dart@@ -0,0 +1,458 @@+import 'dart:async';++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++import '../shared/widgets/app_dialog.dart';+import '../state/app_state.dart';+import '../api/api_client.dart' show MachineSignInRequest;+import '../viewer/connect_code.dart';+import '../viewer/direct_link.dart' show sameFingerprint;+import '../viewer/qr_scanner.dart';+import 'box_chrome.dart';+import 'terminal_text_action.dart';++/// **Add this machine?** — a machine's QR (`harness link qr`, or Add Phone), opened in this browser+/// by the phone's camera or scanned in the app: what the code is for, then the one-time-code pairing+/// and the trust group once the person approves. Viewer builds (web) only.+///+/// ```+/// Add this machine?+/// machine-remote-2 · online+/// fingerprint 5F80·61C4·6142·ADCF ← check it matches the machine's screen+/// account [email protected]+/// Approve Cancel+/// ```+Future<void> showAddMachineDialog(+ BuildContext context,+ AppNotifier notifier,+ ConnectCode code, {+ bool expired = false,+ bool wrongMachine = false,+}) => showAppDialog<void>(+ context: context,+ builder: (context) => Dialog(+ alignment: Alignment.topCenter,+ backgroundColor: Colors.transparent,+ elevation: 0,+ insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),+ child: AddMachineDialog(+ notifier: notifier,+ code: code,+ expired: expired,+ wrongMachine: wrongMachine,+ onClose: () => Navigator.of(context).pop(),+ ),+ ),+);++/// The in-app camera (`viewer/qr_scanner.dart`), then **Add this machine?** for what it read.+/// [machineId], from a locked machine's own row, refuses a code for a different machine.+Future<void> scanToAddMachine(+ BuildContext context,+ AppNotifier notifier, {+ String? machineId,+}) async {+ final raw = await scanQrCode(+ context,+ accept: (text) => ConnectCode.parse(text) != null,+ );+ if (raw == null || !context.mounted) return;+ final code = ConnectCode.parse(raw)!;+ await showAddMachineDialog(+ context,+ notifier,+ code,+ wrongMachine: machineId != null && code.machineId != machineId,+ );+}++/// Why a code cannot add a machine for this browser, or null when it can be asked about.+String? addMachineRefusal(ConnectCode code, String? signedInEmail) {+ if (code.pairCode == null || (code.machineId == null && !code.isSignIn)) {+ return "That code can't add a machine. On the machine, run "+ '`harness link qr` (or Add Phone in the desktop app) and scan that.';+ }+ final me = signedInEmail?.trim();+ if (me != null &&+ me.contains('@') &&+ code.email.isNotEmpty &&+ code.email.toLowerCase() != me.toLowerCase()) {+ return 'Signed in as $me, but this code is for ${code.email}. '+ 'Sign in as ${code.email} to add it.';+ }+ return null;+}++/// `5F8061C46142ADCF` as the machine prints it: `5F80·61C4·6142·ADCF`.+String spacedFingerprint(String fingerprint) {+ final plain = fingerprint.toUpperCase().replaceAll(RegExp('[^0-9A-Z]'), '');+ return [+ for (var i = 0; i < plain.length; i += 4)+ plain.substring(i, i + 4 > plain.length ? plain.length : i + 4),+ ].join('·');+}++enum _Phase { confirm, finding, lookingUp, approving, linking, done, failed }++class AddMachineDialog extends StatefulWidget {+ const AddMachineDialog({+ super.key,+ required this.notifier,+ required this.code,+ required this.onClose,+ this.expired = false,+ this.wrongMachine = false,+ });++ final AppNotifier notifier;+ final ConnectCode code;+ final VoidCallback onClose;++ /// The code waited too long (a sign-in, say): nothing to approve, scan the QR again.+ final bool expired;++ /// Scanned from a locked machine's row, but the code names another machine.+ final bool wrongMachine;++ @override+ State<AddMachineDialog> createState() => _AddMachineDialogState();+}++class _AddMachineDialogState extends State<AddMachineDialog> {+ _Phase _phase = _Phase.confirm;+ String? _message;++ AppNotifier get _app => widget.notifier;++ /// The machine's id: the code's own, or — a machine asking to be signed in — what approving bound.+ String? _approvedMachineId;+ String get _machineId => widget.code.machineId ?? _approvedMachineId ?? '';++ /// A machine asking to be signed in (`harness login`'s QR), and what the server says it is.+ bool get _signIn => widget.code.isSignIn;+ MachineSignInRequest? _request;++ /// A BROWSER asking to be signed in (the web sign-in page's QR, `k=v`), rather than a machine.+ bool get _browser => widget.code.isViewerSignIn;++ /// After a sign-in's approval: how many machines it will reach.+ int? _reaches;++ @override+ void initState() {+ super.initState();+ final refusal = widget.expired+ ? "This code expired. Scan the machine's QR again — it shows a fresh one."+ : widget.wrongMachine+ ? "That code is for another machine. Scan the one on this machine's screen."+ : addMachineRefusal(widget.code, _app.currentUser?.email);+ if (refusal != null) {+ _phase = _Phase.failed;+ _message = refusal;+ } else if (_signIn) {+ _phase = _Phase.lookingUp;+ unawaited(_lookUp());+ } else if (_app.stateOf(_machineId) == null) {+ // Signed in a moment ago, or the machine joined the account a moment ago: ask for the list+ // once before saying it isn't there.+ _phase = _Phase.finding;+ unawaited(_find());+ }+ }++ Future<void> _find() async {+ try {+ await _app.refreshMachines().timeout(const Duration(seconds: 6));+ } catch (_) {}+ if (!mounted) return;+ setState(() {+ if (_app.stateOf(_machineId) == null) {+ _phase = _Phase.failed;+ _message =+ "That machine isn't on your account. Sign in to Harness on it "+ 'with ${_app.currentUser?.email ?? 'this account'}.';+ } else {+ _phase = _Phase.confirm;+ }+ });+ }++ Future<void> _lookUp() async {+ MachineSignInRequest? request;+ String? problem;+ try {+ request = await _app.api.lookupMachineSignIn(widget.code.signInRequest!);+ final qr = widget.code.fingerprint, server = request.fingerprint;+ // The server's copy must be the QR's: otherwise the code on screen is not the request here.+ if (qr != null && server != null && !sameFingerprint(qr, server)) {+ problem = "That code doesn't match the machine's sign-in request. Nothing was approved.";+ }+ } catch (_) {+ problem =+ "That code expired or was already used. Scan the machine's new one.";+ }+ if (!mounted) return;+ setState(() {+ _request = request;+ _phase = problem == null ? _Phase.confirm : _Phase.failed;+ _message = problem;+ });+ }++ /// A sign-in QR — a browser's or a machine's: sign it in and bring it into this device's group.+ /// The two exchange keys in the approval itself; neither dials the other ([AppNotifier.approveSignInByQr]).+ Future<void> _approveByQr() async {+ final pub = _request?.pub;+ if (pub == null) {+ setState(() {+ _phase = _Phase.failed;+ _message = _browser+ ? "That browser's sign-in page is too old to be added. Reload it and scan again."+ : 'That machine runs an older Harness. Update it (harness update) and scan again.';+ });+ return;+ }+ setState(() => _phase = _Phase.approving);+ final out = await _app.approveSignInByQr(+ userCode: widget.code.signInRequest!,+ code: widget.code.pairCode!,+ pub: pub,+ label:+ _request?.label ??+ widget.code.hostname ??+ (_browser ? 'browser' : 'computer'),+ qrFingerprint: widget.code.fingerprint,+ machine: !_browser,+ );+ if (!mounted) return;+ setState(() {+ if (out.error == null) {+ _phase = _Phase.done;+ _reaches = out.machines;+ _approvedMachineId = out.machineId;+ } else {+ _phase = _Phase.failed;+ _message = out.error == 'FINGERPRINT'+ ? "Its key doesn't match its code. Nothing was approved."+ : "Couldn't approve it — the code may have expired. Scan the new one.";+ }+ });+ }++ Future<void> _notMe() async {+ try {+ await _app.api.denyMachineSignIn(widget.code.signInRequest!);+ } catch (_) {+ // It dies in minutes anyway.+ }+ if (!mounted) return;+ setState(() {+ _phase = _Phase.failed;+ _message = _browser+ ? 'Declined. That browser was not signed in.'+ : 'Declined. That machine was not signed in.';+ });+ }++ Future<void> _approve() async {+ if (_signIn) return _approveByQr();+ setState(() => _phase = _Phase.linking);+ final error = await _app.connectWithCode(+ _machineId,+ widget.code.pairCode!,+ expectedFingerprint: widget.code.fingerprint,+ );+ if (!mounted) return;+ setState(() {+ _phase = error == null ? _Phase.done : _Phase.failed;+ _message = error;+ });+ }++ KeyEventResult _key(FocusNode _, KeyEvent event) {+ if (event is! KeyDownEvent) return KeyEventResult.ignored;+ if (event.logicalKey == LogicalKeyboardKey.escape) {+ widget.onClose();+ return KeyEventResult.handled;+ }+ if (event.logicalKey == LogicalKeyboardKey.enter &&+ _phase == _Phase.confirm) {+ unawaited(_approve());+ return KeyEventResult.handled;+ }+ return KeyEventResult.ignored;+ }++ @override+ Widget build(BuildContext context) {+ final state = _app.stateOf(_machineId);+ final name = _browser+ ? (_request?.label ?? widget.code.hostname ?? 'A browser')+ : state?.machine.displayName ??+ widget.code.hostname ??+ _request?.label ??+ 'This machine';+ final host = widget.code.hostname;+ final online = state?.nodeOnline;+ final others = _app.machineStates.values+ .where((s) => s.machine.machineId != _machineId && !s.needsLink)+ .length;+ final fp = widget.code.fingerprint;+ return Focus(+ autofocus: true,+ onKeyEvent: _key,+ child: SizedBox(+ width: 460,+ child: TerminalBox(+ child: Padding(+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ switch (_phase) {+ _Phase.done when _browser => 'Browser signed in',+ _Phase.failed when _browser =>+ 'Couldn’t sign in the browser',+ _ when _browser => 'Sign in this browser?',+ _Phase.done => 'Machine added',+ _Phase.failed => 'Couldn’t add the machine',+ _ when _signIn => 'Sign in & add machine?',+ _ => 'Add this machine?',+ },+ key: const Key('add-machine-title'),+ style: boxMonoStyle(color: kBoxFaint),+ ),+ const SizedBox(height: 12),+ Text(name, style: boxMonoStyle(weight: FontWeight.w600)),+ if (host != null && host != name && !_browser)+ Text(host, style: boxMonoStyle(color: kBoxFaint)),+ if (_phase != _Phase.failed && state != null)+ Text(+ switch (online) {+ true => 'online',+ false => 'offline — start Harness on it',+ null => 'status unknown',+ },+ style: boxMonoStyle(+ color: online == true ? Colors.greenAccent : kBoxFaint,+ ),+ ),+ if (fp != null && _phase != _Phase.failed) ...[+ const SizedBox(height: 12),+ Text(+ 'fingerprint ${spacedFingerprint(fp)}',+ key: const Key('add-machine-fingerprint'),+ style: boxMonoStyle(),+ ),+ Text(+ _browser+ ? "Check it matches the browser's screen."+ : "Check it matches the machine's screen.",+ style: boxMonoStyle(color: kBoxFaint),+ ),+ ],+ if (_app.currentUser?.email case final email?+ when _phase == _Phase.confirm) ...[+ const SizedBox(height: 8),+ Text(+ _signIn ? 'signs in as $email' : 'account $email',+ style: boxMonoStyle(),+ ),+ ],+ if (_signIn && _phase == _Phase.confirm) ...[+ if (_request?.country case final country?)+ Text(+ 'requested from $country',+ style: boxMonoStyle(color: kBoxFaint),+ ),+ const SizedBox(height: 6),+ Text(+ _browser+ ? 'Only approve a browser you are using right now — '+ 'it gets your account and your machines.'+ : 'Only approve a machine you are setting up right now.',+ key: const Key('add-machine-warning'),+ style: boxMonoStyle(color: Colors.amberAccent),+ ),+ ],+ const SizedBox(height: 12),+ Text(+ switch (_phase) {+ _Phase.confirm when _browser => 'It joins your devices and reaches your machines — no password.',+ _Phase.approving when _browser =>+ 'Signing it in and adding it to your devices…',+ _Phase.done when _browser =>+ _reaches == 0+ ? '$name is signed in. Machines you link later reach it too.'+ : '$name is signed in and reaches your $_reaches '+ 'machine${_reaches == 1 ? '' : 's'}.',+ _Phase.confirm =>+ others == 0+ ? 'This browser will reach it without a password.'+ : 'It will reach, and be reached by, your $others other '+ 'machine${others == 1 ? '' : 's'} — no password.',+ _Phase.finding => 'Looking for it on your account…',+ _Phase.lookingUp => 'Reading the code…',+ _Phase.approving =>+ 'Signing it in and adding it to your devices…',+ _Phase.linking => 'Linking · adding it to your devices…',+ _Phase.done when _signIn && (_reaches ?? 0) == 0 =>+ '$name is signed in. Machines you link later reach it too.',+ _Phase.done when _signIn =>+ '$name is signed in and reaches your $_reaches '+ 'machine${_reaches == 1 ? '' : 's'}, and they reach it.',+ _Phase.done =>+ '$name reaches your other machines, and they reach it.',+ _Phase.failed => _message ?? 'Try scanning its code again.',+ },+ key: const Key('add-machine-status'),+ style: boxMonoStyle(+ color: _phase == _Phase.failed+ ? Colors.redAccent+ : Colors.white70,+ ),+ ),+ const SizedBox(height: 14),+ // Wraps on a phone-width screen rather than overflowing: three actions for a+ // sign-in (Not me, Approve, Cancel) do not fit a narrow line in a mono face.+ Wrap(+ alignment: WrapAlignment.end,+ spacing: 12,+ runSpacing: 8,+ children: [+ if (_phase == _Phase.confirm) ...[+ if (_signIn) ...[+ TerminalTextAction(+ key: const Key('add-machine-not-me'),+ label: 'Not me',+ onPressed: () => unawaited(_notMe()),+ ),+ ],+ TerminalTextAction(+ key: const Key('add-machine-approve'),+ label: 'Approve',+ onPressed: () => unawaited(_approve()),+ ),+ ],+ TerminalTextAction(+ key: const Key('add-machine-close'),+ label: switch (_phase) {+ _Phase.done => 'Done',+ _Phase.linking || _Phase.approving => 'Hide',+ _ => 'Cancel',+ },+ onPressed: widget.onClose,+ ),+ ],+ ),+ ],+ ),+ ),+ ),+ ),+ );+ }+}diff --git a/desktop/lib/widgets/add_phone_dialog.dart b/desktop/lib/widgets/add_phone_dialog.dartindex 77942d71c..ac82f4187 100644--- a/desktop/lib/widgets/add_phone_dialog.dart+++ b/desktop/lib/widgets/add_phone_dialog.dart@@ -9,6 +9,9 @@ import 'package:qr/qr.dart';import 'package:xterm/xterm.dart' show TerminalTheme;import '../api/api_client.dart';+import '../core/local_hostname.dart';+import '../e2ee/keys.dart' show fingerprint;+import '../e2ee/pair_code.dart';import '../shared/theme/app_theme.dart' as grid;import '../shortcuts/app_keymap.dart';import '../state/app_state.dart';@@ -20,6 +23,9 @@ import 'box_chrome.dart';import 'terminal_prompt.dart';import 'terminal_text_action.dart';+// The pairing code moved beside the rest of the E2EE code; its callers still find it here.+export '../e2ee/pair_code.dart';+/// Harness ▸ Add Phone… — a QR the phone scans to sign in to this account AND/// pair with this computer, end to end encrypted, with no password typed.///@@ -50,6 +56,8 @@ Future<void> showAddPhoneDialog(VoidCallback? onConnectMachine,PairedDevicesCall? listDevices,RemovePairedDeviceCall? removeDevice,+ MachineFingerprintCall? machineFingerprint,+ GroupMachinesCall? groupMachines,}) => showTerminalPrompt<void>(context,keymap: keymap,@@ -60,44 +68,36 @@ Future<void> showAddPhoneDialog(onConnectMachine: onConnectMachine,listDevices: listDevices ?? app.api.pairedDevices,removeDevice: removeDevice ?? app.api.removePairedDevice,+ machineFingerprint: machineFingerprint,+ groupMachines: groupMachines,),);+/// The other machines in this computer's trust group (`GET /api/group`), or null when it cannot+/// say. After a phone links, the dialog watches this settle to say which machines now reach it.+typedef GroupMachinesCall =+ Future<List<({String machineId, String label})>?> Function();++/// The fingerprint of the machine a phone is being paired with: this computer's+/// daemon's, or — [remoteMachineId], from a viewer — the key pinned for it.+typedef MachineFingerprintCall = Future<String?> Function(+ String? remoteMachineId,+);++Future<String?> machineFingerprintOf(+ AppNotifier app,+ String? remoteMachineId,+) async {+ if (remoteMachineId == null) return app.api.machineFingerprint();+ final peer = await app.viewer?.keys.peer(remoteMachineId);+ return peer == null ? null : fingerprint(peer.pub);+}+/// Where the QR points. The phone's `ConnectCode` (mobile/// `lib/phone/welcome/connect_code.dart`) parses exactly this.const kPhonePairHost = 'harness.autonomous.ai';const kPhonePairPath = '/pair';-/// The characters a pairing code is drawn from: no `0 O 1 I L`, which read-/// alike — and no `U` either.-///-/// ⚠️ `U` is left out on purpose, although it reads fine. The daemon feeds-/// the code through core.ts `normalizeCode`, which maps `U` to `V` (Crockford-/// base32); the phone's `normalizePairCode` only uppercases and strips-/// separators. A code with a `U` in it would therefore reach CPace as two-/// different secrets and fail as `CODE_MISMATCH` every time — for a 16-letter-/// code, about four scans in ten. Without it both sides agree whatever either-/// normaliser does, at 30 symbols: 78 bits over 16 characters, far past what-/// three guesses per five minutes (the daemon's rate limit) could dent.-const kPhonePairCodeAlphabet = 'ABCDEFGHJKMNPQRSTVWXYZ23456789';-const kPhonePairCodeLength = 16;--/// A fresh one-time pairing code, from a cryptographically secure source.-///-/// It is the whole secret the pairing rests on — the backend relays the-/// handshake and must learn nothing from it — so never `Random()`.-/// [random] exists for tests; `Random.secure().nextInt` is uniform, so no-/// symbol is likelier than another.-String newPhonePairCode({math.Random? random}) {- final source = random ?? math.Random.secure();- return String.fromCharCodes([- for (var i = 0; i < kPhonePairCodeLength; i++)- kPhonePairCodeAlphabet.codeUnitAt(- source.nextInt(kPhonePairCodeAlphabet.length),- ),- ]);-}-/// `https://harness.autonomous.ai/pair#e=<email>&m=<machineId>&c=<code>&h=<sign-in code>`.////// ⚠️ EVERYTHING rides in the FRAGMENT, never the query. The code is the@@ -116,11 +116,17 @@ String newPhonePairCode({math.Random? random}) {/// or on a phone app that predates it — the phone signs in with an emailed/// code, as before. It is the account's credential for its minute, which is/// one more reason all of this rides in the fragment.+///+/// [fingerprint] (`f`) is the machine's identity fingerprint, separators+/// dropped: a phone that knows the field refuses a machine proving a different+/// key. [hostname] (`n`) is for its confirm screen only.Uri phonePairLink({required String email,required String machineId,required String code,String? signIn,+ String? fingerprint,+ String? hostname,}) => Uri(scheme: 'https',host: kPhonePairHost,@@ -129,7 +135,9 @@ Uri phonePairLink({'e=${Uri.encodeQueryComponent(email)}''&m=${Uri.encodeQueryComponent(machineId)}''&c=$code'- '${signIn != null ? '&h=${Uri.encodeQueryComponent(signIn)}' : ''}',+ '${signIn != null ? '&h=${Uri.encodeQueryComponent(signIn)}' : ''}'+ '${fingerprint != null ? '&f=${fingerprint.toUpperCase().replaceAll(RegExp('[^0-9A-Z]'), '')}' : ''}'+ '${hostname != null ? '&n=${Uri.encodeQueryComponent(hostname)}' : ''}',);/// What one `POST /api/pair` came to, as far as this dialog cares.@@ -252,6 +260,8 @@ class AddPhoneDialog extends StatefulWidget {this.onConnectMachine,this.listDevices,this.removeDevice,+ this.machineFingerprint,+ this.groupMachines,});final AppNotifier app;@@ -264,6 +274,13 @@ class AddPhoneDialog extends StatefulWidget {final PairedDevicesCall? listDevices;final RemovePairedDeviceCall? removeDevice;+ /// Null (tests): the QR carries no fingerprint.+ final MachineFingerprintCall? machineFingerprint;++ /// Null (tests, a viewer): the dialog closes on "Connected" rather than waiting to report the+ /// trust group the phone brought.+ final GroupMachinesCall? groupMachines;+@overrideState<AddPhoneDialog> createState() => _AddPhoneDialogState();}@@ -282,6 +299,15 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {/// How long "Connected" stays up before the dialog closes itself.static const _connectedHold = Duration(milliseconds: 1500);+ /// After a link, how the group is watched: the phone pushes this computer to its other machines+ /// and they answer, so the list grows for a few seconds. Reported once it has not grown for+ /// [_groupSettle] — sooner when there is nobody else to wait for — and never later than+ /// [_groupWait]. Whoever is offline catches up on their own. Shorter than the CLI's (qrLink.ts):+ /// somebody is looking at this.+ static const _groupSettle = Duration(seconds: 6);+ static const _groupEmpty = Duration(seconds: 12);+ static const _groupWait = Duration(seconds: 30);+/// How often the QR gets a new sign-in code. Shorter than the code's own/// life (90 s at the backend), so the one on screen always has at least/// half a minute left in it when a phone reads it.@@ -315,6 +341,13 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {/// without one: the phone then asks for an emailed code.String? _signIn;bool _signInAsked = false;++ /// The machine's identity fingerprint for the QR (`f`), asked once on open:+ /// from this computer's daemon, or — pairing a phone to a remote machine —+ /// the key this viewer pinned for it. The QR waits for the answer (or its+ /// absence), so it does not change under a phone mid-scan.+ String? _fingerprint;+ bool _fingerprintAsked = false;Timer? _signInTimer;/// The devices paired with this computer, newest first; null until the@@ -330,6 +363,12 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {/// No pairing to be had from this daemon — asking stopped for good.bool _stopped = false;String? _connected;++ /// Watching the trust group after a link ([_watchGroup]).+ bool _syncing = false;++ /// The machines this computer reaches once the group settled, by name; null before.+ List<String>? _reaches;String? _message;/// A message that is an instruction to the person ("scan the new code"),@@ -344,6 +383,21 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {_syncLoop();unawaited(_renewSignIn());unawaited(_loadDevices());+ unawaited(_loadFingerprint());+ }++ Future<void> _loadFingerprint() async {+ String? found;+ try {+ found = await widget.machineFingerprint?.call(_remoteMachineId);+ } catch (_) {+ // Without it the QR still pairs; the phone just cannot cross-check the key.+ }+ if (!mounted) return;+ setState(() {+ _fingerprint = found;+ _fingerprintAsked = true;+ });}@override@@ -418,6 +472,10 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {});// The phone that just joined is on the list now.unawaited(_loadDevices());+ if (widget.groupMachines case final group?) {+ await _watchGroup(group);+ return; // Stays up to be read; Esc or Done closes it.+ }if (await _sleep(_connectedHold) && mounted) {Navigator.of(context).pop();}@@ -470,6 +528,43 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {}}+ /// Watches the trust group settle after a phone linked, then says which machines this computer+ /// now reaches — the other half of what the scan did.+ Future<void> _watchGroup(GroupMachinesCall group) async {+ setState(() => _syncing = true);+ // Time is counted in polls, not read off the clock: the waits are the polls.+ var elapsed = Duration.zero;+ var steady = Duration.zero;+ var machines = <({String machineId, String label})>[];+ while (true) {+ List<({String machineId, String label})>? next;+ try {+ next = await group();+ } catch (_) {+ next = null;+ }+ if (_closed) return;+ if (next != null && next.length != machines.length) {+ machines = next;+ steady = Duration.zero;+ }+ if (machines.isNotEmpty && steady >= _groupSettle) break;+ if (machines.isEmpty && elapsed >= _groupEmpty) break;+ if (elapsed >= _groupWait) break;+ if (!await _sleep(_poll)) return;+ elapsed += _poll;+ steady += _poll;+ }+ setState(() {+ _syncing = false;+ _reaches = [+ for (final m in machines)+ app.stateOf(m.machineId)?.machine.displayName ??+ (m.label.isNotEmpty ? m.label : m.machineId.substring(0, 8)),+ ];+ });+ }+/// Ask for a sign-in code, put it in the QR, and ask again before it runs/// out — for as long as the QR is on screen. A failure is not retried/// sooner: the QR works without one, and the next renewal tries again.@@ -662,12 +757,22 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {}// A moment's wait for the sign-in code, in the QR's own space: a QR that// changed right after it appeared would be one scanned without it.- if (!_signInAsked) return [SizedBox(height: qrSide + row * 2)];+ if (!_signInAsked || !_fingerprintAsked) {+ return [SizedBox(height: qrSide + row * 2)];+ }final link = phonePairLink(email: target.email,machineId: target.machineId,code: _code,signIn: _signIn,+ fingerprint: _fingerprint,+ // Beside the fingerprint, and only where the app asks for one: the+ // phone's confirm screen names the machine by it.+ hostname: widget.machineFingerprint == null+ ? null+ : _remoteMachineId != null+ ? app.stateOf(_remoteMachineId)?.machine.hostname+ : localHostnameOrNull(),).toString();return [Center(@@ -689,10 +794,49 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {// One line, and it is the status too: what to do, then that it worked.// The phone's own screen says the rest (Yes — scan to connect)._status(),+ ..._groupLines(row),..._devicesList(row),];}+ /// Under "Connected": the trust group the phone brought — being added to it, then who this+ /// computer reaches — and a way out once there is nothing left to wait for.+ List<Widget> _groupLines(double row) {+ if (_connected == null || widget.groupMachines == null) return const [];+ final reaches = _reaches;+ final String text;+ if (_syncing || reaches == null) {+ text = 'Adding this ${_thisComputer()} to your devices…';+ } else if (reaches.isEmpty) {+ text = 'Computers you link later reach it too.';+ } else {+ text =+ 'Reaches ${reaches.length} '+ '${reaches.length == 1 ? 'machine' : 'machines'}: ${reaches.join(' · ')}';+ }+ return [+ Semantics(+ liveRegion: true,+ child: Text(+ text,+ key: const ValueKey('add-phone-group'),+ textAlign: TextAlign.center,+ style: _ink(reaches == null ? _faint : null),+ ),+ ),+ if (reaches != null) ...[+ SizedBox(height: row),+ Center(+ child: TerminalTextAction(+ key: const ValueKey('add-phone-done'),+ label: 'Done',+ onPressed: _close,+ ),+ ),+ ],+ ];+ }+/// Who can already reach this computer, with a way to take it back: the/// safety net for a QR somebody else scanned.List<Widget> _devicesList(double row) {diff --git a/desktop/lib/widgets/machines_panel.dart b/desktop/lib/widgets/machines_panel.dartindex f141c9f5f..e94449f8d 100644--- a/desktop/lib/widgets/machines_panel.dart+++ b/desktop/lib/widgets/machines_panel.dart@@ -1,5 +1,6 @@import 'dart:async';+import 'package:flutter/foundation.dart' show kIsWeb;import 'package:flutter/material.dart';import 'package:flutter/semantics.dart' show CustomSemanticsAction;import 'package:flutter/services.dart';@@ -7,6 +8,8 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:url_launcher/url_launcher.dart';import '../auth/cli_link.dart';+import '../viewer/qr_scanner.dart';+import 'add_machine_dialog.dart' show scanToAddMachine;import '../core/models.dart';import '../core/machine_resources.dart';import '../screens/login_screen.dart';@@ -574,6 +577,21 @@ class _MachinesPanelState extends State<_MachinesPanel>return Column(crossAxisAlignment: CrossAxisAlignment.start,children: [+ if (kIsWeb && qrScanSupported) ...[+ const Text('Harness already running there? Scan its code:'),+ const SizedBox(height: 4),+ const _Detail(+ 'On it: harness link qr, or Add Phone in the desktop app.',+ ),+ const SizedBox(height: 8),+ _button(+ 'Scan its code',+ () => unawaited(scanToAddMachine(context, app)),+ key: const ValueKey('scan-add-machine'),+ primary: true,+ ),+ const SizedBox(height: 14),+ ],const Text('1. Open Harness on your other computer.'),const SizedBox(height: 6),_Detail(@@ -1549,6 +1567,26 @@ class _MachinePasswordState extends State<_MachinePassword> {const SizedBox(height: 8),_Feedback(error, error: true),],+ // In a phone's browser the machine's QR is the easier way in: no password to type.+ if (kIsWeb && !_local && qrScanSupported) ...[+ const SizedBox(height: 8),+ Align(+ alignment: Alignment.centerLeft,+ child: _button(+ 'Scan its code',+ _busy+ ? null+ : () => unawaited(+ scanToAddMachine(+ context,+ widget.app,+ machineId: widget.machine.machine.machineId,+ ),+ ),+ key: ValueKey('scan-code-${widget.machine.machine.machineId}'),+ ),+ ),+ ],if (_showHelp) ...[const SizedBox(height: 8),_Detail(diff --git a/desktop/scripts/serve-web.py b/desktop/scripts/serve-web.pyindex 3f61462ec..2ab6869ad 100644--- a/desktop/scripts/serve-web.py+++ b/desktop/scripts/serve-web.py@@ -11,7 +11,7 @@ from urllib.parse import urlsplitclass WebPreview(SimpleHTTPRequestHandler):def do_GET(self):path = urlsplit(self.path).path- if path in {"/callback", "/auth/callback"} or path.startswith("/s/"):+ if path in {"/callback", "/auth/callback", "/pair"} or path.startswith("/s/"):self.path = "/index.html"super().do_GET()diff --git a/desktop/test/add_machine_dialog_test.dart b/desktop/test/add_machine_dialog_test.dartnew file mode 100644index 000000000..3cc27e9e1--- /dev/null+++ b/desktop/test/add_machine_dialog_test.dart@@ -0,0 +1,322 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/api/api_client.dart';+import 'package:harness/auth/auth_session.dart';+import 'package:harness/auth/cli_link.dart';+import 'package:harness/auth/peer_link_client.dart';+import 'package:harness/core/config.dart';+import 'package:harness/core/models.dart';+import 'package:harness/state/app_state.dart';+import 'package:harness/viewer/connect_code.dart';+import 'package:harness/widgets/add_machine_dialog.dart';++class _Links implements PeerLinkClient {+ final calls = <(String, String, String?)>[];+ String? error;++ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async {+ calls.add((machineId, code, expectedFingerprint));+ return error == null+ ? CliLinkConnectResult(linkedMachineId: machineId)+ : CliLinkConnectResult(error: error);+ }++ @override+ Future<CliLinkConnectResult> connect(+ String machineId,+ String password, {+ void Function(String stage)? onProgress,+ String? displayName,+ }) async => const CliLinkConnectResult(error: 'not used');++ @override+ Future<CliLinkListResult> list() async => const CliLinkListResult();++ @override+ Future<String?> unlink(String machineId) async => null;+}++final _id = 'b' * 32;++/// The backend's side of a browser's sign-in, as the approving device sees it.+class _Api extends ApiClient {+ _Api({this.pub, this.viewer = true})+ : super(config: AppConfig.dev, session: AuthSession());+ final String? pub;+ final bool viewer;+ var denied = 0;+ @override+ Future<MachineSignInRequest> lookupMachineSignIn(String userCode) async =>+ MachineSignInRequest(+ label: viewer ? 'Chrome on macOS' : 'box2',+ viewer: viewer,+ fingerprint: 'AB12CD34EF567890',+ country: 'VN',+ pub: pub,+ );+ @override+ Future<void> denyMachineSignIn(String userCode) async => denied++;+}++/// The group handoff, faked: its real work (sealing, the roster, the sync) is tested where it lives.+class _Approver extends AppNotifier {+ _Approver(PeerLinkClient links, {this.error})+ : super(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ peerLinks: links,+ );+ final String? error;+ final calls = <(String, String, String, String?, bool)>[];+ @override+ Future<({String? error, int machines, String? machineId})> approveSignInByQr({+ required String userCode,+ required String code,+ required String pub,+ required String label,+ String? qrFingerprint,+ bool machine = false,+ }) async {+ calls.add((userCode, code, pub, qrFingerprint, machine));+ return (error: error, machines: 2, machineId: machine ? 'c' * 32 : null);+ }+}++ConnectCode _browserCode() => ConnectCode.parse(+ ConnectCode.signInLink(+ 'U' * 26,+ pairCode: 'ABCDEFGHJKMNPQRS',+ fingerprint: 'AB12CD34EF567890',+ hostname: 'Chrome on macOS',+ viewer: true,+ ),+)!;++AppNotifier _app(_Links links, {String email = '[email protected]'}) {+ final app = AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ peerLinks: links,+ )..currentUser = CurrentUserProfile(email: email);+ final machine = Machine(+ machineId: _id,+ name: 'machine-remote-2',+ authMode: MachineAuthMode.remote,+ );+ app.machineStates[_id] = MachineState(machine)+ ..nodeOnline = true+ ..needsLink = true;+ return app;+}++ConnectCode _code({String email = '[email protected]'}) => ConnectCode.parse(+ ConnectCode.link(+ email,+ machineId: _id,+ pairCode: 'ABCDEFGHJKMNPQRS',+ fingerprint: '5F8061C46142ADCF',+ hostname: 'box2.local',+ ),+)!;++Future<void> _open(+ WidgetTester tester,+ AppNotifier app,+ ConnectCode code, {+ bool expired = false,+}) async {+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: Builder(+ builder: (context) => TextButton(+ onPressed: () =>+ showAddMachineDialog(context, app, code, expired: expired),+ child: const Text('open'),+ ),+ ),+ ),+ ),+ );+ await tester.tap(find.text('open'));+ await tester.pumpAndSettle();+}++String _text(WidgetTester tester, String key) =>+ tester.widget<Text>(find.byKey(Key(key))).data!;++void main() {+ testWidgets('shows what the code is for, and links only once approved', (+ tester,+ ) async {+ final links = _Links();+ final app = _app(links);+ addTearDown(app.dispose);+ await _open(tester, app, _code());+ expect(_text(tester, 'add-machine-title'), 'Add this machine?');+ expect(+ _text(tester, 'add-machine-fingerprint'),+ contains('5F80·61C4·6142·ADCF'),+ );+ expect(find.text('box2.local'), findsOneWidget);+ expect(links.calls, isEmpty);++ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(links.calls, [(_id, 'ABCDEFGHJKMNPQRS', '5F8061C46142ADCF')]);+ expect(_text(tester, 'add-machine-title'), 'Machine added');+ expect(app.machineStates[_id]!.needsLink, isFalse);+ });++ testWidgets(+ 'a code for another account is refused before anything is asked',+ (tester) async {+ final links = _Links();+ final app = _app(links, email: '[email protected]');+ addTearDown(app.dispose);+ await _open(tester, app, _code(email: '[email protected]'));+ expect(+ _text(tester, 'add-machine-status'),+ contains('Signed in as [email protected]'),+ );+ expect(find.byKey(const Key('add-machine-approve')), findsNothing);+ expect(links.calls, isEmpty);+ },+ );++ testWidgets('a code that waited too long says to scan again', (tester) async {+ final links = _Links();+ final app = _app(links);+ addTearDown(app.dispose);+ await _open(tester, app, _code(), expired: true);+ expect(_text(tester, 'add-machine-status'), contains('expired'));+ expect(find.byKey(const Key('add-machine-approve')), findsNothing);+ });++ testWidgets('a failed link is said, with nothing marked linked', (+ tester,+ ) async {+ final links = _Links()+ ..error =+ 'That machine’s fingerprint doesn’t match its code. Nothing was linked.';+ final app = _app(links);+ addTearDown(app.dispose);+ await _open(tester, app, _code());+ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(+ _text(tester, 'add-machine-status'),+ contains('fingerprint doesn’t match'),+ );+ expect(app.machineStates[_id]!.needsLink, isTrue);+ });++ testWidgets(+ 'a browser\'s sign-in QR: approve signs it in and hands it this device\'s group',+ (tester) async {+ final app = _Approver(_Links())+ ..currentUser = const CurrentUserProfile(email: '[email protected]')+ ..api = _Api(pub: 'PUB=');+ addTearDown(app.dispose);+ await _open(tester, app, _browserCode());+ expect(_text(tester, 'add-machine-title'), 'Sign in this browser?');+ expect(find.text('Chrome on macOS'), findsOneWidget);+ expect(+ _text(tester, 'add-machine-warning'),+ contains('browser you are using'),+ );+ expect(+ _text(tester, 'add-machine-status'),+ contains('joins your devices'),+ );++ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(app.calls, [+ ('U' * 26, 'ABCDEFGHJKMNPQRS', 'PUB=', 'AB12CD34EF567890', false),+ ]);+ expect(_text(tester, 'add-machine-title'), 'Browser signed in');+ expect(_text(tester, 'add-machine-status'), contains('your 2 machines'));+ },+ );++ testWidgets('a browser whose key does not match its QR is refused', (+ tester,+ ) async {+ final app = _Approver(_Links(), error: 'FINGERPRINT')+ ..currentUser = const CurrentUserProfile(email: '[email protected]')+ ..api = _Api(pub: 'PUB=');+ addTearDown(app.dispose);+ await _open(tester, app, _browserCode());+ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(_text(tester, 'add-machine-status'), contains("doesn't match"));+ });++ testWidgets('an old sign-in page, with no key to take in, is not approved', (+ tester,+ ) async {+ final app = _Approver(_Links())+ ..currentUser = const CurrentUserProfile(email: '[email protected]')+ ..api = _Api();+ addTearDown(app.dispose);+ await _open(tester, app, _browserCode());+ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(app.calls, isEmpty);+ expect(_text(tester, 'add-machine-status'), contains('too old'));+ });++ testWidgets('"Not me" declines a browser\'s request', (tester) async {+ final api = _Api(pub: 'PUB=');+ final app = _Approver(_Links())+ ..currentUser = const CurrentUserProfile(email: '[email protected]')+ ..api = api;+ addTearDown(app.dispose);+ await _open(tester, app, _browserCode());+ await tester.tap(find.byKey(const Key('add-machine-not-me')));+ await tester.pumpAndSettle();+ expect(api.denied, 1);+ expect(app.calls, isEmpty);+ expect(_text(tester, 'add-machine-status'), contains('browser was not'));+ });++ testWidgets(+ 'a machine\'s sign-in QR goes the same way: approve hands it the group, no dial',+ (tester) async {+ final links = _Links();+ final app = _Approver(links)+ ..currentUser = const CurrentUserProfile(email: '[email protected]')+ ..api = _Api(pub: 'PUB=', viewer: false);+ addTearDown(app.dispose);+ final code = ConnectCode.parse(+ ConnectCode.signInLink(+ 'U' * 26,+ pairCode: 'ABCDEFGHJKMNPQRS',+ fingerprint: 'AB12CD34EF567890',+ hostname: 'box2',+ ),+ )!;+ await _open(tester, app, code);+ expect(_text(tester, 'add-machine-title'), 'Sign in & add machine?');+ await tester.tap(find.byKey(const Key('add-machine-approve')));+ await tester.pumpAndSettle();+ expect(app.calls, [+ ('U' * 26, 'ABCDEFGHJKMNPQRS', 'PUB=', 'AB12CD34EF567890', true),+ ]);+ // The keys changed hands in the approval: nothing waits for the machine, nothing dials it.+ expect(links.calls, isEmpty);+ expect(_text(tester, 'add-machine-title'), 'Machine added');+ expect(_text(tester, 'add-machine-status'), contains('your 2 machines'));+ },+ );+}diff --git a/desktop/test/add_phone_dialog_test.dart b/desktop/test/add_phone_dialog_test.dartindex f3c64db3b..7d151ee87 100644--- a/desktop/test/add_phone_dialog_test.dart+++ b/desktop/test/add_phone_dialog_test.dart@@ -73,6 +73,7 @@ Future<void> _open(VoidCallback? onConnectMachine,PairedDevicesCall? listDevices,RemovePairedDeviceCall? removeDevice,+ GroupMachinesCall? groupMachines,}) async {tester.view.devicePixelRatio = 1;tester.view.physicalSize = const Size(1280, 800);@@ -93,6 +94,7 @@ Future<void> _open(onConnectMachine: onConnectMachine,listDevices: listDevices ?? () async => null,removeDevice: removeDevice ?? (_) async => false,+ groupMachines: groupMachines,),);await tester.pump();@@ -107,6 +109,23 @@ String _status(WidgetTester tester) =>tester.widget<Text>(find.byKey(const ValueKey('add-phone-status'))).data!;void main() {+ test(+ 'the link carries the fingerprint (separators dropped) and the hostname',+ () {+ final link = phonePairLink(+ email: '[email protected]',+ machineId: 'm',+ code: 'ABCDEFGHJKMNPQRS',+ fingerprint: 'b18e·5F33·8400·69CB',+ hostname: 'Studio Mac',+ );+ final fields = Uri.splitQueryString(link.fragment);+ expect(fields['f'], 'B18E5F33840069CB');+ expect(fields['n'], 'Studio Mac');+ expect(link.query, isEmpty);+ },+ );+AppNotifier browserApp() {final storage = MemoryStore();final session = AuthSession(storage: storage);@@ -475,6 +494,47 @@ void main() {expect(daemon.codes, hasLength(3));});+ testWidgets(+ 'once paired, it watches the group settle and says who this computer reaches',+ (tester) async {+ final app = _signedInApp();+ addTearDown(app.dispose);+ final daemon = _FakeDaemon([+ () => const PhonePairAnswer.paired('Dee’s iPhone'),+ ]);+ var asks = 0;+ await _open(+ tester,+ app,+ daemon.call,+ groupMachines: () async {+ asks++;+ // The phone's machines arrive a moment after the link.+ return [+ if (asks > 1) (machineId: 'a' * 32, label: 'studio'),+ if (asks > 2) (machineId: 'b' * 32, label: 'box-2'),+ ];+ },+ );+ await tester.pump();+ expect(_status(tester), '✓ Connected Dee’s iPhone');+ String group() => tester+ .widget<Text>(find.byKey(const ValueKey('add-phone-group')))+ .data!;+ expect(group(), startsWith('Adding this'));+ for (var i = 0; i < 8; i++) {+ await tester.pump(const Duration(milliseconds: 1500));+ }+ expect(group(), 'Reaches 2 machines: studio · box-2');+ // It stays up to be read, and Done closes it.+ expect(find.byType(AddPhoneDialog), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey('add-phone-done')));+ await tester.pump();+ await tester.pump();+ expect(find.byType(AddPhoneDialog), findsNothing);+ },+ );+testWidgets('a code that did not match is replaced, QR and all', (tester,) async {diff --git a/desktop/test/box_render_preview_test.dart b/desktop/test/box_render_preview_test.dartindex e8463c1a6..84813f2ed 100644--- a/desktop/test/box_render_preview_test.dart+++ b/desktop/test/box_render_preview_test.dart@@ -40,6 +40,15 @@ import 'support/restart_connection.dart';import 'terminal_find_test.dart' show findField, finishFind, output;class _PreviewLink implements PeerLinkClient {+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(error: 'not used');+final result = Completer<CliLinkConnectResult>();@overrideFuture<CliLinkConnectResult> connect(diff --git a/desktop/test/cli_login_test.dart b/desktop/test/cli_login_test.dartindex 23c10d9b1..f7adf7243 100644--- a/desktop/test/cli_login_test.dart+++ b/desktop/test/cli_login_test.dart@@ -78,7 +78,107 @@ class _TimeoutProcess extends _Process {}}+/// The runner for a sign-in by phone: asks for `--qr` and hands out one scripted process.+class _QrRunner extends HarnessCliRunner {+ _QrRunner(this.process);+ final _Process process;+ List<String>? arguments;+ @override+ Future<Process> start(List<String> arguments) async {+ this.arguments = arguments;+ return process;+ }+}+void main() {+ test('a sign-in by phone shows each QR, resolves at the result, and keeps reporting the link', () async {+ final process = _Process();+ final runner = _QrRunner(process);+ final login = CliLogin(runner: runner);+ final qrs = <SignInQr>[];+ final stages = <String>[];+ var done = false;+ final signingIn = login+ .login(+ onAuthorizeUrl: (_) => fail('no browser for a sign-in by phone'),+ qr: SignInQrListener(+ onQr: qrs.add,+ onProgress: (stage, _) => stages.add(stage),+ ),+ )+ .then((_) => done = true);+ await pumpEventQueue();+ expect(runner.arguments, [+ 'login',+ '--force',+ '--json',+ '--entry-point=desktop',+ '--qr',+ ]);+ process.emit({+ 'type': 'qr',+ 'url': 'https://x/pair#s=A&c=B',+ 'fingerprint': '0763·ADD9',+ 'expiresAt': 1790000000000,+ });+ process.emit({+ 'type': 'qr',+ 'url': 'https://x/pair#s=C&c=B',+ 'fingerprint': '0763·ADD9',+ });+ await pumpEventQueue();+ expect(qrs.map((q) => q.url), [+ 'https://x/pair#s=A&c=B',+ 'https://x/pair#s=C&c=B',+ ]);+ expect(+ qrs.first.expiresAt,+ DateTime.fromMillisecondsSinceEpoch(1790000000000),+ );+ expect(done, isFalse);++ process.emit({'type': 'approved', 'machineId': 'm'});+ process.emit({'type': 'result', 'status': 'success'});+ await signingIn;+ expect(+ done,+ isTrue,+ ); // signed in: the app goes on while the CLI links the phone++ process.emit({'type': 'linked', 'label': "Dee's iPhone"});+ process.emit({'type': 'synced', 'machines': []});+ process.finish();+ await pumpEventQueue();+ expect(stages, ['approved', 'linked', 'synced', 'ended']);+ });++ test('a declined sign-in by phone fails with its message', () async {+ final process = _Process();+ final login = CliLogin(runner: _QrRunner(process));+ final signingIn = login.login(+ onAuthorizeUrl: (_) {},+ qr: SignInQrListener(onQr: (_) {}),+ );+ await pumpEventQueue();+ process.emit({+ 'type': 'result',+ 'status': 'error',+ 'code': 'DENIED',+ 'message': 'Declined on your phone. Nothing was signed in.',+ });+ process.finish(1);+ await expectLater(+ signingIn,+ throwsA(+ isA<StateError>().having(+ (e) => e.message,+ 'message',+ contains('Declined'),+ ),+ ),+ );+ });+test('logout reports a nonzero CLI exit as a failure', () async {final process = _Process()..finish(1);final runner = _LogoutRunner(process);diff --git a/desktop/test/desktop_account_transition_test.dart b/desktop/test/desktop_account_transition_test.dartindex 6fe9d4b16..6e1ca6a3f 100644--- a/desktop/test/desktop_account_transition_test.dart+++ b/desktop/test/desktop_account_transition_test.dart@@ -22,7 +22,7 @@ class _Login extends CliLogin {Future<void> logout() async {}@override- Future<void> login({required void Function(String) onAuthorizeUrl}) async {+ Future<void> login({required void Function(String) onAuthorizeUrl, SignInQrListener? qr}) async {logins++;await pending?.future;if (fail) throw StateError('Fixture sign-in failed.');diff --git a/desktop/test/link_another_machine_test.dart b/desktop/test/link_another_machine_test.dartindex 00deefcc7..35ac0d8a1 100644--- a/desktop/test/link_another_machine_test.dart+++ b/desktop/test/link_another_machine_test.dart@@ -18,6 +18,15 @@ import 'package:harness/widgets/machines_manager.dart';import 'keymap_host_test.dart' show key, MemoryKeymap;class _Links implements PeerLinkClient {+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(error: 'not used');+final requests = <String>[];@overrideFuture<CliLinkConnectResult> connect(diff --git a/desktop/test/link_machine_widget_test.dart b/desktop/test/link_machine_widget_test.dartindex 9b1ad8c78..f746faa29 100644--- a/desktop/test/link_machine_widget_test.dart+++ b/desktop/test/link_machine_widget_test.dart@@ -13,6 +13,15 @@ import 'package:harness/widgets/link_machine_screen.dart';import 'keymap_host_test.dart' show key;class _FakeCliLink implements CliLink {+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(error: 'not used');+final Future<CliLinkConnectResult> Function(String machineId, String password)onConnect;_FakeCliLink(this.onConnect);diff --git a/desktop/test/login_phone_link_test.dart b/desktop/test/login_phone_link_test.dartnew file mode 100644index 000000000..a6791617d--- /dev/null+++ b/desktop/test/login_phone_link_test.dart@@ -0,0 +1,141 @@+import 'dart:async';++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/auth/auth_session.dart';+import 'package:harness/auth/cli_login.dart';+import 'package:harness/core/config.dart';+import 'package:harness/screens/login_screen.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/state/app_state.dart';++/// `harness login --qr --json`, held open: the test plays the link leg's events itself.+class _PhoneLogin extends CliLogin {+ SignInQrListener? listener;+ @override+ Future<void> login({+ required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,+ }) {+ listener = qr;+ return Completer<void>().future;+ }++ @override+ void cancel() {}+}++/// The sign-in sheet over a guest desk, its QR sign-in started and — as far as the sheet can+/// tell — signed in: what remains is the phone's link, which the test reports.+Future<(AppNotifier, SignInQrListener, Future<bool>)> _signedInByPhone(+ WidgetTester tester,+) async {+ grid.AppTheme.brightness.value = Brightness.light;+ signInSheetStartsQr = true;+ addTearDown(() => signInSheetStartsQr = false);+ final login = _PhoneLogin();+ final app =+ AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ cliLogin: login,+ )+ ..status = AppStatus.authenticated+ ..signedIn = false;+ addTearDown(app.dispose);+ late Future<bool> closed;+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ home: Builder(+ builder: (context) => TextButton(+ onPressed: () => closed = showSignInSheet(context, app),+ child: const Text('open'),+ ),+ ),+ ),+ );+ await tester.tap(find.text('open'));+ await tester.pump();+ await tester.pump();+ app.signedIn = true;+ return (app, login.listener!, closed);+}++String _title(WidgetTester tester) =>+ tester.widget<Text>(find.byKey(const Key('login-title'))).data!;++void main() {+ testWidgets(+ 'the sheet shows the link steps and goes back once the group is synced',+ (tester) async {+ final (app, qr, closed) = await _signedInByPhone(tester);++ qr.onProgress!('linked', {'label': 'Dee’s iPhone'});+ await tester.pump();+ expect(find.byKey(const Key('login-phone-link')), findsOneWidget);+ expect(_title(tester), 'Adding this computer to your devices');+ expect(find.text('Linked with Dee’s iPhone'), findsOneWidget);+ expect(+ find.text('Adding this computer to your devices…'),+ findsOneWidget,+ );+ expect(find.byKey(const Key('login-qr')), findsNothing);++ qr.onProgress!('synced', {+ 'machines': [+ {'machineId': 'a', 'name': 'studio'},+ {'machineId': 'b', 'name': 'box-2'},+ ],+ });+ await tester.pump();+ expect(find.text('Reaches 2 machines: studio · box-2'), findsOneWidget);+ // Held long enough to read, then back to the desk.+ await tester.pump(const Duration(seconds: 1));+ expect(find.byKey(const Key('login-phone-link')), findsOneWidget);+ await tester.pump(const Duration(seconds: 2));+ await tester.pump();+ expect(find.byKey(const Key('login-phone-link')), findsNothing);+ expect(await closed, isTrue);+ expect(app.phoneLink, isNull);+ },+ );++ testWidgets(+ 'a link that stops short says so, then goes back to the desk by itself',+ (tester) async {+ final (app, qr, closed) = await _signedInByPhone(tester);+ qr.onProgress!('linked', {'label': 'Pixel'});+ qr.onProgress!('ended', const {});+ await tester.pump();+ expect(app.phoneLink?.stage, PhoneLinkStage.failed);+ expect(find.byKey(const Key('login-phone-link-error')), findsOneWidget);+ // Long enough to read, then the desk — signed in all the same.+ await tester.pump(const Duration(seconds: 3));+ expect(find.byKey(const Key('login-phone-link')), findsOneWidget);+ await tester.pump(const Duration(seconds: 2));+ await tester.pump();+ expect(find.byKey(const Key('login-phone-link')), findsNothing);+ expect(await closed, isTrue);+ },+ );++ testWidgets('an error result names what went wrong', (tester) async {+ final (app, qr, _) = await _signedInByPhone(tester);+ qr.onProgress!('result', {+ 'status': 'error',+ 'message': 'DAEMON_UNREACHABLE',+ });+ await tester.pump();+ expect(app.phoneLink?.stage, PhoneLinkStage.failed);+ expect(+ tester.widget<Text>(find.byKey(const Key('login-phone-link-error'))).data,+ contains('(DAEMON_UNREACHABLE)'),+ );+ // The sheet moves on by itself; let it.+ await tester.pump(const Duration(seconds: 5));+ await tester.pump();+ await tester.pumpWidget(const SizedBox());+ });+}diff --git a/desktop/test/login_screen_test.dart b/desktop/test/login_screen_test.dartindex f11014d73..09fb60747 100644--- a/desktop/test/login_screen_test.dart+++ b/desktop/test/login_screen_test.dart@@ -1,11 +1,14 @@+import 'dart:async';import 'dart:math' as math;import 'package:flutter/material.dart';+import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/auth/auth_session.dart';import 'package:harness/auth/cli_login.dart';import 'package:harness/core/config.dart';import 'package:harness/screens/login_screen.dart';+import 'package:harness/widgets/add_phone_dialog.dart' show PhonePairQr;import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';import 'package:harness/widgets/login_fleet_map.dart';@@ -42,11 +45,49 @@ class _FailingCliLogin extends CliLogin {@overrideFuture<void> login({required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,}) async {throw CliNotAvailableException('Could not run the harness CLI');}}+/// A sign-in by phone that shows its QR and then waits for the phone — never for a process.+class _QrCliLogin extends CliLogin {+ final attempts = <SignInQrListener?>[];+ @override+ Future<void> login({+ required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,+ }) {+ attempts.add(qr);+ qr?.onQr(+ const SignInQr(+ url: 'https://harness.autonomous.ai/pair#s=ABC&c=DEF&f=0763ADD9&n=box',+ fingerprint: '0763·ADD9·1F78·F90D',+ ),+ );+ return Completer<void>().future;+ }++ @override+ void cancel() {}+}++class _SlowQrCliLogin extends CliLogin {+ SignInQrListener? listener;+ @override+ Future<void> login({+ required void Function(String url) onAuthorizeUrl,+ SignInQrListener? qr,+ }) {+ listener = qr;+ return Completer<void>().future;+ }++ @override+ void cancel() {}+}+AppNotifier _notifier(AppStatus status, {CliLogin? cliLogin}) {grid.AppTheme.brightness.value = Brightness.light;return AppNotifier(@@ -73,6 +114,132 @@ double _contrast(Color a, Color b) {}void main() {+ testWidgets(+ 'signing in by phone shows the QR, its fingerprint, and a way to the browser',+ (tester) async {+ final login = _QrCliLogin();+ final app = _notifier(AppStatus.unauthenticated, cliLogin: login);+ await tester.pumpWidget(_host(app));+ // Asked for explicitly: the desktop app's default stays the browser until the CLI ships it.+ unawaited(app.login(qr: true));+ await tester.pump(const Duration(milliseconds: 100));+ expect(login.attempts.single, isNotNull);+ expect(find.byKey(const Key('login-qr')), findsOneWidget);+ expect(find.byType(PhonePairQr), findsOneWidget);+ expect(find.textContaining('0763·ADD9·1F78·F90D'), findsOneWidget);+ expect(find.text('Waiting for your phone…'), findsOneWidget);+ // How to scan, spelled out: the camera (Harness in the phone's browser) or the app.+ expect(find.byKey(const Key('login-scan-steps')), findsOneWidget);+ expect(find.textContaining('Scan a QR code'), findsOneWidget);++ // The link the QR encodes, for a phone that cannot scan it.+ String? copied;+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ SystemChannels.platform,+ (call) async {+ if (call.method == 'Clipboard.setData') {+ copied = (call.arguments as Map)['text'] as String?;+ }+ return null;+ },+ );+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ SystemChannels.platform,+ null,+ ),+ );+ await tester.ensureVisible(find.byKey(const Key('login-copy-link')));+ await tester.tap(find.byKey(const Key('login-copy-link')));+ await tester.pump();+ expect(copied, startsWith('https://harness.autonomous.ai/pair#s=ABC'));+ expect(find.text('Link copied'), findsOneWidget);++ await tester.ensureVisible(find.byKey(const Key('login-use-browser')));+ await tester.tap(find.byKey(const Key('login-use-browser')));+ await tester.pump(const Duration(milliseconds: 100));+ expect(login.attempts, hasLength(2));+ expect(login.attempts.last, isNull); // the browser's SSO this time+ await tester.pumpWidget(const SizedBox());+ },+ );++ testWidgets(+ 'a sign-in started for the phone holds the QR square before the code arrives',+ (tester) async {+ final login = _SlowQrCliLogin();+ final app = _notifier(AppStatus.unauthenticated, cliLogin: login);+ await tester.pumpWidget(_host(app));+ unawaited(app.login(qr: true));+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.text('Sign in with your phone'), findsOneWidget);+ expect(find.byKey(const Key('login-qr')), findsOneWidget);+ expect(find.byType(PhonePairQr), findsNothing);+ expect(find.text('Preparing your code…'), findsOneWidget);+ expect(find.byType(LoginFleetMap), findsNothing);++ login.listener!.onQr(+ const SignInQr(+ url:+ 'https://harness.autonomous.ai/pair#s=ABC&c=DEF&f=0763ADD9&n=box',+ fingerprint: '0763·ADD9·1F78·F90D',+ ),+ );+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.byType(PhonePairQr), findsOneWidget);+ expect(find.text('Waiting for your phone…'), findsOneWidget);+ await tester.pumpWidget(const SizedBox());+ },+ );++ testWidgets('the sign-in sheet opens straight onto the phone QR', (+ tester,+ ) async {+ signInSheetStartsQr = true;+ addTearDown(() => signInSheetStartsQr = false);+ final login = _SlowQrCliLogin();+ final app = _notifier(AppStatus.authenticated, cliLogin: login)+ ..signedIn = false;+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ home: Builder(+ builder: (context) => TextButton(+ onPressed: () => showSignInSheet(context, app),+ child: const Text('open'),+ ),+ ),+ ),+ );+ await tester.tap(find.text('open'));+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 100));+ expect(login.listener, isNotNull); // nothing pressed but the door+ expect(find.text('Sign in with your phone'), findsOneWidget);+ expect(find.text('Preparing your code…'), findsOneWidget);+ await tester.pumpWidget(const SizedBox());+ });++ testWidgets(+ 'a CLI that predates the QR sign-in opens the browser, and the screen follows',+ (tester) async {+ // `harness login --qr` on an older CLI: it ignores the flag and prints the SSO page instead.+ final app = _notifier(AppStatus.unauthenticated)+ ..signingIn = true+ ..signingInByPhone = true;+ await tester.pumpWidget(_host(app));+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.byKey(const Key('login-qr')), findsOneWidget);++ app.pendingAuthorizeUrl = 'https://auth.example/authorize';+ await tester.pumpWidget(_host(app));+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.byKey(const Key('login-qr')), findsNothing);+ expect(find.text('Sign in with your phone'), findsNothing);+ await tester.pumpWidget(const SizedBox());+ },+ );+testWidgets('idle offers the action and says what it costs', (tester) async {final app = _notifier(AppStatus.unauthenticated);await tester.pumpWidget(_host(app));@@ -99,6 +266,7 @@ void main() {),findsOneWidget,);+ // The desktop app signs in through the browser until the CLI's QR sign-in is released.expect(find.textContaining('Sign in through your browser'), findsOneWidget);expect(find.textContaining('End-to-end encrypted'), findsOneWidget);});diff --git a/desktop/test/machine_list_outage_test.dart b/desktop/test/machine_list_outage_test.dartindex 90f27e88f..567921778 100644--- a/desktop/test/machine_list_outage_test.dart+++ b/desktop/test/machine_list_outage_test.dart@@ -44,7 +44,7 @@ class _Cli extends CliLogin {Future<CliAuthStatus> checkStatus() async =>const CliAuthStatus(loggedIn: true);@override- Future<void> login({void Function(String url)? onAuthorizeUrl}) async {}+ Future<void> login({void Function(String url)? onAuthorizeUrl, SignInQrListener? qr}) async {}@overrideFuture<void> logout() async {}}diff --git a/desktop/test/machine_list_push_test.dart b/desktop/test/machine_list_push_test.dartindex 10055092d..2cba39942 100644--- a/desktop/test/machine_list_push_test.dart+++ b/desktop/test/machine_list_push_test.dart@@ -51,7 +51,7 @@ class _Cli extends CliLogin {Future<CliAuthStatus> checkStatus() async =>const CliAuthStatus(loggedIn: true);@override- Future<void> login({void Function(String url)? onAuthorizeUrl}) async {}+ Future<void> login({void Function(String url)? onAuthorizeUrl, SignInQrListener? qr}) async {}@overrideFuture<void> logout() async {}}diff --git a/desktop/test/pane_machine_unknown_test.dart b/desktop/test/pane_machine_unknown_test.dartindex 9ea796284..1a3a79f03 100644--- a/desktop/test/pane_machine_unknown_test.dart+++ b/desktop/test/pane_machine_unknown_test.dart@@ -52,7 +52,7 @@ class _Cli extends CliLogin {Future<CliAuthStatus> checkStatus() async =>const CliAuthStatus(loggedIn: true);@override- Future<void> login({void Function(String url)? onAuthorizeUrl}) async {}+ Future<void> login({void Function(String url)? onAuthorizeUrl, SignInQrListener? qr}) async {}@overrideFuture<void> logout() async {}}diff --git a/desktop/test/pane_needs_link_test.dart b/desktop/test/pane_needs_link_test.dartindex d032ab830..d0ef1b6a3 100644--- a/desktop/test/pane_needs_link_test.dart+++ b/desktop/test/pane_needs_link_test.dart@@ -19,6 +19,15 @@ import 'package:harness/widgets/pane_grid.dart';import 'swarm_screen_test.dart' show terminal;class _Link implements CliLink {+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(error: 'not used');+_Link(this.onConnect);final Future<CliLinkConnectResult> Function(String machineId, String password)onConnect;diff --git a/desktop/test/profile_startup_test.dart b/desktop/test/profile_startup_test.dartindex 40b644aa1..544f65010 100644--- a/desktop/test/profile_startup_test.dart+++ b/desktop/test/profile_startup_test.dart@@ -38,7 +38,7 @@ class _Cli extends CliLogin {const CliAuthStatus(loggedIn: true);@override- Future<void> login({void Function(String url)? onAuthorizeUrl}) async {}+ Future<void> login({void Function(String url)? onAuthorizeUrl, SignInQrListener? qr}) async {}@overrideFuture<void> logout() async {}diff --git a/desktop/test/signin_recovery_test.dart b/desktop/test/signin_recovery_test.dartindex 5ecc8b6ad..56bdf766e 100644--- a/desktop/test/signin_recovery_test.dart+++ b/desktop/test/signin_recovery_test.dart@@ -21,7 +21,7 @@ class _Cli extends CliLogin {var cancellations = 0;var statusChecks = 0;@override- Future<void> login({required void Function(String) onAuthorizeUrl}) {+ Future<void> login({required void Function(String) onAuthorizeUrl, SignInQrListener? qr}) {final attempt = _Attempt(onAuthorizeUrl);attempts.add(attempt);return attempt.done.future;diff --git a/desktop/test/signout_recovery_test.dart b/desktop/test/signout_recovery_test.dartindex df6079476..49657d2bf 100644--- a/desktop/test/signout_recovery_test.dart+++ b/desktop/test/signout_recovery_test.dart@@ -29,7 +29,7 @@ class SignOutFixture extends CliLogin {}@override- Future<void> login({required void Function(String) onAuthorizeUrl}) async {+ Future<void> login({required void Function(String) onAuthorizeUrl, SignInQrListener? qr}) async {logins++;throw StateError('Fixture login stopped before any external work.');}diff --git a/desktop/test/support/password_cli.dart b/desktop/test/support/password_cli.dartindex 3c28644e0..87557f878 100644--- a/desktop/test/support/password_cli.dart+++ b/desktop/test/support/password_cli.dart@@ -5,6 +5,15 @@ import 'package:harness/auth/cli_link.dart';/// In-memory CLI for password UI/native fixtures. Never invokes a process or/// reads a Harness home. Every password used with this fake is fixture text.class PasswordCli implements CliLink {+ @override+ Future<CliLinkConnectResult> connectWithCode(+ String machineId,+ String code, {+ required String label,+ String? displayName,+ String? expectedFingerprint,+ }) async => const CliLinkConnectResult(error: 'not used');+RemotePasswordStatus status = const RemotePasswordStatus();RemotePasswordSetResult setResult = const RemotePasswordSetResult(fingerprint: '1535·C035·9474·FE9D',diff --git a/desktop/test/viewer/group_sync_test.dart b/desktop/test/viewer/group_sync_test.dartindex db0a81c51..cc53858c2 100644--- a/desktop/test/viewer/group_sync_test.dart+++ b/desktop/test/viewer/group_sync_test.dart@@ -68,8 +68,9 @@ class _Sink implements WebSocketSink {/// manager.ts `onHello` + `wrapRpcReply`, for one session.Future<_Socket> _machine(E2eeIdentity identity,- Map<String, Object?> Function(Map<String, dynamic> request) reply,-) async {+ Map<String, Object?> Function(Map<String, dynamic> request) reply, {+ Future<void> Function()? beforeReply,+}) async {SessionKeys? keys;var counter = 1;return _Socket((socket, frame) async {@@ -120,6 +121,8 @@ Future<_Socket> _machine('group_sync',null,)!;+ final answer = reply(request);+ await beforeReply?.call();socket.emit({'type': 'group_sync_result','payload': wrapPayload(@@ -128,7 +131,7 @@ Future<_Socket> _machine(counter++,'group_sync_result',null,- {'requestId': request['requestId'], ...reply(request)},+ {'requestId': request['requestId'], ...answer},),});}@@ -174,6 +177,33 @@ void main() {},);+ test('a member taken in while a swap is on the network survives the swap\'s write', () async {+ final keys = ViewerKeyStore(storage: _Memory());+ final machine = await E2eeIdentity.generate();+ final browserPub = b64e((await E2eeIdentity.generate()).pub);+ await keys.pin(_machineId, machine.pub);+ // The approval lands while the machine is still answering this swap.+ final socket = await _machine(+ machine,+ (_) => {'members': [], 'removed': []},+ beforeReply: () => admitGroupMember(+ keys,+ GroupMember(pub: browserPub, kind: 'viewer', label: 'Chrome on macOS', at: 99),+ ),+ );+ await syncTrustGroup(+ machineId: _machineId,+ keys: keys,+ accessToken: 't',+ wsBaseUrl: 'wss://relay.test',+ autonomousEnv: 'prod',+ label: 'Studio PC',+ socket: socket.factory,+ );+ final stored = GroupRoster.parse(await keys.groupRoster());+ expect(stored.members.map((m) => m.pub), contains(browserPub));+ });+test('the merge matches the CLI: tombstones beat older entries, newer links beat tombstones', () async {final self = b64e((await E2eeIdentity.generate()).pub);final pub = b64e((await E2eeIdentity.generate()).pub);@@ -205,4 +235,98 @@ void main() {);expect(back.roster.members.single.at, 11);});++ group('a browser signing in by phone', () {+ test(+ 'the phone hands it its group, sealed so only the QR\'s code opens it',+ () async {+ final phone = ViewerKeyStore(storage: _Memory());+ final browser = ViewerKeyStore(storage: _Memory());+ final machinePub = Uint8List.fromList(List.generate(32, (i) => i + 7));+ await phone.pin('a' * 32, machinePub, label: 'studio');++ final roster = await handoffRoster(phone, selfLabel: 'iPhone');+ final sealed = sealHandedRoster(+ roster,+ code: 'ABCDEFGHJKMNPQRS',+ userCode: 'U1',+ );+ // Another code, or the same code for another request, opens nothing.+ expect(+ openHandedRoster(sealed, code: 'ABCDEFGHJKMNPQRT', userCode: 'U1'),+ isNull,+ );+ expect(+ openHandedRoster(sealed, code: 'ABCDEFGHJKMNPQRS', userCode: 'U2'),+ isNull,+ );+ final tampered = b64d(sealed)..[3] ^= 1;+ expect(+ openHandedRoster(+ b64e(tampered),+ code: 'ABCDEFGHJKMNPQRS',+ userCode: 'U1',+ ),+ isNull,+ );++ final raw = openHandedRoster(+ sealed,+ code: 'abcdefghjkmnpqrs',+ userCode: 'U1',+ );+ final outcome = await adoptHandedRoster(browser, raw);+ expect(outcome.pinned, ['a' * 32]);+ expect((await browser.peer('a' * 32))!.pub, machinePub);+ // The phone is in the browser's roster too: the two trust each other from the start.+ final stored = GroupRoster.parse(await browser.groupRoster());+ expect(+ stored.members.map((m) => m.pub),+ contains(b64e((await phone.identity()).pub)),+ );+ },+ );++ test(+ 'the phone takes the browser into its own roster, for its next sync',+ () async {+ final phone = ViewerKeyStore(storage: _Memory());+ final browserPub = b64e((await E2eeIdentity.generate()).pub);+ await admitGroupMember(+ phone,+ GroupMember(+ pub: browserPub,+ kind: 'viewer',+ label: 'Chrome on macOS',+ at: 5,+ ),+ );+ final stored = GroupRoster.parse(await phone.groupRoster());+ expect(stored.members.map((m) => m.pub), [browserPub]);+ },+ );+ });++ test('a handed roster seals to the bytes the CLI opens', () {+ // The same vector as cli/src/lib/e2ee/handedRoster.spec.ts: the CLI opens what the phones seal.+ const vector =+ 'MCsWzwhdskkULflZqvr/unR+ynpfBWQdAE3GXwh+/8m83dSl5Ec/JCojguagCCL91gghdXqGphL7tgaRHbJO11qaAJAvrguTW6XwhFjtK3V785T2LWibIeRWCjBsrJ+FCPGtbK+6qTS0dmFWPNyB41Jm7Qc1ICGuXKVLNort+YXR3uMh+sx16TlHddBqkbn1rkZE7O+MiYfFSiwjAw2+hTwIiBmSzZAi7wEn99u/22/yMpp83cH6a8tZzVZvyKBSZ0hIVfE=';+ final roster = GroupRoster([+ GroupMember(+ pub: '${'A' * 43}=',+ kind: 'machine',+ label: 'studio',+ at: 1700000000000,+ machineId: 'a' * 32,+ ),+ ], const []);+ expect(+ sealHandedRoster(+ roster,+ code: 'ABCDEFGHJKMNPQRS',+ userCode: 'VECTORUSERCODE',+ ),+ vector,+ );+ });}diff --git a/desktop/test/viewer/pending_pair_test.dart b/desktop/test/viewer/pending_pair_test.dartnew file mode 100644index 000000000..fa9259f19--- /dev/null+++ b/desktop/test/viewer/pending_pair_test.dart@@ -0,0 +1,73 @@+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/viewer/connect_code.dart';+import 'package:harness/viewer/pending_pair.dart';++/// A machine's QR opened by a phone's camera lands here as `/pair#…`; the web app holds the code+/// across sign-in. These are the rules for what it holds, and for how long.+void main() {+ final t0 = DateTime(2026, 9, 28, 12);+ final link = ConnectCode.link(+ '[email protected]',+ machineId: 'a' * 32,+ pairCode: 'ABCDEFGHJKMNPQRS',+ fingerprint: '5F8061C46142ADCF',+ hostname: 'box 2',+ );++ test(+ 'any host serving the app takes a /pair link; the fragment is the code',+ () {+ for (final host in [+ 'harness.autonomous.ai',+ 'localhost:8080',+ 'stag.harness.example',+ ]) {+ final base = Uri.parse(+ link.replaceFirst('harness.autonomous.ai', host),+ );+ final pending = PendingPair.fromUri(base, t0)!;+ expect(pending.code.machineId, 'a' * 32);+ expect(pending.code.pairCode, 'ABCDEFGHJKMNPQRS');+ expect(pending.code.fingerprint, '5F8061C46142ADCF');+ expect(pending.code.hostname, 'box 2');+ }+ },+ );++ test('anything else is not a pending pair', () {+ expect(+ PendingPair.fromUri(Uri.parse('https://harness.autonomous.ai/'), t0),+ isNull,+ );+ expect(+ PendingPair.fromUri(+ Uri.parse('https://harness.autonomous.ai/s/abc#key=x'),+ t0,+ ),+ isNull,+ );+ // A code that cannot pair (no machine or no pairing code) is not held.+ expect(+ PendingPair.fromUri(Uri.parse(ConnectCode.link('[email protected]')), t0),+ isNull,+ );+ expect(+ PendingPair.fromUri(+ Uri.parse('https://harness.autonomous.ai/pair#junk'),+ t0,+ ),+ isNull,+ );+ });++ test('survives the sign-in round trip, and goes stale after its window', () {+ final pending = PendingPair.fromUri(Uri.parse(link), t0)!;+ final back = PendingPair.decode(pending.encode())!;+ expect(back.code.fingerprint, '5F8061C46142ADCF');+ expect(back.capturedAt, t0);+ expect(back.isExpired(t0.add(const Duration(minutes: 2))), isFalse);+ expect(back.isExpired(t0.add(PendingPair.ttl)), isTrue);+ expect(PendingPair.decode(null), isNull);+ expect(PendingPair.decode('not json'), isNull);+ });+}diff --git a/desktop/test/web_qr_sign_in_test.dart b/desktop/test/web_qr_sign_in_test.dartnew file mode 100644index 000000000..80da5b6db--- /dev/null+++ b/desktop/test/web_qr_sign_in_test.dart@@ -0,0 +1,192 @@+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/auth/cli_login.dart' show SignInQr;+import 'package:harness/core/config.dart';+import 'package:harness/core/web_form_factor.dart';+import 'package:harness/viewer/connect_code.dart';+import 'package:harness/viewer/direct_auth_api.dart';+import 'package:harness/viewer/qr_sign_in.dart';++/// The backend's device-auth, scripted: each start mints the next request; polls answer in order.+class _Api extends DirectAuthApi {+ _Api(this.answers) : super(config: AppConfig.dev);+ final List<SignInRequestAnswer> answers;+ final started = <(String, String, String)>[];+ final polled = <String>[];++ @override+ Future<SignInRequest> startSignInRequest({+ required String label,+ required String fingerprint,+ required String pub,+ }) async {+ started.add((label, fingerprint, pub));+ return SignInRequest(+ userCode: 'USER${started.length}',+ deviceCode: 'dev${started.length}',+ expiresIn: const Duration(seconds: 16),+ );+ }++ @override+ Future<SignInRequestAnswer> pollSignInRequest(String deviceCode) async {+ polled.add(deviceCode);+ return answers.isEmpty+ ? const SignInRequestAnswer.pending()+ : answers.removeAt(0);+ }+}++WebQrSignIn _signIn(_Api api) {+ var n = 0;+ return WebQrSignIn(+ api: api,+ fingerprint: 'AB12·CD34·EF56·7890',+ pub: 'PUBKEY=',+ label: 'Chrome on macOS',+ linkBase: Uri.parse('http://127.0.0.1:8080'),+ mintCode: () => 'ABCDEFGHJKMNPQR${++n}',+ sleep: (_) async {},+ );+}++void main() {+ test('shows a browser QR, and hands back the session and the phone\'s group once approved', () async {+ final api = _Api([+ const SignInRequestAnswer.pending(),+ const SignInRequestAnswer.approved(+ IssuedTokens(token: 'hna_x', refreshToken: 'hnr_x'),+ sealedRoster: 'c2VhbGVk',+ ),+ ]);+ final qrs = <SignInQr>[];+ final result = await _signIn(api).run(onQr: qrs.add, current: () => true);++ expect(api.started, [('Chrome on macOS', 'AB12CD34EF567890', 'PUBKEY=')]);+ expect(qrs, hasLength(1));+ final code = ConnectCode.parse(qrs.single.url)!;+ expect(code.isViewerSignIn, isTrue);+ expect(code.signInRequest, 'USER1');+ expect(code.pairCode, 'ABCDEFGHJKMNPQR1');+ expect(code.fingerprint, 'AB12CD34EF567890');+ expect(code.hostname, 'Chrome on macOS');+ // Lands on this build, so a phone's camera opens a build that can approve it.+ expect(Uri.parse(qrs.single.url).origin, 'http://127.0.0.1:8080');++ expect(result.tokens.token, 'hna_x');+ expect(result.code, 'ABCDEFGHJKMNPQR1');+ expect(result.userCode, 'USER1');+ expect(result.sealedRoster, 'c2VhbGVk');+ });++ test(+ 'an expired request is replaced with a fresh one, and a fresh QR',+ () async {+ final api = _Api([+ const SignInRequestAnswer.expired(),+ const SignInRequestAnswer.approved(IssuedTokens(token: 't')),+ ]);+ final qrs = <SignInQr>[];+ final result = await _signIn(api).run(onQr: qrs.add, current: () => true);+ expect(qrs.map((q) => ConnectCode.parse(q.url)!.signInRequest), [+ 'USER1',+ 'USER2',+ ]);+ expect(result.code, 'ABCDEFGHJKMNPQR2');+ },+ );++ test('a request left unanswered is redrawn before it expires', () async {+ final api = _Api([+ for (var i = 0; i < 3; i++) const SignInRequestAnswer.pending(),+ const SignInRequestAnswer.approved(IssuedTokens(token: 't')),+ ]);+ final qrs = <SignInQr>[];+ await _signIn(api).run(onQr: qrs.add, current: () => true);+ // 16 s requests, replaced 10 s early, polled every 2 s: three polls per QR.+ expect(qrs, hasLength(2));+ expect(api.polled, ['dev1', 'dev1', 'dev1', 'dev2']);+ });++ test('"Not me" on the phone ends it, and so does a cancel here', () async {+ await expectLater(+ _signIn(_Api([const SignInRequestAnswer.denied()]))+ .run(onQr: (_) {}, current: () => true),+ throwsA(+ isA<DirectAuthException>().having(+ (e) => e.message,+ 'message',+ contains('Declined'),+ ),+ ),+ );+ var live = true;+ await expectLater(+ _signIn(_Api([])).run(onQr: (_) => live = false, current: () => live),+ throwsA(isA<DirectAuthException>()),+ );+ });++ group('web form factor', () {+ test('a phone browser is web mobile; a tablet or a laptop is not', () {+ expect(+ mobileUserAgent(+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) Mobile/15E148 Safari/604.1',+ ),+ isTrue,+ );+ expect(+ mobileUserAgent(+ 'Mozilla/5.0 (Linux; Android 15; Pixel 9) Chrome/130.0 Mobile Safari/537.36',+ ),+ isTrue,+ );+ expect(+ mobileUserAgent(+ 'Mozilla/5.0 (Linux; Android 14; SM-X910) Chrome/130.0 Safari/537.36',+ ),+ isFalse,+ );+ expect(+ mobileUserAgent(+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/130.0 Safari/537.36',+ ),+ isFalse,+ );+ });++ test('names the browser and its OS', () {+ expect(+ browserLabelFrom(+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 Chrome/130.0 Safari/537.36',+ ),+ 'Chrome on macOS',+ );+ expect(+ browserLabelFrom(+ 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 Chrome/130.0 Safari/537.36 Edg/130.0',+ ),+ 'Edge on Windows',+ );+ expect(+ browserLabelFrom(+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 Version/18.0 Safari/605.1.15',+ ),+ 'Safari on macOS',+ );+ expect(+ browserLabelFrom(+ 'Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0',+ ),+ 'Firefox on Linux',+ );+ expect(browserLabelFrom(''), 'Web browser');+ });++ test('native builds are never web mobile, and tests can pick one', () {+ expect(isMobileWeb, isFalse);+ debugMobileWebOverride = true;+ addTearDown(() => debugMobileWebOverride = null);+ expect(isMobileWeb, isTrue);+ });+ });+}diff --git a/desktop/test/workspace_account_lifecycle_test.dart b/desktop/test/workspace_account_lifecycle_test.dartindex 555e5baa4..e680cf9c8 100644--- a/desktop/test/workspace_account_lifecycle_test.dart+++ b/desktop/test/workspace_account_lifecycle_test.dart@@ -25,7 +25,7 @@ class WorkspaceAccountLogin extends CliLogin {@overrideFuture<void> logout() async {}@override- Future<void> login({required void Function(String) onAuthorizeUrl}) async {+ Future<void> login({required void Function(String) onAuthorizeUrl, SignInQrListener? qr}) async {logins++;}diff --git a/desktop/web/vendor/README.md b/desktop/web/vendor/README.mdnew file mode 100644index 000000000..ac7738f61--- /dev/null+++ b/desktop/web/vendor/README.md@@ -0,0 +1,6 @@+# Vendored browser scripts++- `jsQR.js` — [jsQR](https://github.com/cozmo/jsQR) 1.4.0, Apache-2.0 (`jsQR.LICENSE`). Decodes QR codes+ from camera frames for the in-app "Scan its code" (`lib/viewer/qr_scanner_web.dart`) on browsers+ without the native `BarcodeDetector` (iOS Safari). Loaded on demand only, and served from this+ origin rather than a CDN: this page holds the browser's E2EE keys.diff --git a/desktop/web/vendor/jsQR.LICENSE b/desktop/web/vendor/jsQR.LICENSEnew file mode 100644index 000000000..8f71f43fe--- /dev/null+++ b/desktop/web/vendor/jsQR.LICENSE@@ -0,0 +1,202 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "{}"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright {yyyy} {name of copyright owner}++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+diff --git a/desktop/web/vendor/jsQR.js b/desktop/web/vendor/jsQR.jsnew file mode 100644index 000000000..429896a9d--- /dev/null+++ b/desktop/web/vendor/jsQR.js@@ -0,0 +1,10102 @@+(function webpackUniversalModuleDefinition(root, factory) {+ if(typeof exports === 'object' && typeof module === 'object')+ module.exports = factory();+ else if(typeof define === 'function' && define.amd)+ define([], factory);+ else if(typeof exports === 'object')+ exports["jsQR"] = factory();+ else+ root["jsQR"] = factory();+})(typeof self !== 'undefined' ? self : this, function() {+return /******/ (function(modules) { // webpackBootstrap+/******/ // The module cache+/******/ var installedModules = {};+/******/+/******/ // The require function+/******/ function __webpack_require__(moduleId) {+/******/+/******/ // Check if module is in cache+/******/ if(installedModules[moduleId]) {+/******/ return installedModules[moduleId].exports;+/******/ }+/******/ // Create a new module (and put it into the cache)+/******/ var module = installedModules[moduleId] = {+/******/ i: moduleId,+/******/ l: false,+/******/ exports: {}+/******/ };+/******/+/******/ // Execute the module function+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);+/******/+/******/ // Flag the module as loaded+/******/ module.l = true;+/******/+/******/ // Return the exports of the module+/******/ return module.exports;+/******/ }+/******/+/******/+/******/ // expose the modules object (__webpack_modules__)+/******/ __webpack_require__.m = modules;+/******/+/******/ // expose the module cache+/******/ __webpack_require__.c = installedModules;+/******/+/******/ // define getter function for harmony exports+/******/ __webpack_require__.d = function(exports, name, getter) {+/******/ if(!__webpack_require__.o(exports, name)) {+/******/ Object.defineProperty(exports, name, {+/******/ configurable: false,+/******/ enumerable: true,+/******/ get: getter+/******/ });+/******/ }+/******/ };+/******/+/******/ // getDefaultExport function for compatibility with non-harmony modules+/******/ __webpack_require__.n = function(module) {+/******/ var getter = module && module.__esModule ?+/******/ function getDefault() { return module['default']; } :+/******/ function getModuleExports() { return module; };+/******/ __webpack_require__.d(getter, 'a', getter);+/******/ return getter;+/******/ };+/******/+/******/ // Object.prototype.hasOwnProperty.call+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };+/******/+/******/ // __webpack_public_path__+/******/ __webpack_require__.p = "";+/******/+/******/ // Load entry module and return exports+/******/ return __webpack_require__(__webpack_require__.s = 3);+/******/ })+/************************************************************************/+/******/ ([+/* 0 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var BitMatrix = /** @class */ (function () {+ function BitMatrix(data, width) {+ this.width = width;+ this.height = data.length / width;+ this.data = data;+ }+ BitMatrix.createEmpty = function (width, height) {+ return new BitMatrix(new Uint8ClampedArray(width * height), width);+ };+ BitMatrix.prototype.get = function (x, y) {+ if (x < 0 || x >= this.width || y < 0 || y >= this.height) {+ return false;+ }+ return !!this.data[y * this.width + x];+ };+ BitMatrix.prototype.set = function (x, y, v) {+ this.data[y * this.width + x] = v ? 1 : 0;+ };+ BitMatrix.prototype.setRegion = function (left, top, width, height, v) {+ for (var y = top; y < top + height; y++) {+ for (var x = left; x < left + width; x++) {+ this.set(x, y, !!v);+ }+ }+ };+ return BitMatrix;+}());+exports.BitMatrix = BitMatrix;+++/***/ }),+/* 1 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var GenericGFPoly_1 = __webpack_require__(2);+function addOrSubtractGF(a, b) {+ return a ^ b; // tslint:disable-line:no-bitwise+}+exports.addOrSubtractGF = addOrSubtractGF;+var GenericGF = /** @class */ (function () {+ function GenericGF(primitive, size, genBase) {+ this.primitive = primitive;+ this.size = size;+ this.generatorBase = genBase;+ this.expTable = new Array(this.size);+ this.logTable = new Array(this.size);+ var x = 1;+ for (var i = 0; i < this.size; i++) {+ this.expTable[i] = x;+ x = x * 2;+ if (x >= this.size) {+ x = (x ^ this.primitive) & (this.size - 1); // tslint:disable-line:no-bitwise+ }+ }+ for (var i = 0; i < this.size - 1; i++) {+ this.logTable[this.expTable[i]] = i;+ }+ this.zero = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([0]));+ this.one = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([1]));+ }+ GenericGF.prototype.multiply = function (a, b) {+ if (a === 0 || b === 0) {+ return 0;+ }+ return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)];+ };+ GenericGF.prototype.inverse = function (a) {+ if (a === 0) {+ throw new Error("Can't invert 0");+ }+ return this.expTable[this.size - this.logTable[a] - 1];+ };+ GenericGF.prototype.buildMonomial = function (degree, coefficient) {+ if (degree < 0) {+ throw new Error("Invalid monomial degree less than 0");+ }+ if (coefficient === 0) {+ return this.zero;+ }+ var coefficients = new Uint8ClampedArray(degree + 1);+ coefficients[0] = coefficient;+ return new GenericGFPoly_1.default(this, coefficients);+ };+ GenericGF.prototype.log = function (a) {+ if (a === 0) {+ throw new Error("Can't take log(0)");+ }+ return this.logTable[a];+ };+ GenericGF.prototype.exp = function (a) {+ return this.expTable[a];+ };+ return GenericGF;+}());+exports.default = GenericGF;+++/***/ }),+/* 2 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var GenericGF_1 = __webpack_require__(1);+var GenericGFPoly = /** @class */ (function () {+ function GenericGFPoly(field, coefficients) {+ if (coefficients.length === 0) {+ throw new Error("No coefficients.");+ }+ this.field = field;+ var coefficientsLength = coefficients.length;+ if (coefficientsLength > 1 && coefficients[0] === 0) {+ // Leading term must be non-zero for anything except the constant polynomial "0"+ var firstNonZero = 1;+ while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {+ firstNonZero++;+ }+ if (firstNonZero === coefficientsLength) {+ this.coefficients = field.zero.coefficients;+ }+ else {+ this.coefficients = new Uint8ClampedArray(coefficientsLength - firstNonZero);+ for (var i = 0; i < this.coefficients.length; i++) {+ this.coefficients[i] = coefficients[firstNonZero + i];+ }+ }+ }+ else {+ this.coefficients = coefficients;+ }+ }+ GenericGFPoly.prototype.degree = function () {+ return this.coefficients.length - 1;+ };+ GenericGFPoly.prototype.isZero = function () {+ return this.coefficients[0] === 0;+ };+ GenericGFPoly.prototype.getCoefficient = function (degree) {+ return this.coefficients[this.coefficients.length - 1 - degree];+ };+ GenericGFPoly.prototype.addOrSubtract = function (other) {+ var _a;+ if (this.isZero()) {+ return other;+ }+ if (other.isZero()) {+ return this;+ }+ var smallerCoefficients = this.coefficients;+ var largerCoefficients = other.coefficients;+ if (smallerCoefficients.length > largerCoefficients.length) {+ _a = [largerCoefficients, smallerCoefficients], smallerCoefficients = _a[0], largerCoefficients = _a[1];+ }+ var sumDiff = new Uint8ClampedArray(largerCoefficients.length);+ var lengthDiff = largerCoefficients.length - smallerCoefficients.length;+ for (var i = 0; i < lengthDiff; i++) {+ sumDiff[i] = largerCoefficients[i];+ }+ for (var i = lengthDiff; i < largerCoefficients.length; i++) {+ sumDiff[i] = GenericGF_1.addOrSubtractGF(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);+ }+ return new GenericGFPoly(this.field, sumDiff);+ };+ GenericGFPoly.prototype.multiply = function (scalar) {+ if (scalar === 0) {+ return this.field.zero;+ }+ if (scalar === 1) {+ return this;+ }+ var size = this.coefficients.length;+ var product = new Uint8ClampedArray(size);+ for (var i = 0; i < size; i++) {+ product[i] = this.field.multiply(this.coefficients[i], scalar);+ }+ return new GenericGFPoly(this.field, product);+ };+ GenericGFPoly.prototype.multiplyPoly = function (other) {+ if (this.isZero() || other.isZero()) {+ return this.field.zero;+ }+ var aCoefficients = this.coefficients;+ var aLength = aCoefficients.length;+ var bCoefficients = other.coefficients;+ var bLength = bCoefficients.length;+ var product = new Uint8ClampedArray(aLength + bLength - 1);+ for (var i = 0; i < aLength; i++) {+ var aCoeff = aCoefficients[i];+ for (var j = 0; j < bLength; j++) {+ product[i + j] = GenericGF_1.addOrSubtractGF(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));+ }+ }+ return new GenericGFPoly(this.field, product);+ };+ GenericGFPoly.prototype.multiplyByMonomial = function (degree, coefficient) {+ if (degree < 0) {+ throw new Error("Invalid degree less than 0");+ }+ if (coefficient === 0) {+ return this.field.zero;+ }+ var size = this.coefficients.length;+ var product = new Uint8ClampedArray(size + degree);+ for (var i = 0; i < size; i++) {+ product[i] = this.field.multiply(this.coefficients[i], coefficient);+ }+ return new GenericGFPoly(this.field, product);+ };+ GenericGFPoly.prototype.evaluateAt = function (a) {+ var result = 0;+ if (a === 0) {+ // Just return the x^0 coefficient+ return this.getCoefficient(0);+ }+ var size = this.coefficients.length;+ if (a === 1) {+ // Just the sum of the coefficients+ this.coefficients.forEach(function (coefficient) {+ result = GenericGF_1.addOrSubtractGF(result, coefficient);+ });+ return result;+ }+ result = this.coefficients[0];+ for (var i = 1; i < size; i++) {+ result = GenericGF_1.addOrSubtractGF(this.field.multiply(a, result), this.coefficients[i]);+ }+ return result;+ };+ return GenericGFPoly;+}());+exports.default = GenericGFPoly;+++/***/ }),+/* 3 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var binarizer_1 = __webpack_require__(4);+var decoder_1 = __webpack_require__(5);+var extractor_1 = __webpack_require__(11);+var locator_1 = __webpack_require__(12);+function scan(matrix) {+ var locations = locator_1.locate(matrix);+ if (!locations) {+ return null;+ }+ for (var _i = 0, locations_1 = locations; _i < locations_1.length; _i++) {+ var location_1 = locations_1[_i];+ var extracted = extractor_1.extract(matrix, location_1);+ var decoded = decoder_1.decode(extracted.matrix);+ if (decoded) {+ return {+ binaryData: decoded.bytes,+ data: decoded.text,+ chunks: decoded.chunks,+ version: decoded.version,+ location: {+ topRightCorner: extracted.mappingFunction(location_1.dimension, 0),+ topLeftCorner: extracted.mappingFunction(0, 0),+ bottomRightCorner: extracted.mappingFunction(location_1.dimension, location_1.dimension),+ bottomLeftCorner: extracted.mappingFunction(0, location_1.dimension),+ topRightFinderPattern: location_1.topRight,+ topLeftFinderPattern: location_1.topLeft,+ bottomLeftFinderPattern: location_1.bottomLeft,+ bottomRightAlignmentPattern: location_1.alignmentPattern,+ },+ };+ }+ }+ return null;+}+var defaultOptions = {+ inversionAttempts: "attemptBoth",+};+function jsQR(data, width, height, providedOptions) {+ if (providedOptions === void 0) { providedOptions = {}; }+ var options = defaultOptions;+ Object.keys(options || {}).forEach(function (opt) {+ options[opt] = providedOptions[opt] || options[opt];+ });+ var shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst";+ var tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";+ var _a = binarizer_1.binarize(data, width, height, shouldInvert), binarized = _a.binarized, inverted = _a.inverted;+ var result = scan(tryInvertedFirst ? inverted : binarized);+ if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {+ result = scan(tryInvertedFirst ? binarized : inverted);+ }+ return result;+}+jsQR.default = jsQR;+exports.default = jsQR;+++/***/ }),+/* 4 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var BitMatrix_1 = __webpack_require__(0);+var REGION_SIZE = 8;+var MIN_DYNAMIC_RANGE = 24;+function numBetween(value, min, max) {+ return value < min ? min : value > max ? max : value;+}+// Like BitMatrix but accepts arbitry Uint8 values+var Matrix = /** @class */ (function () {+ function Matrix(width, height) {+ this.width = width;+ this.data = new Uint8ClampedArray(width * height);+ }+ Matrix.prototype.get = function (x, y) {+ return this.data[y * this.width + x];+ };+ Matrix.prototype.set = function (x, y, value) {+ this.data[y * this.width + x] = value;+ };+ return Matrix;+}());+function binarize(data, width, height, returnInverted) {+ if (data.length !== width * height * 4) {+ throw new Error("Malformed data passed to binarizer.");+ }+ // Convert image to greyscale+ var greyscalePixels = new Matrix(width, height);+ for (var x = 0; x < width; x++) {+ for (var y = 0; y < height; y++) {+ var r = data[((y * width + x) * 4) + 0];+ var g = data[((y * width + x) * 4) + 1];+ var b = data[((y * width + x) * 4) + 2];+ greyscalePixels.set(x, y, 0.2126 * r + 0.7152 * g + 0.0722 * b);+ }+ }+ var horizontalRegionCount = Math.ceil(width / REGION_SIZE);+ var verticalRegionCount = Math.ceil(height / REGION_SIZE);+ var blackPoints = new Matrix(horizontalRegionCount, verticalRegionCount);+ for (var verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) {+ for (var hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) {+ var sum = 0;+ var min = Infinity;+ var max = 0;+ for (var y = 0; y < REGION_SIZE; y++) {+ for (var x = 0; x < REGION_SIZE; x++) {+ var pixelLumosity = greyscalePixels.get(hortizontalRegion * REGION_SIZE + x, verticalRegion * REGION_SIZE + y);+ sum += pixelLumosity;+ min = Math.min(min, pixelLumosity);+ max = Math.max(max, pixelLumosity);+ }+ }+ var average = sum / (Math.pow(REGION_SIZE, 2));+ if (max - min <= MIN_DYNAMIC_RANGE) {+ // If variation within the block is low, assume this is a block with only light or only+ // dark pixels. In that case we do not want to use the average, as it would divide this+ // low contrast area into black and white pixels, essentially creating data out of noise.+ //+ // Default the blackpoint for these blocks to be half the min - effectively white them out+ average = min / 2;+ if (verticalRegion > 0 && hortizontalRegion > 0) {+ // Correct the "white background" assumption for blocks that have neighbors by comparing+ // the pixels in this block to the previously calculated black points. This is based on+ // the fact that dark barcode symbology is always surrounded by some amount of light+ // background for which reasonable black point estimates were made. The bp estimated at+ // the boundaries is used for the interior.+ // The (min < bp) is arbitrary but works better than other heuristics that were tried.+ var averageNeighborBlackPoint = (blackPoints.get(hortizontalRegion, verticalRegion - 1) ++ (2 * blackPoints.get(hortizontalRegion - 1, verticalRegion)) ++ blackPoints.get(hortizontalRegion - 1, verticalRegion - 1)) / 4;+ if (min < averageNeighborBlackPoint) {+ average = averageNeighborBlackPoint;+ }+ }+ }+ blackPoints.set(hortizontalRegion, verticalRegion, average);+ }+ }+ var binarized = BitMatrix_1.BitMatrix.createEmpty(width, height);+ var inverted = null;+ if (returnInverted) {+ inverted = BitMatrix_1.BitMatrix.createEmpty(width, height);+ }+ for (var verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) {+ for (var hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) {+ var left = numBetween(hortizontalRegion, 2, horizontalRegionCount - 3);+ var top_1 = numBetween(verticalRegion, 2, verticalRegionCount - 3);+ var sum = 0;+ for (var xRegion = -2; xRegion <= 2; xRegion++) {+ for (var yRegion = -2; yRegion <= 2; yRegion++) {+ sum += blackPoints.get(left + xRegion, top_1 + yRegion);+ }+ }+ var threshold = sum / 25;+ for (var xRegion = 0; xRegion < REGION_SIZE; xRegion++) {+ for (var yRegion = 0; yRegion < REGION_SIZE; yRegion++) {+ var x = hortizontalRegion * REGION_SIZE + xRegion;+ var y = verticalRegion * REGION_SIZE + yRegion;+ var lum = greyscalePixels.get(x, y);+ binarized.set(x, y, lum <= threshold);+ if (returnInverted) {+ inverted.set(x, y, !(lum <= threshold));+ }+ }+ }+ }+ }+ if (returnInverted) {+ return { binarized: binarized, inverted: inverted };+ }+ return { binarized: binarized };+}+exports.binarize = binarize;+++/***/ }),+/* 5 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var BitMatrix_1 = __webpack_require__(0);+var decodeData_1 = __webpack_require__(6);+var reedsolomon_1 = __webpack_require__(9);+var version_1 = __webpack_require__(10);+// tslint:disable:no-bitwise+function numBitsDiffering(x, y) {+ var z = x ^ y;+ var bitCount = 0;+ while (z) {+ bitCount++;+ z &= z - 1;+ }+ return bitCount;+}+function pushBit(bit, byte) {+ return (byte << 1) | bit;+}+// tslint:enable:no-bitwise+var FORMAT_INFO_TABLE = [+ { bits: 0x5412, formatInfo: { errorCorrectionLevel: 1, dataMask: 0 } },+ { bits: 0x5125, formatInfo: { errorCorrectionLevel: 1, dataMask: 1 } },+ { bits: 0x5E7C, formatInfo: { errorCorrectionLevel: 1, dataMask: 2 } },+ { bits: 0x5B4B, formatInfo: { errorCorrectionLevel: 1, dataMask: 3 } },+ { bits: 0x45F9, formatInfo: { errorCorrectionLevel: 1, dataMask: 4 } },+ { bits: 0x40CE, formatInfo: { errorCorrectionLevel: 1, dataMask: 5 } },+ { bits: 0x4F97, formatInfo: { errorCorrectionLevel: 1, dataMask: 6 } },+ { bits: 0x4AA0, formatInfo: { errorCorrectionLevel: 1, dataMask: 7 } },+ { bits: 0x77C4, formatInfo: { errorCorrectionLevel: 0, dataMask: 0 } },+ { bits: 0x72F3, formatInfo: { errorCorrectionLevel: 0, dataMask: 1 } },+ { bits: 0x7DAA, formatInfo: { errorCorrectionLevel: 0, dataMask: 2 } },+ { bits: 0x789D, formatInfo: { errorCorrectionLevel: 0, dataMask: 3 } },+ { bits: 0x662F, formatInfo: { errorCorrectionLevel: 0, dataMask: 4 } },+ { bits: 0x6318, formatInfo: { errorCorrectionLevel: 0, dataMask: 5 } },+ { bits: 0x6C41, formatInfo: { errorCorrectionLevel: 0, dataMask: 6 } },+ { bits: 0x6976, formatInfo: { errorCorrectionLevel: 0, dataMask: 7 } },+ { bits: 0x1689, formatInfo: { errorCorrectionLevel: 3, dataMask: 0 } },+ { bits: 0x13BE, formatInfo: { errorCorrectionLevel: 3, dataMask: 1 } },+ { bits: 0x1CE7, formatInfo: { errorCorrectionLevel: 3, dataMask: 2 } },+ { bits: 0x19D0, formatInfo: { errorCorrectionLevel: 3, dataMask: 3 } },+ { bits: 0x0762, formatInfo: { errorCorrectionLevel: 3, dataMask: 4 } },+ { bits: 0x0255, formatInfo: { errorCorrectionLevel: 3, dataMask: 5 } },+ { bits: 0x0D0C, formatInfo: { errorCorrectionLevel: 3, dataMask: 6 } },+ { bits: 0x083B, formatInfo: { errorCorrectionLevel: 3, dataMask: 7 } },+ { bits: 0x355F, formatInfo: { errorCorrectionLevel: 2, dataMask: 0 } },+ { bits: 0x3068, formatInfo: { errorCorrectionLevel: 2, dataMask: 1 } },+ { bits: 0x3F31, formatInfo: { errorCorrectionLevel: 2, dataMask: 2 } },+ { bits: 0x3A06, formatInfo: { errorCorrectionLevel: 2, dataMask: 3 } },+ { bits: 0x24B4, formatInfo: { errorCorrectionLevel: 2, dataMask: 4 } },+ { bits: 0x2183, formatInfo: { errorCorrectionLevel: 2, dataMask: 5 } },+ { bits: 0x2EDA, formatInfo: { errorCorrectionLevel: 2, dataMask: 6 } },+ { bits: 0x2BED, formatInfo: { errorCorrectionLevel: 2, dataMask: 7 } },+];+var DATA_MASKS = [+ function (p) { return ((p.y + p.x) % 2) === 0; },+ function (p) { return (p.y % 2) === 0; },+ function (p) { return p.x % 3 === 0; },+ function (p) { return (p.y + p.x) % 3 === 0; },+ function (p) { return (Math.floor(p.y / 2) + Math.floor(p.x / 3)) % 2 === 0; },+ function (p) { return ((p.x * p.y) % 2) + ((p.x * p.y) % 3) === 0; },+ function (p) { return ((((p.y * p.x) % 2) + (p.y * p.x) % 3) % 2) === 0; },+ function (p) { return ((((p.y + p.x) % 2) + (p.y * p.x) % 3) % 2) === 0; },+];+function buildFunctionPatternMask(version) {+ var dimension = 17 + 4 * version.versionNumber;+ var matrix = BitMatrix_1.BitMatrix.createEmpty(dimension, dimension);+ matrix.setRegion(0, 0, 9, 9, true); // Top left finder pattern + separator + format+ matrix.setRegion(dimension - 8, 0, 8, 9, true); // Top right finder pattern + separator + format+ matrix.setRegion(0, dimension - 8, 9, 8, true); // Bottom left finder pattern + separator + format+ // Alignment patterns+ for (var _i = 0, _a = version.alignmentPatternCenters; _i < _a.length; _i++) {+ var x = _a[_i];+ for (var _b = 0, _c = version.alignmentPatternCenters; _b < _c.length; _b++) {+ var y = _c[_b];+ if (!(x === 6 && y === 6 || x === 6 && y === dimension - 7 || x === dimension - 7 && y === 6)) {+ matrix.setRegion(x - 2, y - 2, 5, 5, true);+ }+ }+ }+ matrix.setRegion(6, 9, 1, dimension - 17, true); // Vertical timing pattern+ matrix.setRegion(9, 6, dimension - 17, 1, true); // Horizontal timing pattern+ if (version.versionNumber > 6) {+ matrix.setRegion(dimension - 11, 0, 3, 6, true); // Version info, top right+ matrix.setRegion(0, dimension - 11, 6, 3, true); // Version info, bottom left+ }+ return matrix;+}+function readCodewords(matrix, version, formatInfo) {+ var dataMask = DATA_MASKS[formatInfo.dataMask];+ var dimension = matrix.height;+ var functionPatternMask = buildFunctionPatternMask(version);+ var codewords = [];+ var currentByte = 0;+ var bitsRead = 0;+ // Read columns in pairs, from right to left+ var readingUp = true;+ for (var columnIndex = dimension - 1; columnIndex > 0; columnIndex -= 2) {+ if (columnIndex === 6) { // Skip whole column with vertical alignment pattern;+ columnIndex--;+ }+ for (var i = 0; i < dimension; i++) {+ var y = readingUp ? dimension - 1 - i : i;+ for (var columnOffset = 0; columnOffset < 2; columnOffset++) {+ var x = columnIndex - columnOffset;+ if (!functionPatternMask.get(x, y)) {+ bitsRead++;+ var bit = matrix.get(x, y);+ if (dataMask({ y: y, x: x })) {+ bit = !bit;+ }+ currentByte = pushBit(bit, currentByte);+ if (bitsRead === 8) { // Whole bytes+ codewords.push(currentByte);+ bitsRead = 0;+ currentByte = 0;+ }+ }+ }+ }+ readingUp = !readingUp;+ }+ return codewords;+}+function readVersion(matrix) {+ var dimension = matrix.height;+ var provisionalVersion = Math.floor((dimension - 17) / 4);+ if (provisionalVersion <= 6) { // 6 and under dont have version info in the QR code+ return version_1.VERSIONS[provisionalVersion - 1];+ }+ var topRightVersionBits = 0;+ for (var y = 5; y >= 0; y--) {+ for (var x = dimension - 9; x >= dimension - 11; x--) {+ topRightVersionBits = pushBit(matrix.get(x, y), topRightVersionBits);+ }+ }+ var bottomLeftVersionBits = 0;+ for (var x = 5; x >= 0; x--) {+ for (var y = dimension - 9; y >= dimension - 11; y--) {+ bottomLeftVersionBits = pushBit(matrix.get(x, y), bottomLeftVersionBits);+ }+ }+ var bestDifference = Infinity;+ var bestVersion;+ for (var _i = 0, VERSIONS_1 = version_1.VERSIONS; _i < VERSIONS_1.length; _i++) {+ var version = VERSIONS_1[_i];+ if (version.infoBits === topRightVersionBits || version.infoBits === bottomLeftVersionBits) {+ return version;+ }+ var difference = numBitsDiffering(topRightVersionBits, version.infoBits);+ if (difference < bestDifference) {+ bestVersion = version;+ bestDifference = difference;+ }+ difference = numBitsDiffering(bottomLeftVersionBits, version.infoBits);+ if (difference < bestDifference) {+ bestVersion = version;+ bestDifference = difference;+ }+ }+ // We can tolerate up to 3 bits of error since no two version info codewords will+ // differ in less than 8 bits.+ if (bestDifference <= 3) {+ return bestVersion;+ }+}+function readFormatInformation(matrix) {+ var topLeftFormatInfoBits = 0;+ for (var x = 0; x <= 8; x++) {+ if (x !== 6) { // Skip timing pattern bit+ topLeftFormatInfoBits = pushBit(matrix.get(x, 8), topLeftFormatInfoBits);+ }+ }+ for (var y = 7; y >= 0; y--) {+ if (y !== 6) { // Skip timing pattern bit+ topLeftFormatInfoBits = pushBit(matrix.get(8, y), topLeftFormatInfoBits);+ }+ }+ var dimension = matrix.height;+ var topRightBottomRightFormatInfoBits = 0;+ for (var y = dimension - 1; y >= dimension - 7; y--) { // bottom left+ topRightBottomRightFormatInfoBits = pushBit(matrix.get(8, y), topRightBottomRightFormatInfoBits);+ }+ for (var x = dimension - 8; x < dimension; x++) { // top right+ topRightBottomRightFormatInfoBits = pushBit(matrix.get(x, 8), topRightBottomRightFormatInfoBits);+ }+ var bestDifference = Infinity;+ var bestFormatInfo = null;+ for (var _i = 0, FORMAT_INFO_TABLE_1 = FORMAT_INFO_TABLE; _i < FORMAT_INFO_TABLE_1.length; _i++) {+ var _a = FORMAT_INFO_TABLE_1[_i], bits = _a.bits, formatInfo = _a.formatInfo;+ if (bits === topLeftFormatInfoBits || bits === topRightBottomRightFormatInfoBits) {+ return formatInfo;+ }+ var difference = numBitsDiffering(topLeftFormatInfoBits, bits);+ if (difference < bestDifference) {+ bestFormatInfo = formatInfo;+ bestDifference = difference;+ }+ if (topLeftFormatInfoBits !== topRightBottomRightFormatInfoBits) { // also try the other option+ difference = numBitsDiffering(topRightBottomRightFormatInfoBits, bits);+ if (difference < bestDifference) {+ bestFormatInfo = formatInfo;+ bestDifference = difference;+ }+ }+ }+ // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits differing means we found a match+ if (bestDifference <= 3) {+ return bestFormatInfo;+ }+ return null;+}+function getDataBlocks(codewords, version, ecLevel) {+ var ecInfo = version.errorCorrectionLevels[ecLevel];+ var dataBlocks = [];+ var totalCodewords = 0;+ ecInfo.ecBlocks.forEach(function (block) {+ for (var i = 0; i < block.numBlocks; i++) {+ dataBlocks.push({ numDataCodewords: block.dataCodewordsPerBlock, codewords: [] });+ totalCodewords += block.dataCodewordsPerBlock + ecInfo.ecCodewordsPerBlock;+ }+ });+ // In some cases the QR code will be malformed enough that we pull off more or less than we should.+ // If we pull off less there's nothing we can do.+ // If we pull off more we can safely truncate+ if (codewords.length < totalCodewords) {+ return null;+ }+ codewords = codewords.slice(0, totalCodewords);+ var shortBlockSize = ecInfo.ecBlocks[0].dataCodewordsPerBlock;+ // Pull codewords to fill the blocks up to the minimum size+ for (var i = 0; i < shortBlockSize; i++) {+ for (var _i = 0, dataBlocks_1 = dataBlocks; _i < dataBlocks_1.length; _i++) {+ var dataBlock = dataBlocks_1[_i];+ dataBlock.codewords.push(codewords.shift());+ }+ }+ // If there are any large blocks, pull codewords to fill the last element of those+ if (ecInfo.ecBlocks.length > 1) {+ var smallBlockCount = ecInfo.ecBlocks[0].numBlocks;+ var largeBlockCount = ecInfo.ecBlocks[1].numBlocks;+ for (var i = 0; i < largeBlockCount; i++) {+ dataBlocks[smallBlockCount + i].codewords.push(codewords.shift());+ }+ }+ // Add the rest of the codewords to the blocks. These are the error correction codewords.+ while (codewords.length > 0) {+ for (var _a = 0, dataBlocks_2 = dataBlocks; _a < dataBlocks_2.length; _a++) {+ var dataBlock = dataBlocks_2[_a];+ dataBlock.codewords.push(codewords.shift());+ }+ }+ return dataBlocks;+}+function decodeMatrix(matrix) {+ var version = readVersion(matrix);+ if (!version) {+ return null;+ }+ var formatInfo = readFormatInformation(matrix);+ if (!formatInfo) {+ return null;+ }+ var codewords = readCodewords(matrix, version, formatInfo);+ var dataBlocks = getDataBlocks(codewords, version, formatInfo.errorCorrectionLevel);+ if (!dataBlocks) {+ return null;+ }+ // Count total number of data bytes+ var totalBytes = dataBlocks.reduce(function (a, b) { return a + b.numDataCodewords; }, 0);+ var resultBytes = new Uint8ClampedArray(totalBytes);+ var resultIndex = 0;+ for (var _i = 0, dataBlocks_3 = dataBlocks; _i < dataBlocks_3.length; _i++) {+ var dataBlock = dataBlocks_3[_i];+ var correctedBytes = reedsolomon_1.decode(dataBlock.codewords, dataBlock.codewords.length - dataBlock.numDataCodewords);+ if (!correctedBytes) {+ return null;+ }+ for (var i = 0; i < dataBlock.numDataCodewords; i++) {+ resultBytes[resultIndex++] = correctedBytes[i];+ }+ }+ try {+ return decodeData_1.decode(resultBytes, version.versionNumber);+ }+ catch (_a) {+ return null;+ }+}+function decode(matrix) {+ if (matrix == null) {+ return null;+ }+ var result = decodeMatrix(matrix);+ if (result) {+ return result;+ }+ // Decoding didn't work, try mirroring the QR across the topLeft -> bottomRight line.+ for (var x = 0; x < matrix.width; x++) {+ for (var y = x + 1; y < matrix.height; y++) {+ if (matrix.get(x, y) !== matrix.get(y, x)) {+ matrix.set(x, y, !matrix.get(x, y));+ matrix.set(y, x, !matrix.get(y, x));+ }+ }+ }+ return decodeMatrix(matrix);+}+exports.decode = decode;+++/***/ }),+/* 6 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+// tslint:disable:no-bitwise+var BitStream_1 = __webpack_require__(7);+var shiftJISTable_1 = __webpack_require__(8);+var Mode;+(function (Mode) {+ Mode["Numeric"] = "numeric";+ Mode["Alphanumeric"] = "alphanumeric";+ Mode["Byte"] = "byte";+ Mode["Kanji"] = "kanji";+ Mode["ECI"] = "eci";+})(Mode = exports.Mode || (exports.Mode = {}));+var ModeByte;+(function (ModeByte) {+ ModeByte[ModeByte["Terminator"] = 0] = "Terminator";+ ModeByte[ModeByte["Numeric"] = 1] = "Numeric";+ ModeByte[ModeByte["Alphanumeric"] = 2] = "Alphanumeric";+ ModeByte[ModeByte["Byte"] = 4] = "Byte";+ ModeByte[ModeByte["Kanji"] = 8] = "Kanji";+ ModeByte[ModeByte["ECI"] = 7] = "ECI";+ // StructuredAppend = 0x3,+ // FNC1FirstPosition = 0x5,+ // FNC1SecondPosition = 0x9,+})(ModeByte || (ModeByte = {}));+function decodeNumeric(stream, size) {+ var bytes = [];+ var text = "";+ var characterCountSize = [10, 12, 14][size];+ var length = stream.readBits(characterCountSize);+ // Read digits in groups of 3+ while (length >= 3) {+ var num = stream.readBits(10);+ if (num >= 1000) {+ throw new Error("Invalid numeric value above 999");+ }+ var a = Math.floor(num / 100);+ var b = Math.floor(num / 10) % 10;+ var c = num % 10;+ bytes.push(48 + a, 48 + b, 48 + c);+ text += a.toString() + b.toString() + c.toString();+ length -= 3;+ }+ // If the number of digits aren't a multiple of 3, the remaining digits are special cased.+ if (length === 2) {+ var num = stream.readBits(7);+ if (num >= 100) {+ throw new Error("Invalid numeric value above 99");+ }+ var a = Math.floor(num / 10);+ var b = num % 10;+ bytes.push(48 + a, 48 + b);+ text += a.toString() + b.toString();+ }+ else if (length === 1) {+ var num = stream.readBits(4);+ if (num >= 10) {+ throw new Error("Invalid numeric value above 9");+ }+ bytes.push(48 + num);+ text += num.toString();+ }+ return { bytes: bytes, text: text };+}+var AlphanumericCharacterCodes = [+ "0", "1", "2", "3", "4", "5", "6", "7", "8",+ "9", "A", "B", "C", "D", "E", "F", "G", "H",+ "I", "J", "K", "L", "M", "N", "O", "P", "Q",+ "R", "S", "T", "U", "V", "W", "X", "Y", "Z",+ " ", "$", "%", "*", "+", "-", ".", "/", ":",+];+function decodeAlphanumeric(stream, size) {+ var bytes = [];+ var text = "";+ var characterCountSize = [9, 11, 13][size];+ var length = stream.readBits(characterCountSize);+ while (length >= 2) {+ var v = stream.readBits(11);+ var a = Math.floor(v / 45);+ var b = v % 45;+ bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0), AlphanumericCharacterCodes[b].charCodeAt(0));+ text += AlphanumericCharacterCodes[a] + AlphanumericCharacterCodes[b];+ length -= 2;+ }+ if (length === 1) {+ var a = stream.readBits(6);+ bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0));+ text += AlphanumericCharacterCodes[a];+ }+ return { bytes: bytes, text: text };+}+function decodeByte(stream, size) {+ var bytes = [];+ var text = "";+ var characterCountSize = [8, 16, 16][size];+ var length = stream.readBits(characterCountSize);+ for (var i = 0; i < length; i++) {+ var b = stream.readBits(8);+ bytes.push(b);+ }+ try {+ text += decodeURIComponent(bytes.map(function (b) { return "%" + ("0" + b.toString(16)).substr(-2); }).join(""));+ }+ catch (_a) {+ // failed to decode+ }+ return { bytes: bytes, text: text };+}+function decodeKanji(stream, size) {+ var bytes = [];+ var text = "";+ var characterCountSize = [8, 10, 12][size];+ var length = stream.readBits(characterCountSize);+ for (var i = 0; i < length; i++) {+ var k = stream.readBits(13);+ var c = (Math.floor(k / 0xC0) << 8) | (k % 0xC0);+ if (c < 0x1F00) {+ c += 0x8140;+ }+ else {+ c += 0xC140;+ }+ bytes.push(c >> 8, c & 0xFF);+ text += String.fromCharCode(shiftJISTable_1.shiftJISTable[c]);+ }+ return { bytes: bytes, text: text };+}+function decode(data, version) {+ var _a, _b, _c, _d;+ var stream = new BitStream_1.BitStream(data);+ // There are 3 'sizes' based on the version. 1-9 is small (0), 10-26 is medium (1) and 27-40 is large (2).+ var size = version <= 9 ? 0 : version <= 26 ? 1 : 2;+ var result = {+ text: "",+ bytes: [],+ chunks: [],+ version: version,+ };+ while (stream.available() >= 4) {+ var mode = stream.readBits(4);+ if (mode === ModeByte.Terminator) {+ return result;+ }+ else if (mode === ModeByte.ECI) {+ if (stream.readBits(1) === 0) {+ result.chunks.push({+ type: Mode.ECI,+ assignmentNumber: stream.readBits(7),+ });+ }+ else if (stream.readBits(1) === 0) {+ result.chunks.push({+ type: Mode.ECI,+ assignmentNumber: stream.readBits(14),+ });+ }+ else if (stream.readBits(1) === 0) {+ result.chunks.push({+ type: Mode.ECI,+ assignmentNumber: stream.readBits(21),+ });+ }+ else {+ // ECI data seems corrupted+ result.chunks.push({+ type: Mode.ECI,+ assignmentNumber: -1,+ });+ }+ }+ else if (mode === ModeByte.Numeric) {+ var numericResult = decodeNumeric(stream, size);+ result.text += numericResult.text;+ (_a = result.bytes).push.apply(_a, numericResult.bytes);+ result.chunks.push({+ type: Mode.Numeric,+ text: numericResult.text,+ });+ }+ else if (mode === ModeByte.Alphanumeric) {+ var alphanumericResult = decodeAlphanumeric(stream, size);+ result.text += alphanumericResult.text;+ (_b = result.bytes).push.apply(_b, alphanumericResult.bytes);+ result.chunks.push({+ type: Mode.Alphanumeric,+ text: alphanumericResult.text,+ });+ }+ else if (mode === ModeByte.Byte) {+ var byteResult = decodeByte(stream, size);+ result.text += byteResult.text;+ (_c = result.bytes).push.apply(_c, byteResult.bytes);+ result.chunks.push({+ type: Mode.Byte,+ bytes: byteResult.bytes,+ text: byteResult.text,+ });+ }+ else if (mode === ModeByte.Kanji) {+ var kanjiResult = decodeKanji(stream, size);+ result.text += kanjiResult.text;+ (_d = result.bytes).push.apply(_d, kanjiResult.bytes);+ result.chunks.push({+ type: Mode.Kanji,+ bytes: kanjiResult.bytes,+ text: kanjiResult.text,+ });+ }+ }+ // If there is no data left, or the remaining bits are all 0, then that counts as a termination marker+ if (stream.available() === 0 || stream.readBits(stream.available()) === 0) {+ return result;+ }+}+exports.decode = decode;+++/***/ }),+/* 7 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++// tslint:disable:no-bitwise+Object.defineProperty(exports, "__esModule", { value: true });+var BitStream = /** @class */ (function () {+ function BitStream(bytes) {+ this.byteOffset = 0;+ this.bitOffset = 0;+ this.bytes = bytes;+ }+ BitStream.prototype.readBits = function (numBits) {+ if (numBits < 1 || numBits > 32 || numBits > this.available()) {+ throw new Error("Cannot read " + numBits.toString() + " bits");+ }+ var result = 0;+ // First, read remainder from current byte+ if (this.bitOffset > 0) {+ var bitsLeft = 8 - this.bitOffset;+ var toRead = numBits < bitsLeft ? numBits : bitsLeft;+ var bitsToNotRead = bitsLeft - toRead;+ var mask = (0xFF >> (8 - toRead)) << bitsToNotRead;+ result = (this.bytes[this.byteOffset] & mask) >> bitsToNotRead;+ numBits -= toRead;+ this.bitOffset += toRead;+ if (this.bitOffset === 8) {+ this.bitOffset = 0;+ this.byteOffset++;+ }+ }+ // Next read whole bytes+ if (numBits > 0) {+ while (numBits >= 8) {+ result = (result << 8) | (this.bytes[this.byteOffset] & 0xFF);+ this.byteOffset++;+ numBits -= 8;+ }+ // Finally read a partial byte+ if (numBits > 0) {+ var bitsToNotRead = 8 - numBits;+ var mask = (0xFF >> bitsToNotRead) << bitsToNotRead;+ result = (result << numBits) | ((this.bytes[this.byteOffset] & mask) >> bitsToNotRead);+ this.bitOffset += numBits;+ }+ }+ return result;+ };+ BitStream.prototype.available = function () {+ return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;+ };+ return BitStream;+}());+exports.BitStream = BitStream;+++/***/ }),+/* 8 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+exports.shiftJISTable = {+ 0x20: 0x0020,+ 0x21: 0x0021,+ 0x22: 0x0022,+ 0x23: 0x0023,+ 0x24: 0x0024,+ 0x25: 0x0025,+ 0x26: 0x0026,+ 0x27: 0x0027,+ 0x28: 0x0028,+ 0x29: 0x0029,+ 0x2A: 0x002A,+ 0x2B: 0x002B,+ 0x2C: 0x002C,+ 0x2D: 0x002D,+ 0x2E: 0x002E,+ 0x2F: 0x002F,+ 0x30: 0x0030,+ 0x31: 0x0031,+ 0x32: 0x0032,+ 0x33: 0x0033,+ 0x34: 0x0034,+ 0x35: 0x0035,+ 0x36: 0x0036,+ 0x37: 0x0037,+ 0x38: 0x0038,+ 0x39: 0x0039,+ 0x3A: 0x003A,+ 0x3B: 0x003B,+ 0x3C: 0x003C,+ 0x3D: 0x003D,+ 0x3E: 0x003E,+ 0x3F: 0x003F,+ 0x40: 0x0040,+ 0x41: 0x0041,+ 0x42: 0x0042,+ 0x43: 0x0043,+ 0x44: 0x0044,+ 0x45: 0x0045,+ 0x46: 0x0046,+ 0x47: 0x0047,+ 0x48: 0x0048,+ 0x49: 0x0049,+ 0x4A: 0x004A,+ 0x4B: 0x004B,+ 0x4C: 0x004C,+ 0x4D: 0x004D,+ 0x4E: 0x004E,+ 0x4F: 0x004F,+ 0x50: 0x0050,+ 0x51: 0x0051,+ 0x52: 0x0052,+ 0x53: 0x0053,+ 0x54: 0x0054,+ 0x55: 0x0055,+ 0x56: 0x0056,+ 0x57: 0x0057,+ 0x58: 0x0058,+ 0x59: 0x0059,+ 0x5A: 0x005A,+ 0x5B: 0x005B,+ 0x5C: 0x00A5,+ 0x5D: 0x005D,+ 0x5E: 0x005E,+ 0x5F: 0x005F,+ 0x60: 0x0060,+ 0x61: 0x0061,+ 0x62: 0x0062,+ 0x63: 0x0063,+ 0x64: 0x0064,+ 0x65: 0x0065,+ 0x66: 0x0066,+ 0x67: 0x0067,+ 0x68: 0x0068,+ 0x69: 0x0069,+ 0x6A: 0x006A,+ 0x6B: 0x006B,+ 0x6C: 0x006C,+ 0x6D: 0x006D,+ 0x6E: 0x006E,+ 0x6F: 0x006F,+ 0x70: 0x0070,+ 0x71: 0x0071,+ 0x72: 0x0072,+ 0x73: 0x0073,+ 0x74: 0x0074,+ 0x75: 0x0075,+ 0x76: 0x0076,+ 0x77: 0x0077,+ 0x78: 0x0078,+ 0x79: 0x0079,+ 0x7A: 0x007A,+ 0x7B: 0x007B,+ 0x7C: 0x007C,+ 0x7D: 0x007D,+ 0x7E: 0x203E,+ 0x8140: 0x3000,+ 0x8141: 0x3001,+ 0x8142: 0x3002,+ 0x8143: 0xFF0C,+ 0x8144: 0xFF0E,+ 0x8145: 0x30FB,+ 0x8146: 0xFF1A,+ 0x8147: 0xFF1B,+ 0x8148: 0xFF1F,+ 0x8149: 0xFF01,+ 0x814A: 0x309B,+ 0x814B: 0x309C,+ 0x814C: 0x00B4,+ 0x814D: 0xFF40,+ 0x814E: 0x00A8,+ 0x814F: 0xFF3E,+ 0x8150: 0xFFE3,+ 0x8151: 0xFF3F,+ 0x8152: 0x30FD,+ 0x8153: 0x30FE,+ 0x8154: 0x309D,+ 0x8155: 0x309E,+ 0x8156: 0x3003,+ 0x8157: 0x4EDD,+ 0x8158: 0x3005,+ 0x8159: 0x3006,+ 0x815A: 0x3007,+ 0x815B: 0x30FC,+ 0x815C: 0x2015,+ 0x815D: 0x2010,+ 0x815E: 0xFF0F,+ 0x815F: 0x005C,+ 0x8160: 0x301C,+ 0x8161: 0x2016,+ 0x8162: 0xFF5C,+ 0x8163: 0x2026,+ 0x8164: 0x2025,+ 0x8165: 0x2018,+ 0x8166: 0x2019,+ 0x8167: 0x201C,+ 0x8168: 0x201D,+ 0x8169: 0xFF08,+ 0x816A: 0xFF09,+ 0x816B: 0x3014,+ 0x816C: 0x3015,+ 0x816D: 0xFF3B,+ 0x816E: 0xFF3D,+ 0x816F: 0xFF5B,+ 0x8170: 0xFF5D,+ 0x8171: 0x3008,+ 0x8172: 0x3009,+ 0x8173: 0x300A,+ 0x8174: 0x300B,+ 0x8175: 0x300C,+ 0x8176: 0x300D,+ 0x8177: 0x300E,+ 0x8178: 0x300F,+ 0x8179: 0x3010,+ 0x817A: 0x3011,+ 0x817B: 0xFF0B,+ 0x817C: 0x2212,+ 0x817D: 0x00B1,+ 0x817E: 0x00D7,+ 0x8180: 0x00F7,+ 0x8181: 0xFF1D,+ 0x8182: 0x2260,+ 0x8183: 0xFF1C,+ 0x8184: 0xFF1E,+ 0x8185: 0x2266,+ 0x8186: 0x2267,+ 0x8187: 0x221E,+ 0x8188: 0x2234,+ 0x8189: 0x2642,+ 0x818A: 0x2640,+ 0x818B: 0x00B0,+ 0x818C: 0x2032,+ 0x818D: 0x2033,+ 0x818E: 0x2103,+ 0x818F: 0xFFE5,+ 0x8190: 0xFF04,+ 0x8191: 0x00A2,+ 0x8192: 0x00A3,+ 0x8193: 0xFF05,+ 0x8194: 0xFF03,+ 0x8195: 0xFF06,+ 0x8196: 0xFF0A,+ 0x8197: 0xFF20,+ 0x8198: 0x00A7,+ 0x8199: 0x2606,+ 0x819A: 0x2605,+ 0x819B: 0x25CB,+ 0x819C: 0x25CF,+ 0x819D: 0x25CE,+ 0x819E: 0x25C7,+ 0x819F: 0x25C6,+ 0x81A0: 0x25A1,+ 0x81A1: 0x25A0,+ 0x81A2: 0x25B3,+ 0x81A3: 0x25B2,+ 0x81A4: 0x25BD,+ 0x81A5: 0x25BC,+ 0x81A6: 0x203B,+ 0x81A7: 0x3012,+ 0x81A8: 0x2192,+ 0x81A9: 0x2190,+ 0x81AA: 0x2191,+ 0x81AB: 0x2193,+ 0x81AC: 0x3013,+ 0x81B8: 0x2208,+ 0x81B9: 0x220B,+ 0x81BA: 0x2286,+ 0x81BB: 0x2287,+ 0x81BC: 0x2282,+ 0x81BD: 0x2283,+ 0x81BE: 0x222A,+ 0x81BF: 0x2229,+ 0x81C8: 0x2227,+ 0x81C9: 0x2228,+ 0x81CA: 0x00AC,+ 0x81CB: 0x21D2,+ 0x81CC: 0x21D4,+ 0x81CD: 0x2200,+ 0x81CE: 0x2203,+ 0x81DA: 0x2220,+ 0x81DB: 0x22A5,+ 0x81DC: 0x2312,+ 0x81DD: 0x2202,+ 0x81DE: 0x2207,+ 0x81DF: 0x2261,+ 0x81E0: 0x2252,+ 0x81E1: 0x226A,+ 0x81E2: 0x226B,+ 0x81E3: 0x221A,+ 0x81E4: 0x223D,+ 0x81E5: 0x221D,+ 0x81E6: 0x2235,+ 0x81E7: 0x222B,+ 0x81E8: 0x222C,+ 0x81F0: 0x212B,+ 0x81F1: 0x2030,+ 0x81F2: 0x266F,+ 0x81F3: 0x266D,+ 0x81F4: 0x266A,+ 0x81F5: 0x2020,+ 0x81F6: 0x2021,+ 0x81F7: 0x00B6,+ 0x81FC: 0x25EF,+ 0x824F: 0xFF10,+ 0x8250: 0xFF11,+ 0x8251: 0xFF12,+ 0x8252: 0xFF13,+ 0x8253: 0xFF14,+ 0x8254: 0xFF15,+ 0x8255: 0xFF16,+ 0x8256: 0xFF17,+ 0x8257: 0xFF18,+ 0x8258: 0xFF19,+ 0x8260: 0xFF21,+ 0x8261: 0xFF22,+ 0x8262: 0xFF23,+ 0x8263: 0xFF24,+ 0x8264: 0xFF25,+ 0x8265: 0xFF26,+ 0x8266: 0xFF27,+ 0x8267: 0xFF28,+ 0x8268: 0xFF29,+ 0x8269: 0xFF2A,+ 0x826A: 0xFF2B,+ 0x826B: 0xFF2C,+ 0x826C: 0xFF2D,+ 0x826D: 0xFF2E,+ 0x826E: 0xFF2F,+ 0x826F: 0xFF30,+ 0x8270: 0xFF31,+ 0x8271: 0xFF32,+ 0x8272: 0xFF33,+ 0x8273: 0xFF34,+ 0x8274: 0xFF35,+ 0x8275: 0xFF36,+ 0x8276: 0xFF37,+ 0x8277: 0xFF38,+ 0x8278: 0xFF39,+ 0x8279: 0xFF3A,+ 0x8281: 0xFF41,+ 0x8282: 0xFF42,+ 0x8283: 0xFF43,+ 0x8284: 0xFF44,+ 0x8285: 0xFF45,+ 0x8286: 0xFF46,+ 0x8287: 0xFF47,+ 0x8288: 0xFF48,+ 0x8289: 0xFF49,+ 0x828A: 0xFF4A,+ 0x828B: 0xFF4B,+ 0x828C: 0xFF4C,+ 0x828D: 0xFF4D,+ 0x828E: 0xFF4E,+ 0x828F: 0xFF4F,+ 0x8290: 0xFF50,+ 0x8291: 0xFF51,+ 0x8292: 0xFF52,+ 0x8293: 0xFF53,+ 0x8294: 0xFF54,+ 0x8295: 0xFF55,+ 0x8296: 0xFF56,+ 0x8297: 0xFF57,+ 0x8298: 0xFF58,+ 0x8299: 0xFF59,+ 0x829A: 0xFF5A,+ 0x829F: 0x3041,+ 0x82A0: 0x3042,+ 0x82A1: 0x3043,+ 0x82A2: 0x3044,+ 0x82A3: 0x3045,+ 0x82A4: 0x3046,+ 0x82A5: 0x3047,+ 0x82A6: 0x3048,+ 0x82A7: 0x3049,+ 0x82A8: 0x304A,+ 0x82A9: 0x304B,+ 0x82AA: 0x304C,+ 0x82AB: 0x304D,+ 0x82AC: 0x304E,+ 0x82AD: 0x304F,+ 0x82AE: 0x3050,+ 0x82AF: 0x3051,+ 0x82B0: 0x3052,+ 0x82B1: 0x3053,+ 0x82B2: 0x3054,+ 0x82B3: 0x3055,+ 0x82B4: 0x3056,+ 0x82B5: 0x3057,+ 0x82B6: 0x3058,+ 0x82B7: 0x3059,+ 0x82B8: 0x305A,+ 0x82B9: 0x305B,+ 0x82BA: 0x305C,+ 0x82BB: 0x305D,+ 0x82BC: 0x305E,+ 0x82BD: 0x305F,+ 0x82BE: 0x3060,+ 0x82BF: 0x3061,+ 0x82C0: 0x3062,+ 0x82C1: 0x3063,+ 0x82C2: 0x3064,+ 0x82C3: 0x3065,+ 0x82C4: 0x3066,+ 0x82C5: 0x3067,+ 0x82C6: 0x3068,+ 0x82C7: 0x3069,+ 0x82C8: 0x306A,+ 0x82C9: 0x306B,+ 0x82CA: 0x306C,+ 0x82CB: 0x306D,+ 0x82CC: 0x306E,+ 0x82CD: 0x306F,+ 0x82CE: 0x3070,+ 0x82CF: 0x3071,+ 0x82D0: 0x3072,+ 0x82D1: 0x3073,+ 0x82D2: 0x3074,+ 0x82D3: 0x3075,+ 0x82D4: 0x3076,+ 0x82D5: 0x3077,+ 0x82D6: 0x3078,+ 0x82D7: 0x3079,+ 0x82D8: 0x307A,+ 0x82D9: 0x307B,+ 0x82DA: 0x307C,+ 0x82DB: 0x307D,+ 0x82DC: 0x307E,+ 0x82DD: 0x307F,+ 0x82DE: 0x3080,+ 0x82DF: 0x3081,+ 0x82E0: 0x3082,+ 0x82E1: 0x3083,+ 0x82E2: 0x3084,+ 0x82E3: 0x3085,+ 0x82E4: 0x3086,+ 0x82E5: 0x3087,+ 0x82E6: 0x3088,+ 0x82E7: 0x3089,+ 0x82E8: 0x308A,+ 0x82E9: 0x308B,+ 0x82EA: 0x308C,+ 0x82EB: 0x308D,+ 0x82EC: 0x308E,+ 0x82ED: 0x308F,+ 0x82EE: 0x3090,+ 0x82EF: 0x3091,+ 0x82F0: 0x3092,+ 0x82F1: 0x3093,+ 0x8340: 0x30A1,+ 0x8341: 0x30A2,+ 0x8342: 0x30A3,+ 0x8343: 0x30A4,+ 0x8344: 0x30A5,+ 0x8345: 0x30A6,+ 0x8346: 0x30A7,+ 0x8347: 0x30A8,+ 0x8348: 0x30A9,+ 0x8349: 0x30AA,+ 0x834A: 0x30AB,+ 0x834B: 0x30AC,+ 0x834C: 0x30AD,+ 0x834D: 0x30AE,+ 0x834E: 0x30AF,+ 0x834F: 0x30B0,+ 0x8350: 0x30B1,+ 0x8351: 0x30B2,+ 0x8352: 0x30B3,+ 0x8353: 0x30B4,+ 0x8354: 0x30B5,+ 0x8355: 0x30B6,+ 0x8356: 0x30B7,+ 0x8357: 0x30B8,+ 0x8358: 0x30B9,+ 0x8359: 0x30BA,+ 0x835A: 0x30BB,+ 0x835B: 0x30BC,+ 0x835C: 0x30BD,+ 0x835D: 0x30BE,+ 0x835E: 0x30BF,+ 0x835F: 0x30C0,+ 0x8360: 0x30C1,+ 0x8361: 0x30C2,+ 0x8362: 0x30C3,+ 0x8363: 0x30C4,+ 0x8364: 0x30C5,+ 0x8365: 0x30C6,+ 0x8366: 0x30C7,+ 0x8367: 0x30C8,+ 0x8368: 0x30C9,+ 0x8369: 0x30CA,+ 0x836A: 0x30CB,+ 0x836B: 0x30CC,+ 0x836C: 0x30CD,+ 0x836D: 0x30CE,+ 0x836E: 0x30CF,+ 0x836F: 0x30D0,+ 0x8370: 0x30D1,+ 0x8371: 0x30D2,+ 0x8372: 0x30D3,+ 0x8373: 0x30D4,+ 0x8374: 0x30D5,+ 0x8375: 0x30D6,+ 0x8376: 0x30D7,+ 0x8377: 0x30D8,+ 0x8378: 0x30D9,+ 0x8379: 0x30DA,+ 0x837A: 0x30DB,+ 0x837B: 0x30DC,+ 0x837C: 0x30DD,+ 0x837D: 0x30DE,+ 0x837E: 0x30DF,+ 0x8380: 0x30E0,+ 0x8381: 0x30E1,+ 0x8382: 0x30E2,+ 0x8383: 0x30E3,+ 0x8384: 0x30E4,+ 0x8385: 0x30E5,+ 0x8386: 0x30E6,+ 0x8387: 0x30E7,+ 0x8388: 0x30E8,+ 0x8389: 0x30E9,+ 0x838A: 0x30EA,+ 0x838B: 0x30EB,+ 0x838C: 0x30EC,+ 0x838D: 0x30ED,+ 0x838E: 0x30EE,+ 0x838F: 0x30EF,+ 0x8390: 0x30F0,+ 0x8391: 0x30F1,+ 0x8392: 0x30F2,+ 0x8393: 0x30F3,+ 0x8394: 0x30F4,+ 0x8395: 0x30F5,+ 0x8396: 0x30F6,+ 0x839F: 0x0391,+ 0x83A0: 0x0392,+ 0x83A1: 0x0393,+ 0x83A2: 0x0394,+ 0x83A3: 0x0395,+ 0x83A4: 0x0396,+ 0x83A5: 0x0397,+ 0x83A6: 0x0398,+ 0x83A7: 0x0399,+ 0x83A8: 0x039A,+ 0x83A9: 0x039B,+ 0x83AA: 0x039C,+ 0x83AB: 0x039D,+ 0x83AC: 0x039E,+ 0x83AD: 0x039F,+ 0x83AE: 0x03A0,+ 0x83AF: 0x03A1,+ 0x83B0: 0x03A3,+ 0x83B1: 0x03A4,+ 0x83B2: 0x03A5,+ 0x83B3: 0x03A6,+ 0x83B4: 0x03A7,+ 0x83B5: 0x03A8,+ 0x83B6: 0x03A9,+ 0x83BF: 0x03B1,+ 0x83C0: 0x03B2,+ 0x83C1: 0x03B3,+ 0x83C2: 0x03B4,+ 0x83C3: 0x03B5,+ 0x83C4: 0x03B6,+ 0x83C5: 0x03B7,+ 0x83C6: 0x03B8,+ 0x83C7: 0x03B9,+ 0x83C8: 0x03BA,+ 0x83C9: 0x03BB,+ 0x83CA: 0x03BC,+ 0x83CB: 0x03BD,+ 0x83CC: 0x03BE,+ 0x83CD: 0x03BF,+ 0x83CE: 0x03C0,+ 0x83CF: 0x03C1,+ 0x83D0: 0x03C3,+ 0x83D1: 0x03C4,+ 0x83D2: 0x03C5,+ 0x83D3: 0x03C6,+ 0x83D4: 0x03C7,+ 0x83D5: 0x03C8,+ 0x83D6: 0x03C9,+ 0x8440: 0x0410,+ 0x8441: 0x0411,+ 0x8442: 0x0412,+ 0x8443: 0x0413,+ 0x8444: 0x0414,+ 0x8445: 0x0415,+ 0x8446: 0x0401,+ 0x8447: 0x0416,+ 0x8448: 0x0417,+ 0x8449: 0x0418,+ 0x844A: 0x0419,+ 0x844B: 0x041A,+ 0x844C: 0x041B,+ 0x844D: 0x041C,+ 0x844E: 0x041D,+ 0x844F: 0x041E,+ 0x8450: 0x041F,+ 0x8451: 0x0420,+ 0x8452: 0x0421,+ 0x8453: 0x0422,+ 0x8454: 0x0423,+ 0x8455: 0x0424,+ 0x8456: 0x0425,+ 0x8457: 0x0426,+ 0x8458: 0x0427,+ 0x8459: 0x0428,+ 0x845A: 0x0429,+ 0x845B: 0x042A,+ 0x845C: 0x042B,+ 0x845D: 0x042C,+ 0x845E: 0x042D,+ 0x845F: 0x042E,+ 0x8460: 0x042F,+ 0x8470: 0x0430,+ 0x8471: 0x0431,+ 0x8472: 0x0432,+ 0x8473: 0x0433,+ 0x8474: 0x0434,+ 0x8475: 0x0435,+ 0x8476: 0x0451,+ 0x8477: 0x0436,+ 0x8478: 0x0437,+ 0x8479: 0x0438,+ 0x847A: 0x0439,+ 0x847B: 0x043A,+ 0x847C: 0x043B,+ 0x847D: 0x043C,+ 0x847E: 0x043D,+ 0x8480: 0x043E,+ 0x8481: 0x043F,+ 0x8482: 0x0440,+ 0x8483: 0x0441,+ 0x8484: 0x0442,+ 0x8485: 0x0443,+ 0x8486: 0x0444,+ 0x8487: 0x0445,+ 0x8488: 0x0446,+ 0x8489: 0x0447,+ 0x848A: 0x0448,+ 0x848B: 0x0449,+ 0x848C: 0x044A,+ 0x848D: 0x044B,+ 0x848E: 0x044C,+ 0x848F: 0x044D,+ 0x8490: 0x044E,+ 0x8491: 0x044F,+ 0x849F: 0x2500,+ 0x84A0: 0x2502,+ 0x84A1: 0x250C,+ 0x84A2: 0x2510,+ 0x84A3: 0x2518,+ 0x84A4: 0x2514,+ 0x84A5: 0x251C,+ 0x84A6: 0x252C,+ 0x84A7: 0x2524,+ 0x84A8: 0x2534,+ 0x84A9: 0x253C,+ 0x84AA: 0x2501,+ 0x84AB: 0x2503,+ 0x84AC: 0x250F,+ 0x84AD: 0x2513,+ 0x84AE: 0x251B,+ 0x84AF: 0x2517,+ 0x84B0: 0x2523,+ 0x84B1: 0x2533,+ 0x84B2: 0x252B,+ 0x84B3: 0x253B,+ 0x84B4: 0x254B,+ 0x84B5: 0x2520,+ 0x84B6: 0x252F,+ 0x84B7: 0x2528,+ 0x84B8: 0x2537,+ 0x84B9: 0x253F,+ 0x84BA: 0x251D,+ 0x84BB: 0x2530,+ 0x84BC: 0x2525,+ 0x84BD: 0x2538,+ 0x84BE: 0x2542,+ 0x889F: 0x4E9C,+ 0x88A0: 0x5516,+ 0x88A1: 0x5A03,+ 0x88A2: 0x963F,+ 0x88A3: 0x54C0,+ 0x88A4: 0x611B,+ 0x88A5: 0x6328,+ 0x88A6: 0x59F6,+ 0x88A7: 0x9022,+ 0x88A8: 0x8475,+ 0x88A9: 0x831C,+ 0x88AA: 0x7A50,+ 0x88AB: 0x60AA,+ 0x88AC: 0x63E1,+ 0x88AD: 0x6E25,+ 0x88AE: 0x65ED,+ 0x88AF: 0x8466,+ 0x88B0: 0x82A6,+ 0x88B1: 0x9BF5,+ 0x88B2: 0x6893,+ 0x88B3: 0x5727,+ 0x88B4: 0x65A1,+ 0x88B5: 0x6271,+ 0x88B6: 0x5B9B,+ 0x88B7: 0x59D0,+ 0x88B8: 0x867B,+ 0x88B9: 0x98F4,+ 0x88BA: 0x7D62,+ 0x88BB: 0x7DBE,+ 0x88BC: 0x9B8E,+ 0x88BD: 0x6216,+ 0x88BE: 0x7C9F,+ 0x88BF: 0x88B7,+ 0x88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0x540B,+ 0x8945: 0x53F3,+ 0x8946: 0x5B87,+ 0x8947: 0x70CF,+ 0x8948: 0x7FBD,+ 0x8949: 0x8FC2,+ 0x894A: 0x96E8,+ 0x894B: 0x536F,+ 0x894C: 0x9D5C,+ 0x894D: 0x7ABA,+ 0x894E: 0x4E11,+ 0x894F: 0x7893,+ 0x8950: 0x81FC,+ 0x8951: 0x6E26,+ 0x8952: 0x5618,+ 0x8953: 0x5504,+ 0x8954: 0x6B1D,+ 0x8955: 0x851A,+ 0x8956: 0x9C3B,+ 0x8957: 0x59E5,+ 0x8958: 0x53A9,+ 0x8959: 0x6D66,+ 0x895A: 0x74DC,+ 0x895B: 0x958F,+ 0x895C: 0x5642,+ 0x895D: 0x4E91,+ 0x895E: 0x904B,+ 0x895F: 0x96F2,+ 0x8960: 0x834F,+ 0x8961: 0x990C,+ 0x8962: 0x53E1,+ 0x8963: 0x55B6,+ 0x8964: 0x5B30,+ 0x8965: 0x5F71,+ 0x8966: 0x6620,+ 0x8967: 0x66F3,+ 0x8968: 0x6804,+ 0x8969: 0x6C38,+ 0x896A: 0x6CF3,+ 0x896B: 0x6D29,+ 0x896C: 0x745B,+ 0x896D: 0x76C8,+ 0x896E: 0x7A4E,+ 0x896F: 0x9834,+ 0x8970: 0x82F1,+ 0x8971: 0x885B,+ 0x8972: 0x8A60,+ 0x8973: 0x92ED,+ 0x8974: 0x6DB2,+ 0x8975: 0x75AB,+ 0x8976: 0x76CA,+ 0x8977: 0x99C5,+ 0x8978: 0x60A6,+ 0x8979: 0x8B01,+ 0x897A: 0x8D8A,+ 0x897B: 0x95B2,+ 0x897C: 0x698E,+ 0x897D: 0x53AD,+ 0x897E: 0x5186,+ 0x8980: 0x5712,+ 0x8981: 0x5830,+ 0x8982: 0x5944,+ 0x8983: 0x5BB4,+ 0x8984: 0x5EF6,+ 0x8985: 0x6028,+ 0x8986: 0x63A9,+ 0x8987: 0x63F4,+ 0x8988: 0x6CBF,+ 0x8989: 0x6F14,+ 0x898A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: 0x6B96,+ 0x9043: 0x71ED,+ 0x9044: 0x7E54,+ 0x9045: 0x8077,+ 0x9046: 0x8272,+ 0x9047: 0x89E6,+ 0x9048: 0x98DF,+ 0x9049: 0x8755,+ 0x904A: 0x8FB1,+ 0x904B: 0x5C3B,+ 0x904C: 0x4F38,+ 0x904D: 0x4FE1,+ 0x904E: 0x4FB5,+ 0x904F: 0x5507,+ 0x9050: 0x5A20,+ 0x9051: 0x5BDD,+ 0x9052: 0x5BE9,+ 0x9053: 0x5FC3,+ 0x9054: 0x614E,+ 0x9055: 0x632F,+ 0x9056: 0x65B0,+ 0x9057: 0x664B,+ 0x9058: 0x68EE,+ 0x9059: 0x699B,+ 0x905A: 0x6D78,+ 0x905B: 0x6DF1,+ 0x905C: 0x7533,+ 0x905D: 0x75B9,+ 0x905E: 0x771F,+ 0x905F: 0x795E,+ 0x9060: 0x79E6,+ 0x9061: 0x7D33,+ 0x9062: 0x81E3,+ 0x9063: 0x82AF,+ 0x9064: 0x85AA,+ 0x9065: 0x89AA,+ 0x9066: 0x8A3A,+ 0x9067: 0x8EAB,+ 0x9068: 0x8F9B,+ 0x9069: 0x9032,+ 0x906A: 0x91DD,+ 0x906B: 0x9707,+ 0x906C: 0x4EBA,+ 0x906D: 0x4EC1,+ 0x906E: 0x5203,+ 0x906F: 0x5875,+ 0x9070: 0x58EC,+ 0x9071: 0x5C0B,+ 0x9072: 0x751A,+ 0x9073: 0x5C3D,+ 0x9074: 0x814E,+ 0x9075: 0x8A0A,+ 0x9076: 0x8FC5,+ 0x9077: 0x9663,+ 0x9078: 0x976D,+ 0x9079: 0x7B25,+ 0x907A: 0x8ACF,+ 0x907B: 0x9808,+ 0x907C: 0x9162,+ 0x907D: 0x56F3,+ 0x907E: 0x53A8,+ 0x9080: 0x9017,+ 0x9081: 0x5439,+ 0x9082: 0x5782,+ 0x9083: 0x5E25,+ 0x9084: 0x63A8,+ 0x9085: 0x6C34,+ 0x9086: 0x708A,+ 0x9087: 0x7761,+ 0x9088: 0x7C8B,+ 0x9089: 0x7FE0,+ 0x908A: 0x8870,+ 0x908B: 0x9042,+ 0x908C: 0x9154,+ 0x908D: 0x9310,+ 0x908E: 0x9318,+ 0x908F: 0x968F,+ 0x9090: 0x745E,+ 0x9091: 0x9AC4,+ 0x9092: 0x5D07,+ 0x9093: 0x5D69,+ 0x9094: 0x6570,+ 0x9095: 0x67A2,+ 0x9096: 0x8DA8,+ 0x9097: 0x96DB,+ 0x9098: 0x636E,+ 0x9099: 0x6749,+ 0x909A: 0x6919,+ 0x909B: 0x83C5,+ 0x909C: 0x9817,+ 0x909D: 0x96C0,+ 0x909E: 0x88FE,+ 0x909F: 0x6F84,+ 0x90A0: 0x647A,+ 0x90A1: 0x5BF8,+ 0x90A2: 0x4E16,+ 0x90A3: 0x702C,+ 0x90A4: 0x755D,+ 0x90A5: 0x662F,+ 0x90A6: 0x51C4,+ 0x90A7: 0x5236,+ 0x90A8: 0x52E2,+ 0x90A9: 0x59D3,+ 0x90AA: 0x5F81,+ 0x90AB: 0x6027,+ 0x90AC: 0x6210,+ 0x90AD: 0x653F,+ 0x90AE: 0x6574,+ 0x90AF: 0x661F,+ 0x90B0: 0x6674,+ 0x90B1: 0x68F2,+ 0x90B2: 0x6816,+ 0x90B3: 0x6B63,+ 0x90B4: 0x6E05,+ 0x90B5: 0x7272,+ 0x90B6: 0x751F,+ 0x90B7: 0x76DB,+ 0x90B8: 0x7CBE,+ 0x90B9: 0x8056,+ 0x90BA: 0x58F0,+ 0x90BB: 0x88FD,+ 0x90BC: 0x897F,+ 0x90BD: 0x8AA0,+ 0x90BE: 0x8A93,+ 0x90BF: 0x8ACB,+ 0x90C0: 0x901D,+ 0x90C1: 0x9192,+ 0x90C2: 0x9752,+ 0x90C3: 0x9759,+ 0x90C4: 0x6589,+ 0x90C5: 0x7A0E,+ 0x90C6: 0x8106,+ 0x90C7: 0x96BB,+ 0x90C8: 0x5E2D,+ 0x90C9: 0x60DC,+ 0x90CA: 0x621A,+ 0x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914F: 0x524D,+ 0x9150: 0x5584,+ 0x9151: 0x6F38,+ 0x9152: 0x7136,+ 0x9153: 0x5168,+ 0x9154: 0x7985,+ 0x9155: 0x7E55,+ 0x9156: 0x81B3,+ 0x9157: 0x7CCE,+ 0x9158: 0x564C,+ 0x9159: 0x5851,+ 0x915A: 0x5CA8,+ 0x915B: 0x63AA,+ 0x915C: 0x66FE,+ 0x915D: 0x66FD,+ 0x915E: 0x695A,+ 0x915F: 0x72D9,+ 0x9160: 0x758F,+ 0x9161: 0x758E,+ 0x9162: 0x790E,+ 0x9163: 0x7956,+ 0x9164: 0x79DF,+ 0x9165: 0x7C97,+ 0x9166: 0x7D20,+ 0x9167: 0x7D44,+ 0x9168: 0x8607,+ 0x9169: 0x8A34,+ 0x916A: 0x963B,+ 0x916B: 0x9061,+ 0x916C: 0x9F20,+ 0x916D: 0x50E7,+ 0x916E: 0x5275,+ 0x916F: 0x53CC,+ 0x9170: 0x53E2,+ 0x9171: 0x5009,+ 0x9172: 0x55AA,+ 0x9173: 0x58EE,+ 0x9174: 0x594F,+ 0x9175: 0x723D,+ 0x9176: 0x5B8B,+ 0x9177: 0x5C64,+ 0x9178: 0x531D,+ 0x9179: 0x60E3,+ 0x917A: 0x60F3,+ 0x917B: 0x635C,+ 0x917C: 0x6383,+ 0x917D: 0x633F,+ 0x917E: 0x63BB,+ 0x9180: 0x64CD,+ 0x9181: 0x65E9,+ 0x9182: 0x66F9,+ 0x9183: 0x5DE3,+ 0x9184: 0x69CD,+ 0x9185: 0x69FD,+ 0x9186: 0x6F15,+ 0x9187: 0x71E5,+ 0x9188: 0x4E89,+ 0x9189: 0x75E9,+ 0x918A: 0x76F8,+ 0x918B: 0x7A93,+ 0x918C: 0x7CDF,+ 0x918D: 0x7DCF,+ 0x918E: 0x7D9C,+ 0x918F: 0x8061,+ 0x9190: 0x8349,+ 0x9191: 0x8358,+ 0x9192: 0x846C,+ 0x9193: 0x84BC,+ 0x9194: 0x85FB,+ 0x9195: 0x88C5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0x7BAA,+ 0x925D: 0x7DBB,+ 0x925E: 0x803D,+ 0x925F: 0x80C6,+ 0x9260: 0x86CB,+ 0x9261: 0x8A95,+ 0x9262: 0x935B,+ 0x9263: 0x56E3,+ 0x9264: 0x58C7,+ 0x9265: 0x5F3E,+ 0x9266: 0x65AD,+ 0x9267: 0x6696,+ 0x9268: 0x6A80,+ 0x9269: 0x6BB5,+ 0x926A: 0x7537,+ 0x926B: 0x8AC7,+ 0x926C: 0x5024,+ 0x926D: 0x77E5,+ 0x926E: 0x5730,+ 0x926F: 0x5F1B,+ 0x9270: 0x6065,+ 0x9271: 0x667A,+ 0x9272: 0x6C60,+ 0x9273: 0x75F4,+ 0x9274: 0x7A1A,+ 0x9275: 0x7F6E,+ 0x9276: 0x81F4,+ 0x9277: 0x8718,+ 0x9278: 0x9045,+ 0x9279: 0x99B3,+ 0x927A: 0x7BC9,+ 0x927B: 0x755C,+ 0x927C: 0x7AF9,+ 0x927D: 0x7B51,+ 0x927E: 0x84C4,+ 0x9280: 0x9010,+ 0x9281: 0x79E9,+ 0x9282: 0x7A92,+ 0x9283: 0x8336,+ 0x9284: 0x5AE1,+ 0x9285: 0x7740,+ 0x9286: 0x4E2D,+ 0x9287: 0x4EF2,+ 0x9288: 0x5B99,+ 0x9289: 0x5FE0,+ 0x928A: 0x62BD,+ 0x928B: 0x663C,+ 0x928C: 0x67F1,+ 0x928D: 0x6CE8,+ 0x928E: 0x866B,+ 0x928F: 0x8877,+ 0x9290: 0x8A3B,+ 0x9291: 0x914E,+ 0x9292: 0x92F3,+ 0x9293: 0x99D0,+ 0x9294: 0x6A17,+ 0x9295: 0x7026,+ 0x9296: 0x732A,+ 0x9297: 0x82E7,+ 0x9298: 0x8457,+ 0x9299: 0x8CAF,+ 0x929A: 0x4E01,+ 0x929B: 0x5146,+ 0x929C: 0x51CB,+ 0x929D: 0x558B,+ 0x929E: 0x5BF5,+ 0x929F: 0x5E16,+ 0x92A0: 0x5E33,+ 0x92A1: 0x5E81,+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x505C,+ 0x92E3: 0x5075,+ 0x92E4: 0x5243,+ 0x92E5: 0x8C9E,+ 0x92E6: 0x5448,+ 0x92E7: 0x5824,+ 0x92E8: 0x5B9A,+ 0x92E9: 0x5E1D,+ 0x92EA: 0x5E95,+ 0x92EB: 0x5EAD,+ 0x92EC: 0x5EF7,+ 0x92ED: 0x5F1F,+ 0x92EE: 0x608C,+ 0x92EF: 0x62B5,+ 0x92F0: 0x633A,+ 0x92F1: 0x63D0,+ 0x92F2: 0x68AF,+ 0x92F3: 0x6C40,+ 0x92F4: 0x7887,+ 0x92F5: 0x798E,+ 0x92F6: 0x7A0B,+ 0x92F7: 0x7DE0,+ 0x92F8: 0x8247,+ 0x92F9: 0x8A02,+ 0x92FA: 0x8AE6,+ 0x92FB: 0x8E44,+ 0x92FC: 0x9013,+ 0x9340: 0x90B8,+ 0x9341: 0x912D,+ 0x9342: 0x91D8,+ 0x9343: 0x9F0E,+ 0x9344: 0x6CE5,+ 0x9345: 0x6458,+ 0x9346: 0x64E2,+ 0x9347: 0x6575,+ 0x9348: 0x6EF4,+ 0x9349: 0x7684,+ 0x934A: 0x7B1B,+ 0x934B: 0x9069,+ 0x934C: 0x93D1,+ 0x934D: 0x6EBA,+ 0x934E: 0x54F2,+ 0x934F: 0x5FB9,+ 0x9350: 0x64A4,+ 0x9351: 0x8F4D,+ 0x9352: 0x8FED,+ 0x9353: 0x9244,+ 0x9354: 0x5178,+ 0x9355: 0x586B,+ 0x9356: 0x5929,+ 0x9357: 0x5C55,+ 0x9358: 0x5E97,+ 0x9359: 0x6DFB,+ 0x935A: 0x7E8F,+ 0x935B: 0x751C,+ 0x935C: 0x8CBC,+ 0x935D: 0x8EE2,+ 0x935E: 0x985B,+ 0x935F: 0x70B9,+ 0x9360: 0x4F1D,+ 0x9361: 0x6BBF,+ 0x9362: 0x6FB1,+ 0x9363: 0x7530,+ 0x9364: 0x96FB,+ 0x9365: 0x514E,+ 0x9366: 0x5410,+ 0x9367: 0x5835,+ 0x9368: 0x5857,+ 0x9369: 0x59AC,+ 0x936A: 0x5C60,+ 0x936B: 0x5F92,+ 0x936C: 0x6597,+ 0x936D: 0x675C,+ 0x936E: 0x6E21,+ 0x936F: 0x767B,+ 0x9370: 0x83DF,+ 0x9371: 0x8CED,+ 0x9372: 0x9014,+ 0x9373: 0x90FD,+ 0x9374: 0x934D,+ 0x9375: 0x7825,+ 0x9376: 0x783A,+ 0x9377: 0x52AA,+ 0x9378: 0x5EA6,+ 0x9379: 0x571F,+ 0x937A: 0x5974,+ 0x937B: 0x6012,+ 0x937C: 0x5012,+ 0x937D: 0x515A,+ 0x937E: 0x51AC,+ 0x9380: 0x51CD,+ 0x9381: 0x5200,+ 0x9382: 0x5510,+ 0x9383: 0x5854,+ 0x9384: 0x5858,+ 0x9385: 0x5957,+ 0x9386: 0x5B95,+ 0x9387: 0x5CF6,+ 0x9388: 0x5D8B,+ 0x9389: 0x60BC,+ 0x938A: 0x6295,+ 0x938B: 0x642D,+ 0x938C: 0x6771,+ 0x938D: 0x6843,+ 0x938E: 0x68BC,+ 0x938F: 0x68DF,+ 0x9390: 0x76D7,+ 0x9391: 0x6DD8,+ 0x9392: 0x6E6F,+ 0x9393: 0x6D9B,+ 0x9394: 0x706F,+ 0x9395: 0x71C8,+ 0x9396: 0x5F53,+ 0x9397: 0x75D8,+ 0x9398: 0x7977,+ 0x9399: 0x7B49,+ 0x939A: 0x7B54,+ 0x939B: 0x7B52,+ 0x939C: 0x7CD6,+ 0x939D: 0x7D71,+ 0x939E: 0x5230,+ 0x939F: 0x8463,+ 0x93A0: 0x8569,+ 0x93A1: 0x85E4,+ 0x93A2: 0x8A0E,+ 0x93A3: 0x8B04,+ 0x93A4: 0x8C46,+ 0x93A5: 0x8E0F,+ 0x93A6: 0x9003,+ 0x93A7: 0x900F,+ 0x93A8: 0x9419,+ 0x93A9: 0x9676,+ 0x93AA: 0x982D,+ 0x93AB: 0x9A30,+ 0x93AC: 0x95D8,+ 0x93AD: 0x50CD,+ 0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,+ 0x93EF: 0x96E3,+ 0x93F0: 0x6C5D,+ 0x93F1: 0x4E8C,+ 0x93F2: 0x5C3C,+ 0x93F3: 0x5F10,+ 0x93F4: 0x8FE9,+ 0x93F5: 0x5302,+ 0x93F6: 0x8CD1,+ 0x93F7: 0x8089,+ 0x93F8: 0x8679,+ 0x93F9: 0x5EFF,+ 0x93FA: 0x65E5,+ 0x93FB: 0x4E73,+ 0x93FC: 0x5165,+ 0x9440: 0x5982,+ 0x9441: 0x5C3F,+ 0x9442: 0x97EE,+ 0x9443: 0x4EFB,+ 0x9444: 0x598A,+ 0x9445: 0x5FCD,+ 0x9446: 0x8A8D,+ 0x9447: 0x6FE1,+ 0x9448: 0x79B0,+ 0x9449: 0x7962,+ 0x944A: 0x5BE7,+ 0x944B: 0x8471,+ 0x944C: 0x732B,+ 0x944D: 0x71B1,+ 0x944E: 0x5E74,+ 0x944F: 0x5FF5,+ 0x9450: 0x637B,+ 0x9451: 0x649A,+ 0x9452: 0x71C3,+ 0x9453: 0x7C98,+ 0x9454: 0x4E43,+ 0x9455: 0x5EFC,+ 0x9456: 0x4E4B,+ 0x9457: 0x57DC,+ 0x9458: 0x56A2,+ 0x9459: 0x60A9,+ 0x945A: 0x6FC3,+ 0x945B: 0x7D0D,+ 0x945C: 0x80FD,+ 0x945D: 0x8133,+ 0x945E: 0x81BF,+ 0x945F: 0x8FB2,+ 0x9460: 0x8997,+ 0x9461: 0x86A4,+ 0x9462: 0x5DF4,+ 0x9463: 0x628A,+ 0x9464: 0x64AD,+ 0x9465: 0x8987,+ 0x9466: 0x6777,+ 0x9467: 0x6CE2,+ 0x9468: 0x6D3E,+ 0x9469: 0x7436,+ 0x946A: 0x7834,+ 0x946B: 0x5A46,+ 0x946C: 0x7F75,+ 0x946D: 0x82AD,+ 0x946E: 0x99AC,+ 0x946F: 0x4FF3,+ 0x9470: 0x5EC3,+ 0x9471: 0x62DD,+ 0x9472: 0x6392,+ 0x9473: 0x6557,+ 0x9474: 0x676F,+ 0x9475: 0x76C3,+ 0x9476: 0x724C,+ 0x9477: 0x80CC,+ 0x9478: 0x80BA,+ 0x9479: 0x8F29,+ 0x947A: 0x914D,+ 0x947B: 0x500D,+ 0x947C: 0x57F9,+ 0x947D: 0x5A92,+ 0x947E: 0x6885,+ 0x9480: 0x6973,+ 0x9481: 0x7164,+ 0x9482: 0x72FD,+ 0x9483: 0x8CB7,+ 0x9484: 0x58F2,+ 0x9485: 0x8CE0,+ 0x9486: 0x966A,+ 0x9487: 0x9019,+ 0x9488: 0x877F,+ 0x9489: 0x79E4,+ 0x948A: 0x77E7,+ 0x948B: 0x8429,+ 0x948C: 0x4F2F,+ 0x948D: 0x5265,+ 0x948E: 0x535A,+ 0x948F: 0x62CD,+ 0x9490: 0x67CF,+ 0x9491: 0x6CCA,+ 0x9492: 0x767D,+ 0x9493: 0x7B94,+ 0x9494: 0x7C95,+ 0x9495: 0x8236,+ 0x9496: 0x8584,+ 0x9497: 0x8FEB,+ 0x9498: 0x66DD,+ 0x9499: 0x6F20,+ 0x949A: 0x7206,+ 0x949B: 0x7E1B,+ 0x949C: 0x83AB,+ 0x949D: 0x99C1,+ 0x949E: 0x9EA6,+ 0x949F: 0x51FD,+ 0x94A0: 0x7BB1,+ 0x94A1: 0x7872,+ 0x94A2: 0x7BB8,+ 0x94A3: 0x8087,+ 0x94A4: 0x7B48,+ 0x94A5: 0x6AE8,+ 0x94A6: 0x5E61,+ 0x94A7: 0x808C,+ 0x94A8: 0x7551,+ 0x94A9: 0x7560,+ 0x94AA: 0x516B,+ 0x94AB: 0x9262,+ 0x94AC: 0x6E8C,+ 0x94AD: 0x767A,+ 0x94AE: 0x9197,+ 0x94AF: 0x9AEA,+ 0x94B0: 0x4F10,+ 0x94B1: 0x7F70,+ 0x94B2: 0x629C,+ 0x94B3: 0x7B4F,+ 0x94B4: 0x95A5,+ 0x94B5: 0x9CE9,+ 0x94B6: 0x567A,+ 0x94B7: 0x5859,+ 0x94B8: 0x86E4,+ 0x94B9: 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FA: 0x7435,+ 0x94FB: 0x7709,+ 0x94FC: 0x7F8E,+ 0x9540: 0x9F3B,+ 0x9541: 0x67CA,+ 0x9542: 0x7A17,+ 0x9543: 0x5339,+ 0x9544: 0x758B,+ 0x9545: 0x9AED,+ 0x9546: 0x5F66,+ 0x9547: 0x819D,+ 0x9548: 0x83F1,+ 0x9549: 0x8098,+ 0x954A: 0x5F3C,+ 0x954B: 0x5FC5,+ 0x954C: 0x7562,+ 0x954D: 0x7B46,+ 0x954E: 0x903C,+ 0x954F: 0x6867,+ 0x9550: 0x59EB,+ 0x9551: 0x5A9B,+ 0x9552: 0x7D10,+ 0x9553: 0x767E,+ 0x9554: 0x8B2C,+ 0x9555: 0x4FF5,+ 0x9556: 0x5F6A,+ 0x9557: 0x6A19,+ 0x9558: 0x6C37,+ 0x9559: 0x6F02,+ 0x955A: 0x74E2,+ 0x955B: 0x7968,+ 0x955C: 0x8868,+ 0x955D: 0x8A55,+ 0x955E: 0x8C79,+ 0x955F: 0x5EDF,+ 0x9560: 0x63CF,+ 0x9561: 0x75C5,+ 0x9562: 0x79D2,+ 0x9563: 0x82D7,+ 0x9564: 0x9328,+ 0x9565: 0x92F2,+ 0x9566: 0x849C,+ 0x9567: 0x86ED,+ 0x9568: 0x9C2D,+ 0x9569: 0x54C1,+ 0x956A: 0x5F6C,+ 0x956B: 0x658C,+ 0x956C: 0x6D5C,+ 0x956D: 0x7015,+ 0x956E: 0x8CA7,+ 0x956F: 0x8CD3,+ 0x9570: 0x983B,+ 0x9571: 0x654F,+ 0x9572: 0x74F6,+ 0x9573: 0x4E0D,+ 0x9574: 0x4ED8,+ 0x9575: 0x57E0,+ 0x9576: 0x592B,+ 0x9577: 0x5A66,+ 0x9578: 0x5BCC,+ 0x9579: 0x51A8,+ 0x957A: 0x5E03,+ 0x957B: 0x5E9C,+ 0x957C: 0x6016,+ 0x957D: 0x6276,+ 0x957E: 0x6577,+ 0x9580: 0x65A7,+ 0x9581: 0x666E,+ 0x9582: 0x6D6E,+ 0x9583: 0x7236,+ 0x9584: 0x7B26,+ 0x9585: 0x8150,+ 0x9586: 0x819A,+ 0x9587: 0x8299,+ 0x9588: 0x8B5C,+ 0x9589: 0x8CA0,+ 0x958A: 0x8CE6,+ 0x958B: 0x8D74,+ 0x958C: 0x961C,+ 0x958D: 0x9644,+ 0x958E: 0x4FAE,+ 0x958F: 0x64AB,+ 0x9590: 0x6B66,+ 0x9591: 0x821E,+ 0x9592: 0x8461,+ 0x9593: 0x856A,+ 0x9594: 0x90E8,+ 0x9595: 0x5C01,+ 0x9596: 0x6953,+ 0x9597: 0x98A8,+ 0x9598: 0x847A,+ 0x9599: 0x8557,+ 0x959A: 0x4F0F,+ 0x959B: 0x526F,+ 0x959C: 0x5FA9,+ 0x959D: 0x5E45,+ 0x959E: 0x670D,+ 0x959F: 0x798F,+ 0x95A0: 0x8179,+ 0x95A1: 0x8907,+ 0x95A2: 0x8986,+ 0x95A3: 0x6DF5,+ 0x95A4: 0x5F17,+ 0x95A5: 0x6255,+ 0x95A6: 0x6CB8,+ 0x95A7: 0x4ECF,+ 0x95A8: 0x7269,+ 0x95A9: 0x9B92,+ 0x95AA: 0x5206,+ 0x95AB: 0x543B,+ 0x95AC: 0x5674,+ 0x95AD: 0x58B3,+ 0x95AE: 0x61A4,+ 0x95AF: 0x626E,+ 0x95B0: 0x711A,+ 0x95B1: 0x596E,+ 0x95B2: 0x7C89,+ 0x95B3: 0x7CDE,+ 0x95B4: 0x7D1B,+ 0x95B5: 0x96F0,+ 0x95B6: 0x6587,+ 0x95B7: 0x805E,+ 0x95B8: 0x4E19,+ 0x95B9: 0x4F75,+ 0x95BA: 0x5175,+ 0x95BB: 0x5840,+ 0x95BC: 0x5E63,+ 0x95BD: 0x5E73,+ 0x95BE: 0x5F0A,+ 0x95BF: 0x67C4,+ 0x95C0: 0x4E26,+ 0x95C1: 0x853D,+ 0x95C2: 0x9589,+ 0x95C3: 0x965B,+ 0x95C4: 0x7C73,+ 0x95C5: 0x9801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0x964A: 0x8912,+ 0x964B: 0x8A2A,+ 0x964C: 0x8C4A,+ 0x964D: 0x90A6,+ 0x964E: 0x92D2,+ 0x964F: 0x98FD,+ 0x9650: 0x9CF3,+ 0x9651: 0x9D6C,+ 0x9652: 0x4E4F,+ 0x9653: 0x4EA1,+ 0x9654: 0x508D,+ 0x9655: 0x5256,+ 0x9656: 0x574A,+ 0x9657: 0x59A8,+ 0x9658: 0x5E3D,+ 0x9659: 0x5FD8,+ 0x965A: 0x5FD9,+ 0x965B: 0x623F,+ 0x965C: 0x66B4,+ 0x965D: 0x671B,+ 0x965E: 0x67D0,+ 0x965F: 0x68D2,+ 0x9660: 0x5192,+ 0x9661: 0x7D21,+ 0x9662: 0x80AA,+ 0x9663: 0x81A8,+ 0x9664: 0x8B00,+ 0x9665: 0x8C8C,+ 0x9666: 0x8CBF,+ 0x9667: 0x927E,+ 0x9668: 0x9632,+ 0x9669: 0x5420,+ 0x966A: 0x982C,+ 0x966B: 0x5317,+ 0x966C: 0x50D5,+ 0x966D: 0x535C,+ 0x966E: 0x58A8,+ 0x966F: 0x64B2,+ 0x9670: 0x6734,+ 0x9671: 0x7267,+ 0x9672: 0x7766,+ 0x9673: 0x7A46,+ 0x9674: 0x91E6,+ 0x9675: 0x52C3,+ 0x9676: 0x6CA1,+ 0x9677: 0x6B86,+ 0x9678: 0x5800,+ 0x9679: 0x5E4C,+ 0x967A: 0x5954,+ 0x967B: 0x672C,+ 0x967C: 0x7FFB,+ 0x967D: 0x51E1,+ 0x967E: 0x76C6,+ 0x9680: 0x6469,+ 0x9681: 0x78E8,+ 0x9682: 0x9B54,+ 0x9683: 0x9EBB,+ 0x9684: 0x57CB,+ 0x9685: 0x59B9,+ 0x9686: 0x6627,+ 0x9687: 0x679A,+ 0x9688: 0x6BCE,+ 0x9689: 0x54E9,+ 0x968A: 0x69D9,+ 0x968B: 0x5E55,+ 0x968C: 0x819C,+ 0x968D: 0x6795,+ 0x968E: 0x9BAA,+ 0x968F: 0x67FE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0x96D1: 0x6BDB,+ 0x96D2: 0x731B,+ 0x96D3: 0x76F2,+ 0x96D4: 0x7DB2,+ 0x96D5: 0x8017,+ 0x96D6: 0x8499,+ 0x96D7: 0x5132,+ 0x96D8: 0x6728,+ 0x96D9: 0x9ED9,+ 0x96DA: 0x76EE,+ 0x96DB: 0x6762,+ 0x96DC: 0x52FF,+ 0x96DD: 0x9905,+ 0x96DE: 0x5C24,+ 0x96DF: 0x623B,+ 0x96E0: 0x7C7E,+ 0x96E1: 0x8CB0,+ 0x96E2: 0x554F,+ 0x96E3: 0x60B6,+ 0x96E4: 0x7D0B,+ 0x96E5: 0x9580,+ 0x96E6: 0x5301,+ 0x96E7: 0x4E5F,+ 0x96E8: 0x51B6,+ 0x96E9: 0x591C,+ 0x96EA: 0x723A,+ 0x96EB: 0x8036,+ 0x96EC: 0x91CE,+ 0x96ED: 0x5F25,+ 0x96EE: 0x77E2,+ 0x96EF: 0x5384,+ 0x96F0: 0x5F79,+ 0x96F1: 0x7D04,+ 0x96F2: 0x85AC,+ 0x96F3: 0x8A33,+ 0x96F4: 0x8E8D,+ 0x96F5: 0x9756,+ 0x96F6: 0x67F3,+ 0x96F7: 0x85AE,+ 0x96F8: 0x9453,+ 0x96F9: 0x6109,+ 0x96FA: 0x6108,+ 0x96FB: 0x6CB9,+ 0x96FC: 0x7652,+ 0x9740: 0x8AED,+ 0x9741: 0x8F38,+ 0x9742: 0x552F,+ 0x9743: 0x4F51,+ 0x9744: 0x512A,+ 0x9745: 0x52C7,+ 0x9746: 0x53CB,+ 0x9747: 0x5BA5,+ 0x9748: 0x5E7D,+ 0x9749: 0x60A0,+ 0x974A: 0x6182,+ 0x974B: 0x63D6,+ 0x974C: 0x6709,+ 0x974D: 0x67DA,+ 0x974E: 0x6E67,+ 0x974F: 0x6D8C,+ 0x9750: 0x7336,+ 0x9751: 0x7337,+ 0x9752: 0x7531,+ 0x9753: 0x7950,+ 0x9754: 0x88D5,+ 0x9755: 0x8A98,+ 0x9756: 0x904A,+ 0x9757: 0x9091,+ 0x9758: 0x90F5,+ 0x9759: 0x96C4,+ 0x975A: 0x878D,+ 0x975B: 0x5915,+ 0x975C: 0x4E88,+ 0x975D: 0x4F59,+ 0x975E: 0x4E0E,+ 0x975F: 0x8A89,+ 0x9760: 0x8F3F,+ 0x9761: 0x9810,+ 0x9762: 0x50AD,+ 0x9763: 0x5E7C,+ 0x9764: 0x5996,+ 0x9765: 0x5BB9,+ 0x9766: 0x5EB8,+ 0x9767: 0x63DA,+ 0x9768: 0x63FA,+ 0x9769: 0x64C1,+ 0x976A: 0x66DC,+ 0x976B: 0x694A,+ 0x976C: 0x69D8,+ 0x976D: 0x6D0B,+ 0x976E: 0x6EB6,+ 0x976F: 0x7194,+ 0x9770: 0x7528,+ 0x9771: 0x7AAF,+ 0x9772: 0x7F8A,+ 0x9773: 0x8000,+ 0x9774: 0x8449,+ 0x9775: 0x84C9,+ 0x9776: 0x8981,+ 0x9777: 0x8B21,+ 0x9778: 0x8E0A,+ 0x9779: 0x9065,+ 0x977A: 0x967D,+ 0x977B: 0x990A,+ 0x977C: 0x617E,+ 0x977D: 0x6291,+ 0x977E: 0x6B32,+ 0x9780: 0x6C83,+ 0x9781: 0x6D74,+ 0x9782: 0x7FCC,+ 0x9783: 0x7FFC,+ 0x9784: 0x6DC0,+ 0x9785: 0x7F85,+ 0x9786: 0x87BA,+ 0x9787: 0x88F8,+ 0x9788: 0x6765,+ 0x9789: 0x83B1,+ 0x978A: 0x983C,+ 0x978B: 0x96F7,+ 0x978C: 0x6D1B,+ 0x978D: 0x7D61,+ 0x978E: 0x843D,+ 0x978F: 0x916A,+ 0x9790: 0x4E71,+ 0x9791: 0x5375,+ 0x9792: 0x5D50,+ 0x9793: 0x6B04,+ 0x9794: 0x6FEB,+ 0x9795: 0x85CD,+ 0x9796: 0x862D,+ 0x9797: 0x89A7,+ 0x9798: 0x5229,+ 0x9799: 0x540F,+ 0x979A: 0x5C65,+ 0x979B: 0x674E,+ 0x979C: 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 0x7D2F,+ 0x97DE: 0x985E,+ 0x97DF: 0x4EE4,+ 0x97E0: 0x4F36,+ 0x97E1: 0x4F8B,+ 0x97E2: 0x51B7,+ 0x97E3: 0x52B1,+ 0x97E4: 0x5DBA,+ 0x97E5: 0x601C,+ 0x97E6: 0x73B2,+ 0x97E7: 0x793C,+ 0x97E8: 0x82D3,+ 0x97E9: 0x9234,+ 0x97EA: 0x96B7,+ 0x97EB: 0x96F6,+ 0x97EC: 0x970A,+ 0x97ED: 0x9E97,+ 0x97EE: 0x9F62,+ 0x97EF: 0x66A6,+ 0x97F0: 0x6B74,+ 0x97F1: 0x5217,+ 0x97F2: 0x52A3,+ 0x97F3: 0x70C8,+ 0x97F4: 0x88C2,+ 0x97F5: 0x5EC9,+ 0x97F6: 0x604B,+ 0x97F7: 0x6190,+ 0x97F8: 0x6F23,+ 0x97F9: 0x7149,+ 0x97FA: 0x7C3E,+ 0x97FB: 0x7DF4,+ 0x97FC: 0x806F,+ 0x9840: 0x84EE,+ 0x9841: 0x9023,+ 0x9842: 0x932C,+ 0x9843: 0x5442,+ 0x9844: 0x9B6F,+ 0x9845: 0x6AD3,+ 0x9846: 0x7089,+ 0x9847: 0x8CC2,+ 0x9848: 0x8DEF,+ 0x9849: 0x9732,+ 0x984A: 0x52B4,+ 0x984B: 0x5A41,+ 0x984C: 0x5ECA,+ 0x984D: 0x5F04,+ 0x984E: 0x6717,+ 0x984F: 0x697C,+ 0x9850: 0x6994,+ 0x9851: 0x6D6A,+ 0x9852: 0x6F0F,+ 0x9853: 0x7262,+ 0x9854: 0x72FC,+ 0x9855: 0x7BED,+ 0x9856: 0x8001,+ 0x9857: 0x807E,+ 0x9858: 0x874B,+ 0x9859: 0x90CE,+ 0x985A: 0x516D,+ 0x985B: 0x9E93,+ 0x985C: 0x7984,+ 0x985D: 0x808B,+ 0x985E: 0x9332,+ 0x985F: 0x8AD6,+ 0x9860: 0x502D,+ 0x9861: 0x548C,+ 0x9862: 0x8A71,+ 0x9863: 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69,+ 0x98CF: 0x4F70,+ 0x98D0: 0x4F91,+ 0x98D1: 0x4F6F,+ 0x98D2: 0x4F86,+ 0x98D3: 0x4F96,+ 0x98D4: 0x5118,+ 0x98D5: 0x4FD4,+ 0x98D6: 0x4FDF,+ 0x98D7: 0x4FCE,+ 0x98D8: 0x4FD8,+ 0x98D9: 0x4FDB,+ 0x98DA: 0x4FD1,+ 0x98DB: 0x4FDA,+ 0x98DC: 0x4FD0,+ 0x98DD: 0x4FE4,+ 0x98DE: 0x4FE5,+ 0x98DF: 0x501A,+ 0x98E0: 0x5028,+ 0x98E1: 0x5014,+ 0x98E2: 0x502A,+ 0x98E3: 0x5025,+ 0x98E4: 0x5005,+ 0x98E5: 0x4F1C,+ 0x98E6: 0x4FF6,+ 0x98E7: 0x5021,+ 0x98E8: 0x5029,+ 0x98E9: 0x502C,+ 0x98EA: 0x4FFE,+ 0x98EB: 0x4FEF,+ 0x98EC: 0x5011,+ 0x98ED: 0x5006,+ 0x98EE: 0x5043,+ 0x98EF: 0x5047,+ 0x98F0: 0x6703,+ 0x98F1: 0x5055,+ 0x98F2: 0x5050,+ 0x98F3: 0x5048,+ 0x98F4: 0x505A,+ 0x98F5: 0x5056,+ 0x98F6: 0x506C,+ 0x98F7: 0x5078,+ 0x98F8: 0x5080,+ 0x98F9: 0x509A,+ 0x98FA: 0x5085,+ 0x98FB: 0x50B4,+ 0x98FC: 0x50B2,+ 0x9940: 0x50C9,+ 0x9941: 0x50CA,+ 0x9942: 0x50B3,+ 0x9943: 0x50C2,+ 0x9944: 0x50D6,+ 0x9945: 0x50DE,+ 0x9946: 0x50E5,+ 0x9947: 0x50ED,+ 0x9948: 0x50E3,+ 0x9949: 0x50EE,+ 0x994A: 0x50F9,+ 0x994B: 0x50F5,+ 0x994C: 0x5109,+ 0x994D: 0x5101,+ 0x994E: 0x5102,+ 0x994F: 0x5116,+ 0x9950: 0x5115,+ 0x9951: 0x5114,+ 0x9952: 0x511A,+ 0x9953: 0x5121,+ 0x9954: 0x513A,+ 0x9955: 0x5137,+ 0x9956: 0x513C,+ 0x9957: 0x513B,+ 0x9958: 0x513F,+ 0x9959: 0x5140,+ 0x995A: 0x5152,+ 0x995B: 0x514C,+ 0x995C: 0x5154,+ 0x995D: 0x5162,+ 0x995E: 0x7AF8,+ 0x995F: 0x5169,+ 0x9960: 0x516A,+ 0x9961: 0x516E,+ 0x9962: 0x5180,+ 0x9963: 0x5182,+ 0x9964: 0x56D8,+ 0x9965: 0x518C,+ 0x9966: 0x5189,+ 0x9967: 0x518F,+ 0x9968: 0x5191,+ 0x9969: 0x5193,+ 0x996A: 0x5195,+ 0x996B: 0x5196,+ 0x996C: 0x51A4,+ 0x996D: 0x51A6,+ 0x996E: 0x51A2,+ 0x996F: 0x51A9,+ 0x9970: 0x51AA,+ 0x9971: 0x51AB,+ 0x9972: 0x51B3,+ 0x9973: 0x51B1,+ 0x9974: 0x51B2,+ 0x9975: 0x51B0,+ 0x9976: 0x51B5,+ 0x9977: 0x51BD,+ 0x9978: 0x51C5,+ 0x9979: 0x51C9,+ 0x997A: 0x51DB,+ 0x997B: 0x51E0,+ 0x997C: 0x8655,+ 0x997D: 0x51E9,+ 0x997E: 0x51ED,+ 0x9980: 0x51F0,+ 0x9981: 0x51F5,+ 0x9982: 0x51FE,+ 0x9983: 0x5204,+ 0x9984: 0x520B,+ 0x9985: 0x5214,+ 0x9986: 0x520E,+ 0x9987: 0x5227,+ 0x9988: 0x522A,+ 0x9989: 0x522E,+ 0x998A: 0x5233,+ 0x998B: 0x5239,+ 0x998C: 0x524F,+ 0x998D: 0x5244,+ 0x998E: 0x524B,+ 0x998F: 0x524C,+ 0x9990: 0x525E,+ 0x9991: 0x5254,+ 0x9992: 0x526A,+ 0x9993: 0x5274,+ 0x9994: 0x5269,+ 0x9995: 0x5273,+ 0x9996: 0x527F,+ 0x9997: 0x527D,+ 0x9998: 0x528D,+ 0x9999: 0x5294,+ 0x999A: 0x5292,+ 0x999B: 0x5271,+ 0x999C: 0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E056: 0x6FA4,+ 0xE057: 0x6FB9,+ 0xE058: 0x6FC6,+ 0xE059: 0x6FAA,+ 0xE05A: 0x6FDF,+ 0xE05B: 0x6FD5,+ 0xE05C: 0x6FEC,+ 0xE05D: 0x6FD4,+ 0xE05E: 0x6FD8,+ 0xE05F: 0x6FF1,+ 0xE060: 0x6FEE,+ 0xE061: 0x6FDB,+ 0xE062: 0x7009,+ 0xE063: 0x700B,+ 0xE064: 0x6FFA,+ 0xE065: 0x7011,+ 0xE066: 0x7001,+ 0xE067: 0x700F,+ 0xE068: 0x6FFE,+ 0xE069: 0x701B,+ 0xE06A: 0x701A,+ 0xE06B: 0x6F74,+ 0xE06C: 0x701D,+ 0xE06D: 0x7018,+ 0xE06E: 0x701F,+ 0xE06F: 0x7030,+ 0xE070: 0x703E,+ 0xE071: 0x7032,+ 0xE072: 0x7051,+ 0xE073: 0x7063,+ 0xE074: 0x7099,+ 0xE075: 0x7092,+ 0xE076: 0x70AF,+ 0xE077: 0x70F1,+ 0xE078: 0x70AC,+ 0xE079: 0x70B8,+ 0xE07A: 0x70B3,+ 0xE07B: 0x70AE,+ 0xE07C: 0x70DF,+ 0xE07D: 0x70CB,+ 0xE07E: 0x70DD,+ 0xE080: 0x70D9,+ 0xE081: 0x7109,+ 0xE082: 0x70FD,+ 0xE083: 0x711C,+ 0xE084: 0x7119,+ 0xE085: 0x7165,+ 0xE086: 0x7155,+ 0xE087: 0x7188,+ 0xE088: 0x7166,+ 0xE089: 0x7162,+ 0xE08A: 0x714C,+ 0xE08B: 0x7156,+ 0xE08C: 0x716C,+ 0xE08D: 0x718F,+ 0xE08E: 0x71FB,+ 0xE08F: 0x7184,+ 0xE090: 0x7195,+ 0xE091: 0x71A8,+ 0xE092: 0x71AC,+ 0xE093: 0x71D7,+ 0xE094: 0x71B9,+ 0xE095: 0x71BE,+ 0xE096: 0x71D2,+ 0xE097: 0x71C9,+ 0xE098: 0x71D4,+ 0xE099: 0x71CE,+ 0xE09A: 0x71E0,+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0x7564,+ 0xE15F: 0x7567,+ 0xE160: 0x756B,+ 0xE161: 0x756D,+ 0xE162: 0x7578,+ 0xE163: 0x7576,+ 0xE164: 0x7586,+ 0xE165: 0x7587,+ 0xE166: 0x7574,+ 0xE167: 0x758A,+ 0xE168: 0x7589,+ 0xE169: 0x7582,+ 0xE16A: 0x7594,+ 0xE16B: 0x759A,+ 0xE16C: 0x759D,+ 0xE16D: 0x75A5,+ 0xE16E: 0x75A3,+ 0xE16F: 0x75C2,+ 0xE170: 0x75B3,+ 0xE171: 0x75C3,+ 0xE172: 0x75B5,+ 0xE173: 0x75BD,+ 0xE174: 0x75B8,+ 0xE175: 0x75BC,+ 0xE176: 0x75B1,+ 0xE177: 0x75CD,+ 0xE178: 0x75CA,+ 0xE179: 0x75D2,+ 0xE17A: 0x75D9,+ 0xE17B: 0x75E3,+ 0xE17C: 0x75DE,+ 0xE17D: 0x75FE,+ 0xE17E: 0x75FF,+ 0xE180: 0x75FC,+ 0xE181: 0x7601,+ 0xE182: 0x75F0,+ 0xE183: 0x75FA,+ 0xE184: 0x75F2,+ 0xE185: 0x75F3,+ 0xE186: 0x760B,+ 0xE187: 0x760D,+ 0xE188: 0x7609,+ 0xE189: 0x761F,+ 0xE18A: 0x7627,+ 0xE18B: 0x7620,+ 0xE18C: 0x7621,+ 0xE18D: 0x7622,+ 0xE18E: 0x7624,+ 0xE18F: 0x7634,+ 0xE190: 0x7630,+ 0xE191: 0x763B,+ 0xE192: 0x7647,+ 0xE193: 0x7648,+ 0xE194: 0x7646,+ 0xE195: 0x765C,+ 0xE196: 0x7658,+ 0xE197: 0x7661,+ 0xE198: 0x7662,+ 0xE199: 0x7668,+ 0xE19A: 0x7669,+ 0xE19B: 0x766A,+ 0xE19C: 0x7667,+ 0xE19D: 0x766C,+ 0xE19E: 0x7670,+ 0xE19F: 0x7672,+ 0xE1A0: 0x7676,+ 0xE1A1: 0x7678,+ 0xE1A2: 0x767C,+ 0xE1A3: 0x7680,+ 0xE1A4: 0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0x81C8,+ 0xE465: 0x81DA,+ 0xE466: 0x81DF,+ 0xE467: 0x81E0,+ 0xE468: 0x81E7,+ 0xE469: 0x81FA,+ 0xE46A: 0x81FB,+ 0xE46B: 0x81FE,+ 0xE46C: 0x8201,+ 0xE46D: 0x8202,+ 0xE46E: 0x8205,+ 0xE46F: 0x8207,+ 0xE470: 0x820A,+ 0xE471: 0x820D,+ 0xE472: 0x8210,+ 0xE473: 0x8216,+ 0xE474: 0x8229,+ 0xE475: 0x822B,+ 0xE476: 0x8238,+ 0xE477: 0x8233,+ 0xE478: 0x8240,+ 0xE479: 0x8259,+ 0xE47A: 0x8258,+ 0xE47B: 0x825D,+ 0xE47C: 0x825A,+ 0xE47D: 0x825F,+ 0xE47E: 0x8264,+ 0xE480: 0x8262,+ 0xE481: 0x8268,+ 0xE482: 0x826A,+ 0xE483: 0x826B,+ 0xE484: 0x822E,+ 0xE485: 0x8271,+ 0xE486: 0x8277,+ 0xE487: 0x8278,+ 0xE488: 0x827E,+ 0xE489: 0x828D,+ 0xE48A: 0x8292,+ 0xE48B: 0x82AB,+ 0xE48C: 0x829F,+ 0xE48D: 0x82BB,+ 0xE48E: 0x82AC,+ 0xE48F: 0x82E1,+ 0xE490: 0x82E3,+ 0xE491: 0x82DF,+ 0xE492: 0x82D2,+ 0xE493: 0x82F4,+ 0xE494: 0x82F3,+ 0xE495: 0x82FA,+ 0xE496: 0x8393,+ 0xE497: 0x8303,+ 0xE498: 0x82FB,+ 0xE499: 0x82F9,+ 0xE49A: 0x82DE,+ 0xE49B: 0x8306,+ 0xE49C: 0x82DC,+ 0xE49D: 0x8309,+ 0xE49E: 0x82D9,+ 0xE49F: 0x8335,+ 0xE4A0: 0x8334,+ 0xE4A1: 0x8316,+ 0xE4A2: 0x8332,+ 0xE4A3: 0x8331,+ 0xE4A4: 0x8340,+ 0xE4A5: 0x8339,+ 0xE4A6: 0x8350,+ 0xE4A7: 0x8345,+ 0xE4A8: 0x832F,+ 0xE4A9: 0x832B,+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0x84BB,+ 0xE4E9: 0x84DA,+ 0xE4EA: 0x84D0,+ 0xE4EB: 0x84C1,+ 0xE4EC: 0x84C6,+ 0xE4ED: 0x84D6,+ 0xE4EE: 0x84A1,+ 0xE4EF: 0x8521,+ 0xE4F0: 0x84FF,+ 0xE4F1: 0x84F4,+ 0xE4F2: 0x8517,+ 0xE4F3: 0x8518,+ 0xE4F4: 0x852C,+ 0xE4F5: 0x851F,+ 0xE4F6: 0x8515,+ 0xE4F7: 0x8514,+ 0xE4F8: 0x84FC,+ 0xE4F9: 0x8540,+ 0xE4FA: 0x8563,+ 0xE4FB: 0x8558,+ 0xE4FC: 0x8548,+ 0xE540: 0x8541,+ 0xE541: 0x8602,+ 0xE542: 0x854B,+ 0xE543: 0x8555,+ 0xE544: 0x8580,+ 0xE545: 0x85A4,+ 0xE546: 0x8588,+ 0xE547: 0x8591,+ 0xE548: 0x858A,+ 0xE549: 0x85A8,+ 0xE54A: 0x856D,+ 0xE54B: 0x8594,+ 0xE54C: 0x859B,+ 0xE54D: 0x85EA,+ 0xE54E: 0x8587,+ 0xE54F: 0x859C,+ 0xE550: 0x8577,+ 0xE551: 0x857E,+ 0xE552: 0x8590,+ 0xE553: 0x85C9,+ 0xE554: 0x85BA,+ 0xE555: 0x85CF,+ 0xE556: 0x85B9,+ 0xE557: 0x85D0,+ 0xE558: 0x85D5,+ 0xE559: 0x85DD,+ 0xE55A: 0x85E5,+ 0xE55B: 0x85DC,+ 0xE55C: 0x85F9,+ 0xE55D: 0x860A,+ 0xE55E: 0x8613,+ 0xE55F: 0x860B,+ 0xE560: 0x85FE,+ 0xE561: 0x85FA,+ 0xE562: 0x8606,+ 0xE563: 0x8622,+ 0xE564: 0x861A,+ 0xE565: 0x8630,+ 0xE566: 0x863F,+ 0xE567: 0x864D,+ 0xE568: 0x4E55,+ 0xE569: 0x8654,+ 0xE56A: 0x865F,+ 0xE56B: 0x8667,+ 0xE56C: 0x8671,+ 0xE56D: 0x8693,+ 0xE56E: 0x86A3,+ 0xE56F: 0x86A9,+ 0xE570: 0x86AA,+ 0xE571: 0x868B,+ 0xE572: 0x868C,+ 0xE573: 0x86B6,+ 0xE574: 0x86AF,+ 0xE575: 0x86C4,+ 0xE576: 0x86C6,+ 0xE577: 0x86B0,+ 0xE578: 0x86C9,+ 0xE579: 0x8823,+ 0xE57A: 0x86AB,+ 0xE57B: 0x86D4,+ 0xE57C: 0x86DE,+ 0xE57D: 0x86E9,+ 0xE57E: 0x86EC,+ 0xE580: 0x86DF,+ 0xE581: 0x86DB,+ 0xE582: 0x86EF,+ 0xE583: 0x8712,+ 0xE584: 0x8706,+ 0xE585: 0x8708,+ 0xE586: 0x8700,+ 0xE587: 0x8703,+ 0xE588: 0x86FB,+ 0xE589: 0x8711,+ 0xE58A: 0x8709,+ 0xE58B: 0x870D,+ 0xE58C: 0x86F9,+ 0xE58D: 0x870A,+ 0xE58E: 0x8734,+ 0xE58F: 0x873F,+ 0xE590: 0x8737,+ 0xE591: 0x873B,+ 0xE592: 0x8725,+ 0xE593: 0x8729,+ 0xE594: 0x871A,+ 0xE595: 0x8760,+ 0xE596: 0x875F,+ 0xE597: 0x8778,+ 0xE598: 0x874C,+ 0xE599: 0x874E,+ 0xE59A: 0x8774,+ 0xE59B: 0x8757,+ 0xE59C: 0x8768,+ 0xE59D: 0x876E,+ 0xE59E: 0x8759,+ 0xE59F: 0x8753,+ 0xE5A0: 0x8763,+ 0xE5A1: 0x876A,+ 0xE5A2: 0x8805,+ 0xE5A3: 0x87A2,+ 0xE5A4: 0x879F,+ 0xE5A5: 0x8782,+ 0xE5A6: 0x87AF,+ 0xE5A7: 0x87CB,+ 0xE5A8: 0x87BD,+ 0xE5A9: 0x87C0,+ 0xE5AA: 0x87D0,+ 0xE5AB: 0x96D6,+ 0xE5AC: 0x87AB,+ 0xE5AD: 0x87C4,+ 0xE5AE: 0x87B3,+ 0xE5AF: 0x87C7,+ 0xE5B0: 0x87C6,+ 0xE5B1: 0x87BB,+ 0xE5B2: 0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0xE5F1: 0x8925,+ 0xE5F2: 0x892A,+ 0xE5F3: 0x892B,+ 0xE5F4: 0x8941,+ 0xE5F5: 0x8944,+ 0xE5F6: 0x893B,+ 0xE5F7: 0x8936,+ 0xE5F8: 0x8938,+ 0xE5F9: 0x894C,+ 0xE5FA: 0x891D,+ 0xE5FB: 0x8960,+ 0xE5FC: 0x895E,+ 0xE640: 0x8966,+ 0xE641: 0x8964,+ 0xE642: 0x896D,+ 0xE643: 0x896A,+ 0xE644: 0x896F,+ 0xE645: 0x8974,+ 0xE646: 0x8977,+ 0xE647: 0x897E,+ 0xE648: 0x8983,+ 0xE649: 0x8988,+ 0xE64A: 0x898A,+ 0xE64B: 0x8993,+ 0xE64C: 0x8998,+ 0xE64D: 0x89A1,+ 0xE64E: 0x89A9,+ 0xE64F: 0x89A6,+ 0xE650: 0x89AC,+ 0xE651: 0x89AF,+ 0xE652: 0x89B2,+ 0xE653: 0x89BA,+ 0xE654: 0x89BD,+ 0xE655: 0x89BF,+ 0xE656: 0x89C0,+ 0xE657: 0x89DA,+ 0xE658: 0x89DC,+ 0xE659: 0x89DD,+ 0xE65A: 0x89E7,+ 0xE65B: 0x89F4,+ 0xE65C: 0x89F8,+ 0xE65D: 0x8A03,+ 0xE65E: 0x8A16,+ 0xE65F: 0x8A10,+ 0xE660: 0x8A0C,+ 0xE661: 0x8A1B,+ 0xE662: 0x8A1D,+ 0xE663: 0x8A25,+ 0xE664: 0x8A36,+ 0xE665: 0x8A41,+ 0xE666: 0x8A5B,+ 0xE667: 0x8A52,+ 0xE668: 0x8A46,+ 0xE669: 0x8A48,+ 0xE66A: 0x8A7C,+ 0xE66B: 0x8A6D,+ 0xE66C: 0x8A6C,+ 0xE66D: 0x8A62,+ 0xE66E: 0x8A85,+ 0xE66F: 0x8A82,+ 0xE670: 0x8A84,+ 0xE671: 0x8AA8,+ 0xE672: 0x8AA1,+ 0xE673: 0x8A91,+ 0xE674: 0x8AA5,+ 0xE675: 0x8AA6,+ 0xE676: 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 0xE7F2: 0x9293,+ 0xE7F3: 0x929B,+ 0xE7F4: 0x925A,+ 0xE7F5: 0x92CF,+ 0xE7F6: 0x92B9,+ 0xE7F7: 0x92B7,+ 0xE7F8: 0x92E9,+ 0xE7F9: 0x930F,+ 0xE7FA: 0x92FA,+ 0xE7FB: 0x9344,+ 0xE7FC: 0x932E,+ 0xE840: 0x9319,+ 0xE841: 0x9322,+ 0xE842: 0x931A,+ 0xE843: 0x9323,+ 0xE844: 0x933A,+ 0xE845: 0x9335,+ 0xE846: 0x933B,+ 0xE847: 0x935C,+ 0xE848: 0x9360,+ 0xE849: 0x937C,+ 0xE84A: 0x936E,+ 0xE84B: 0x9356,+ 0xE84C: 0x93B0,+ 0xE84D: 0x93AC,+ 0xE84E: 0x93AD,+ 0xE84F: 0x9394,+ 0xE850: 0x93B9,+ 0xE851: 0x93D6,+ 0xE852: 0x93D7,+ 0xE853: 0x93E8,+ 0xE854: 0x93E5,+ 0xE855: 0x93D8,+ 0xE856: 0x93C3,+ 0xE857: 0x93DD,+ 0xE858: 0x93D0,+ 0xE859: 0x93C8,+ 0xE85A: 0x93E4,+ 0xE85B: 0x941A,+ 0xE85C: 0x9414,+ 0xE85D: 0x9413,+ 0xE85E: 0x9403,+ 0xE85F: 0x9407,+ 0xE860: 0x9410,+ 0xE861: 0x9436,+ 0xE862: 0x942B,+ 0xE863: 0x9435,+ 0xE864: 0x9421,+ 0xE865: 0x943A,+ 0xE866: 0x9441,+ 0xE867: 0x9452,+ 0xE868: 0x9444,+ 0xE869: 0x945B,+ 0xE86A: 0x9460,+ 0xE86B: 0x9462,+ 0xE86C: 0x945E,+ 0xE86D: 0x946A,+ 0xE86E: 0x9229,+ 0xE86F: 0x9470,+ 0xE870: 0x9475,+ 0xE871: 0x9477,+ 0xE872: 0x947D,+ 0xE873: 0x945A,+ 0xE874: 0x947C,+ 0xE875: 0x947E,+ 0xE876: 0x9481,+ 0xE877: 0x947F,+ 0xE878: 0x9582,+ 0xE879: 0x9587,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 0xE8FB: 0x986F,+ 0xE8FC: 0x9870,+ 0xE940: 0x9871,+ 0xE941: 0x9874,+ 0xE942: 0x9873,+ 0xE943: 0x98AA,+ 0xE944: 0x98AF,+ 0xE945: 0x98B1,+ 0xE946: 0x98B6,+ 0xE947: 0x98C4,+ 0xE948: 0x98C3,+ 0xE949: 0x98C6,+ 0xE94A: 0x98E9,+ 0xE94B: 0x98EB,+ 0xE94C: 0x9903,+ 0xE94D: 0x9909,+ 0xE94E: 0x9912,+ 0xE94F: 0x9914,+ 0xE950: 0x9918,+ 0xE951: 0x9921,+ 0xE952: 0x991D,+ 0xE953: 0x991E,+ 0xE954: 0x9924,+ 0xE955: 0x9920,+ 0xE956: 0x992C,+ 0xE957: 0x992E,+ 0xE958: 0x993D,+ 0xE959: 0x993E,+ 0xE95A: 0x9942,+ 0xE95B: 0x9949,+ 0xE95C: 0x9945,+ 0xE95D: 0x9950,+ 0xE95E: 0x994B,+ 0xE95F: 0x9951,+ 0xE960: 0x9952,+ 0xE961: 0x994C,+ 0xE962: 0x9955,+ 0xE963: 0x9997,+ 0xE964: 0x9998,+ 0xE965: 0x99A5,+ 0xE966: 0x99AD,+ 0xE967: 0x99AE,+ 0xE968: 0x99BC,+ 0xE969: 0x99DF,+ 0xE96A: 0x99DB,+ 0xE96B: 0x99DD,+ 0xE96C: 0x99D8,+ 0xE96D: 0x99D1,+ 0xE96E: 0x99ED,+ 0xE96F: 0x99EE,+ 0xE970: 0x99F1,+ 0xE971: 0x99F2,+ 0xE972: 0x99FB,+ 0xE973: 0x99F8,+ 0xE974: 0x9A01,+ 0xE975: 0x9A0F,+ 0xE976: 0x9A05,+ 0xE977: 0x99E2,+ 0xE978: 0x9A19,+ 0xE979: 0x9A2B,+ 0xE97A: 0x9A37,+ 0xE97B: 0x9A45,+ 0xE97C: 0x9A42,+ 0xE97D: 0x9A40,+ 0xE97E: 0x9A43,+ 0xE980: 0x9A3E,+ 0xE981: 0x9A55,+ 0xE982: 0x9A4D,+ 0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x9EDE,+ 0xEA7A: 0x9EDD,+ 0xEA7B: 0x9EE0,+ 0xEA7C: 0x9EE5,+ 0xEA7D: 0x9EE8,+ 0xEA7E: 0x9EEF,+ 0xEA80: 0x9EF4,+ 0xEA81: 0x9EF6,+ 0xEA82: 0x9EF7,+ 0xEA83: 0x9EF9,+ 0xEA84: 0x9EFB,+ 0xEA85: 0x9EFC,+ 0xEA86: 0x9EFD,+ 0xEA87: 0x9F07,+ 0xEA88: 0x9F08,+ 0xEA89: 0x76B7,+ 0xEA8A: 0x9F15,+ 0xEA8B: 0x9F21,+ 0xEA8C: 0x9F2C,+ 0xEA8D: 0x9F3E,+ 0xEA8E: 0x9F4A,+ 0xEA8F: 0x9F52,+ 0xEA90: 0x9F54,+ 0xEA91: 0x9F63,+ 0xEA92: 0x9F5F,+ 0xEA93: 0x9F60,+ 0xEA94: 0x9F61,+ 0xEA95: 0x9F66,+ 0xEA96: 0x9F67,+ 0xEA97: 0x9F6C,+ 0xEA98: 0x9F6A,+ 0xEA99: 0x9F77,+ 0xEA9A: 0x9F72,+ 0xEA9B: 0x9F76,+ 0xEA9C: 0x9F95,+ 0xEA9D: 0x9F9C,+ 0xEA9E: 0x9FA0,+ 0xEA9F: 0x582F,+ 0xEAA0: 0x69C7,+ 0xEAA1: 0x9059,+ 0xEAA2: 0x7464,+ 0xEAA3: 0x51DC,+ 0xEAA4: 0x7199,+};+++/***/ }),+/* 9 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var GenericGF_1 = __webpack_require__(1);+var GenericGFPoly_1 = __webpack_require__(2);+function runEuclideanAlgorithm(field, a, b, R) {+ var _a;+ // Assume a's degree is >= b's+ if (a.degree() < b.degree()) {+ _a = [b, a], a = _a[0], b = _a[1];+ }+ var rLast = a;+ var r = b;+ var tLast = field.zero;+ var t = field.one;+ // Run Euclidean algorithm until r's degree is less than R/2+ while (r.degree() >= R / 2) {+ var rLastLast = rLast;+ var tLastLast = tLast;+ rLast = r;+ tLast = t;+ // Divide rLastLast by rLast, with quotient in q and remainder in r+ if (rLast.isZero()) {+ // Euclidean algorithm already terminated?+ return null;+ }+ r = rLastLast;+ var q = field.zero;+ var denominatorLeadingTerm = rLast.getCoefficient(rLast.degree());+ var dltInverse = field.inverse(denominatorLeadingTerm);+ while (r.degree() >= rLast.degree() && !r.isZero()) {+ var degreeDiff = r.degree() - rLast.degree();+ var scale = field.multiply(r.getCoefficient(r.degree()), dltInverse);+ q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale));+ r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));+ }+ t = q.multiplyPoly(tLast).addOrSubtract(tLastLast);+ if (r.degree() >= rLast.degree()) {+ return null;+ }+ }+ var sigmaTildeAtZero = t.getCoefficient(0);+ if (sigmaTildeAtZero === 0) {+ return null;+ }+ var inverse = field.inverse(sigmaTildeAtZero);+ return [t.multiply(inverse), r.multiply(inverse)];+}+function findErrorLocations(field, errorLocator) {+ // This is a direct application of Chien's search+ var numErrors = errorLocator.degree();+ if (numErrors === 1) {+ return [errorLocator.getCoefficient(1)];+ }+ var result = new Array(numErrors);+ var errorCount = 0;+ for (var i = 1; i < field.size && errorCount < numErrors; i++) {+ if (errorLocator.evaluateAt(i) === 0) {+ result[errorCount] = field.inverse(i);+ errorCount++;+ }+ }+ if (errorCount !== numErrors) {+ return null;+ }+ return result;+}+function findErrorMagnitudes(field, errorEvaluator, errorLocations) {+ // This is directly applying Forney's Formula+ var s = errorLocations.length;+ var result = new Array(s);+ for (var i = 0; i < s; i++) {+ var xiInverse = field.inverse(errorLocations[i]);+ var denominator = 1;+ for (var j = 0; j < s; j++) {+ if (i !== j) {+ denominator = field.multiply(denominator, GenericGF_1.addOrSubtractGF(1, field.multiply(errorLocations[j], xiInverse)));+ }+ }+ result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse), field.inverse(denominator));+ if (field.generatorBase !== 0) {+ result[i] = field.multiply(result[i], xiInverse);+ }+ }+ return result;+}+function decode(bytes, twoS) {+ var outputBytes = new Uint8ClampedArray(bytes.length);+ outputBytes.set(bytes);+ var field = new GenericGF_1.default(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1+ var poly = new GenericGFPoly_1.default(field, outputBytes);+ var syndromeCoefficients = new Uint8ClampedArray(twoS);+ var error = false;+ for (var s = 0; s < twoS; s++) {+ var evaluation = poly.evaluateAt(field.exp(s + field.generatorBase));+ syndromeCoefficients[syndromeCoefficients.length - 1 - s] = evaluation;+ if (evaluation !== 0) {+ error = true;+ }+ }+ if (!error) {+ return outputBytes;+ }+ var syndrome = new GenericGFPoly_1.default(field, syndromeCoefficients);+ var sigmaOmega = runEuclideanAlgorithm(field, field.buildMonomial(twoS, 1), syndrome, twoS);+ if (sigmaOmega === null) {+ return null;+ }+ var errorLocations = findErrorLocations(field, sigmaOmega[0]);+ if (errorLocations == null) {+ return null;+ }+ var errorMagnitudes = findErrorMagnitudes(field, sigmaOmega[1], errorLocations);+ for (var i = 0; i < errorLocations.length; i++) {+ var position = outputBytes.length - 1 - field.log(errorLocations[i]);+ if (position < 0) {+ return null;+ }+ outputBytes[position] = GenericGF_1.addOrSubtractGF(outputBytes[position], errorMagnitudes[i]);+ }+ return outputBytes;+}+exports.decode = decode;+++/***/ }),+/* 10 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+exports.VERSIONS = [+ {+ infoBits: null,+ versionNumber: 1,+ alignmentPatternCenters: [],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 7,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 19 }],+ },+ {+ ecCodewordsPerBlock: 10,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }],+ },+ {+ ecCodewordsPerBlock: 13,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 13 }],+ },+ {+ ecCodewordsPerBlock: 17,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 9 }],+ },+ ],+ },+ {+ infoBits: null,+ versionNumber: 2,+ alignmentPatternCenters: [6, 18],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 10,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 34 }],+ },+ {+ ecCodewordsPerBlock: 16,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 28 }],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 22 }],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }],+ },+ ],+ },+ {+ infoBits: null,+ versionNumber: 3,+ alignmentPatternCenters: [6, 22],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 15,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 55 }],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 44 }],+ },+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 17 }],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 13 }],+ },+ ],+ },+ {+ infoBits: null,+ versionNumber: 4,+ alignmentPatternCenters: [6, 26],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 20,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 80 }],+ },+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 32 }],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 24 }],+ },+ {+ ecCodewordsPerBlock: 16,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 9 }],+ },+ ],+ },+ {+ infoBits: null,+ versionNumber: 5,+ alignmentPatternCenters: [6, 30],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 108 }],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 43 }],+ },+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 15 },+ { numBlocks: 2, dataCodewordsPerBlock: 16 },+ ],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 11 },+ { numBlocks: 2, dataCodewordsPerBlock: 12 },+ ],+ },+ ],+ },+ {+ infoBits: null,+ versionNumber: 6,+ alignmentPatternCenters: [6, 34],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 68 }],+ },+ {+ ecCodewordsPerBlock: 16,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 27 }],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 19 }],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 15 }],+ },+ ],+ },+ {+ infoBits: 0x07C94,+ versionNumber: 7,+ alignmentPatternCenters: [6, 22, 38],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 20,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 78 }],+ },+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 31 }],+ },+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 14 },+ { numBlocks: 4, dataCodewordsPerBlock: 15 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 13 },+ { numBlocks: 1, dataCodewordsPerBlock: 14 },+ ],+ },+ ],+ },+ {+ infoBits: 0x085BC,+ versionNumber: 8,+ alignmentPatternCenters: [6, 24, 42],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 97 }],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 38 },+ { numBlocks: 2, dataCodewordsPerBlock: 39 },+ ],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 18 },+ { numBlocks: 2, dataCodewordsPerBlock: 19 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 14 },+ { numBlocks: 2, dataCodewordsPerBlock: 15 },+ ],+ },+ ],+ },+ {+ infoBits: 0x09A99,+ versionNumber: 9,+ alignmentPatternCenters: [6, 26, 46],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 116 }],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 36 },+ { numBlocks: 2, dataCodewordsPerBlock: 37 },+ ],+ },+ {+ ecCodewordsPerBlock: 20,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 16 },+ { numBlocks: 4, dataCodewordsPerBlock: 17 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 12 },+ { numBlocks: 4, dataCodewordsPerBlock: 13 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0A4D3,+ versionNumber: 10,+ alignmentPatternCenters: [6, 28, 50],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 18,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 68 },+ { numBlocks: 2, dataCodewordsPerBlock: 69 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 43 },+ { numBlocks: 1, dataCodewordsPerBlock: 44 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 19 },+ { numBlocks: 2, dataCodewordsPerBlock: 20 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 15 },+ { numBlocks: 2, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0BBF6,+ versionNumber: 11,+ alignmentPatternCenters: [6, 30, 54],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 20,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 81 }],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 1, dataCodewordsPerBlock: 50 },+ { numBlocks: 4, dataCodewordsPerBlock: 51 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 22 },+ { numBlocks: 4, dataCodewordsPerBlock: 23 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 12 },+ { numBlocks: 8, dataCodewordsPerBlock: 13 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0C762,+ versionNumber: 12,+ alignmentPatternCenters: [6, 32, 58],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 92 },+ { numBlocks: 2, dataCodewordsPerBlock: 93 },+ ],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 36 },+ { numBlocks: 2, dataCodewordsPerBlock: 37 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 20 },+ { numBlocks: 6, dataCodewordsPerBlock: 21 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 7, dataCodewordsPerBlock: 14 },+ { numBlocks: 4, dataCodewordsPerBlock: 15 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0D847,+ versionNumber: 13,+ alignmentPatternCenters: [6, 34, 62],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 107 }],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 37 },+ { numBlocks: 1, dataCodewordsPerBlock: 38 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 20 },+ { numBlocks: 4, dataCodewordsPerBlock: 21 },+ ],+ },+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 12, dataCodewordsPerBlock: 11 },+ { numBlocks: 4, dataCodewordsPerBlock: 12 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0E60D,+ versionNumber: 14,+ alignmentPatternCenters: [6, 26, 46, 66],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 115 },+ { numBlocks: 1, dataCodewordsPerBlock: 116 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 40 },+ { numBlocks: 5, dataCodewordsPerBlock: 41 },+ ],+ },+ {+ ecCodewordsPerBlock: 20,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 16 },+ { numBlocks: 5, dataCodewordsPerBlock: 17 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 12 },+ { numBlocks: 5, dataCodewordsPerBlock: 13 },+ ],+ },+ ],+ },+ {+ infoBits: 0x0F928,+ versionNumber: 15,+ alignmentPatternCenters: [6, 26, 48, 70],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 22,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 87 },+ { numBlocks: 1, dataCodewordsPerBlock: 88 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 41 },+ { numBlocks: 5, dataCodewordsPerBlock: 42 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 24 },+ { numBlocks: 7, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 12 },+ { numBlocks: 7, dataCodewordsPerBlock: 13 },+ ],+ },+ ],+ },+ {+ infoBits: 0x10B78,+ versionNumber: 16,+ alignmentPatternCenters: [6, 26, 50, 74],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 98 },+ { numBlocks: 1, dataCodewordsPerBlock: 99 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 7, dataCodewordsPerBlock: 45 },+ { numBlocks: 3, dataCodewordsPerBlock: 46 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [+ { numBlocks: 15, dataCodewordsPerBlock: 19 },+ { numBlocks: 2, dataCodewordsPerBlock: 20 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 15 },+ { numBlocks: 13, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1145D,+ versionNumber: 17,+ alignmentPatternCenters: [6, 30, 54, 78],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 1, dataCodewordsPerBlock: 107 },+ { numBlocks: 5, dataCodewordsPerBlock: 108 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 10, dataCodewordsPerBlock: 46 },+ { numBlocks: 1, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 1, dataCodewordsPerBlock: 22 },+ { numBlocks: 15, dataCodewordsPerBlock: 23 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 14 },+ { numBlocks: 17, dataCodewordsPerBlock: 15 },+ ],+ },+ ],+ },+ {+ infoBits: 0x12A17,+ versionNumber: 18,+ alignmentPatternCenters: [6, 30, 56, 82],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 120 },+ { numBlocks: 1, dataCodewordsPerBlock: 121 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 9, dataCodewordsPerBlock: 43 },+ { numBlocks: 4, dataCodewordsPerBlock: 44 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 17, dataCodewordsPerBlock: 22 },+ { numBlocks: 1, dataCodewordsPerBlock: 23 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 14 },+ { numBlocks: 19, dataCodewordsPerBlock: 15 },+ ],+ },+ ],+ },+ {+ infoBits: 0x13532,+ versionNumber: 19,+ alignmentPatternCenters: [6, 30, 58, 86],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 113 },+ { numBlocks: 4, dataCodewordsPerBlock: 114 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 44 },+ { numBlocks: 11, dataCodewordsPerBlock: 45 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 17, dataCodewordsPerBlock: 21 },+ { numBlocks: 4, dataCodewordsPerBlock: 22 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 9, dataCodewordsPerBlock: 13 },+ { numBlocks: 16, dataCodewordsPerBlock: 14 },+ ],+ },+ ],+ },+ {+ infoBits: 0x149A6,+ versionNumber: 20,+ alignmentPatternCenters: [6, 34, 62, 90],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 107 },+ { numBlocks: 5, dataCodewordsPerBlock: 108 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 41 },+ { numBlocks: 13, dataCodewordsPerBlock: 42 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 15, dataCodewordsPerBlock: 24 },+ { numBlocks: 5, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 15, dataCodewordsPerBlock: 15 },+ { numBlocks: 10, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x15683,+ versionNumber: 21,+ alignmentPatternCenters: [6, 28, 50, 72, 94],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 116 },+ { numBlocks: 4, dataCodewordsPerBlock: 117 },+ ],+ },+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 42 }],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 17, dataCodewordsPerBlock: 22 },+ { numBlocks: 6, dataCodewordsPerBlock: 23 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 16 },+ { numBlocks: 6, dataCodewordsPerBlock: 17 },+ ],+ },+ ],+ },+ {+ infoBits: 0x168C9,+ versionNumber: 22,+ alignmentPatternCenters: [6, 26, 50, 74, 98],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 111 },+ { numBlocks: 7, dataCodewordsPerBlock: 112 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 46 }],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 7, dataCodewordsPerBlock: 24 },+ { numBlocks: 16, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 24,+ ecBlocks: [{ numBlocks: 34, dataCodewordsPerBlock: 13 }],+ },+ ],+ },+ {+ infoBits: 0x177EC,+ versionNumber: 23,+ alignmentPatternCenters: [6, 30, 54, 74, 102],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 121 },+ { numBlocks: 5, dataCodewordsPerBlock: 122 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 47 },+ { numBlocks: 14, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 24 },+ { numBlocks: 14, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 16, dataCodewordsPerBlock: 15 },+ { numBlocks: 14, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x18EC4,+ versionNumber: 24,+ alignmentPatternCenters: [6, 28, 54, 80, 106],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 117 },+ { numBlocks: 4, dataCodewordsPerBlock: 118 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 45 },+ { numBlocks: 14, dataCodewordsPerBlock: 46 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 24 },+ { numBlocks: 16, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 30, dataCodewordsPerBlock: 16 },+ { numBlocks: 2, dataCodewordsPerBlock: 17 },+ ],+ },+ ],+ },+ {+ infoBits: 0x191E1,+ versionNumber: 25,+ alignmentPatternCenters: [6, 32, 58, 84, 110],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 26,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 106 },+ { numBlocks: 4, dataCodewordsPerBlock: 107 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 47 },+ { numBlocks: 13, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 7, dataCodewordsPerBlock: 24 },+ { numBlocks: 22, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 22, dataCodewordsPerBlock: 15 },+ { numBlocks: 13, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1AFAB,+ versionNumber: 26,+ alignmentPatternCenters: [6, 30, 58, 86, 114],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 10, dataCodewordsPerBlock: 114 },+ { numBlocks: 2, dataCodewordsPerBlock: 115 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 46 },+ { numBlocks: 4, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 28, dataCodewordsPerBlock: 22 },+ { numBlocks: 6, dataCodewordsPerBlock: 23 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 33, dataCodewordsPerBlock: 16 },+ { numBlocks: 4, dataCodewordsPerBlock: 17 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1B08E,+ versionNumber: 27,+ alignmentPatternCenters: [6, 34, 62, 90, 118],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 122 },+ { numBlocks: 4, dataCodewordsPerBlock: 123 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 22, dataCodewordsPerBlock: 45 },+ { numBlocks: 3, dataCodewordsPerBlock: 46 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 8, dataCodewordsPerBlock: 23 },+ { numBlocks: 26, dataCodewordsPerBlock: 24 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 12, dataCodewordsPerBlock: 15 },+ { numBlocks: 28, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1CC1A,+ versionNumber: 28,+ alignmentPatternCenters: [6, 26, 50, 74, 98, 122],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 117 },+ { numBlocks: 10, dataCodewordsPerBlock: 118 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 3, dataCodewordsPerBlock: 45 },+ { numBlocks: 23, dataCodewordsPerBlock: 46 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 24 },+ { numBlocks: 31, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 15 },+ { numBlocks: 31, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1D33F,+ versionNumber: 29,+ alignmentPatternCenters: [6, 30, 54, 78, 102, 126],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 7, dataCodewordsPerBlock: 116 },+ { numBlocks: 7, dataCodewordsPerBlock: 117 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 21, dataCodewordsPerBlock: 45 },+ { numBlocks: 7, dataCodewordsPerBlock: 46 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 1, dataCodewordsPerBlock: 23 },+ { numBlocks: 37, dataCodewordsPerBlock: 24 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 15 },+ { numBlocks: 26, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1ED75,+ versionNumber: 30,+ alignmentPatternCenters: [6, 26, 52, 78, 104, 130],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 5, dataCodewordsPerBlock: 115 },+ { numBlocks: 10, dataCodewordsPerBlock: 116 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 47 },+ { numBlocks: 10, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 15, dataCodewordsPerBlock: 24 },+ { numBlocks: 25, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 23, dataCodewordsPerBlock: 15 },+ { numBlocks: 25, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x1F250,+ versionNumber: 31,+ alignmentPatternCenters: [6, 30, 56, 82, 108, 134],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 13, dataCodewordsPerBlock: 115 },+ { numBlocks: 3, dataCodewordsPerBlock: 116 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 46 },+ { numBlocks: 29, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 42, dataCodewordsPerBlock: 24 },+ { numBlocks: 1, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 23, dataCodewordsPerBlock: 15 },+ { numBlocks: 28, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x209D5,+ versionNumber: 32,+ alignmentPatternCenters: [6, 34, 60, 86, 112, 138],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 115 }],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 10, dataCodewordsPerBlock: 46 },+ { numBlocks: 23, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 10, dataCodewordsPerBlock: 24 },+ { numBlocks: 35, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 15 },+ { numBlocks: 35, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x216F0,+ versionNumber: 33,+ alignmentPatternCenters: [6, 30, 58, 86, 114, 142],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 17, dataCodewordsPerBlock: 115 },+ { numBlocks: 1, dataCodewordsPerBlock: 116 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 14, dataCodewordsPerBlock: 46 },+ { numBlocks: 21, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 29, dataCodewordsPerBlock: 24 },+ { numBlocks: 19, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 11, dataCodewordsPerBlock: 15 },+ { numBlocks: 46, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x228BA,+ versionNumber: 34,+ alignmentPatternCenters: [6, 34, 62, 90, 118, 146],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 13, dataCodewordsPerBlock: 115 },+ { numBlocks: 6, dataCodewordsPerBlock: 116 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 14, dataCodewordsPerBlock: 46 },+ { numBlocks: 23, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 44, dataCodewordsPerBlock: 24 },+ { numBlocks: 7, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 59, dataCodewordsPerBlock: 16 },+ { numBlocks: 1, dataCodewordsPerBlock: 17 },+ ],+ },+ ],+ },+ {+ infoBits: 0x2379F,+ versionNumber: 35,+ alignmentPatternCenters: [6, 30, 54, 78, 102, 126, 150],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 12, dataCodewordsPerBlock: 121 },+ { numBlocks: 7, dataCodewordsPerBlock: 122 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 12, dataCodewordsPerBlock: 47 },+ { numBlocks: 26, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 39, dataCodewordsPerBlock: 24 },+ { numBlocks: 14, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 22, dataCodewordsPerBlock: 15 },+ { numBlocks: 41, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x24B0B,+ versionNumber: 36,+ alignmentPatternCenters: [6, 24, 50, 76, 102, 128, 154],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 121 },+ { numBlocks: 14, dataCodewordsPerBlock: 122 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 6, dataCodewordsPerBlock: 47 },+ { numBlocks: 34, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 46, dataCodewordsPerBlock: 24 },+ { numBlocks: 10, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 2, dataCodewordsPerBlock: 15 },+ { numBlocks: 64, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x2542E,+ versionNumber: 37,+ alignmentPatternCenters: [6, 28, 54, 80, 106, 132, 158],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 17, dataCodewordsPerBlock: 122 },+ { numBlocks: 4, dataCodewordsPerBlock: 123 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 29, dataCodewordsPerBlock: 46 },+ { numBlocks: 14, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 49, dataCodewordsPerBlock: 24 },+ { numBlocks: 10, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 24, dataCodewordsPerBlock: 15 },+ { numBlocks: 46, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x26A64,+ versionNumber: 38,+ alignmentPatternCenters: [6, 32, 58, 84, 110, 136, 162],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 4, dataCodewordsPerBlock: 122 },+ { numBlocks: 18, dataCodewordsPerBlock: 123 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 13, dataCodewordsPerBlock: 46 },+ { numBlocks: 32, dataCodewordsPerBlock: 47 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 48, dataCodewordsPerBlock: 24 },+ { numBlocks: 14, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 42, dataCodewordsPerBlock: 15 },+ { numBlocks: 32, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x27541,+ versionNumber: 39,+ alignmentPatternCenters: [6, 26, 54, 82, 110, 138, 166],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 20, dataCodewordsPerBlock: 117 },+ { numBlocks: 4, dataCodewordsPerBlock: 118 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 40, dataCodewordsPerBlock: 47 },+ { numBlocks: 7, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 43, dataCodewordsPerBlock: 24 },+ { numBlocks: 22, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 10, dataCodewordsPerBlock: 15 },+ { numBlocks: 67, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+ {+ infoBits: 0x28C69,+ versionNumber: 40,+ alignmentPatternCenters: [6, 30, 58, 86, 114, 142, 170],+ errorCorrectionLevels: [+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 19, dataCodewordsPerBlock: 118 },+ { numBlocks: 6, dataCodewordsPerBlock: 119 },+ ],+ },+ {+ ecCodewordsPerBlock: 28,+ ecBlocks: [+ { numBlocks: 18, dataCodewordsPerBlock: 47 },+ { numBlocks: 31, dataCodewordsPerBlock: 48 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 34, dataCodewordsPerBlock: 24 },+ { numBlocks: 34, dataCodewordsPerBlock: 25 },+ ],+ },+ {+ ecCodewordsPerBlock: 30,+ ecBlocks: [+ { numBlocks: 20, dataCodewordsPerBlock: 15 },+ { numBlocks: 61, dataCodewordsPerBlock: 16 },+ ],+ },+ ],+ },+];+++/***/ }),+/* 11 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var BitMatrix_1 = __webpack_require__(0);+function squareToQuadrilateral(p1, p2, p3, p4) {+ var dx3 = p1.x - p2.x + p3.x - p4.x;+ var dy3 = p1.y - p2.y + p3.y - p4.y;+ if (dx3 === 0 && dy3 === 0) { // Affine+ return {+ a11: p2.x - p1.x,+ a12: p2.y - p1.y,+ a13: 0,+ a21: p3.x - p2.x,+ a22: p3.y - p2.y,+ a23: 0,+ a31: p1.x,+ a32: p1.y,+ a33: 1,+ };+ }+ else {+ var dx1 = p2.x - p3.x;+ var dx2 = p4.x - p3.x;+ var dy1 = p2.y - p3.y;+ var dy2 = p4.y - p3.y;+ var denominator = dx1 * dy2 - dx2 * dy1;+ var a13 = (dx3 * dy2 - dx2 * dy3) / denominator;+ var a23 = (dx1 * dy3 - dx3 * dy1) / denominator;+ return {+ a11: p2.x - p1.x + a13 * p2.x,+ a12: p2.y - p1.y + a13 * p2.y,+ a13: a13,+ a21: p4.x - p1.x + a23 * p4.x,+ a22: p4.y - p1.y + a23 * p4.y,+ a23: a23,+ a31: p1.x,+ a32: p1.y,+ a33: 1,+ };+ }+}+function quadrilateralToSquare(p1, p2, p3, p4) {+ // Here, the adjoint serves as the inverse:+ var sToQ = squareToQuadrilateral(p1, p2, p3, p4);+ return {+ a11: sToQ.a22 * sToQ.a33 - sToQ.a23 * sToQ.a32,+ a12: sToQ.a13 * sToQ.a32 - sToQ.a12 * sToQ.a33,+ a13: sToQ.a12 * sToQ.a23 - sToQ.a13 * sToQ.a22,+ a21: sToQ.a23 * sToQ.a31 - sToQ.a21 * sToQ.a33,+ a22: sToQ.a11 * sToQ.a33 - sToQ.a13 * sToQ.a31,+ a23: sToQ.a13 * sToQ.a21 - sToQ.a11 * sToQ.a23,+ a31: sToQ.a21 * sToQ.a32 - sToQ.a22 * sToQ.a31,+ a32: sToQ.a12 * sToQ.a31 - sToQ.a11 * sToQ.a32,+ a33: sToQ.a11 * sToQ.a22 - sToQ.a12 * sToQ.a21,+ };+}+function times(a, b) {+ return {+ a11: a.a11 * b.a11 + a.a21 * b.a12 + a.a31 * b.a13,+ a12: a.a12 * b.a11 + a.a22 * b.a12 + a.a32 * b.a13,+ a13: a.a13 * b.a11 + a.a23 * b.a12 + a.a33 * b.a13,+ a21: a.a11 * b.a21 + a.a21 * b.a22 + a.a31 * b.a23,+ a22: a.a12 * b.a21 + a.a22 * b.a22 + a.a32 * b.a23,+ a23: a.a13 * b.a21 + a.a23 * b.a22 + a.a33 * b.a23,+ a31: a.a11 * b.a31 + a.a21 * b.a32 + a.a31 * b.a33,+ a32: a.a12 * b.a31 + a.a22 * b.a32 + a.a32 * b.a33,+ a33: a.a13 * b.a31 + a.a23 * b.a32 + a.a33 * b.a33,+ };+}+function extract(image, location) {+ var qToS = quadrilateralToSquare({ x: 3.5, y: 3.5 }, { x: location.dimension - 3.5, y: 3.5 }, { x: location.dimension - 6.5, y: location.dimension - 6.5 }, { x: 3.5, y: location.dimension - 3.5 });+ var sToQ = squareToQuadrilateral(location.topLeft, location.topRight, location.alignmentPattern, location.bottomLeft);+ var transform = times(sToQ, qToS);+ var matrix = BitMatrix_1.BitMatrix.createEmpty(location.dimension, location.dimension);+ var mappingFunction = function (x, y) {+ var denominator = transform.a13 * x + transform.a23 * y + transform.a33;+ return {+ x: (transform.a11 * x + transform.a21 * y + transform.a31) / denominator,+ y: (transform.a12 * x + transform.a22 * y + transform.a32) / denominator,+ };+ };+ for (var y = 0; y < location.dimension; y++) {+ for (var x = 0; x < location.dimension; x++) {+ var xValue = x + 0.5;+ var yValue = y + 0.5;+ var sourcePixel = mappingFunction(xValue, yValue);+ matrix.set(x, y, image.get(Math.floor(sourcePixel.x), Math.floor(sourcePixel.y)));+ }+ }+ return {+ matrix: matrix,+ mappingFunction: mappingFunction,+ };+}+exports.extract = extract;+++/***/ }),+/* 12 */+/***/ (function(module, exports, __webpack_require__) {++"use strict";++Object.defineProperty(exports, "__esModule", { value: true });+var MAX_FINDERPATTERNS_TO_SEARCH = 4;+var MIN_QUAD_RATIO = 0.5;+var MAX_QUAD_RATIO = 1.5;+var distance = function (a, b) { return Math.sqrt(Math.pow((b.x - a.x), 2) + Math.pow((b.y - a.y), 2)); };+function sum(values) {+ return values.reduce(function (a, b) { return a + b; });+}+// Takes three finder patterns and organizes them into topLeft, topRight, etc+function reorderFinderPatterns(pattern1, pattern2, pattern3) {+ var _a, _b, _c, _d;+ // Find distances between pattern centers+ var oneTwoDistance = distance(pattern1, pattern2);+ var twoThreeDistance = distance(pattern2, pattern3);+ var oneThreeDistance = distance(pattern1, pattern3);+ var bottomLeft;+ var topLeft;+ var topRight;+ // Assume one closest to other two is B; A and C will just be guesses at first+ if (twoThreeDistance >= oneTwoDistance && twoThreeDistance >= oneThreeDistance) {+ _a = [pattern2, pattern1, pattern3], bottomLeft = _a[0], topLeft = _a[1], topRight = _a[2];+ }+ else if (oneThreeDistance >= twoThreeDistance && oneThreeDistance >= oneTwoDistance) {+ _b = [pattern1, pattern2, pattern3], bottomLeft = _b[0], topLeft = _b[1], topRight = _b[2];+ }+ else {+ _c = [pattern1, pattern3, pattern2], bottomLeft = _c[0], topLeft = _c[1], topRight = _c[2];+ }+ // Use cross product to figure out whether bottomLeft (A) and topRight (C) are correct or flipped in relation to topLeft (B)+ // This asks whether BC x BA has a positive z component, which is the arrangement we want. If it's negative, then+ // we've got it flipped around and should swap topRight and bottomLeft.+ if (((topRight.x - topLeft.x) * (bottomLeft.y - topLeft.y)) - ((topRight.y - topLeft.y) * (bottomLeft.x - topLeft.x)) < 0) {+ _d = [topRight, bottomLeft], bottomLeft = _d[0], topRight = _d[1];+ }+ return { bottomLeft: bottomLeft, topLeft: topLeft, topRight: topRight };+}+// Computes the dimension (number of modules on a side) of the QR Code based on the position of the finder patterns+function computeDimension(topLeft, topRight, bottomLeft, matrix) {+ var moduleSize = (sum(countBlackWhiteRun(topLeft, bottomLeft, matrix, 5)) / 7 + // Divide by 7 since the ratio is 1:1:3:1:1+ sum(countBlackWhiteRun(topLeft, topRight, matrix, 5)) / 7 ++ sum(countBlackWhiteRun(bottomLeft, topLeft, matrix, 5)) / 7 ++ sum(countBlackWhiteRun(topRight, topLeft, matrix, 5)) / 7) / 4;+ if (moduleSize < 1) {+ throw new Error("Invalid module size");+ }+ var topDimension = Math.round(distance(topLeft, topRight) / moduleSize);+ var sideDimension = Math.round(distance(topLeft, bottomLeft) / moduleSize);+ var dimension = Math.floor((topDimension + sideDimension) / 2) + 7;+ switch (dimension % 4) {+ case 0:+ dimension++;+ break;+ case 2:+ dimension--;+ break;+ }+ return { dimension: dimension, moduleSize: moduleSize };+}+// Takes an origin point and an end point and counts the sizes of the black white run from the origin towards the end point.+// Returns an array of elements, representing the pixel size of the black white run.+// Uses a variant of http://en.wikipedia.org/wiki/Bresenham's_line_algorithm+function countBlackWhiteRunTowardsPoint(origin, end, matrix, length) {+ var switchPoints = [{ x: Math.floor(origin.x), y: Math.floor(origin.y) }];+ var steep = Math.abs(end.y - origin.y) > Math.abs(end.x - origin.x);+ var fromX;+ var fromY;+ var toX;+ var toY;+ if (steep) {+ fromX = Math.floor(origin.y);+ fromY = Math.floor(origin.x);+ toX = Math.floor(end.y);+ toY = Math.floor(end.x);+ }+ else {+ fromX = Math.floor(origin.x);+ fromY = Math.floor(origin.y);+ toX = Math.floor(end.x);+ toY = Math.floor(end.y);+ }+ var dx = Math.abs(toX - fromX);+ var dy = Math.abs(toY - fromY);+ var error = Math.floor(-dx / 2);+ var xStep = fromX < toX ? 1 : -1;+ var yStep = fromY < toY ? 1 : -1;+ var currentPixel = true;+ // Loop up until x == toX, but not beyond+ for (var x = fromX, y = fromY; x !== toX + xStep; x += xStep) {+ // Does current pixel mean we have moved white to black or vice versa?+ // Scanning black in state 0,2 and white in state 1, so if we find the wrong+ // color, advance to next state or end if we are in state 2 already+ var realX = steep ? y : x;+ var realY = steep ? x : y;+ if (matrix.get(realX, realY) !== currentPixel) {+ currentPixel = !currentPixel;+ switchPoints.push({ x: realX, y: realY });+ if (switchPoints.length === length + 1) {+ break;+ }+ }+ error += dy;+ if (error > 0) {+ if (y === toY) {+ break;+ }+ y += yStep;+ error -= dx;+ }+ }+ var distances = [];+ for (var i = 0; i < length; i++) {+ if (switchPoints[i] && switchPoints[i + 1]) {+ distances.push(distance(switchPoints[i], switchPoints[i + 1]));+ }+ else {+ distances.push(0);+ }+ }+ return distances;+}+// Takes an origin point and an end point and counts the sizes of the black white run in the origin point+// along the line that intersects with the end point. Returns an array of elements, representing the pixel sizes+// of the black white run. Takes a length which represents the number of switches from black to white to look for.+function countBlackWhiteRun(origin, end, matrix, length) {+ var _a;+ var rise = end.y - origin.y;+ var run = end.x - origin.x;+ var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));+ var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x - run, y: origin.y - rise }, matrix, Math.ceil(length / 2));+ var middleValue = towardsEnd.shift() + awayFromEnd.shift() - 1; // Substract one so we don't double count a pixel+ return (_a = awayFromEnd.concat(middleValue)).concat.apply(_a, towardsEnd);+}+// Takes in a black white run and an array of expected ratios. Returns the average size of the run as well as the "error" -+// that is the amount the run diverges from the expected ratio+function scoreBlackWhiteRun(sequence, ratios) {+ var averageSize = sum(sequence) / sum(ratios);+ var error = 0;+ ratios.forEach(function (ratio, i) {+ error += Math.pow((sequence[i] - ratio * averageSize), 2);+ });+ return { averageSize: averageSize, error: error };+}+// Takes an X,Y point and an array of sizes and scores the point against those ratios.+// For example for a finder pattern takes the ratio list of 1:1:3:1:1 and checks horizontal, vertical and diagonal ratios+// against that.+function scorePattern(point, ratios, matrix) {+ try {+ var horizontalRun = countBlackWhiteRun(point, { x: -1, y: point.y }, matrix, ratios.length);+ var verticalRun = countBlackWhiteRun(point, { x: point.x, y: -1 }, matrix, ratios.length);+ var topLeftPoint = {+ x: Math.max(0, point.x - point.y) - 1,+ y: Math.max(0, point.y - point.x) - 1,+ };+ var topLeftBottomRightRun = countBlackWhiteRun(point, topLeftPoint, matrix, ratios.length);+ var bottomLeftPoint = {+ x: Math.min(matrix.width, point.x + point.y) + 1,+ y: Math.min(matrix.height, point.y + point.x) + 1,+ };+ var bottomLeftTopRightRun = countBlackWhiteRun(point, bottomLeftPoint, matrix, ratios.length);+ var horzError = scoreBlackWhiteRun(horizontalRun, ratios);+ var vertError = scoreBlackWhiteRun(verticalRun, ratios);+ var diagDownError = scoreBlackWhiteRun(topLeftBottomRightRun, ratios);+ var diagUpError = scoreBlackWhiteRun(bottomLeftTopRightRun, ratios);+ var ratioError = Math.sqrt(horzError.error * horzError.error ++ vertError.error * vertError.error ++ diagDownError.error * diagDownError.error ++ diagUpError.error * diagUpError.error);+ var avgSize = (horzError.averageSize + vertError.averageSize + diagDownError.averageSize + diagUpError.averageSize) / 4;+ var sizeError = (Math.pow((horzError.averageSize - avgSize), 2) ++ Math.pow((vertError.averageSize - avgSize), 2) ++ Math.pow((diagDownError.averageSize - avgSize), 2) ++ Math.pow((diagUpError.averageSize - avgSize), 2)) / avgSize;+ return ratioError + sizeError;+ }+ catch (_a) {+ return Infinity;+ }+}+function recenterLocation(matrix, p) {+ var leftX = Math.round(p.x);+ while (matrix.get(leftX, Math.round(p.y))) {+ leftX--;+ }+ var rightX = Math.round(p.x);+ while (matrix.get(rightX, Math.round(p.y))) {+ rightX++;+ }+ var x = (leftX + rightX) / 2;+ var topY = Math.round(p.y);+ while (matrix.get(Math.round(x), topY)) {+ topY--;+ }+ var bottomY = Math.round(p.y);+ while (matrix.get(Math.round(x), bottomY)) {+ bottomY++;+ }+ var y = (topY + bottomY) / 2;+ return { x: x, y: y };+}+function locate(matrix) {+ var finderPatternQuads = [];+ var activeFinderPatternQuads = [];+ var alignmentPatternQuads = [];+ var activeAlignmentPatternQuads = [];+ var _loop_1 = function (y) {+ var length_1 = 0;+ var lastBit = false;+ var scans = [0, 0, 0, 0, 0];+ var _loop_2 = function (x) {+ var v = matrix.get(x, y);+ if (v === lastBit) {+ length_1++;+ }+ else {+ scans = [scans[1], scans[2], scans[3], scans[4], length_1];+ length_1 = 1;+ lastBit = v;+ // Do the last 5 color changes ~ match the expected ratio for a finder pattern? 1:1:3:1:1 of b:w:b:w:b+ var averageFinderPatternBlocksize = sum(scans) / 7;+ var validFinderPattern = Math.abs(scans[0] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&+ Math.abs(scans[1] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&+ Math.abs(scans[2] - 3 * averageFinderPatternBlocksize) < 3 * averageFinderPatternBlocksize &&+ Math.abs(scans[3] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&+ Math.abs(scans[4] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&+ !v; // And make sure the current pixel is white since finder patterns are bordered in white+ // Do the last 3 color changes ~ match the expected ratio for an alignment pattern? 1:1:1 of w:b:w+ var averageAlignmentPatternBlocksize = sum(scans.slice(-3)) / 3;+ var validAlignmentPattern = Math.abs(scans[2] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&+ Math.abs(scans[3] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&+ Math.abs(scans[4] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&+ v; // Is the current pixel black since alignment patterns are bordered in black+ if (validFinderPattern) {+ // Compute the start and end x values of the large center black square+ var endX_1 = x - scans[3] - scans[4];+ var startX_1 = endX_1 - scans[2];+ var line = { startX: startX_1, endX: endX_1, y: y };+ // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with+ // that line as the starting point.+ var matchingQuads = activeFinderPatternQuads.filter(function (q) {+ return (startX_1 >= q.bottom.startX && startX_1 <= q.bottom.endX) ||+ (endX_1 >= q.bottom.startX && startX_1 <= q.bottom.endX) ||+ (startX_1 <= q.bottom.startX && endX_1 >= q.bottom.endX && ((scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO &&+ (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO));+ });+ if (matchingQuads.length > 0) {+ matchingQuads[0].bottom = line;+ }+ else {+ activeFinderPatternQuads.push({ top: line, bottom: line });+ }+ }+ if (validAlignmentPattern) {+ // Compute the start and end x values of the center black square+ var endX_2 = x - scans[4];+ var startX_2 = endX_2 - scans[3];+ var line = { startX: startX_2, y: y, endX: endX_2 };+ // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with+ // that line as the starting point.+ var matchingQuads = activeAlignmentPatternQuads.filter(function (q) {+ return (startX_2 >= q.bottom.startX && startX_2 <= q.bottom.endX) ||+ (endX_2 >= q.bottom.startX && startX_2 <= q.bottom.endX) ||+ (startX_2 <= q.bottom.startX && endX_2 >= q.bottom.endX && ((scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO &&+ (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO));+ });+ if (matchingQuads.length > 0) {+ matchingQuads[0].bottom = line;+ }+ else {+ activeAlignmentPatternQuads.push({ top: line, bottom: line });+ }+ }+ }+ };+ for (var x = -1; x <= matrix.width; x++) {+ _loop_2(x);+ }+ finderPatternQuads.push.apply(finderPatternQuads, activeFinderPatternQuads.filter(function (q) { return q.bottom.y !== y && q.bottom.y - q.top.y >= 2; }));+ activeFinderPatternQuads = activeFinderPatternQuads.filter(function (q) { return q.bottom.y === y; });+ alignmentPatternQuads.push.apply(alignmentPatternQuads, activeAlignmentPatternQuads.filter(function (q) { return q.bottom.y !== y; }));+ activeAlignmentPatternQuads = activeAlignmentPatternQuads.filter(function (q) { return q.bottom.y === y; });+ };+ for (var y = 0; y <= matrix.height; y++) {+ _loop_1(y);+ }+ finderPatternQuads.push.apply(finderPatternQuads, activeFinderPatternQuads.filter(function (q) { return q.bottom.y - q.top.y >= 2; }));+ alignmentPatternQuads.push.apply(alignmentPatternQuads, activeAlignmentPatternQuads);+ var finderPatternGroups = finderPatternQuads+ .filter(function (q) { return q.bottom.y - q.top.y >= 2; }) // All quads must be at least 2px tall since the center square is larger than a block+ .map(function (q) {+ var x = (q.top.startX + q.top.endX + q.bottom.startX + q.bottom.endX) / 4;+ var y = (q.top.y + q.bottom.y + 1) / 2;+ if (!matrix.get(Math.round(x), Math.round(y))) {+ return;+ }+ var lengths = [q.top.endX - q.top.startX, q.bottom.endX - q.bottom.startX, q.bottom.y - q.top.y + 1];+ var size = sum(lengths) / lengths.length;+ var score = scorePattern({ x: Math.round(x), y: Math.round(y) }, [1, 1, 3, 1, 1], matrix);+ return { score: score, x: x, y: y, size: size };+ })+ .filter(function (q) { return !!q; }) // Filter out any rejected quads from above+ .sort(function (a, b) { return a.score - b.score; })+ // Now take the top finder pattern options and try to find 2 other options with a similar size.+ .map(function (point, i, finderPatterns) {+ if (i > MAX_FINDERPATTERNS_TO_SEARCH) {+ return null;+ }+ var otherPoints = finderPatterns+ .filter(function (p, ii) { return i !== ii; })+ .map(function (p) { return ({ x: p.x, y: p.y, score: p.score + (Math.pow((p.size - point.size), 2)) / point.size, size: p.size }); })+ .sort(function (a, b) { return a.score - b.score; });+ if (otherPoints.length < 2) {+ return null;+ }+ var score = point.score + otherPoints[0].score + otherPoints[1].score;+ return { points: [point].concat(otherPoints.slice(0, 2)), score: score };+ })+ .filter(function (q) { return !!q; }) // Filter out any rejected finder patterns from above+ .sort(function (a, b) { return a.score - b.score; });+ if (finderPatternGroups.length === 0) {+ return null;+ }+ var _a = reorderFinderPatterns(finderPatternGroups[0].points[0], finderPatternGroups[0].points[1], finderPatternGroups[0].points[2]), topRight = _a.topRight, topLeft = _a.topLeft, bottomLeft = _a.bottomLeft;+ var alignment = findAlignmentPattern(matrix, alignmentPatternQuads, topRight, topLeft, bottomLeft);+ var result = [];+ if (alignment) {+ result.push({+ alignmentPattern: { x: alignment.alignmentPattern.x, y: alignment.alignmentPattern.y },+ bottomLeft: { x: bottomLeft.x, y: bottomLeft.y },+ dimension: alignment.dimension,+ topLeft: { x: topLeft.x, y: topLeft.y },+ topRight: { x: topRight.x, y: topRight.y },+ });+ }+ // We normally use the center of the quads as the location of the tracking points, which is optimal for most cases and will account+ // for a skew in the image. However, In some cases, a slight skew might not be real and instead be caused by image compression+ // errors and/or low resolution. For those cases, we'd be better off centering the point exactly in the middle of the black area. We+ // compute and return the location data for the naively centered points as it is little additional work and allows for multiple+ // attempts at decoding harder images.+ var midTopRight = recenterLocation(matrix, topRight);+ var midTopLeft = recenterLocation(matrix, topLeft);+ var midBottomLeft = recenterLocation(matrix, bottomLeft);+ var centeredAlignment = findAlignmentPattern(matrix, alignmentPatternQuads, midTopRight, midTopLeft, midBottomLeft);+ if (centeredAlignment) {+ result.push({+ alignmentPattern: { x: centeredAlignment.alignmentPattern.x, y: centeredAlignment.alignmentPattern.y },+ bottomLeft: { x: midBottomLeft.x, y: midBottomLeft.y },+ topLeft: { x: midTopLeft.x, y: midTopLeft.y },+ topRight: { x: midTopRight.x, y: midTopRight.y },+ dimension: centeredAlignment.dimension,+ });+ }+ if (result.length === 0) {+ return null;+ }+ return result;+}+exports.locate = locate;+function findAlignmentPattern(matrix, alignmentPatternQuads, topRight, topLeft, bottomLeft) {+ var _a;+ // Now that we've found the three finder patterns we can determine the blockSize and the size of the QR code.+ // We'll use these to help find the alignment pattern but also later when we do the extraction.+ var dimension;+ var moduleSize;+ try {+ (_a = computeDimension(topLeft, topRight, bottomLeft, matrix), dimension = _a.dimension, moduleSize = _a.moduleSize);+ }+ catch (e) {+ return null;+ }+ // Now find the alignment pattern+ var bottomRightFinderPattern = {+ x: topRight.x - topLeft.x + bottomLeft.x,+ y: topRight.y - topLeft.y + bottomLeft.y,+ };+ var modulesBetweenFinderPatterns = ((distance(topLeft, bottomLeft) + distance(topLeft, topRight)) / 2 / moduleSize);+ var correctionToTopLeft = 1 - (3 / modulesBetweenFinderPatterns);+ var expectedAlignmentPattern = {+ x: topLeft.x + correctionToTopLeft * (bottomRightFinderPattern.x - topLeft.x),+ y: topLeft.y + correctionToTopLeft * (bottomRightFinderPattern.y - topLeft.y),+ };+ var alignmentPatterns = alignmentPatternQuads+ .map(function (q) {+ var x = (q.top.startX + q.top.endX + q.bottom.startX + q.bottom.endX) / 4;+ var y = (q.top.y + q.bottom.y + 1) / 2;+ if (!matrix.get(Math.floor(x), Math.floor(y))) {+ return;+ }+ var lengths = [q.top.endX - q.top.startX, q.bottom.endX - q.bottom.startX, (q.bottom.y - q.top.y + 1)];+ var size = sum(lengths) / lengths.length;+ var sizeScore = scorePattern({ x: Math.floor(x), y: Math.floor(y) }, [1, 1, 1], matrix);+ var score = sizeScore + distance({ x: x, y: y }, expectedAlignmentPattern);+ return { x: x, y: y, score: score };+ })+ .filter(function (v) { return !!v; })+ .sort(function (a, b) { return a.score - b.score; });+ // If there are less than 15 modules between finder patterns it's a version 1 QR code and as such has no alignmemnt pattern+ // so we can only use our best guess.+ var alignmentPattern = modulesBetweenFinderPatterns >= 15 && alignmentPatterns.length ? alignmentPatterns[0] : expectedAlignmentPattern;+ return { alignmentPattern: alignmentPattern, dimension: dimension };+}+++/***/ })+/******/ ])["default"];+});\ No newline at end of file