| … | … | @@ -133,6 +133,23 @@ export async function mintIdentity ({ rootMnemonic = null, configFile = null, ha |
| 133 | 133 | * Safe to retry: the directory accepts a re-submission of the identical genesis, and the op can be |
| 134 | 134 | * re-derived from the root mnemonic alone if this device is gone. |
| 135 | 135 | */ |
| 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 | */ |
| 148 | export async function ensureFetch () { |
| 149 | if (typeof globalThis.fetch !== 'function') await import('bare-fetch/global') |
| 150 | return typeof globalThis.fetch === 'function' |
| 151 | } |
| 152 | |
| 136 | 153 | export async function submitMintedGenesis ({ did, signedOp, plcUrl = null, onStep = () => {} } = {}) { |
| 137 | 154 | if (!did || !signedOp) throw new Error('submitMintedGenesis requires { did, signedOp }') |
| 138 | 155 | // Bare has no global fetch and PlcDirectory needs one for the POST. Installed lazily so that minting |