Sample
pkce-challenge 5.0.2
Verified sample for npm pkce-challenge 5.0.2. The contract ran on node 22 · linux debian/x64 · docker and passed: require('pkce-challenge') in CommonJS…
sha256:f4140b4c0d3e880fa07c11b03499283bd60b898920d607fe790986a35ca14911
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-11-28 |
Case
HOW- Goal
- verify pkg:npm/pkce-challenge@5.0.2
- Packages
- Environment
- node 22.23.2
- Created
- 2026-11-28T03:46:43Z
Contract
- require('pkce-challenge') in CommonJS exposes default (pkceChallenge), generateChallenge, and verifyChallenge functions
- pkceChallenge() defaults to a 43-character RFC 7636 unreserved code_verifier and its 43-character unpadded base64url SHA-256 code_challenge
- pkceChallenge(length) accepts lengths from 43 through 128 inclusive and produces matching SHA-256 base64url challenges
- pkceChallenge(length) rejects with a string message when length is below 43 or above 128
- generateChallenge computes the RFC 7636 Appendix B test vector challenge for the reference verifier
- verifyChallenge resolves to true for matching verifier/challenge pairs and false when either value is altered
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/pkce-challenge@5.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pkce-challenge@5.0.2
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:c50b3db2eb54e05b9600dc8a7ab56541f402eb70b7d62b48392fc99bae42c103","constraints":{"executionContext":"node"},"contract":["require('pkce-challenge') in CommonJS exposes default (pkceChallenge), generateChallenge, and verifyChallenge functions","pkceChallenge() defaults to a 43-character RFC 7636 unreserved code_verifier and its 43-character unpadded base64url SHA-256 code_challenge","pkceChallenge(length) accepts lengths from 43 through 128 inclusive and produces matching SHA-256 base64url challenges","pkceChallenge(length) rejects with a string message when length is below 43 or above 128","generateChallenge computes the RFC 7636 Appendix B test vector challenge for the reference verifier","verifyChallenge resolves to true for matching verifier/challenge pairs and false when either value is altered"],"goal":"verify pkg:npm/pkce-challenge@5.0.2","kind":"HOW","packages":["pkg:npm/pkce-challenge@5.0.2"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/pkce-challenge@5.0.2"],"schemaVersion":1,"subject":"pkg:npm/pkce-challenge@5.0.2","verifierAdapter":"node-typescript@1"}
{
"name": "pkce-challenge-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pkce-challenge-sample",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"pkce-challenge": "5.0.2"
}
},
"node_modules/pkce-challenge": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.2.tgz",
"integrity": "sha512-vCc54+qyIfKC5e2UN28AZKElwqjLINgiIV3RKI8pDu93TjaAJoB3QrgMzEBouy8yOKsXVXdAinO1QArJf9x5WA==",
"license": "MIT",
"engines": {
"node": ">=16.20.0"
}
}
}
}
{
"name": "pkce-challenge-sample",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"pkce-challenge": "5.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/pkce-challenge@5.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/pkce-challenge@5.0.2"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
"use strict";
const {
default: pkceChallenge,
generateChallenge,
verifyChallenge,
} = require("pkce-challenge");
async function createPkcePair(length) {
return pkceChallenge(length);
}
async function computePkceChallenge(verifier) {
return generateChallenge(verifier);
}
async function checkPkcePair(verifier, challenge) {
return verifyChallenge(verifier, challenge);
}
module.exports = {
createPkcePair,
computePkceChallenge,
checkPkcePair,
};
"use strict";
const assert = require("node:assert/strict");
const crypto = require("node:crypto");
const pkg = require("pkce-challenge");
const {
createPkcePair,
computePkceChallenge,
checkPkcePair,
} = require("../src/index.js");
const UNRESERVED_RE = /^[A-Za-z0-9\-._~]+$/;
const BASE64URL_SHA256_RE = /^[A-Za-z0-9\-_]{43}$/;
function sha256Base64Url(input) {
return crypto.createHash("sha256").update(input, "utf8").digest("base64url");
}
async function main() {
// 1. CommonJS exports expose default (pkceChallenge), generateChallenge, and verifyChallenge
assert.equal(typeof pkg.default, "function");
assert.equal(typeof pkg.generateChallenge, "function");
assert.equal(typeof pkg.verifyChallenge, "function");
// 2. Default length generates a 43-character unreserved verifier and matching 43-char base64url challenge
const defaultPair = await createPkcePair();
assert.equal(defaultPair.code_verifier.length, 43);
assert.match(defaultPair.code_verifier, UNRESERVED_RE);
assert.match(defaultPair.code_challenge, BASE64URL_SHA256_RE);
assert.equal(defaultPair.code_challenge, sha256Base64Url(defaultPair.code_verifier));
// 3. Explicit boundary lengths (43 and 128) succeed and match SHA-256 base64url digest
for (const len of [43, 64, 128]) {
const pair = await createPkcePair(len);
assert.equal(pair.code_verifier.length, len);
assert.match(pair.code_verifier, UNRESERVED_RE);
assert.equal(pair.code_challenge, sha256Base64Url(pair.code_verifier));
}
// 4. Out-of-range lengths (< 43 or > 128) reject with a string message
for (const badLen of [42, 129]) {
let rejected;
try {
await createPkcePair(badLen);
assert.fail(`Expected rejection for length ${badLen}`);
} catch (err) {
rejected = err;
}
assert.equal(typeof rejected, "string");
assert.equal(rejected, `Expected a length between 43 and 128. Received ${badLen}.`);
}
// 5. generateChallenge matches RFC 7636 Appendix B test vector
const rfcVerifier = "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk";
const rfcChallenge = "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM";
const computedRfc = await computePkceChallenge(rfcVerifier);
assert.equal(computedRfc, rfcChallenge);
assert.equal(computedRfc, sha256Base64Url(rfcVerifier));
// 6. verifyChallenge returns true for matching pairs and false for mismatched verifier or challenge
assert.strictEqual(await checkPkcePair(rfcVerifier, rfcChallenge), true);
assert.strictEqual(
await checkPkcePair(defaultPair.code_verifier, defaultPair.code_challenge),
true
);
assert.strictEqual(await checkPkcePair(rfcVerifier, "wrong_challenge"), false);
assert.strictEqual(await checkPkcePair(`${rfcVerifier}x`, rfcChallenge), false);
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
Origin Seeder
anonymous