{"id":13703152,"url":"https://github.com/keys-pub/go-libfido2","last_synced_at":"2026-01-16T15:58:18.272Z","repository":{"id":42653935,"uuid":"257129124","full_name":"keys-pub/go-libfido2","owner":"keys-pub","description":"libfido2 bindings for golang","archived":false,"fork":false,"pushed_at":"2025-01-04T23:31:41.000Z","size":5299,"stargazers_count":72,"open_issues_count":5,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T00:22:11.960Z","etag":null,"topics":["fido2","fido2-authenticator","golang","libfido2","webauthn"],"latest_commit_sha":null,"homepage":"https://keys.pub","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keys-pub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["gabriel","keys-pub"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-20T00:10:13.000Z","updated_at":"2025-01-04T23:31:46.000Z","dependencies_parsed_at":"2024-01-25T04:47:42.905Z","dependency_job_id":"be5860e6-2424-43f2-8a76-bb4cd4fa1743","html_url":"https://github.com/keys-pub/go-libfido2","commit_stats":null,"previous_names":["keys-pub/go-fido2"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keys-pub%2Fgo-libfido2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keys-pub%2Fgo-libfido2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keys-pub%2Fgo-libfido2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keys-pub%2Fgo-libfido2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keys-pub","download_url":"https://codeload.github.com/keys-pub/go-libfido2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252458325,"owners_count":21751017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["fido2","fido2-authenticator","golang","libfido2","webauthn"],"created_at":"2024-08-02T21:00:51.104Z","updated_at":"2026-01-16T15:58:18.257Z","avatar_url":"https://github.com/keys-pub.png","language":"C","funding_links":["https://github.com/sponsors/gabriel","https://github.com/sponsors/keys-pub"],"categories":["Client Libraries"],"sub_categories":[],"readme":"# go-libfido2\n\nGo wrapper for libfido2.\n\n```go\nimport (\n    \"github.com/keys-pub/go-libfido2\"\n)\n\nfunc ExampleDevice_Assertion() {\n    locs, err := libfido2.DeviceLocations()\n    if err != nil {\n        log.Fatal(err)\n    }\n    if len(locs) == 0 {\n        log.Println(\"No devices\")\n        return\n    }\n\n    log.Printf(\"Using device: %+v\\n\", locs[0])\n    path := locs[0].Path\n    device, err := libfido2.NewDevice(path)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    cdh := libfido2.RandBytes(32)\n    userID := libfido2.RandBytes(32)\n    salt := libfido2.RandBytes(32)\n    pin := \"12345\"\n\n    attest, err := device.MakeCredential(\n        cdh,\n        libfido2.RelyingParty{\n            ID: \"keys.pub\",\n        },\n        libfido2.User{\n            ID:   userID,\n            Name: \"gabriel\",\n        },\n        libfido2.ES256, // Algorithm\n        pin,\n        \u0026libfido2.MakeCredentialOpts{\n            Extensions: []libfido2.Extension{libfido2.HMACSecretExtension},\n        },\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    log.Printf(\"Attestation:\\n\")\n    log.Printf(\"AuthData: %s\\n\", hex.EncodeToString(attest.AuthData))\n    log.Printf(\"ClientDataHash: %s\\n\", hex.EncodeToString(attest.ClientDataHash))\n    log.Printf(\"ID: %s\\n\", hex.EncodeToString(attest.CredentialID))\n    log.Printf(\"Type: %s\\n\", attest.CredentialType)\n    log.Printf(\"Sig: %s\\n\", hex.EncodeToString(attest.Sig))\n\n    assertion, err := device.Assertion(\n        \"keys.pub\",\n        cdh,\n        [][]byte{attest.CredentialID},\n        pin,\n        \u0026libfido2.AssertionOpts{\n            Extensions: []libfido2.Extension{libfido2.HMACSecretExtension},\n            HMACSalt:   salt,\n        },\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    log.Printf(\"Assertion:\\n\")\n    log.Printf(\"%s\\n\", hex.EncodeToString(assertion.AuthData))\n    log.Printf(\"%s\\n\", hex.EncodeToString(assertion.HMACSecret))\n    log.Printf(\"%s\\n\", hex.EncodeToString(assertion.Sig))\n\n    // Output:\n    //\n}\n```\n\n## Examples\n\nThe examples require a device.\n\nTo run an example, set FIDO2_EXAMPLES=1.\n\n```shell\nFIDO2_EXAMPLES=1 go test -v -run ExampleDeviceLocations\nFIDO2_EXAMPLES=1 go test -v -run ExampleDevice_Assertion\nFIDO2_EXAMPLES=1 go test -v -run ExampleDevice_Credentials\nFIDO2_EXAMPLES=1 go test -v -run ExampleDevice_BioList\n```\n\n## Dependencies\n\n### Linux\n\n```shell\nsudo apt install software-properties-common\nsudo apt-add-repository ppa:yubico/stable\nsudo apt update\nsudo apt install libfido2-dev\n```\n\n### macOS\n\n```shell\nbrew install libfido2\n```\n\n### Windows\n\n```shell\nscoop bucket add keys.pub https://github.com/keys-pub/scoop-bucket\nscoop install libfido2\n```\n\n\n### Building libfido2\n\n#### macOS\n\n```shell\nexport CFLAGS=\"-I/usr/local/include -I/usr/local/opt/openssl@1.1/include\"\nexport LDFLAGS=\"-L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib/\"\n(rm -rf build \u0026\u0026 mkdir build \u0026\u0026 cd build \u0026\u0026 cmake ..) \u0026\u0026 make -C build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeys-pub%2Fgo-libfido2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeys-pub%2Fgo-libfido2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeys-pub%2Fgo-libfido2/lists"}