OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-proto-peer commits / fcd44d1

ensureFetch: install a global fetch from THIS package's tree
bare-fetch pulls in bare-tls and bare-zlib, which are NATIVE. An Android bundle names the sonames it needs and the APK must supply them — and the app's own tree resolves bare-tls 3.1.10 while the APK carries 3.1.7. A caller importing bare-fetch itself therefore demands a library the device does not have: measured as a failed build, and had it shipped, a bundle that dies at dlopen and is condemned for ever. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fcd44d1d0d80943a445043c31c50d7eda1cefd33
by plankatron <fleeky@gmail.com> · 2026-09-11T19:27:54.000Z

Changed files (1) +17 -0

lib/mint.js +17 -0
……@@ -133,6 +133,23 @@ export async function mintIdentity ({ rootMnemonic = null, configFile = null, ha
133133 * Safe to retry: the directory accepts a re-submission of the identical genesis, and the op can be
134134 * re-derived from the root mnemonic alone if this device is gone.
135135 */
136/**
137 * Install a global `fetch`, from THIS package's dependency tree.
138 *
139 * ⛔ WHY IT LIVES HERE AND NOT IN THE CALLER. `bare-fetch` pulls in bare-tls and bare-zlib, which are
140 * NATIVE. An Android bundle names the sonames it needs and the APK must supply them — and the app's
141 * own tree resolves bare-tls 3.1.10 while the APK carries 3.1.7. A caller importing bare-fetch itself
142 * therefore demands a library that does not exist on the device: measured, as a failed build, and the
143 * failure mode had it shipped is a bundle that dies at dlopen and is condemned for ever.
144 *
145 * Resolving it from here keeps the version the same one every other network path in this package
146 * already uses, which is the one the APK was built against.
147 */
148export async function ensureFetch () {
149 if (typeof globalThis.fetch !== 'function') await import('bare-fetch/global')
150 return typeof globalThis.fetch === 'function'
151}
152
136153export async function submitMintedGenesis ({ did, signedOp, plcUrl = null, onStep = () => {} } = {}) {
137154 if (!did || !signedOp) throw new Error('submitMintedGenesis requires { did, signedOp }')
138155 // Bare has no global fetch and PlcDirectory needs one for the POST. Installed lazily so that minting