fix(ui): Invite a Peer sends trust_level=observer to federation.invite

The invite type chosen in QuickActions was only used for the modal
title — the RPC never carried it, so every invite was minted Trusted.
Pass it through so 'Invite a Peer' mints observer invites and 'Link
Your Nodes' keeps trusted ones.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-14 06:34:33 -04:00
parent 2434c55f32
commit f9f120f397
2 changed files with 7 additions and 3 deletions

View File

@ -668,10 +668,12 @@ class RPCClient {
}
// Federation
async federationInvite(): Promise<{ code: string; did: string; onion: string }> {
async federationInvite(
trustLevel: 'trusted' | 'observer' = 'trusted'
): Promise<{ code: string; did: string; onion: string; trust_level: string }> {
return this.call({
method: 'federation.invite',
params: {},
params: { trust_level: trustLevel },
})
}

View File

@ -400,7 +400,9 @@ async function generateInvite() {
try {
generatingInvite.value = true
error.value = ''
const result = await rpcClient.federationInvite()
// The invite type is not cosmetic: it sets the trust level the invite
// grants both sides ("Invite a Peer" = observer, "Link Your Nodes" = trusted)
const result = await rpcClient.federationInvite(inviteType.value)
inviteCode.value = result.code
} catch (e) {
error.value = e instanceof Error ? e.message : 'Failed to generate invite'