Repository navigation
Add email proof verification to @reclaimprotocol/client - #26
Draft
predatorx7 wants to merge 2 commits into
Draft
predatorx7 wants to merge 2 commits into
predatorx7 wants to merge 2 commits into
Conversation
Copy Reclaim's email verification core into @reclaimprotocol/client/email and verify email proofs from Builder results. Signature checks are the default; full re-verification of the email runs only on Linux with Bubblewrap 0.12+ and fails clearly elsewhere. The copy adds a signed provider field and renames the authenticated address field. Results trust email issuers from options or Builder's JWKS (x-reclaim-email-issuers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| throw new Error('UNKNOWN_SYNTHETIC_CASE') | ||
| } | ||
|
|
||
| const rsa = generateKeyPairSync('rsa', { modulusLength: 1024 }) |
CodeQL flagged the start-or-end whitespace regex as polynomial on long runs of inner whitespace. A plain scan gives the same result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Copies the Reclaim email verification core into
@reclaimprotocol/clientand adds a consumer verifier foremail-v1proofs. AI-session results from Builder can now carry email proofs, and the client verifies them.Email entry points
@reclaimprotocol/client/email/{core,protocol,contracts,schemas,sender,google,preview,ai}copy the private core's exports one-to-one, under the same names.src/email/coreandsrc/email/lib./apiimports them.Contract changes in the copy
EMAIL_PROVIDERS = ['gmail']and theEmailProvidertype.EmailRequest.provideris required, and the request hash covers it.emailProvider.authenticatedGmailAddressis renamedauthenticatedAddress.@reclaimprotocol/client/email:verifyEmailProof(proof, { trustedIssuers, mode, request, now, signal })signaturemode checks the snapshot and the canonical parameters and context. It checks the keccak identifier and that the EIP-191 signature recovers to a trusted issuer. It also checks the email-proof and raw-email digests, the source kind and the validity window.request, it also runs every request-binding check that ai-sdk runs, plus a provider check.fullmode also re-checks DKIM, re-parses the email and runs the Bubblewrap-sandboxed evidence checks. It needs Linux with bwrap 0.12 or later. Otherwise it throwsemail-full-verification-unavailableand never falls back tosignature.reason.trustedIssuersaddress throws a 400.AI-session results (
verifyResultFull/results.receive)An entry with
method: 'email'is verified withverifyEmailProofagainst the entry'semail.request.emailIssuersplus the JWKSx-reclaim-email-issuerslist.emailVerification('signature'by default, or'full') andallowEmailProofs.email.requestfails, as does one whoseemail.provider,senderordkimSignerdiffers from the verified proof.hashes,proofRecipesorproofValidation.hashes/providerId, email entries fail withemail-not-allowedunlessallowEmailProofsis set.iat, so a redelivered or stored result still verifies.method,emailProof,emailProvider,sender,dkimSigner,authenticatedAddress,extractedParametersandemailCheck.email-issuer-not-trusted,email-proof-invalid,email-not-allowedandemail-full-verification-unavailable. Only the last one is retryable.Sandbox worker fix (differs from the core)
A fresh install resolves strtok3 10.7 or later through file-type. Importing it makes the worker's stdio sockets non-blocking, so large inputs failed with EAGAIN and preview output could be written only in part. The workers now retry on EAGAIN and always write their full output. This bug also exists upstream in the core.
Tests
tests/email: tests forverifyEmailProofandverifyResultFullwith email entries, using proofs signed in-test with a throwaway key.tests/email/core: 18 of the core's test files (667 tests), ported to node:test through a small compatibility file. Tests that need the document sandbox are skipped on hosts that can't start it.Notes
@reclaimprotocol/client@^0.2.0.postal-mime4.0.4 andmailauth7.1.0 have npm advisories. Upgrading them needs the core's DKIM tests to be re-run../email*exports also have adefaultcondition andtypesVersions, so the CommonJS Portal gateway canrequire()them (Node 22.12+ loads the ESM files).fullmode needs user namespaces and/procmounting in the container.🤖 Generated with Claude Code