サンプル
github.com/google/uuid v1.6.0: generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup
検証済みサンプル — golang github.com/google/uuid v1.6.0: generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup. go 1.26 · linux alpine/x64 …
sha256:251dffaa3b57e08712a80732c5fc61847a0120da6832e0e25d9300c329f725bb
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 2
宣言された環境
windows 11 x64 go
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-19 |
| 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-09-07 |
ケース
HOW- ゴール
- generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup
- シンボル
-
- NewDCEGroup
- NewDCEPerson
- 作成日
- 2026-08-18T21:29:11Z
コントラクト
- uuid.NewDCEPerson returns non-nil UUID v2 without error
- uuid.NewDCEPerson returns UUID with Version 2 and RFC4122 variant
- uuid.NewDCEPerson returns UUID with Person domain
- uuid.NewDCEGroup returns non-nil UUID v2 with Group domain
- uuid.NewDCESecurity generates UUID v2 with specified domain and ID
- uuid.Parse successfully parses generated UUID v2 string back to original UUID
ファイル
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/main.go
ソース
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: generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/google/uuid@v1.6.0
Demonstrate these symbols/APIs:
- NewDCEGroup
- NewDCEPerson
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@11.8.0
- runtime: node@24.13.1
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:a1a58741a2bbfcf82d9721fd7f8644c52335303c4dcf371ac08d6396bb84459a","contract":["uuid.NewDCEPerson returns non-nil UUID v2 without error","uuid.NewDCEPerson returns UUID with Version 2 and RFC4122 variant","uuid.NewDCEPerson returns UUID with Person domain","uuid.NewDCEGroup returns non-nil UUID v2 with Group domain","uuid.NewDCESecurity generates UUID v2 with specified domain and ID","uuid.Parse successfully parses generated UUID v2 string back to original UUID"],"goal":"generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup","kind":"HOW","packages":["pkg:golang/github.com/google/uuid@v1.6.0"],"schemaVersion":1,"symbols":["NewDCEGroup","NewDCEPerson"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","ecosystem":"golang","os":"windows","osVersionBucket":"11","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/google/uuid@v1.6.0"],"schemaVersion":1,"symbols":["NewDCEGroup","NewDCEPerson"],"verifierAdapter":"golang@1"}
module sample
go 1.26.5
require github.com/google/uuid v1.6.0
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
package main
import (
"fmt"
"github.com/google/uuid"
)
// GeneratePersonUUID creates a DCE Security (version 2) UUID for the current person.
func GeneratePersonUUID() (uuid.UUID, error) {
return uuid.NewDCEPerson()
}
// GenerateGroupUUID creates a DCE Security (version 2) UUID for the current group.
func GenerateGroupUUID() (uuid.UUID, error) {
return uuid.NewDCEGroup()
}
// GenerateCustomDCEUUID creates a DCE Security (version 2) UUID with an explicit domain and ID.
func GenerateCustomDCEUUID(domain uuid.Domain, id uint32) (uuid.UUID, error) {
return uuid.NewDCESecurity(domain, id)
}
func main() {
personUUID, err := GeneratePersonUUID()
if err != nil {
fmt.Printf("Failed to generate person UUID: %v\n", err)
return
}
fmt.Printf("Person UUID: %s\n", personUUID.String())
fmt.Printf("Version: %d, Domain: %v, Variant: %v\n", personUUID.Version(), personUUID.Domain(), personUUID.Variant())
groupUUID, err := GenerateGroupUUID()
if err != nil {
fmt.Printf("Failed to generate group UUID: %v\n", err)
return
}
fmt.Printf("Group UUID: %s\n", groupUUID.String())
fmt.Printf("Version: %d, Domain: %v, Variant: %v\n", groupUUID.Version(), groupUUID.Domain(), groupUUID.Variant())
customUUID, err := GenerateCustomDCEUUID(uuid.Person, 1001)
if err != nil {
fmt.Printf("Failed to generate custom DCE UUID: %v\n", err)
return
}
fmt.Printf("Custom DCE UUID: %s (ID: %d)\n", customUUID.String(), customUUID.ID())
}
{
"schemaVersion": 1,
"goal": "generate DCE Security UUID v2 with uuid.NewDCEPerson and uuid.NewDCEGroup",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/google/uuid@v1.6.0"
],
"symbols": [
"NewDCEGroup",
"NewDCEPerson"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@11.8.0",
"runtime": "node@24.13.1"
}
}
package main
import (
"bytes"
"fmt"
"os"
"github.com/google/uuid"
)
func assertTrue(name string, condition bool) {
if !condition {
fmt.Fprintf(os.Stderr, "Assertion failed for %s: expected true, got false\n", name)
os.Exit(1)
}
}
func main() {
// 1. uuid.NewDCEPerson returns non-nil UUID v2 without error
personUUID, err := uuid.NewDCEPerson()
assertTrue("uuid.NewDCEPerson returns without error", err == nil)
assertTrue("uuid.NewDCEPerson returns non-nil UUID", personUUID != uuid.Nil)
assertTrue("uuid.NewDCEPerson byte length is 16", len(personUUID) == 16)
// 2. uuid.NewDCEPerson returns UUID with Version 2 and RFC4122 variant
assertTrue("uuid.NewDCEPerson version is 2", personUUID.Version() == 2)
assertTrue("uuid.NewDCEPerson variant is RFC4122", personUUID.Variant() == uuid.RFC4122)
// 3. uuid.NewDCEPerson returns UUID with Person domain
assertTrue("uuid.NewDCEPerson domain is Person", personUUID.Domain() == uuid.Person)
// 4. uuid.NewDCEGroup returns non-nil UUID v2 with Group domain
groupUUID, err := uuid.NewDCEGroup()
assertTrue("uuid.NewDCEGroup returns without error", err == nil)
assertTrue("uuid.NewDCEGroup returns non-nil UUID", groupUUID != uuid.Nil)
assertTrue("uuid.NewDCEGroup version is 2", groupUUID.Version() == 2)
assertTrue("uuid.NewDCEGroup domain is Group", groupUUID.Domain() == uuid.Group)
// 5. uuid.NewDCESecurity generates UUID v2 with specified domain and ID
const customID uint32 = 42001
customUUID, err := uuid.NewDCESecurity(uuid.Person, customID)
assertTrue("uuid.NewDCESecurity returns without error", err == nil)
assertTrue("uuid.NewDCESecurity version is 2", customUUID.Version() == 2)
assertTrue("uuid.NewDCESecurity domain matches", customUUID.Domain() == uuid.Person)
assertTrue("uuid.NewDCESecurity ID matches", customUUID.ID() == customID)
// 6. uuid.Parse successfully parses generated UUID v2 string back to original UUID
parsedPerson, err := uuid.Parse(personUUID.String())
assertTrue("uuid.Parse parses person UUID without error", err == nil)
assertTrue("parsed person UUID equals original", parsedPerson == personUUID)
assertTrue("parsed person UUID bytes match", bytes.Equal(parsedPerson[:], personUUID[:]))
assertTrue("parsed person UUID preserves version 2", parsedPerson.Version() == 2)
assertTrue("parsed person UUID preserves Person domain", parsedPerson.Domain() == uuid.Person)
fmt.Println("All contract assertions passed successfully.")
}
オリジンシーダー
匿名