CodeSampleX

Sample

npm-user-validate 3.0.0: email, pw, requirements

Verified sample for npm npm-user-validate 3.0.0: email, pw, requirements. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:ef27f77f500d97895cc07af3e1637a4ad3f317eb28e6628e9dd120d366a61e77

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 linux 24 · ubuntu · glibc 2.39 x64 npm

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-10-21

Case

HOW
Goal
verify pkg:npm/npm-user-validate@3.0.0
Packages
Symbols
  • email
  • pw
  • requirements
  • username
Created
2026-10-21T12:47:21Z

Contract

  1. validate.username('valid-account_01') === null
  2. validate.email('contact@example.com') === null
  3. validate.pw('sample-secret-value') === null
  4. validate.username('InvalidCase') returns Error matching requirements.username.lowerCase
  5. validate.username('bad space') returns Error matching requirements.username.urlSafe
  6. validate.username('.leadingdot') returns Error matching requirements.username.dot
  7. validate.username(215 chars) returns Error matching requirements.username.length
  8. validate.username("bad'quote") returns Error matching requirements.username.illegal
  9. validate.email('not-an-address') returns Error matching requirements.email.valid
  10. validate.email(>254 chars) returns Error matching requirements.email.length

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
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/npm-user-validate@3.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/npm-user-validate@3.0.0

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.
csx.json
{"case":{"caseId":"case:sha256:d0295397e9b0ba82717f17a5226bf930402254d944689ad62bb224f7915fd371","contract":["validate.username('valid-account_01') === null","validate.email('contact@example.com') === null","validate.pw('sample-secret-value') === null","validate.username('InvalidCase') returns Error matching requirements.username.lowerCase","validate.username('bad space') returns Error matching requirements.username.urlSafe","validate.username('.leadingdot') returns Error matching requirements.username.dot","validate.username(215 chars) returns Error matching requirements.username.length","validate.username(\"bad'quote\") returns Error matching requirements.username.illegal","validate.email('not-an-address') returns Error matching requirements.email.valid","validate.email(\u003e254 chars) returns Error matching requirements.email.length"],"goal":"verify pkg:npm/npm-user-validate@3.0.0","kind":"HOW","packages":["pkg:npm/npm-user-validate@3.0.0"],"schemaVersion":1,"symbols":["email","pw","requirements","username"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/npm-user-validate@3.0.0"],"schemaVersion":1,"subject":"pkg:npm/npm-user-validate@3.0.0","symbols":["email","pw","requirements","username"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "npm-user-validate": "3.0.0"
      }
    },
    "node_modules/npm-user-validate": {
      "version": "3.0.0",
      "resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-3.0.0.tgz",
      "integrity": "sha512-9xi0RdSmJ4mPYTC393VJPz1Sp8LyCx9cUnm/L9Qcb3cFO8gjT4mN20P9FAsea8qDHdQ7LtcN8VLh2UT47SdKCw==",
      "license": "BSD-2-Clause",
      "engines": {
        "node": "^18.17.0 || >=20.5.0"
      }
    }
  }
}
package.json
{
  "name": "sample",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "type": "module",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "npm-user-validate": "3.0.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/npm-user-validate@3.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/npm-user-validate@3.0.0"
  ]
}
test/contract.mjs
import assert from "node:assert/strict";
import validate from "npm-user-validate";

// 1. Validate valid inputs return null
assert.equal(validate.username("valid-account_01"), null);
assert.equal(validate.email("contact@example.com"), null);
assert.equal(validate.pw("sample-secret-value"), null);

// 2. Validate username error conditions
const upperErr = validate.username("InvalidCase");
assert.ok(upperErr instanceof Error);
assert.equal(upperErr.message, validate.requirements.username.lowerCase);

const urlUnsafeErr = validate.username("bad space");
assert.ok(urlUnsafeErr instanceof Error);
assert.equal(urlUnsafeErr.message, validate.requirements.username.urlSafe);

const dotErr = validate.username(".leadingdot");
assert.ok(dotErr instanceof Error);
assert.equal(dotErr.message, validate.requirements.username.dot);

const lenErr = validate.username("a".repeat(215));
assert.ok(lenErr instanceof Error);
assert.equal(lenErr.message, validate.requirements.username.length);

const quoteErr = validate.username("bad'quote");
assert.ok(quoteErr instanceof Error);
assert.equal(quoteErr.message, `${validate.requirements.username.illegal} "'"`);

// 3. Validate email error conditions
const invalidEmailErr = validate.email("not-an-address");
assert.ok(invalidEmailErr instanceof Error);
assert.equal(invalidEmailErr.message, validate.requirements.email.valid);

const longEmailErr = validate.email(`${"a".repeat(245)}@example.com`);
assert.ok(longEmailErr instanceof Error);
assert.equal(longEmailErr.message, validate.requirements.email.length);

Origin Seeder

anonymous