CodeSampleX

Sample

github.com/mholt/acmez/v3 v3.1.2: acme.ChallengeTypeHTTP01

Verified sample for golang github.com/mholt/acmez/v3 v3.1.2: acme.ChallengeTypeHTTP01. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.

sha256:4a1d99ac105d3a080d6d1defbcc06a8a4541d75c0a017ef2194aebb33e72c001

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

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f…
2026-08-28

Case

HOW
Goal
verify github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01 in pkg:golang/github.com/mholt/acmez/v3@v3.1.2
Packages
Symbols
  • github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01
Environment
go
Created
2026-08-28T01:23:50Z

Contract

  1. acme.ChallengeTypeHTTP01 constant equals "http-01".
  2. acme.Challenge.HTTP01ResourcePath returns the /.well-known/acme-challenge/ prefixed resource path.
  3. acme.Challenge HTTP-01 challenge response is served at the resource path with the challenge key authorization.

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract_test.go

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 github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01 in pkg:golang/github.com/mholt/acmez/v3@v3.1.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/mholt/acmez/v3@v3.1.2
Demonstrate these symbols/APIs:
  - github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01
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.
csx.json
{"case":{"caseId":"case:sha256:30804cd558fff6e10c9ab00315eca12eef5064396c601fa0830d851ae68d28d0","contract":["acme.ChallengeTypeHTTP01 constant equals \"http-01\".","acme.Challenge.HTTP01ResourcePath returns the /.well-known/acme-challenge/ prefixed resource path.","acme.Challenge HTTP-01 challenge response is served at the resource path with the challenge key authorization."],"goal":"verify github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01 in pkg:golang/github.com/mholt/acmez/v3@v3.1.2","kind":"HOW","packages":["pkg:golang/github.com/mholt/acmez/v3@v3.1.2"],"schemaVersion":1,"symbols":["github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01"]},"contractCommand":["go","test","./..."],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","executionContext":"go","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","runtime":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/mholt/acmez/v3@v3.1.2"],"schemaVersion":1,"subject":"pkg:golang/github.com/mholt/acmez/v3@v3.1.2","symbols":["github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01"],"verifierAdapter":"golang@1"}
go.mod
module example.com/acme-http01

go 1.26.6

require github.com/mholt/acmez/v3 v3.1.2
go.sum
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
github.com/mholt/acmez/v3 v3.1.2/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
main.go
package main

import (
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/mholt/acmez/v3/acme"
)

func main() {
	challenge := acme.Challenge{
		Type:             acme.ChallengeTypeHTTP01,
		Token:            "test-token-12345",
		KeyAuthorization: "test-token-12345.thumbprint67890",
	}

	path := challenge.HTTP01ResourcePath()
	fmt.Printf("Challenge Type: %s\n", challenge.Type)
	fmt.Printf("HTTP-01 Path: %s\n", path)

	mux := http.NewServeMux()
	mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "text/plain")
		w.WriteHeader(http.StatusOK)
		_, _ = w.Write([]byte(challenge.KeyAuthorization))
	})

	server := httptest.NewServer(mux)
	defer server.Close()

	resp, err := http.Get(server.URL + path)
	if err != nil {
		fmt.Printf("HTTP error: %v\n", err)
		return
	}
	defer resp.Body.Close()

	fmt.Printf("Response Status: %d\n", resp.StatusCode)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01 in pkg:golang/github.com/mholt/acmez/v3@v3.1.2",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/mholt/acmez/v3@v3.1.2"
  ],
  "symbols": [
    "github.com/mholt/acmez/v3/acme.ChallengeTypeHTTP01"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract_test.go
package test

import (
	"io"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/mholt/acmez/v3/acme"
)

func TestChallengeTypeHTTP01Constant(t *testing.T) {
	if got, want := acme.ChallengeTypeHTTP01, "http-01"; got != want {
		t.Errorf("acme.ChallengeTypeHTTP01 = %q, want %q", got, want)
	}
}

func TestHTTP01ResourcePath(t *testing.T) {
	token := "sample-token-abcxyz"
	challenge := acme.Challenge{
		Type:  acme.ChallengeTypeHTTP01,
		Token: token,
	}

	expectedPath := "/.well-known/acme-challenge/" + token
	if got := challenge.HTTP01ResourcePath(); got != expectedPath {
		t.Errorf("challenge.HTTP01ResourcePath() = %q, want %q", got, expectedPath)
	}

	emptyChallenge := acme.Challenge{
		Type: acme.ChallengeTypeHTTP01,
	}
	if got := emptyChallenge.HTTP01ResourcePath(); got != "/.well-known/acme-challenge/" {
		t.Errorf("emptyChallenge.HTTP01ResourcePath() = %q, want %q", got, "/.well-known/acme-challenge/")
	}
}

func TestHTTP01ChallengeServing(t *testing.T) {
	token := "eval-token-98765"
	keyAuth := "eval-token-98765.account-thumbprint"

	challenge := acme.Challenge{
		Type:             acme.ChallengeTypeHTTP01,
		Token:            token,
		KeyAuthorization: keyAuth,
	}

	mux := http.NewServeMux()
	mux.HandleFunc(challenge.HTTP01ResourcePath(), func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "text/plain")
		w.WriteHeader(http.StatusOK)
		_, _ = w.Write([]byte(challenge.KeyAuthorization))
	})

	server := httptest.NewServer(mux)
	defer server.Close()

	resp, err := http.Get(server.URL + challenge.HTTP01ResourcePath())
	if err != nil {
		t.Fatalf("failed to GET challenge endpoint: %v", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		t.Errorf("status code = %d, want %d", resp.StatusCode, http.StatusOK)
	}

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		t.Fatalf("failed to read response body: %v", err)
	}

	if string(body) != keyAuth {
		t.Errorf("response body = %q, want %q", string(body), keyAuth)
	}
}

Origin Seeder

anonymous