Add webhook auto-verify example with runtime canonical receipt verification#251
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Motivation
metadata.proofmodel and avoiding legacy/top-level proof fields.Description
examples/webhook-auto-verifyincludingpackage.json,.gitignore,README.md, and annpmscript set (start,check,generate:samples).server.jsas an Express server that exposesPOST /webhook, requireseventandreceipt, posts{ receipt }to the verifier (defaulthttps://runtime.commandlayer.org/verify, overrideable withCOMMANDLAYER_VERIFY_URL), accepts whenverifyJson.ok === trueorverifyJson.statusisVALIDorVERIFIED, rejects otherwise with400, and returns502on verifier/network failure while logging verification details (hash_matches,signature_valid,signer_id,kid).scripts/generate-samples.mjswhich calls the runtime sign endpoint (defaulthttps://runtime.commandlayer.org/trust-verification/sign/v1.0.0, overrideable withCOMMANDLAYER_SIGN_URL), extractsreceipt(orfinal_receipt), enforces presence ofmetadata.proof, writes a valid webhook sample and a tampered copy, and prints status messages.sample-canonical-shape-*.json) rather than live signed receipts.Testing
npm installinside the example and the repo, and rannode --check server.jsandnode --check scripts/generate-samples.mjsto validate syntax successfully.npm run generate:samplesbut live sample generation failed due to DNS/network resolution error (getaddrinfo EAI_AGAIN runtime.commandlayer.org).502because the runtime verifier was unreachable from this environment.npm test, which reported two failing tests unrelated to this change caused by missingexamples/sample-receipt.jsonin the repo (pre-existing).Codex Task