{"id":36480998,"url":"https://github.com/agentstation/uuidkey","last_synced_at":"2026-01-12T01:02:27.909Z","repository":{"id":257184107,"uuid":"857541380","full_name":"agentstation/uuidkey","owner":"agentstation","description":"The uuidkey package encodes UUIDs to a readable Key format via the Base32-Crockford codec.","archived":false,"fork":false,"pushed_at":"2025-09-27T02:42:45.000Z","size":113,"stargazers_count":197,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-27T04:23:26.211Z","etag":null,"topics":["api","api-key","api-keys","apikey","apikeys","crockford","crockford-base32","uuid","uuid-v4","uuid-v7","uuid4","uuid7","uuids","uuidv4","uuidv7"],"latest_commit_sha":null,"homepage":"https://agentstation.ai","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agentstation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-14T23:20:21.000Z","updated_at":"2025-09-27T02:42:49.000Z","dependencies_parsed_at":"2025-07-23T20:42:44.168Z","dependency_job_id":"3e2d9206-2a1c-42a4-8cf8-632b6fc4e7bb","html_url":"https://github.com/agentstation/uuidkey","commit_stats":null,"previous_names":["agentstation/uuidkey"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/agentstation/uuidkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentstation%2Fuuidkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentstation%2Fuuidkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentstation%2Fuuidkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentstation%2Fuuidkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agentstation","download_url":"https://codeload.github.com/agentstation/uuidkey/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentstation%2Fuuidkey/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-key","api-keys","apikey","apikeys","crockford","crockford-base32","uuid","uuid-v4","uuid-v7","uuid4","uuid7","uuids","uuidv4","uuidv7"],"created_at":"2026-01-12T01:01:04.474Z","updated_at":"2026-01-12T01:02:27.899Z","avatar_url":"https://github.com/agentstation.png","language":"Go","readme":"```sh\n                         _   _  _   _  ___ ____     _  __          \n                        | | | || | | ||_ _|  _ \\   | |/ /___ _   _ \n                        | | | || | | | | || | | |  | ' // _ \\ | | |\n                        | |_| || |_| | | || |_| |  | . \\  __/ |_| |\n                         \\___/  \\___/ |___|____/   |_|\\_\\___|\\__, |\n                                                             |___/ \n```\n\u003c!-- [![Sourcegraph](https://sourcegraph.com/github.com/agentstation/uuidkey/-/badge.svg?style=flat-square)](https://sourcegraph.com/github.com/agentstation/uuidkey?badge) --\u003e\n[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/agentstation/uuidkey)\n[![Go Report Card](https://goreportcard.com/badge/github.com/agentstation/uuidkey?style=flat-square)](https://goreportcard.com/report/github.com/agentstation/uuidkey)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/agentstation/uuidkey/ci.yaml?style=flat-square)](https://github.com/agentstation/uuidkey/actions)\n[![codecov](https://codecov.io/gh/agentstation/uuidkey/branch/master/graph/badge.svg?token=35UM5QX1Q3)](https://codecov.io/gh/agentstation/uuidkey)\n[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/agentstation/uuidkey/master/LICENSE)\n\u003c!-- [![Forum](https://img.shields.io/badge/community-forum-00afd1.svg?style=flat-square)](https://github.com/agentstation/uuidkey/discussions) --\u003e\n\u003c!-- [![Twitter](https://img.shields.io/badge/twitter-@agentstationHQ-55acee.svg?style=flat-square)](https://twitter.com/agentstationHQ) --\u003e\n\nThe `uuidkey` package encodes UUIDs to a readable `Key` format via the Base32-Crockford codec.\n\n\u003cdiv align=\"center\"\u003e\u003ch3\u003e\u003ca href=\"https://docs.agentstation.ai/blog/beautiful-api-keys/\"\u003e📚 Read the original article on why we made this!\u003c/a\u003e\u003c/h3\u003e\u003c/div\u003e\n\n\u003e **Note:** Thanks to everyone for the feedback and suggestions from the original article, we learned a lot and made improvements to follow the GitHub Secret Scanning format (with checksum) and added additional entropy options to ensure UUIDv7 encoding can be used in a wide variety of use cases. You can still use the `Encode` function to generate a `Key` type without the GitHub prefix format and additional entropy - but we recommend using the `NewAPIKey` function with an 8 character prefix to stay symetrical ;P\n\n## Overview\n\nThe `uuidkey` package generates secure, readable API keys by encoding UUIDs using Base32-Crockford with additional security features.\n\nYou can use the `uuidkey` package to generate API keys for your application using the `NewAPIKey` function (recommended to guarantee at least 128 bits of entropy and follow the GitHub Secret Scanning format) or the `Encode` function (to generate just a `Key` type).\n\n\u003e **Implementation Note:** As of v1.1.0, this package uses only the Go standard library's `encoding/base32` for Base32-Crockford encoding, removing the external dependency on `github.com/richardlehane/crock32`. The implementation maintains full backward compatibility while providing constant-time encoding operations.\n\n## Language Implementations\n\nThe `uuidkey` package has been implemented in several programming languages:\n\n- **Go** - This repository (official implementation)\n  - Package: [github.com/agentstation/uuidkey](https://pkg.go.dev/github.com/agentstation/uuidkey)\n\n- **Node.js/TypeScript** - By [@tanhv90](https://github.com/tanhv90)\n  - Repository: [github.com/tanhv90/uuidkey](https://github.com/tanhv90/uuidkey)\n  - Package: [npm: uuidkey](https://www.npmjs.com/package/uuidkey)\n\n- **.NET/C#** - By [@fremenkiel](https://github.com/Fremenkiel)\n  - Repository: [github.com/Fremenkiel/UuidKey](https://github.com/Fremenkiel/UuidKey)\n\n\u003e Want to add your implementation? Feel free to open a PR to add it to this list!\n\n## API Key Format\n\n```\nAGNTSTNP_38QARV01ET0G6Z2CJD9VA2ZZAR0XJJLSO7WBNWY3F_A1B2C3D8\n└─────┘ └──────────────────────────┘└────────────┘ └──────┘\nPrefix        Key (crock32 UUID)        Entropy      Checksum\n```\n\n### Components\n1. **Prefix** - Company/application identifier (e.g., \"AGNTSTNP\")\n2. **Key** - Base32-Crockford encoded UUID\n3. **Entropy** - Additional random data (128, 160, or 256 bits)\n4. **Checksum** - CRC32 checksum (8 characters) for validation\n\n### Security Features\n1. **Secret Scanning** - Formatted for GitHub Secret Scanning detection\n2. **Validation** - CRC32 checksum for error detection and validation\n3. **Entropy Options** - Configurable entropy levels that ensure UUIDv7 security (128, 160, or 256 bits)\n\n## Compatibility\n\nCompatible with any UUID library following RFC 4122 specification. Officially tested with:\n- [github.com/gofrs/uuid](https://github.com/gofrs/uuid) (v4.4.0+)\n- [github.com/google/uuid](https://github.com/google/uuid) (v1.6.0+)\n\n## Installation\n\nTo install the `uuidkey` package, use the following command:\n\n```sh\ngo get github.com/agentstation/uuidkey\n```\n\n## Usage\n\nTo use the `uuidkey` package in your Go code, follow these steps:\n\n1. Import the package:\n\n```go\nimport \"github.com/agentstation/uuidkey\"\n```\n\n2. Create and parse API Keys:\n\n```go\n// Create a new API Key with default settings (160-bit entropy)\napiKey := uuidkey.NewAPIKey(\"AGNTSTNP\", \"d1756360-5da0-40df-9926-a76abff5601d\")\nfmt.Println(apiKey) // Output: AGNTSTNP_38QARV01ET0G6Z2CJD9VA2ZZAR0XJJLSO7WBNWY3F_A1B2C3D8\n\n// Create an API Key with 128-bit entropy\napiKey = uuidkey.NewAPIKey(\"AGNTSTNP\", \"d1756360-5da0-40df-9926-a76abff5601d\", uuidkey.With128BitEntropy)\nfmt.Println(apiKey) // Output: AGNTSTNP_38QARV01ET0G6Z2CJD9VA2ZZAR0XJJLSO7WBNWY3F_A1B2C3D8\n\n// Parse an existing API Key\napiKey, err := uuidkey.ParseAPIKey(\"AGNTSTNP_38QARV01ET0G6Z2CJD9VA2ZZAR0XJJLSO7WBNWY3F_A1B2C3D8\")\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\nfmt.Printf(\"Prefix: %s, Key: %s, Entropy: %s\\n\", apiKey.Prefix, apiKey.Key, apiKey.Entropy)\n```\n\n3. Work with UUID Keys directly:\n\n```go\n// With hyphens (default)\nkey, _ := uuidkey.Encode(\"d1756360-5da0-40df-9926-a76abff5601d\")\nfmt.Println(key) // Output: 38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\n\n// Without hyphens\nkey, _ := uuidkey.Encode(\"d1756360-5da0-40df-9926-a76abff5601d\", uuidkey.WithoutHyphens)\nfmt.Println(key) // Output: 38QARV01ET0G6Z2CJD9VA2ZZAR0X\n```\n\n4. Decode a Key type to a UUID string with Key format validation:\n\n```go\n// With hyphens\nkey, _ := uuidkey.Parse(\"38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\")\nuuid, err := key.UUID()\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\nfmt.Println(uuid) // Output: d1756360-5da0-40df-9926-a76abff5601d\n\n// Without hyphens\nkey, _ := uuidkey.Parse(\"38QARV01ET0G6Z2CJD9VA2ZZAR0X\")\nuuid, err := key.UUID()\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\nfmt.Println(uuid) // Output: d1756360-5da0-40df-9926-a76abff5601d\n```\n\n5. Decode a Key type to a UUID string with only basic Key length validation:\n\n```go\nkey, _ := uuidkey.Parse(\"38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\")\nuuid, err := key.Decode()\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\nfmt.Println(uuid) // Output: d1756360-5da0-40df-9926-a76abff5601d\n```\n\n6. Work directly with UUID bytes:\n\n```go\n// Convert UUID string to bytes\nuuidStr := \"d1756360-5da0-40df-9926-a76abff5601d\"\nuuidBytes, err := hex.DecodeString(strings.ReplaceAll(uuidStr, \"-\", \"\"))\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\n\n// Convert to [16]byte array\nvar uuid [16]byte\ncopy(uuid[:], uuidBytes)\n\n// Now use the bytes with EncodeBytes (with hyphens)\nkey, _ := uuidkey.EncodeBytes(uuid)\nfmt.Println(key) // Output: 38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\n\n// Without hyphens\nkey, _ := uuidkey.EncodeBytes(uuid, uuidkey.WithoutHyphens)\nfmt.Println(key) // Output: 38QARV01ET0G6Z2CJD9VA2ZZAR0X\n\n// Convert Key back to UUID bytes\nkey, _ := uuidkey.Parse(\"38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\")\nbytes, err := key.Bytes()\nif err != nil {\n    log.Fatal(\"Error:\", err)\n}\nfmt.Printf(\"%x\", bytes) // Output: d17563605da040df9926a76abff5601d\n```\n\n## CLI Tool\n\nThe `uuidkey` CLI provides a command-line interface for encoding/decoding UUIDs and generating API keys.\n\n### Installation\n\n#### Using Go\n\n```bash\ngo install github.com/agentstation/uuidkey/cmd/uuidkey@latest\n```\n\n#### Download Binaries\n\nPre-built binaries are available on the [releases page](https://github.com/agentstation/uuidkey/releases) for:\n- Linux (amd64, arm64, arm)\n- macOS (amd64, arm64)\n- Windows (amd64)\n- FreeBSD (amd64, arm64)\n\n### CLI Usage\n\nThe CLI supports smart command detection - if no input is provided, it generates new values.\n\n```bash\n# Generate a new UUID v4\nuuidkey uuid\n\n# Generate a new UUID v6 (K-sortable)\nuuidkey uuid --version 6\n\n# Generate a new UUID v7 (K-sortable with millisecond precision)\nuuidkey uuid --version 7\n\n# Encode an existing UUID to Base32-Crockford\nuuidkey uuid d1756360-5da0-40df-9926-a76abff5601d\n\n# Generate a new UUID and encode it as a key\nuuidkey key\n\n# Encode an existing UUID as a key\nuuidkey key d1756360-5da0-40df-9926-a76abff5601d\n\n# Decode a key back to UUID\nuuidkey key 38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\n\n# Generate a new API key with default entropy (160 bits)\nuuidkey apikey --prefix MYAPP\n\n# Generate an API key with specific entropy\nuuidkey apikey --prefix MYAPP --entropy 256\n\n# Parse an existing API key\nuuidkey apikey MYAPP_38QARV01ET0G6Z2CJD9VA2ZZAR0X1234567890ABCDEF_A1B2C3D8\n\n# Explicit encode/decode commands\nuuidkey encode d1756360-5da0-40df-9926-a76abff5601d\nuuidkey decode 38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X\n\n# Output as JSON\nuuidkey uuid --json\n\n# Quiet mode (only output the result)\nuuidkey uuid -q\n\n# Version information\nuuidkey version\n\n# Verify binary checksum\nuuidkey version --verify\n\n# Verify against GitHub release checksums\nuuidkey version --verify-online\n```\n\n### Command Reference\n\n#### `uuidkey uuid`\nGenerate or work with UUIDs\n- `--version, -v`: UUID version (4, 6, or 7; default 4)\n- `--time, -t`: Custom timestamp for v6/v7 (RFC3339 format)\n\n#### `uuidkey key`\nEncode UUIDs to Base32-Crockford keys or decode keys back to UUIDs\n- Auto-detects whether input is a UUID (encode) or key (decode)\n- No input generates a new UUID and encodes it\n\n#### `uuidkey apikey`\nGenerate or parse API keys with prefix, entropy, and checksum\n- `--prefix`: Set the prefix for new API keys (required for generation)\n- `--entropy`: Set entropy bits (128, 160, or 256; default 160)\n\n#### `uuidkey encode`\nExplicitly encode a UUID to Base32-Crockford\n\n#### `uuidkey decode`\nExplicitly decode a Base32-Crockford key to UUID\n\n#### `uuidkey version`\nDisplay version and build information\n- `--verify`: Calculate and display binary checksum\n- `--verify-online`: Verify checksum against GitHub releases\n\n### Global Flags\n\n- `--json, -j`: Output in JSON format\n- `--quiet, -q`: Only output the result value\n\n\u003c!-- gomarkdoc:embed:start --\u003e\n\n\u003c!-- Code generated by gomarkdoc. DO NOT EDIT --\u003e\n\n# uuidkey\n\n```go\nimport \"github.com/agentstation/uuidkey\"\n```\n\nPackage uuidkey provides Crockford Base32 encoding that's compatible with the original crock32 number\\-based approach\n\nPackage uuidkey encodes UUIDs to a readable Key format via the Base32\\-Crockford codec.\n\n## Index\n\n- [Constants](\u003c#constants\u003e)\n- [type APIKey](\u003c#APIKey\u003e)\n  - [func NewAPIKey\\(prefix, uuid string, opts ...Option\\) \\(APIKey, error\\)](\u003c#NewAPIKey\u003e)\n  - [func NewAPIKeyFromBytes\\(prefix string, uuid \\[16\\]byte, opts ...Option\\) \\(APIKey, error\\)](\u003c#NewAPIKeyFromBytes\u003e)\n  - [func ParseAPIKey\\(apikey string\\) \\(APIKey, error\\)](\u003c#ParseAPIKey\u003e)\n  - [func \\(a APIKey\\) String\\(\\) string](\u003c#APIKey.String\u003e)\n- [type Key](\u003c#Key\u003e)\n  - [func Encode\\(uuid string, opts ...Option\\) \\(Key, error\\)](\u003c#Encode\u003e)\n  - [func EncodeBytes\\(uuid \\[16\\]byte, opts ...Option\\) \\(Key, error\\)](\u003c#EncodeBytes\u003e)\n  - [func Parse\\(key string\\) \\(Key, error\\)](\u003c#Parse\u003e)\n  - [func \\(k Key\\) Bytes\\(\\) \\(\\[16\\]byte, error\\)](\u003c#Key.Bytes\u003e)\n  - [func \\(k Key\\) Decode\\(\\) \\(string, error\\)](\u003c#Key.Decode\u003e)\n  - [func \\(k Key\\) IsValid\\(\\) bool](\u003c#Key.IsValid\u003e)\n  - [func \\(k Key\\) String\\(\\) string](\u003c#Key.String\u003e)\n  - [func \\(k Key\\) UUID\\(\\) \\(string, error\\)](\u003c#Key.UUID\u003e)\n- [type Option](\u003c#Option\u003e)\n\n\n## Constants\n\n\u003ca name=\"KeyLengthWithHyphens\"\u003e\u003c/a\u003eKey validation constraint constants\n\n```go\nconst (\n    // KeyLengthWithHyphens is the total length of a valid UUID Key, including hyphens.\n    KeyLengthWithHyphens = 31 // 7 + 1 + 7 + 1 + 7 + 1 + 7 = 31 characters\n\n    // KeyLengthWithoutHyphens is the total length of a valid UUID Key, excluding hyphens.\n    KeyLengthWithoutHyphens = 28 // 7 + 7 + 7 + 7 = 28 characters\n\n    // KeyPartLength is the length of each part in a UUID Key.\n    // A UUID Key consists of 4 parts separated by hyphens.\n    KeyPartLength = 7\n\n    // KeyHyphenCount is the number of hyphens in a valid UUID Key.\n    KeyHyphenCount = 3\n\n    // KeyPartsCount is the number of parts in a valid UUID Key.\n    KeyPartsCount = KeyHyphenCount + 1\n\n    // UUIDLength is the standard length of a UUID string, including hyphens.\n    // Reference: RFC 4122 (https://tools.ietf.org/html/rfc4122)\n    UUIDLength = 36\n)\n```\n\n\u003ca name=\"APIKey\"\u003e\u003c/a\u003e\n## type [APIKey](\u003chttps://github.com/agentstation/uuidkey/blob/master/apikey.go#L115-L120\u003e)\n\nAPIKey represents a compound key consisting of four parts or segments: \\- Prefix: A company or application identifier \\(e.g., \"AGNTSTNP\"\\) \\- Key: A UUID\\-based identifier encoded in Base32\\-Crockford \\- Entropy: Additional segment of random data for increased uniqueness \\- Checksum: CRC32 checksum of the previous components \\(8 characters\\)\n\nFormat:\n\n```\n[Prefix]_[UUID Key][Entropy]_[Checksum]\n\nAGNTSTNP_38QARV01ET0G6Z2CJD9VA2ZZAR0XJJLSO7WBNWY3F_A1B2C3D8\n└─────┘ └──────────────────────────┘└────────────┘ └──────┘\nPrefix        Key (crock32 UUID)        Entropy      Checksum\n```\n\n```go\ntype APIKey struct {\n    Prefix   string\n    Key      Key\n    Entropy  string\n    Checksum string\n}\n```\n\n\u003ca name=\"NewAPIKey\"\u003e\u003c/a\u003e\n### func [NewAPIKey](\u003chttps://github.com/agentstation/uuidkey/blob/master/apikey.go#L150\u003e)\n\n```go\nfunc NewAPIKey(prefix, uuid string, opts ...Option) (APIKey, error)\n```\n\nNewAPIKey creates a new APIKey from a string prefix, string UUID, and options.\n\n\u003ca name=\"NewAPIKeyFromBytes\"\u003e\u003c/a\u003e\n### func [NewAPIKeyFromBytes](\u003chttps://github.com/agentstation/uuidkey/blob/master/apikey.go#L185\u003e)\n\n```go\nfunc NewAPIKeyFromBytes(prefix string, uuid [16]byte, opts ...Option) (APIKey, error)\n```\n\nNewAPIKeyFromBytes creates a new APIKey from a string prefix, \\[16\\]byte UUID, and options.\n\n\u003ca name=\"ParseAPIKey\"\u003e\u003c/a\u003e\n### func [ParseAPIKey](\u003chttps://github.com/agentstation/uuidkey/blob/master/apikey.go#L216\u003e)\n\n```go\nfunc ParseAPIKey(apikey string) (APIKey, error)\n```\n\nParseAPIKey will parse a given APIKey string into an APIKey type.\n\n\u003ca name=\"APIKey.String\"\u003e\u003c/a\u003e\n### func \\(APIKey\\) [String](\u003chttps://github.com/agentstation/uuidkey/blob/master/apikey.go#L133\u003e)\n\n```go\nfunc (a APIKey) String() string\n```\n\nString returns the complete API key as a string with all components joined\n\n\u003ca name=\"Key\"\u003e\u003c/a\u003e\n## type [Key](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L36\u003e)\n\nKey is a UUID Key string.\n\n```go\ntype Key string\n```\n\n\u003ca name=\"Encode\"\u003e\u003c/a\u003e\n### func [Encode](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L150\u003e)\n\n```go\nfunc Encode(uuid string, opts ...Option) (Key, error)\n```\n\nEncode will encode a given UUID string into a Key. It pre\\-allocates the exact string capacity needed for better performance.\n\n\u003ca name=\"EncodeBytes\"\u003e\u003c/a\u003e\n### func [EncodeBytes](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L201\u003e)\n\n```go\nfunc EncodeBytes(uuid [16]byte, opts ...Option) (Key, error)\n```\n\nEncodeBytes encodes a \\[16\\]byte UUID into a Key.\n\n\u003ca name=\"Parse\"\u003e\u003c/a\u003e\n### func [Parse](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L73\u003e)\n\n```go\nfunc Parse(key string) (Key, error)\n```\n\nParse converts a Key formatted string into a Key type.\n\n\u003ca name=\"Key.Bytes\"\u003e\u003c/a\u003e\n### func \\(Key\\) [Bytes](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L302\u003e)\n\n```go\nfunc (k Key) Bytes() ([16]byte, error)\n```\n\nBytes converts a Key to a \\[16\\]byte UUID.\n\n\u003ca name=\"Key.Decode\"\u003e\u003c/a\u003e\n### func \\(Key\\) [Decode](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L244\u003e)\n\n```go\nfunc (k Key) Decode() (string, error)\n```\n\nDecode will decode a given Key into a UUID string with basic length validation.\n\n\u003ca name=\"Key.IsValid\"\u003e\u003c/a\u003e\n### func \\(Key\\) [IsValid](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L89\u003e)\n\n```go\nfunc (k Key) IsValid() bool\n```\n\nIsValid verifies if a given Key follows the correct format. The format should be:\n\n- 31 characters long \\(with hyphens\\) or 28 characters \\(without hyphens\\)\n- Uppercase\n- Contains only alphanumeric characters\n- Contains 3 hyphens \\(if hyphenated\\)\n- Each part is 7 characters long\n- Each part contains only valid crockford base32 characters \\(I, L, O, U are not allowed\\)\n\n\u003ca name=\"Key.String\"\u003e\u003c/a\u003e\n### func \\(Key\\) [String](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L39\u003e)\n\n```go\nfunc (k Key) String() string\n```\n\nString will convert your Key into a string.\n\n\u003ca name=\"Key.UUID\"\u003e\u003c/a\u003e\n### func \\(Key\\) [UUID](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L128\u003e)\n\n```go\nfunc (k Key) UUID() (string, error)\n```\n\nUUID will validate and convert a given Key into a UUID string.\n\n\u003ca name=\"Option\"\u003e\u003c/a\u003e\n## type [Option](\u003chttps://github.com/agentstation/uuidkey/blob/master/key.go#L56\u003e)\n\nOption is a function that configures options\n\n```go\ntype Option func(c *config)\n```\n\n\u003ca name=\"With128BitEntropy\"\u003e\u003c/a\u003eWith128BitEntropy expects 128 bits of entropy in the APIKey\n\n```go\nvar With128BitEntropy Option = func(c *config) {\n    c.entropySize = EntropyBits128\n}\n```\n\n\u003ca name=\"With160BitEntropy\"\u003e\u003c/a\u003eWith160BitEntropy expects 160 bits of entropy in the APIKey\n\n```go\nvar With160BitEntropy Option = func(c *config) {\n    c.entropySize = EntropyBits160\n}\n```\n\n\u003ca name=\"With256BitEntropy\"\u003e\u003c/a\u003eWith256BitEntropy expects 256 bits of entropy in the APIKey\n\n```go\nvar With256BitEntropy Option = func(c *config) {\n    c.entropySize = EntropyBits256\n}\n```\n\n\u003ca name=\"WithoutHyphens\"\u003e\u003c/a\u003eWithoutHyphens expects no hyphens in the Key\n\n```go\nvar WithoutHyphens Option = func(c *config) {\n    c.hyphens = false\n}\n```\n\nGenerated by [gomarkdoc](\u003chttps://github.com/princjef/gomarkdoc\u003e)\n\n\n\u003c!-- gomarkdoc:embed:end --\u003e\n\n## Makefile\n\n```sh\njack@devbox ➜ make help\n\nUsage:\n  make \u003ctarget\u003e\n\nGeneral\n  help                  Display the list of targets and their descriptions\n\nTooling\n  install-devbox        Install Devbox\n  devbox-update         Update Devbox\n  devbox                Run Devbox shell\n\nInstallation\n  install               Download go modules\n\nDevelopment\n  fmt                   Run go fmt\n  generate              Generate and embed go documentation into README.md\n  vet                   Run go vet\n  lint                  Run golangci-lint\n\nBenchmarking, Testing, \u0026 Coverage\n  bench                 Run Go benchmarks\n  test                  Run Go tests\n  test-cli              Run CLI-specific tests\n  coverage              Run tests and generate coverage report\n```\n\n### Test Coverage\n- Library: 96.2%\n- CLI: 80.1%\n\nAll tests now pass reliably. The Cobra state pollution issue has been resolved by using fresh command instances for each test.\n\n## Benchmarks\n\n\u003e **Note:** These benchmarks were run on an Apple M2 Max CPU with 12 cores (8 performance and 4 efficiency) and 32 GB of memory, running macOS 14.6.1. The results are not representative of all systems, but should give you a general idea of the performance of the package. I was running other processes on the machine while running the benchmarks.\n\n*Your mileage may vary.*\n\n```sh\ndevbox ➜ make bench\nRunning go benchmarks...\ngo test ./... -tags=bench -bench=.\ngoos: darwin\ngoarch: arm64\npkg: github.com/agentstation/uuidkey\nBenchmarkValidate-12                      \t38844379\t        31.20 ns/op\nBenchmarkValidateInvalid-12               \t799813152\t         1.522 ns/op\nBenchmarkParse-12                         \t37814629\t        31.36 ns/op\nBenchmarkParseInvalid-12                  \t653474202\t         1.850 ns/op\nBenchmarkUUID-12                          \t 3826080\t       315.4 ns/op\nBenchmarkUUIDInvalid-12                   \t84892892\t        13.99 ns/op\nBenchmarkEncode-12                        \t 8739932\t       136.5 ns/op\nBenchmarkDecode-12                        \t 4279651\t       282.4 ns/op\nBenchmarkBytes-12                         \t50595994\t        23.95 ns/op\nBenchmarkEncodeBytes-12                   \t17510078\t        66.62 ns/op\nBenchmarkValidateWithHyphens-12           \t38942652\t        31.03 ns/op\nBenchmarkValidateWithoutHyphens-12        \t39069440\t        30.75 ns/op\nBenchmarkParseWithHyphens-12              \t38794566\t        31.23 ns/op\nBenchmarkParseWithoutHyphens-12           \t39039996\t        30.97 ns/op\nBenchmarkEncodeWithHyphens-12             \t 8860897\t       136.1 ns/op\nBenchmarkEncodeWithoutHyphens-12          \t 8888666\t       136.4 ns/op\nBenchmarkDecodeWithHyphens-12             \t 4300177\t       287.4 ns/op\nBenchmarkDecodeWithoutHyphens-12          \t 4218482\t       281.8 ns/op\nBenchmarkBytesWithHyphens-12              \t49269594\t        23.97 ns/op\nBenchmarkBytesWithoutHyphens-12           \t49764051\t        24.18 ns/op\nBenchmarkEncodeBytesWithHyphens-12        \t18239646\t        66.34 ns/op\nBenchmarkEncodeBytesWithoutHyphens-12     \t17947390\t        65.65 ns/op\nBenchmarkString-12                        \t1000000000\t         0.3002 ns/op\nBenchmarkValidateInvalidFormat-12         \t796483308\t         1.510 ns/op\nBenchmarkParseInvalidFormat-12            \t637520612\t         1.845 ns/op\nBenchmarkDecodeInvalidFormat-12           \t10637605\t       115.0 ns/op\nBenchmarkEncodeInvalidUUID-12             \t11353212\t       105.6 ns/op\nBenchmarkBytesInvalidFormat-12            \t10728985\t       111.9 ns/op\nPASS\nok  \tgithub.com/agentstation/uuidkey\t49.995s\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentstation%2Fuuidkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagentstation%2Fuuidkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentstation%2Fuuidkey/lists"}