Skip to content

feat: Archon Swordsman import + Runecraft bilateral binding display - #1

Open
Flaxscrip wants to merge 1 commit into
mitchuski:mainfrom
Flaxscrip:feature/runecraft-bilateral-binding
Open

feat: Archon Swordsman import + Runecraft bilateral binding display#1
Flaxscrip wants to merge 1 commit into
mitchuski:mainfrom
Flaxscrip:feature/runecraft-bilateral-binding

Conversation

@Flaxscrip

Copy link
Copy Markdown

Overview

This PR adds two capabilities to agentprivacy-spellbook:

  1. Archon Swordsman import — users with an Archon-derived Swordsman identity (from export-swordsman-key.ts against their Archon wallet) can import it directly, bypassing the random-key ceremony or replacing an existing identity post-ceremony.

  2. Runecraft bilateral binding display — blades imported from spellweb.ai that carry a dual Ed25519 Swordsman signature (⚔️🔮 runecrafted) now show that status visually throughout the spellbook UI.

Both features depend on the companion spellweb PR (mitchuski/spellweb#4) which extends SpellwebBladePayloadV1 with the Runecraft proof fields.


Identity Model (context)

The Archon Swordsman is a deterministic Ed25519 keypair derived from an Excalibur DID in the user's Archon wallet — the same wallet that backs the spellweb Mage identity. This means:

  • Same Archon wallet → same participantId across devices and sessions
  • Swordsman can be re-derived at any time with export-swordsman-key.ts --name Excalibur
  • The import replaces the random ephemeral keypair that the ceremony normally generates

A "session bundle" JSON is the handoff format:

{
  "version": 1,
  "type": "archon-swordsman-session",
  "participantId": "ap-59f5daa10788eed6",
  "displayName": "Excalibur",
  "publicKeyHex": "59f5daa10788eed6...",
  "privateKeyHex": "<burned on tab close>",
  "archonDid": "did:cid:bagaaiera...",
  "trustTier": "dragon",
  "signature": "<AgentCard payload signed by private key>"
}

The private key goes to sessionStorage (cleared on tab close); the public key and participantId go to localStorage.


Key Files Changed

File What changed
src/components/ceremony/CeremonyWizard.tsx Collapsible "⚔️ Already have an Archon Swordsman?" bypass panel above the ceremony steps — paste bundle JSON → validates → Import & Begin
src/components/ceremony/SwordsmanAccountSettings.tsx "⚔️ Import Archon" button added alongside the existing "Reroll keys" — opens modal with JSON textarea, validation preview, and Import & Reload
src/lib/spellweb-blade-bridge.ts SpellwebBladeImportPayloadV1, SpellwebBladeMeta, and InventoryBlade extended with swordsmanId?, runecrafted?, swordsmanSignature?; propagated through apply and markdown parse paths
src/components/BladeInventory.tsx ⚔️🔮 runecrafted badge with swordsmanId tooltip
src/components/SpellwebBladeImport.tsx ⚔️🔮 inline badge on runecrafted blades in the inventory list

Runecraft Bilateral Binding

A blade is "runecrafted" when a Swordsman has co-signed it using runecraft.ts:

BLADE:{constellationHash}:{bladeHash}:{lapCount}:{completedAt}

The signature is stored in the blade .md export under a ## Runecraft section. When the .md is imported into spellbook, parseAndAddBladeToInventory reads:

const swordsmanIdMatch  = md.match(/\*\*Swordsman ID:\*\*\s*`([^`]+)`/);
const swordsmanSigMatch = md.match(/\*\*Swordsman Signature:\*\*\s*`([^`]+)`/);
const runecraftedMatch  = /Dual Ed25519 signature verified/.test(md);

The ⚔️🔮 runecrafted badge then appears automatically — no extra user action needed.


Test Plan

Prerequisites

  • agentprivacy-spellbook running at localhost:5001
  • spellweb running at localhost:8000 with a wallet connected (for generating blade .md exports)
  • Optional: export-swordsman-key.ts from archon-spellweb-demo for Archon Swordsman import

1 — Archon Swordsman bypass at ceremony

  • Visit /ceremony for the first time (no existing Swordsman)
  • "⚔️ Already have an Archon Swordsman?" collapsible panel appears above the step tabs
  • Expand it → paste a valid session bundle JSON → turns green with identity preview
  • Click "Import & Begin" → page reloads → /orbs shows the correct participantId

2 — Archon Swordsman import post-ceremony

  • Go to Account Settings → "⚔️ Import Archon" button visible beside "Reroll keys"
  • Click it → modal opens with textarea
  • Paste bundle → validates → green preview shows participantId and trustTier
  • "Import & Reload" → page reloads with new Swordsman identity applied

3 — Runecrafted blade display

  • Export a Runecrafted blade .md from spellweb (one signed with runecraft.ts)
  • Import it via the blade import panel (file upload or paste)
  • BladeInventory shows ⚔️🔮 runecrafted badge with swordsmanId tooltip
  • SpellwebBladeImport inventory list also shows ⚔️🔮 inline
  • Verify: Excalibur (enchanted) blade shows as runecrafted ✓ (already confirmed)

Companion PR

mitchuski/spellweb#4 — Archon wallet integration (Mage identity, vault save/restore). Extend SpellwebBladePayloadV1 with swordsmanId, runecrafted, swordsmanSignature so the Soulbis button carries bilateral proof to this app.


🤖 Generated with Claude Code

- CeremonyWizard: "Already have an Archon Swordsman?" bypass panel — paste
  session bundle from export-swordsman-key.ts to skip the ceremony entirely
- SwordsmanAccountSettings: "Import Archon" button for post-ceremony identity
  replacement, with JSON validation and reload
- spellweb-blade-bridge: extend SpellwebBladeImportPayloadV1, SpellwebBladeMeta,
  and InventoryBlade with swordsmanId / runecrafted / swordsmanSignature fields;
  propagate through applySpellwebBladeToSwordsmanSlots and parseAndAddBladeToInventory
  (markdown parser reads Runecraft section from blade.md automatically)
- BladeInventory: ⚔️🔮 runecrafted badge with swordsmanId tooltip
- SpellwebBladeImport: ⚔️🔮 inline badge on runecrafted blades

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant