@etherplay/dev-wallet-host 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -1
  3. package/lib/server.js +13 -2
  4. package/package.json +1 -1
  5. package/site/assets/{App-81EXtqUY.css → App-CDu0qQwT.css} +26 -26
  6. package/site/assets/{App-n-xKxOMT.js → App-DDcApMye.js} +130 -124
  7. package/site/assets/App-DDcApMye.js.map +1 -0
  8. package/site/assets/{bignumbers-tTSUAFen.js → bignumbers-DEXSwWwa.js} +2 -2
  9. package/site/assets/{bignumbers-tTSUAFen.js.map → bignumbers-DEXSwWwa.js.map} +1 -1
  10. package/site/assets/{index-CnVGoVpH.js → index-BAWUHBts.js} +4 -4
  11. package/site/assets/{index-CnVGoVpH.js.map → index-BAWUHBts.js.map} +1 -1
  12. package/site/assets/{index-BqqAh48J.js → index-BXoUMG4U.js} +6 -6
  13. package/site/assets/{index-BqqAh48J.js.map → index-BXoUMG4U.js.map} +1 -1
  14. package/site/assets/{index-dhS1shEX.js → index-Boiz7eM2.js} +8 -8
  15. package/site/assets/{index-dhS1shEX.js.map → index-Boiz7eM2.js.map} +1 -1
  16. package/site/assets/{index-Y5uolvJQ.js → index-BpgHGts3.js} +3 -3
  17. package/site/assets/{index-Y5uolvJQ.js.map → index-BpgHGts3.js.map} +1 -1
  18. package/site/assets/{index-Wu-sMuYC.js → index-BrlXb28n.js} +2 -2
  19. package/site/assets/{index-Wu-sMuYC.js.map → index-BrlXb28n.js.map} +1 -1
  20. package/site/assets/{index-DqysTtwQ.js → index-NKFZZPPE.js} +6 -6
  21. package/site/assets/{index-DqysTtwQ.js.map → index-NKFZZPPE.js.map} +1 -1
  22. package/site/assets/{login-CbHgl9FL.js → login-Bm1QORQJ.js} +22 -7
  23. package/site/assets/login-Bm1QORQJ.js.map +1 -0
  24. package/site/assets/login-Dm0rG43D.css +54 -0
  25. package/site/assets/{typed-data-Xi7g-SpO.js → typed-data-CUGl6Sw8.js} +4 -4
  26. package/site/assets/{typed-data-Xi7g-SpO.js.map → typed-data-CUGl6Sw8.js.map} +1 -1
  27. package/site/assets/{utf8-B9sGmk3K.js → utf8-xywbIwOw.js} +2 -2
  28. package/site/assets/{utf8-B9sGmk3K.js.map → utf8-xywbIwOw.js.map} +1 -1
  29. package/site/fonts/OFL-Audiowide.txt +93 -0
  30. package/site/fonts/audiowide-latin-400.woff2 +0 -0
  31. package/site/login/index.html +2 -2
  32. package/site/assets/App-n-xKxOMT.js.map +0 -1
  33. package/site/assets/login-CbHgl9FL.js.map +0 -1
  34. package/site/assets/login-bn0FJsfM.css +0 -30
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,MAAM,qBAAqB;AAuC3B,SAAS,gBAA4B;AACpC;AAAA,IACN,oBAAoB;AAAA,IACpB,aAAkD;AAAA,IAClD,UAAU;AAAA,MACT,gBAAiE;AAAA,MACjE,sBAA8E;AAAA,MAC9E,2BAAwF;AAAA,IACzF;AAAA;AAAA;AAAA,IAGA,yBAEuB;AAAA;AAAA;AAAA;AAAA,IAIvB,iBAAiB,CAAC;AAAA,IAClB,sBAAsB,CAAC;AAAA,IACvB,2BAA2B,KAAK,KAAK,KAAK;AAAA;AAAA,IAC1C,yBAAyB;AAAA;AAAA,EAC1B;AACD;AAcA,SAAS,cAAc,OAAkD;AACjE,gBAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC3E;AASgB,uBAAc,UAAsBA,WAA6C;AAC1F,iBAAqB,EAAC,GAAG,UAAU,UAAU,EAAC,GAAG,SAAS,WAAS;AACzE,QAAM,SAAS,CAAC,OAAe,aAC9B,QAAQ,MAAM,yBAAyB,KAAK,QAAQ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A,OAAA;AAAA;AACrC,QAAM,EAAC,SAAS,QAAO,MAAM;AAAA,qBAAAC,KAAA,iBAAO,mBAAc;AAAA,sBAAAA,KAAA;AAAA;AAClD,QAAM,KAAK;AAAA,IACV,QAAQ,SAAS,eAAe,KAAK;AAAA,GACrC;AACF,CAAC,EACA,MAAM,CAAC,QAAQ;AAGP,gBAAM,8CAA8C,GAAG;AACzD,iBAAS,SAAS,eAAe,KAAK;AAC5C,MAAI,QAAQ;AACX,WAAO,cAAc,oCAAmC,2BAAK,YAAW,GAAG;AAAA;AAE7E,CAAC","names":["document","mount","App"],"ignoreList":[],"sources":["../../login/src/lib/config.ts","../../login/src/main.ts"],"sourcesContent":["/**\n * EVERY VALUE THIS HOST IS CONFIGURED WITH, IN ONE PLACE, AND THE ONE RULE ABOUT WHERE IT MAY COME\n * FROM.\n *\n * Two artefacts are built from this source and they differ in exactly one boolean:\n *\n * - the PRODUCTION host bakes every value at build time and honours no runtime document. That is\n * the safer end of the design rather than a shortcut: nothing fetched at runtime reaches a value\n * this host acts on. The most important value here is the allowlist, and an allowlist entry mints\n * credentials with NO HUMAN IN THE LOOP, so making it runtime-injectable in the artefact that\n * holds real accounts would undo that argument in one line.\n *\n * It does make ONE request: it looks for a document only so it can shout about finding one, and\n * throws the answer away unread. The property being protected is that no fetched value is ever\n * applied, which is stronger than \"no fetch happens\" and is the one worth stating exactly.\n * The cost is a 404 in the console of a correctly deployed production host.\n * - the DEVELOPMENT host merges a runtime document over those baked values, because it holds\n * nothing worth protecting: it exists to be run next to somebody's app and by their e2e run, and\n * everything in it is injectable precisely because none of it guards a real account.\n *\n * A production build that FINDS a document ignores it and says so out loud, which is the pattern\n * `ALLOW_LOOPBACK_REQUESTERS` already sets: a capability that must not travel into production\n * shouts when it finds itself there rather than quietly allowing itself.\n *\n * NOTHING ELSE IN THIS HOST READS `import.meta.env`. That is what makes \"which values can be\n * injected, and into which build\" a question with one answer instead of eight.\n *\n * ---------------------------------------------------------------------------------------------\n * THE DOCUMENT\n *\n * A JSON file served at the ROOT of whatever directory this host is served from, next to\n * `index.html`, so a developer edits one file and reloads. Absent is the normal case: every value\n * below has a default that works with no document at all.\n *\n * {\n * \"hostedAuthProvider\": \"openfort\",\n * \"devMnemonic\": \"test test test test test test test test test test test junk\",\n * \"openfort\": {\n * \"publishableKey\": \"\",\n * \"shieldPublishableKey\": \"\",\n * \"encryptionSessionEndpoint\": \"\"\n * },\n * \"allowLoopbackRequesters\": true,\n * \"originAllowlist\": {\"http://localhost:5173\": [{\"chainId\": 31337, \"contract\": \"0x...\"}]},\n * \"crossOriginAllowlist\": {\"http://localhost:5173\": [\"http://localhost:5174\"]},\n * \"autoSignedLifetimeSeconds\": 120,\n * \"promptedLifetimeSeconds\": 0\n * }\n *\n * The field-by-field prose lives with the artefact that ships it,\n * `packages/etherplay-dev-wallet-host/README.md`, so that adding a field means editing the type\n * below and one document rather than four. What is worth repeating HERE is only what a reader of\n * this file needs: the two lifetimes are not an afterthought, because an auto-signed credential's\n * deadline is the only lever an allowlist entry has once it turns out to be wrong.\n */\nimport type {CrossOriginConsent, DelegationTarget} from '@etherplay/connect-core';\n\n/**\n * Whether this build honours a runtime configuration document.\n *\n * The SAME flag that marks the build as unfit for real accounts, deliberately: there is no way to\n * get the injectable configuration without also getting the build that says it is a development\n * one. `vite build` produces the production artefact; `vite build --mode development` produces the\n * development one; `vite dev` is a development one too.\n *\n * The MODE and not `import.meta.env.DEV`, which cannot express this: vite pins `NODE_ENV` to\n * `production` for every `vite build`, so `DEV` is false even under `--mode development` and the two\n * artefacts came out byte for byte identical. Compared POSITIVELY against `development` so that any\n * other mode, named or invented later, bakes its configuration rather than accepting a document.\n */\nexport const DEVELOPMENT_BUILD = import.meta.env.MODE === 'development';\n\n/** Where the document is looked for, relative to the origin this host is served from. */\nexport const RUNTIME_CONFIG_URL = '/config.json';\n\nexport type HostConfig = {\n\t/**\n\t * Which HOSTED provider answers email and OAuth. Never consulted for the mnemonic mechanism,\n\t * which is derived in the browser by the local provider.\n\t */\n\thostedAuthProvider: string;\n\t/**\n\t * The phrase the mnemonic mechanism signs in with.\n\t *\n\t * Defaulted to the standard test mnemonic in EVERY build, including production, and that is\n\t * deliberate rather than an oversight: the accounts it derives are the ones every local chain\n\t * funds, they are public knowledge, and nobody is protecting them. It means the mechanism needs\n\t * no user input beyond picking an account index.\n\t */\n\tdevMnemonic: string;\n\topenfort: {\n\t\tpublishableKey: string;\n\t\tshieldPublishableKey?: string;\n\t\tencryptionSessionEndpoint: string;\n\t};\n\t/** see ALLOW_LOOPBACK_REQUESTERS in allowlist.ts, which is where the cost of this is argued */\n\tallowLoopbackRequesters: boolean;\n\t/** requester origin to the (chainId, contract) pairs it may have signed with nobody in the loop */\n\toriginAllowlist: Record<string, DelegationTarget[]>;\n\t/** origin whose account is at stake, to who may ask for it */\n\tcrossOriginAllowlist: Record<string, CrossOriginConsent>;\n\t/** how long an auto-signed credential may be presented for */\n\tautoSignedLifetimeSeconds: number;\n\t/** how long a credential a human granted may be presented for; 0 means no expiry */\n\tpromptedLifetimeSeconds: number;\n};\n\n/**\n * What this host is configured with when no document is present, which is the normal case.\n *\n * The env reads are here and nowhere else. A production build has only these.\n */\nexport function bakedDefaults(): HostConfig {\n\treturn {\n\t\thostedAuthProvider: import.meta.env.VITE_AUTH_PROVIDER || 'openfort',\n\t\tdevMnemonic: import.meta.env.VITE_DEV_MNEMONIC || 'test test test test test test test test test test test junk',\n\t\topenfort: {\n\t\t\tpublishableKey: import.meta.env.VITE_OPENFORT_PUBLISHABLE_KEY || '',\n\t\t\tshieldPublishableKey: import.meta.env.VITE_OPENFORT_SHIELD_PUBLISHABLE_KEY || undefined,\n\t\t\tencryptionSessionEndpoint: import.meta.env.VITE_OPENFORT_ENCRYPTION_SESSION_ENDPOINT || '',\n\t\t},\n\t\t// A development BUILD allows it unless told not to; any other build refuses it unless told\n\t\t// to, in which case allowlist.ts shouts. Unchanged from when this lived there.\n\t\tallowLoopbackRequesters:\n\t\t\timport.meta.env.VITE_ALLOW_LOOPBACK_CROSS_ORIGIN === 'true' ||\n\t\t\t(DEVELOPMENT_BUILD && import.meta.env.VITE_ALLOW_LOOPBACK_CROSS_ORIGIN !== 'false'),\n\t\t// Empty on purpose. An entry is a standing decision to mint credentials for a third party\n\t\t// with no human in the loop, so it is added when a specific origin and contract are known to\n\t\t// belong to each other, and not before. A placeholder would be a wrong entry.\n\t\toriginAllowlist: {},\n\t\tcrossOriginAllowlist: {},\n\t\tautoSignedLifetimeSeconds: 90 * 24 * 60 * 60, // ~3 months\n\t\tpromptedLifetimeSeconds: 0, // no expiry\n\t};\n}\n\n/** The document as it arrives: every field optional, and nothing is trusted to be the right type. */\nexport type RuntimeConfigDocument = Partial<{\n\thostedAuthProvider: unknown;\n\tdevMnemonic: unknown;\n\topenfort: unknown;\n\tallowLoopbackRequesters: unknown;\n\toriginAllowlist: unknown;\n\tcrossOriginAllowlist: unknown;\n\tautoSignedLifetimeSeconds: unknown;\n\tpromptedLifetimeSeconds: unknown;\n}>;\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Merge the document over the defaults, one field at a time.\n *\n * A field of the wrong type is REFUSED AND SAID OUT LOUD rather than applied or silently dropped: a\n * typo in a dev config that quietly leaves the old value is a debugging session about the wrong\n * thing. Only the fields present are touched, so a document may set one value and inherit the rest.\n */\nexport function mergeDocument(defaults: HostConfig, document: RuntimeConfigDocument): HostConfig {\n\tconst merged: HostConfig = {...defaults, openfort: {...defaults.openfort}};\n\tconst refuse = (field: string, expected: string) =>\n\t\tconsole.error(`[etherplay] ignoring \"${field}\" in ${RUNTIME_CONFIG_URL}: expected ${expected}`);\n\n\tconst string = (field: 'hostedAuthProvider' | 'devMnemonic') => {\n\t\tconst value = document[field];\n\t\tif (value === undefined) return;\n\t\tif (typeof value !== 'string') return refuse(field, 'a string');\n\t\tmerged[field] = value;\n\t};\n\tstring('hostedAuthProvider');\n\tstring('devMnemonic');\n\n\tif (document.openfort !== undefined) {\n\t\tif (!isPlainObject(document.openfort)) {\n\t\t\trefuse('openfort', 'an object');\n\t\t} else {\n\t\t\tfor (const key of ['publishableKey', 'shieldPublishableKey', 'encryptionSessionEndpoint'] as const) {\n\t\t\t\tconst value = document.openfort[key];\n\t\t\t\tif (value === undefined) continue;\n\t\t\t\tif (typeof value !== 'string') {\n\t\t\t\t\trefuse(`openfort.${key}`, 'a string');\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tmerged.openfort[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (document.allowLoopbackRequesters !== undefined) {\n\t\tif (typeof document.allowLoopbackRequesters !== 'boolean') {\n\t\t\trefuse('allowLoopbackRequesters', 'a boolean');\n\t\t} else {\n\t\t\tmerged.allowLoopbackRequesters = document.allowLoopbackRequesters;\n\t\t}\n\t}\n\n\t// THE TWO FIELDS THAT DECIDE WHETHER A CREDENTIAL IS MINTED WITH NOBODY IN THE LOOP, and\n\t// therefore the two checked hardest rather than cast and hoped for. A malformed entry that gets\n\t// through does not fail here: it fails much later as a pair that mysteriously never matches, or\n\t// as an exception inside the matching, at the moment somebody is trying to sign in.\n\t//\n\t// The tables are REPLACED, not merged entry by entry. Merging would make \"remove this entry\"\n\t// impossible to express, and these are the tables where an entry nobody meant to keep is the\n\t// dangerous direction.\n\tif (document.originAllowlist !== undefined) {\n\t\tif (!isPlainObject(document.originAllowlist)) {\n\t\t\trefuse('originAllowlist', 'an object keyed by origin');\n\t\t} else {\n\t\t\tconst table: Record<string, DelegationTarget[]> = {};\n\t\t\tlet sound = true;\n\t\t\tfor (const [origin, entries] of Object.entries(document.originAllowlist)) {\n\t\t\t\tif (!Array.isArray(entries)) {\n\t\t\t\t\trefuse(`originAllowlist[\"${origin}\"]`, 'an array of {chainId, contract}');\n\t\t\t\t\tsound = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst targets: DelegationTarget[] = [];\n\t\t\t\tfor (const [index, entry] of entries.entries()) {\n\t\t\t\t\tconst chainId = isPlainObject(entry) ? entry.chainId : undefined;\n\t\t\t\t\tconst contract = isPlainObject(entry) ? entry.contract : undefined;\n\t\t\t\t\tif (typeof chainId !== 'number' || !Number.isInteger(chainId)) {\n\t\t\t\t\t\trefuse(`originAllowlist[\"${origin}\"][${index}].chainId`, 'a whole number');\n\t\t\t\t\t\tsound = false;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof contract !== 'string' || !/^0x[0-9a-fA-F]{40}$/.test(contract)) {\n\t\t\t\t\t\trefuse(`originAllowlist[\"${origin}\"][${index}].contract`, 'a 0x-prefixed 20-byte address');\n\t\t\t\t\t\tsound = false;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\ttargets.push({chainId, contract: contract as `0x${string}`});\n\t\t\t\t}\n\t\t\t\ttable[origin] = targets;\n\t\t\t}\n\t\t\t// All or nothing. A HALF-APPLIED allowlist is the worst of the three outcomes: it grants\n\t\t\t// something nobody wrote down, and it looks like it worked.\n\t\t\tif (sound) {\n\t\t\t\tmerged.originAllowlist = table;\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[etherplay] originAllowlist is not applied AT ALL because part of it was refused: a table that ` +\n\t\t\t\t\t\t`granted only the entries that happened to parse would be a grant nobody wrote.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\tif (document.crossOriginAllowlist !== undefined) {\n\t\tif (!isPlainObject(document.crossOriginAllowlist)) {\n\t\t\trefuse('crossOriginAllowlist', 'an object keyed by origin');\n\t\t} else {\n\t\t\tconst table: Record<string, CrossOriginConsent> = {};\n\t\t\tlet sound = true;\n\t\t\tfor (const [origin, consent] of Object.entries(document.crossOriginAllowlist)) {\n\t\t\t\tif (consent === '*') {\n\t\t\t\t\ttable[origin] = '*';\n\t\t\t\t} else if (Array.isArray(consent) && consent.every((requester) => typeof requester === 'string')) {\n\t\t\t\t\ttable[origin] = consent as string[];\n\t\t\t\t} else {\n\t\t\t\t\trefuse(`crossOriginAllowlist[\"${origin}\"]`, 'either \"*\" or an array of origin strings');\n\t\t\t\t\tsound = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (sound) {\n\t\t\t\tmerged.crossOriginAllowlist = table;\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[etherplay] crossOriginAllowlist is not applied AT ALL because part of it was refused: a table that ` +\n\t\t\t\t\t\t`admitted only the entries that happened to parse would be a consent nobody gave.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst lifetime = (field: 'autoSignedLifetimeSeconds' | 'promptedLifetimeSeconds') => {\n\t\tconst value = document[field];\n\t\tif (value === undefined) return;\n\t\tif (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {\n\t\t\treturn refuse(field, 'a number of seconds, 0 or more');\n\t\t}\n\t\tmerged[field] = value;\n\t};\n\tlifetime('autoSignedLifetimeSeconds');\n\tlifetime('promptedLifetimeSeconds');\n\n\treturn merged;\n}\n\nlet applied: HostConfig | undefined;\n\n/**\n * What this host is configured with. Every consumer reads it from here.\n *\n * `prepareConfiguration()` settles it before the app is mounted, and the ordering is held together\n * by ONE dynamic import in `main.ts`. That is thin, so an early read is treated as the mistake it\n * is rather than papered over:\n *\n * - in a DEVELOPMENT build it throws. There is no legitimate early read there, and the alternative\n * is a host that quietly runs on empty allowlists and a three-month deadline while its document\n * sits unread, which is the exact silent misconfiguration this file exists to abolish. A future\n * entry point that statically imports `state.ts` should fail loudly on the first run, not\n * mislead somebody months later.\n * - in any other build it is the baked defaults, because that is not merely a fallback, it is the\n * only answer that build can ever give: it honours no document, so early and late agree.\n */\nexport function hostConfig(): HostConfig {\n\tif (!applied) {\n\t\tif (DEVELOPMENT_BUILD) {\n\t\t\tthrow new Error(\n\t\t\t\t'[etherplay] configuration was read before the runtime document was loaded. `prepareConfiguration()` ' +\n\t\t\t\t\t'must be awaited before ANY module that reads configuration is imported (see main.ts, where the app ' +\n\t\t\t\t\t'is imported dynamically for exactly this reason). Reading it now would silently use the baked ' +\n\t\t\t\t\t'defaults and ignore config.json.',\n\t\t\t);\n\t\t}\n\t\tapplied = bakedDefaults();\n\t}\n\treturn applied;\n}\n\nexport async function fetchDocument(): Promise<RuntimeConfigDocument | undefined> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(RUNTIME_CONFIG_URL, {cache: 'no-store'});\n\t} catch (err) {\n\t\t// No server, no network, blocked request. Silent on purpose and NOT the same case as the one\n\t\t// below: a host that cannot be signed into without a network is what this whole artefact is\n\t\t// against, and nobody who is offline needs to be told twice.\n\t\treturn undefined;\n\t}\n\n\tif (!response.ok) {\n\t\t// The ordinary case: no document. Not an error, and not worth a line of its own.\n\t\treturn undefined;\n\t}\n\n\t// A static server that answers every path with `index.html` would hand back HTML here, and\n\t// \"your config silently did nothing\" is exactly the afternoon this file exists to avoid.\n\tconst contentType = response.headers.get('content-type') || '';\n\tif (!contentType.includes('json')) {\n\t\tconsole.warn(\n\t\t\t`[etherplay] ${RUNTIME_CONFIG_URL} answered with \"${contentType}\" rather than JSON, so it is not a ` +\n\t\t\t\t`configuration document and is ignored. A server that falls back to index.html for missing files does this.`,\n\t\t);\n\t\treturn undefined;\n\t}\n\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = await response.json();\n\t} catch (err) {\n\t\t// THE DOCUMENT IS THERE AND BROKEN, which is this artefact's most likely misconfiguration and\n\t\t// the one case that must never be silent. Swallowing it here would contradict the rule the\n\t\t// rest of this file is built on: a typo that quietly leaves the old value is a debugging\n\t\t// session about the wrong thing.\n\t\tconsole.error(\n\t\t\t`[etherplay] ${RUNTIME_CONFIG_URL} exists but is not valid JSON, so ALL of it is ignored and this host is ` +\n\t\t\t\t`running on its built-in defaults: ${(err as Error)?.message}`,\n\t\t);\n\t\treturn undefined;\n\t}\n\n\tif (!isPlainObject(parsed)) {\n\t\tconsole.error(\n\t\t\t`[etherplay] ${RUNTIME_CONFIG_URL} is valid JSON but not an object, so it is ignored and this host is ` +\n\t\t\t\t`running on its built-in defaults.`,\n\t\t);\n\t\treturn undefined;\n\t}\n\treturn parsed as RuntimeConfigDocument;\n}\n\n/**\n * Settle the configuration, then say what this host is, in one line somebody can read.\n *\n * A DEVELOPMENT build waits for the document, because everything after this reads the result. A\n * PRODUCTION build does not wait, and does not use what comes back: it looks only so that it can\n * shout if somebody deployed a document next to it, and nothing it contains ever reaches a value\n * this host acts on. If that ever stops being true, the argument in allowlist.ts about there being\n * no runtime fetch to poison stops being true with it.\n */\nexport async function prepareConfiguration(): Promise<HostConfig> {\n\tif (DEVELOPMENT_BUILD) {\n\t\tconst document = await fetchDocument();\n\t\tapplied = document ? mergeDocument(bakedDefaults(), document) : bakedDefaults();\n\t\tannounce(!!document);\n\t} else {\n\t\tapplied = bakedDefaults();\n\t\tannounce(false);\n\t\tfetchDocument().then((document) => {\n\t\t\tif (document) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[etherplay] found a runtime configuration document at ${RUNTIME_CONFIG_URL} and IGNORED it: this is a ` +\n\t\t\t\t\t\t`production build, which bakes its configuration at build time so that there is no runtime document ` +\n\t\t\t\t\t\t`to poison. Rebuild with \\`--mode development\\` if you meant to configure this host at runtime.`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\treturn applied;\n}\n\n/**\n * The startup line.\n *\n * Which origin this is being served from and which provider it will use for hosted mechanisms are\n * the two facts a developer needs to match against their app's `walletHost` and their own\n * expectations, and looking either of them up costs more than printing them.\n */\nfunction announce(documentApplied: boolean) {\n\tconst config = hostConfig();\n\tconst build = DEVELOPMENT_BUILD ? 'DEVELOPMENT build (not for real accounts)' : 'production build';\n\tconst document = DEVELOPMENT_BUILD\n\t\t? documentApplied\n\t\t\t? `configured by ${RUNTIME_CONFIG_URL}`\n\t\t\t: `no ${RUNTIME_CONFIG_URL} found, using built-in defaults`\n\t\t: 'configured at build time';\n\tconsole.log(\n\t\t`[etherplay] login host serving ${window.location.origin} - ${build}, ${document}.\\n` +\n\t\t\t`[etherplay] email and oauth go to the hosted provider \"${config.hostedAuthProvider}\"; ` +\n\t\t\t`mnemonic is derived locally and needs no key and no network.`,\n\t);\n}\n","import './app.css';\nimport {prepareConfiguration} from './lib/config';\n\n// Configuration first, and the app is imported only afterwards.\n//\n// `state.ts` and `allowlist.ts` read what they are configured with AT IMPORT TIME, which is what\n// makes those values constants rather than something every call site could re-decide. A static\n// import of `App.svelte` here would run them before the runtime document had been read, so the\n// import is dynamic and this is the ordering that keeps it honest.\nprepareConfiguration()\n\t.then(async () => {\n\t\tconst {mount} = await import('svelte');\n\t\tconst {default: App} = await import('./App.svelte');\n\t\tmount(App, {\n\t\t\ttarget: document.getElementById('app')!,\n\t\t});\n\t})\n\t.catch((err) => {\n\t\t// A blank popup with nothing in the console is the worst thing this window can be. Whatever\n\t\t// went wrong before the app existed is said here, in the one place that can still say it.\n\t\tconsole.error('[etherplay] the login host failed to start', err);\n\t\tconst target = document.getElementById('app');\n\t\tif (target) {\n\t\t\ttarget.textContent = `the login host failed to start: ${err?.message || err}`;\n\t\t}\n\t});\n"],"file":"assets/login-CbHgl9FL.js"}
@@ -1,30 +0,0 @@
1
- html,
2
- body {
3
- width: 100%;
4
- height: 100%;
5
- margin: 0;
6
- padding: 0;
7
- }
8
-
9
- * {
10
- box-sizing: border-box;
11
- padding: 0;
12
- margin: 0;
13
- }
14
-
15
- img {
16
- max-width: 100%;
17
- height: auto;
18
- border-style: none;
19
- }
20
-
21
- body {
22
- background-color: white;
23
- color: #13171f;
24
- }
25
- @media (prefers-color-scheme: dark) {
26
- body {
27
- background-color: #13171f;
28
- color: white;
29
- }
30
- }