{"id":46848788,"url":"https://github.com/ldclabs/cose","last_synced_at":"2026-03-10T15:35:52.334Z","repository":{"id":64887227,"uuid":"576282037","full_name":"ldclabs/cose","owner":"ldclabs","description":"📧 Implemented Keys, Algorithms (RFC9053), COSE (RFC9052) and CWT (RFC8392) in Go.","archived":false,"fork":false,"pushed_at":"2025-03-01T22:03:38.000Z","size":293,"stargazers_count":22,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T14:47:13.065Z","etag":null,"topics":["cbor","cose","cryptography","cwt","rfc8152","rfc8392","rfc9052","rfc9053"],"latest_commit_sha":null,"homepage":"","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/ldclabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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":"2022-12-09T13:00:45.000Z","updated_at":"2025-11-28T18:05:15.000Z","dependencies_parsed_at":"2023-11-17T02:26:44.359Z","dependency_job_id":"3b8e0bbe-4df8-4a84-8623-da043b978f23","html_url":"https://github.com/ldclabs/cose","commit_stats":null,"previous_names":["ldclabs/cwt"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ldclabs/cose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldclabs%2Fcose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldclabs%2Fcose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldclabs%2Fcose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldclabs%2Fcose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ldclabs","download_url":"https://codeload.github.com/ldclabs/cose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldclabs%2Fcose/sbom","scorecard":{"id":581294,"data":{"date":"2025-08-11","repo":{"name":"github.com/ldclabs/cose","commit":"7270b3217b0f78a826695bf3c74543a727221bfe"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:16","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:17","Warn: no topLevel permission defined: .github/workflows/ci-cover.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-cover.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/ci-cover.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-cover.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/ci-cover.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci-cover.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/ci-cover.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/ldclabs/cose/codeql.yml/main?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   2 out of   2 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 5 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T19:14:29.672Z","repository_id":64887227,"created_at":"2025-08-20T19:14:29.672Z","updated_at":"2025-08-20T19:14:29.672Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30340117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:03:31.997Z","status":"ssl_error","status_checked_at":"2026-03-10T15:01:30.431Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["cbor","cose","cryptography","cwt","rfc8152","rfc8392","rfc9052","rfc9053"],"created_at":"2026-03-10T15:35:52.207Z","updated_at":"2026-03-10T15:35:52.322Z","avatar_url":"https://github.com/ldclabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keys, Algorithms, COSE and CWT in Go\n\n[![CI](https://github.com/ldclabs/cose/actions/workflows/ci.yml/badge.svg)](https://github.com/ldclabs/cose/actions/workflows/ci.yml)\n[![Codecov](https://codecov.io/gh/ldclabs/cose/branch/main/graph/badge.svg)](https://codecov.io/gh/ldclabs/cose)\n[![CodeQL](https://github.com/ldclabs/cose/actions/workflows/codeql.yml/badge.svg)](https://github.com/ldclabs/cose/actions/workflows/codeql.yml)\n[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/ldclabs/cose/main/LICENSE)\n[![Installation](https://img.shields.io/badge/go-%3E%3D%201.19-blue)](#installation)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ldclabs/cose.svg)](https://pkg.go.dev/github.com/ldclabs/cose)\n\n*A golang library for the [CBOR Object Signing and Encryption (COSE)][cose-spec] and [CBOR Web Token (CWT)][cwt-spec].*\n\n## Index\n\n- [Keys, Algorithms, COSE and CWT in Go](#keys-algorithms-cose-and-cwt-in-go)\n\t- [Index](#index)\n\t- [Introduction](#introduction)\n\t- [Features](#features)\n\t- [Installation](#installation)\n\t- [Packages](#packages)\n\t- [Examples](#examples)\n\t\t- [Create a simple CWT with a signer](#create-a-simple-cwt-with-a-signer)\n\t\t- [Create a complex CWT with one more signers](#create-a-complex-cwt-with-one-more-signers)\n\t- [Security Reviews](#security-reviews)\n\t- [Reference](#reference)\n\t- [License](#license)\n\n## Introduction\n\nCOSE is a standard for signing and encrypting data in the [CBOR][cbor] data format. It is designed to be simple and efficient, and to be usable in constrained environments. It is intended to be used in a variety of applications, including the Internet of Things, and is designed to be extensible to support new algorithms and applications.\n\n## Features\n\n- Key: Full support.\n- Algorithms:\n  - Signing: ECDSA, Ed25519;\n  - Encryption: AES-CCM, AES-GCM, ChaCha20/Poly1305;\n  - MAC: AES-MAC, HMAC;\n  - KDF: HKDF-SHA, HKDF-AES.\n  - ECDH: P256, P384, P521, X25519.\n- COSE: COSE_Encrypt, COSE_Encrypt0, COSE_Mac, COSE_Mac0, COSE_Sign, COSE_Sign1, COSE_recipient, COSE_KDF_Context.\n- CWT: Full support.\n\n## Installation\n\nTo install COSE locally run:\n\n```sh\ngo get github.com/ldclabs/cose\n```\n\nTo import in the cwt package:\n\n```go\nimport \"github.com/ldclabs/cose/cwt\"\n```\n\nTo register crypto algorithms:\n\n```go\nimport (\n  _ \"github.com/ldclabs/cose/key/ed25519\"\n  _ \"github.com/ldclabs/cose/key/aesgcm\"\n)\n```\n\n## Packages\n\n| Package name                                                                        | Import                                       | Description                                                                                                                                |\n| ----------------------------------------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |\n| [cose](https://pkg.go.dev/github.com/ldclabs/cose/cose)                             | github.com/ldclabs/cose/cose                 | [RFC9052: CBOR Object Signing and Encryption][cose-spec]                                                                                   |\n| [cwt](https://pkg.go.dev/github.com/ldclabs/cose/cwt)                               | github.com/ldclabs/cose/cwt                  | [RFC8392: CBOR Web Token][cwt-spec]                                                                                                        |\n| [iana](https://pkg.go.dev/github.com/ldclabs/cose/iana)                             | github.com/ldclabs/cose/iana                 | [IANA: COSE][iana-cose] + [IANA: CWT][iana-cwt] + [IANA: CBOR Tags][iana-cbor-tags]                                                        |\n| [key](https://pkg.go.dev/github.com/ldclabs/cose/key)                               | github.com/ldclabs/cose/key                  | [RFC9053: Algorithms and Key Objects][algorithms-spec]                                                                                     |\n| [ed25519](https://pkg.go.dev/github.com/ldclabs/cose/key/ed25519)                   | github.com/ldclabs/cose/key/ed25519          | Signature Algorithm: [Ed25519](https://datatracker.ietf.org/doc/html/rfc9053#name-edwards-curve-digital-signa)                             |\n| [ecdsa](https://pkg.go.dev/github.com/ldclabs/cose/key/ecdsa)                       | github.com/ldclabs/cose/key/ecdsa            | Signature Algorithm: [ECDSA](https://datatracker.ietf.org/doc/html/rfc9053#name-ecdsa)                                                     |\n| [ecdh](https://pkg.go.dev/github.com/ldclabs/cose/key/ecdh)                         | github.com/ldclabs/cose/key/ecdh             | Elliptic Curve Diffie-Hellman Algorithm: [ECDH](https://datatracker.ietf.org/doc/html/rfc9053#name-direct-key-agreement)                   |\n| [hmac](https://pkg.go.dev/github.com/ldclabs/cose/key/hmac)                         | github.com/ldclabs/cose/key/hmac             | Message Authentication Code (MAC) Algorithm: [HMAC](https://datatracker.ietf.org/doc/html/rfc9053#name-hash-based-message-authenti)        |\n| [aesmac](https://pkg.go.dev/github.com/ldclabs/cose/key/aesmac)                     | github.com/ldclabs/cose/key/aesmac           | Message Authentication Code (MAC) Algorithm: [AES-CBC-MAC](https://datatracker.ietf.org/doc/html/rfc9053#name-hash-based-message-authenti) |\n| [aesgcm](https://pkg.go.dev/github.com/ldclabs/cose/key/aesgcm)                     | github.com/ldclabs/cose/key/aesgcm           | Content Encryption Algorithm: [AES-GCM](https://datatracker.ietf.org/doc/html/rfc9053#name-aes-gcm)                                        |\n| [aesccm](https://pkg.go.dev/github.com/ldclabs/cose/key/aesccm)                     | github.com/ldclabs/cose/key/aesccm           | Content Encryption Algorithm: [AES-CCM](https://datatracker.ietf.org/doc/html/rfc9053#name-aes-ccm)                                        |\n| [chacha20poly1305](https://pkg.go.dev/github.com/ldclabs/cose/key/chacha20poly1305) | github.com/ldclabs/cose/key/chacha20poly1305 | Content Encryption Algorithm: [ChaCha20/Poly1305](https://datatracker.ietf.org/doc/html/rfc9053#name-chacha20-and-poly1305)                |\n| [hkdf](https://pkg.go.dev/github.com/ldclabs/cose/key/hkdf)                         | github.com/ldclabs/cose/key/hkdf             | Key Derivation Functions (KDFs) Algorithm: [HKDF](https://datatracker.ietf.org/doc/html/rfc9053#name-key-derivation-functions-kd)          |\n\n## Examples\n\n### Create a simple CWT with a signer\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/ldclabs/cose/cose\"\n\t\"github.com/ldclabs/cose/cwt\"\n\t\"github.com/ldclabs/cose/key/ed25519\"\n)\n\nfunc main() {\n\t// Create a ed25519 signer key\n\tprivKey, err := ed25519.GenerateKey()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsigner, err := privKey.Signer()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create a verifier key\n\tpubKey, err := ed25519.ToPublicKey(privKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tverifier, err := pubKey.Verifier()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create a claims set\n\tclaims := cwt.Claims{\n\t\tIssuer:     \"ldc:ca\",\n\t\tSubject:    \"ldc:chain\",\n\t\tAudience:   \"ldc:txpool\",\n\t\tExpiration: 1670123579,\n\t\tCWTID:      []byte{1, 2, 3, 4},\n\t}\n\n\t// sign with Sign1Message\n\tobj := cose.Sign1Message[cwt.Claims]{Payload: claims}\n\tcwtData, err := obj.SignAndEncode(signer, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// decode and verify the cwt\n\tobj2, err := cose.VerifySign1Message[cwt.Claims](verifier, cwtData, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// validate the cwt's claims\n\tvalidator, err := cwt.NewValidator(\u0026cwt.ValidatorOpts{\n\t\tExpectedIssuer:   \"ldc:ca\",\n\t\tExpectedAudience: \"ldc:txpool\",\n\t\tClockSkew:        time.Minute,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = validator.Validate(\u0026obj2.Payload)\n\tfmt.Printf(\"Validate Claims: %v\\n\", err)\n\t// Validate Claims: cose/cwt: Validator.Validate: token has expired\n\n\tcborData, err := key.MarshalCBOR(obj2.Payload)\n\t// cborData, err := cbor.Marshal(myClaims)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"CBOR(%d bytes): %x\\n\", len(cborData), cborData)\n\t// CBOR(44 bytes): a501666c64633a636102696c64633a636861696e036a6c64633a7478706f6f6c041a638c103b074401020304\n}\n```\n\n### Create a complex CWT with one more signers\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/ldclabs/cose/cose\"\n\t\"github.com/ldclabs/cose/cwt\"\n\t\"github.com/ldclabs/cose/iana\"\n\t\"github.com/ldclabs/cose/key\"\n\t\"github.com/ldclabs/cose/key/ecdsa\"\n\t\"github.com/ldclabs/cose/key/ed25519\"\n)\n\nfunc main() {\n\t// Create a ed25519 signer key\n\tprivKey1, err := ed25519.GenerateKey()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tprivKey2, err := ecdsa.GenerateKey(iana.AlgorithmES256)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tks := key.KeySet{privKey1, privKey2}\n\n\t// create a claims set\n\tclaims := cwt.ClaimsMap{\n\t\tiana.CWTClaimIss:   \"ldc:ca\",\n\t\tiana.CWTClaimSub:   \"ldc:chain\",\n\t\tiana.CWTClaimAud:   \"ldc:txpool\",\n\t\tiana.CWTClaimExp:   1670123579,\n\t\tiana.CWTClaimScope: \"read,write\",\n\t\t// and more claims...\n\t}\n\n\t// Sign the claims\n\tsigners, err := ks.Signers()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// sign with SignMessage\n\tobj := cose.SignMessage[cwt.ClaimsMap]{Payload: claims}\n\tcwtData, err := obj.SignAndEncode(signers, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// decode and verify the cwt\n\tverifiers, err := ks.Verifiers()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tobj2, err := cose.VerifySignMessage[cwt.ClaimsMap](verifiers, cwtData, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Validate the claims\n\tvalidator, err := cwt.NewValidator(\u0026cwt.ValidatorOpts{\n\t\tExpectedIssuer:   \"ldc:ca\",\n\t\tExpectedAudience: \"ldc:txpool\",\n\t\tClockSkew:        time.Minute,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = validator.ValidateMap(obj2.Payload)\n\tfmt.Printf(\"Validate Claims: %v\\n\", err)\n\t// Validate Claims: cose/cwt: Validator.Validate: token has expired\n\n\tcborData, err := key.MarshalCBOR(obj2.Payload)\n\t// cborData, err := cbor.Marshal(myClaims)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"CBOR(%d bytes): %x\\n\", len(cborData), cborData)\n\t// CBOR(50 bytes): a501666c64633a636102696c64633a636861696e036a6c64633a7478706f6f6c041a638c103b096a726561642c7772697465\n}\n```\n\n## Security Reviews\n\nTodo.\n\n## Reference\n\n1. [RFC9052: CBOR Object Signing and Encryption (COSE)][cose-spec]\n2. [RFC8392: CBOR Web Token (CWT)][cwt-spec]\n3. [RFC9053: CBOR Object Signing and Encryption (COSE): Initial Algorithms][algorithms-spec]\n4. [IANA: CBOR Object Signing and Encryption (COSE)][iana-cose]\n5. [IANA: CBOR Web Token (CWT) Claims][iana-cwt]\n6. [IANA: Concise Binary Object Representation (CBOR) Tags][iana-cbor-tags]\n\n\n[cbor]: https://datatracker.ietf.org/doc/html/rfc8949\n[cose-spec]: https://datatracker.ietf.org/doc/html/rfc9052\n[cwt-spec]: https://datatracker.ietf.org/doc/html/rfc8392\n[algorithms-spec]: https://datatracker.ietf.org/doc/html/rfc9053\n[iana-cose]: https://www.iana.org/assignments/cose/cose.xhtml\n[iana-cwt]: https://www.iana.org/assignments/cwt/cwt.xhtml\n[iana-cbor-tags]: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml\n\n## License\nCopyright © 2022-2024 [LDC Labs](https://github.com/ldclabs).\n\nldclabs/cose is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldclabs%2Fcose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fldclabs%2Fcose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fldclabs%2Fcose/lists"}