You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes the LWS-CID auth loop with the Phase 1 keypair.
Three wires:
1. provisionOwnerKey() now also produces a verificationMethod entry
(publicKeyMultibase for CID v1.0 conformance + publicKeyJwk for
the LWS-CID verifier). createPodStructure / createRootPodStructure
inject the VM into the seeded WebID profile so the existing
verifier in src/auth/lws-cid.js can authenticate JWTs signed with
the on-disk secret. The same VM `id` is referenced from
`authentication` and `assertionMethod` so the key counts as an
auth factor without an app having to PATCH those arrays.
2. The Multikey document at /private/privkey.jsonld now uses
`did:nostr:<hex>` as its controller (was the WebID in Phase 1).
The Phase 1 design log explicitly anticipated this swap once the
resolver landed; jss has had `resolveDidNostrLocally` and
`resolveDidNostrToWebId` for a while, so the controller is no
longer a dangling reference. Backward-compat: callers can still
pass an explicit `controller` if they want the WebID form.
3. generateOwnerKeypair now normalizes the secret so G*secret has
even y (BIP-340 convention). Without normalization, ECDSA
signatures made with the raw secret would verify against the
*natural* y of the public point — even/odd ~50/50 — while the
JWK we publish in the profile is derived from the even-y x-only
Schnorr pubkey. Phase 2's LWS-CID round-trip would flake non-
deterministically. Normalizing once at generation means a single
secret-on-disk works under both Schnorr (Nostr) and ECDSA
(LWS-CID JWT) without parity gymnastics in either path.
Tests:
- 6 new unit tests in test/keys-provision.test.js: did:nostr
controller default, explicit override, VM shape (Multikey + JWK),
legacy controllerWebId arg backward-compat, secret normalization
stress (64 iterations).
- 1 new integration test asserting the direct createPodStructure
call returns the new ownerKey shape (vm + didNostr).
- 1 new test file (test/keys-provision-lws-cid.test.js) with the
end-to-end round-trip: provision a key, generate a profile with
the VM, sign an LWS-CID JWT with the on-disk secret, verify via
the existing verifyLwsCidAuth — returns the WebID. Plus a
negative test: signing with a different secret rejects with a
signature-verification error.
No new dependencies. No changes to the LWS-CID verifier, the
did:nostr resolver, or the profile generator's @context. Phase 2
is two wires plus a controller flip plus a parity-normalization
fix to make the wires actually carry signal.
ClosesJavaScriptSolidServer#443. Phase 2 of JavaScriptSolidServer#437.
0 commit comments