Align enrollment and write-auth with WelcomeMat v1.0
POST /api/signup now requires a DPoP header, tos_signature, and wm+jwt
access_token in the body. The server validates the DPoP proof (with no
ath for enrollment), verifies the ToS signature against the current
terms using the DPoP key, and validates the access token including
tos_hash. The thumbprint is derived from the DPoP proof instead of
being passed in the request body.
All write endpoints (createRecord, putRecord, deleteRecord, applyWrites,
uploadBlob) now validate the wm+jwt access token via validateAccessToken
after DPoP proof validation. Stale tos_hash returns 401 with
{ error: "tos_changed" }.
Test helpers extracted to test/helpers.ts (signJwt, generateAuthKeys,
createDpopJwt, buildAccessToken, signTos). All test files updated to
use valid wm+jwt access tokens. New integration tests cover enrollment
validation and tos_changed rejection on writes.