Sample
github.com/caddyserver/zerossl v0.1.5: Client.DownloadCertificate, Client.RevokeCertificate, Client.CancelCertificate
Verified sample for golang github.com/caddyserver/zerossl v0.1.5: Client.DownloadCertificate, Client.RevokeCertificate, Client.CancelCertificate. The…
sha256:79f7895572690857584fcd95e6ee39364446fcca361339ee9fab9dd18e2f8a31
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 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 pkg:golang/github.com/caddyserver/zerossl@v0.1.5
- Symbols
-
- zerossl.Client.DownloadCertificate
- zerossl.Client.RevokeCertificate
- zerossl.Client.CancelCertificate
- zerossl.Client.VerificationStatus
- Environment
- go
- Created
- 2026-08-28T02:08:30Z
Contract
- assert Client.DownloadCertificate queries /certificates/{id}/download/return with include_cross_signed and parses CertificateBundle
- assert Client.RevokeCertificate sends POST request to /certificates/{id}/revoke with reason query parameter and handles success response
- assert Client.CancelCertificate sends POST request to /certificates/{id}/cancel and handles success response
- assert Client.VerificationStatus queries /certificates/{id}/status and unmarshals ValidationStatus details
Files
- NOTES.md
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- spec.json
Source
# caddyserver/zerossl API Client Usage and Contract Verification
## Search Results
A search via `search_known_solution` for the package `github.com/caddyserver/zerossl@v0.1.5` returned `NO_SAFE_MATCH`.
## Implementation and Behavior Proved
1. **Certificate Bundle Download**: `zerossl.Client.DownloadCertificate` queries `/certificates/{id}/download/return` with `include_cross_signed` and parses returned JSON bundle (`certificate.crt`, `ca_bundle.crt`).
2. **Certificate Revocation**: `zerossl.Client.RevokeCertificate` sends a POST request to `/certificates/{id}/revoke` with the revocation reason (e.g. `zerossl.KeyCompromise`) in query parameters and verifies operation success.
3. **Certificate Cancellation**: `zerossl.Client.CancelCertificate` sends a POST request to `/certificates/{id}/cancel` to cancel draft/pending certificates.
4. **Validation Status Querying**: `zerossl.Client.VerificationStatus` queries `/certificates/{id}/status` to inspect verification completion status and per-domain validation method details.
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:golang/github.com/caddyserver/zerossl@v0.1.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/caddyserver/zerossl@v0.1.5
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.
package sample_test
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/caddyserver/zerossl"
)
func TestClientDownloadCertificate(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/certificates/cert_test_download/download/return" {
t.Errorf("unexpected path: %s", r.URL.Path)
http.NotFound(w, r)
return
}
if r.URL.Query().Get("access_key") != "sample_test_key" {
t.Errorf("unexpected access key: %s", r.URL.Query().Get("access_key"))
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
if r.URL.Query().Get("include_cross_signed") != "1" {
t.Errorf("expected include_cross_signed=1, got %s", r.URL.Query().Get("include_cross_signed"))
}
bundle := zerossl.CertificateBundle{
CertificateCrt: "-----BEGIN CERTIFICATE-----\nTEST_CERT\n-----END CERTIFICATE-----",
CABundleCrt: "-----BEGIN CERTIFICATE-----\nTEST_CA_BUNDLE\n-----END CERTIFICATE-----",
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(bundle)
}))
defer ts.Close()
client := zerossl.Client{
AccessKey: "sample_test_key",
BaseURL: ts.URL,
HTTPClient: ts.Client(),
}
bundle, err := client.DownloadCertificate(context.Background(), "cert_test_download", true)
if err != nil {
t.Fatalf("DownloadCertificate failed: %v", err)
}
if bundle.CertificateCrt != "-----BEGIN CERTIFICATE-----\nTEST_CERT\n-----END CERTIFICATE-----" {
t.Errorf("unexpected CertificateCrt: %s", bundle.CertificateCrt)
}
if bundle.CABundleCrt != "-----BEGIN CERTIFICATE-----\nTEST_CA_BUNDLE\n-----END CERTIFICATE-----" {
t.Errorf("unexpected CABundleCrt: %s", bundle.CABundleCrt)
}
}
func TestClientRevokeCertificate(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/certificates/cert_test_revoke/revoke" {
t.Errorf("unexpected path: %s", r.URL.Path)
http.NotFound(w, r)
return
}
if r.Method != http.MethodPost {
t.Errorf("unexpected method: %s", r.Method)
return
}
if r.URL.Query().Get("access_key") != "sample_test_key" {
t.Errorf("unexpected access key: %s", r.URL.Query().Get("access_key"))
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
if r.URL.Query().Get("reason") != "keyCompromise" {
t.Errorf("expected reason=keyCompromise, got %s", r.URL.Query().Get("reason"))
}
resp := map[string]any{
"success": true,
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(resp)
}))
defer ts.Close()
client := zerossl.Client{
AccessKey: "sample_test_key",
BaseURL: ts.URL,
HTTPClient: ts.Client(),
}
err := client.RevokeCertificate(context.Background(), "cert_test_revoke", zerossl.KeyCompromise)
if err != nil {
t.Fatalf("RevokeCertificate failed: %v", err)
}
}
func TestClientCancelCertificate(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/certificates/cert_test_cancel/cancel" {
t.Errorf("unexpected path: %s", r.URL.Path)
http.NotFound(w, r)
return
}
if r.Method != http.MethodPost {
t.Errorf("unexpected method: %s", r.Method)
return
}
if r.URL.Query().Get("access_key") != "sample_test_key" {
t.Errorf("unexpected access key: %s", r.URL.Query().Get("access_key"))
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
resp := map[string]any{
"success": true,
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(resp)
}))
defer ts.Close()
client := zerossl.Client{
AccessKey: "sample_test_key",
BaseURL: ts.URL,
HTTPClient: ts.Client(),
}
err := client.CancelCertificate(context.Background(), "cert_test_cancel")
if err != nil {
t.Fatalf("CancelCertificate failed: %v", err)
}
}
func TestClientVerificationStatus(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/certificates/cert_test_status/status" {
t.Errorf("unexpected path: %s", r.URL.Path)
http.NotFound(w, r)
return
}
if r.Method != http.MethodGet {
t.Errorf("unexpected method: %s", r.Method)
return
}
if r.URL.Query().Get("access_key") != "sample_test_key" {
t.Errorf("unexpected access key: %s", r.URL.Query().Get("access_key"))
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
resp := map[string]any{
"validation_completed": 1,
"details": map[string]any{
"example.com": map[string]any{
"method": "HTTP_CSR_HASH",
"status": "VALIDATION_COMPLETED",
},
},
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(resp)
}))
defer ts.Close()
client := zerossl.Client{
AccessKey: "sample_test_key",
BaseURL: ts.URL,
HTTPClient: ts.Client(),
}
status, err := client.VerificationStatus(context.Background(), "cert_test_status")
if err != nil {
t.Fatalf("VerificationStatus failed: %v", err)
}
if status.ValidationCompleted != 1 {
t.Errorf("expected ValidationCompleted 1, got %d", status.ValidationCompleted)
}
detail, ok := status.Details["example.com"]
if !ok {
t.Fatalf("expected details for example.com not found")
}
if detail.Method != "HTTP_CSR_HASH" {
t.Errorf("expected Method HTTP_CSR_HASH, got %s", detail.Method)
}
if detail.Status != "VALIDATION_COMPLETED" {
t.Errorf("expected Status VALIDATION_COMPLETED, got %s", detail.Status)
}
}
{"case":{"caseId":"case:sha256:963de1f11b5ff22c5e45552dea07c15640d4114fcd522c9fc82829a3662bab98","contract":["assert Client.DownloadCertificate queries /certificates/{id}/download/return with include_cross_signed and parses CertificateBundle","assert Client.RevokeCertificate sends POST request to /certificates/{id}/revoke with reason query parameter and handles success response","assert Client.CancelCertificate sends POST request to /certificates/{id}/cancel and handles success response","assert Client.VerificationStatus queries /certificates/{id}/status and unmarshals ValidationStatus details"],"goal":"verify pkg:golang/github.com/caddyserver/zerossl@v0.1.5","kind":"HOW","packages":["pkg:golang/github.com/caddyserver/zerossl@v0.1.5"],"schemaVersion":1,"symbols":["zerossl.Client.DownloadCertificate","zerossl.Client.RevokeCertificate","zerossl.Client.CancelCertificate","zerossl.Client.VerificationStatus"]},"contractCommand":["go","test","./..."],"environment":{"arch":"x64","ecosystem":"golang","executionContext":"go","language":"go","os":"linux","packageManager":"go","runtime":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/caddyserver/zerossl@v0.1.5"],"schemaVersion":1,"symbols":["zerossl.Client.DownloadCertificate","zerossl.Client.RevokeCertificate","zerossl.Client.CancelCertificate","zerossl.Client.VerificationStatus"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/caddyserver/zerossl v0.1.5
github.com/caddyserver/zerossl v0.1.5 h1:dkvOjBAEEtY6LIGAHei7sw2UgqSD6TrWweXpV7lvEvE=
github.com/caddyserver/zerossl v0.1.5/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/caddyserver/zerossl@v0.1.5",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/caddyserver/zerossl@v0.1.5"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
Origin Seeder
anonymous