| … | … | @@ -104,7 +104,7 @@ const MUTATIONS = new Set(['post', 'follow', 'unfollow', 'like', 'unlike', 'repl |
| 104 | 104 | // ⛔ Asking a bridge to carry this identity puts a name for it on somebody's domain, which is the |
| 105 | 105 | // same class of act as turning a network on — so it needs an ATTESTED device, not merely a |
| 106 | 106 | // signed-in browser. |
| 107 | | 'bridge-claim', 'bridge-release']) |
| 107 | 'bridge-claim', 'bridge-release', 'bridge-front']) |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * The room, or a refusal that says which of the two possible things is wrong. |
| … | … | @@ -417,6 +417,17 @@ export async function dispatch (node, cmd, a) { |
| 417 | 417 | rememberBridge(node.storage, r.body && r.body.acct, a.bridge) |
| 418 | 418 | return { ...r.body, pending: r.status === 202 ? (r.body && r.body.pending) || true : false } |
| 419 | 419 | } |
| 420 | // ⛔ CARRIED, not named. A bridge that fronts an identity serves what that identity SIGNED — it |
| 421 | // holds no key for it — so this asks for availability, not for authority. |
| 422 | case 'bridge-front': { |
| 423 | const { connectBridge, buildFront } = await import('./bridge.js') |
| 424 | const { rpc } = await connectBridge(node.swarm, a.bridge) |
| 425 | const { nonce } = await rpc.request('challenge', {}) |
| 426 | const r = await rpc.request('front', buildFront({ nonce, id: a.id, root: node.rootHex(), cred: node.cred })) |
| 427 | if (r.status !== 200 && r.status !== 202) throw new Error((r.body && r.body.error) || ('bridge refused: ' + r.status)) |
| 428 | return r.body |
| 429 | } |
| 430 | |
| 420 | 431 | case 'bridge-release': { |
| 421 | 432 | const { connectBridge, buildRelease, bridgeFor, forgetBridge } = await import('./bridge.js') |
| 422 | 433 | // ⚠ The remembered key wins over one supplied by the caller: the node knows which bridge it |