{"id":13499748,"url":"https://github.com/GeertJohan/yubigo","last_synced_at":"2025-03-29T05:32:15.272Z","repository":{"id":5014035,"uuid":"6172548","full_name":"GeertJohan/yubigo","owner":"GeertJohan","description":"  Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubico Yubikey into your existing Go-based user authentication infrastructure.","archived":false,"fork":false,"pushed_at":"2019-09-17T12:24:37.000Z","size":43,"stargazers_count":125,"open_issues_count":2,"forks_count":17,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-02-20T13:32:49.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jceipek/Live-Phoenix","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeertJohan.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}},"created_at":"2012-10-11T11:03:55.000Z","updated_at":"2023-11-18T19:34:35.000Z","dependencies_parsed_at":"2022-09-21T07:49:18.343Z","dependency_job_id":null,"html_url":"https://github.com/GeertJohan/yubigo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeertJohan%2Fyubigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeertJohan%2Fyubigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeertJohan%2Fyubigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeertJohan%2Fyubigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeertJohan","download_url":"https://codeload.github.com/GeertJohan/yubigo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145012,"owners_count":20730494,"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":[],"created_at":"2024-07-31T22:00:40.606Z","updated_at":"2025-03-29T05:32:15.021Z","avatar_url":"https://github.com/GeertJohan.png","language":"Go","funding_links":[],"categories":["Authentication \u0026 OAuth","Libraries / Clients","Authentication and OAuth","身份验证和OAuth","\u003cspan id=\"身份验证和oauth-authentication-and-auth\"\u003e身份验证和OAuth Authentication and Auth\u003c/span\u003e"],"sub_categories":["Third-party Tools"],"readme":"\n## yubigo\n\nYubigo is a Yubikey client API library that provides an easy way to integrate the Yubikey into any Go application.\n\n## Installation\n\nInstallation is simple. Use go get:\n`go get github.com/GeertJohan/yubigo`\n\n## Usage\n\nMake sure to import the library: `import \"github.com/GeertJohan/yubigo\"`\n\nFor use with the default Yubico servers, make sure you have an API key. [Request a key][getapikey].\n\n**Basic OTP checking usage:**\n```go\n\n// create a new yubiAuth instance with id and key\nyubiAuth, err := yubigo.NewYubiAuth(\"1234\", \"fdsaffqaf4vrc2q3cds=\")\nif err != nil {\n\t// probably an invalid key was given\n\tlog.Fatalln(err)\n}\n\n// verify an OTP string\nresult, ok, err := yubiAuth.Verify(\"ccccccbetgjevivbklihljgtbenbfrefccveiglnjfbc\")\nif err != nil {\n\tlog.Fatalln(err)\n}\n\nif ok {\n\t// succes!! The OTP is valid!\n\tlog.Printf(\"Used query was: %s\\n\", result.GetRequestQuery()) // this query string includes the url of the api-server that responded first.\n} else {\n\t// fail! The OTP is invalid or has been used before.\n\tlog.Println(\"The given OTP is invalid!!!\")\n}\n```\n\n**Use your own HTTP Client with fine-tuned config:**\nWhile the library works out of the box, it's not recommended to use the default http client.\nIt is better to configure your own http client with useful timeouts.\n\nFor example:\n```go\nyubigo.HTTPClient = \u0026http.Client{\n    Timeout: time.Second * 15,\n    Transport: \u0026http.Transport{\n        MaxConnsPerHost:     20,\n        MaxIdleConnsPerHost: 5,\n        DialContext: (\u0026net.Dialer{\n            Timeout:   30 * time.Second,\n            KeepAlive: 60 * time.Second,\n        }).DialContext,\n        TLSHandshakeTimeout:   10 * time.Second,\n        ResponseHeaderTimeout: 10 * time.Second,\n        ExpectContinueTimeout: 1 * time.Second,\n    },\n}\n```\n\n**Do not verify HTTPS certificate:**\n```go\n// Disable HTTPS cert verification. Use true to enable again.\nyubiAuth.HttpsVerifyCertificate(false)\n```\n\n\n**HTTP instead of HTTPS:**\n```go\n// Disable HTTPS. Use true to enable again.\nyubiAuth.UseHttps(false)\n```\n\n\n**Custom API server:**\n```go\n// Set a list of n servers, each server as host + path. \n// Do not prepend with protocol\nyubiAuth.SetApiServerList(\"api0.server.com/api/verify\", \"api1.server.com/api/verify\", \"otherserver.com/api/verify\")\n```\n\n## Licence\n\nThis project is licensed under a Simplified BSD license. Please read the [LICENSE file][license].\n\n\n## Todo\n - Test files\n - More documentation\n - Getters/Setters for some options on the YubiAuth object.\n\n## Protocol \u0026 Package documentation\n\nThis project is implementing a pure-Go Yubico OTP Validation Client and is following the [Yubico Validation Protocol Version 2.0][validationProtocolV20].\n\nYou will find \"go doc\"-like [package documentation at go.pkgdoc.org][pkgdoc].\n\n\n [license]: https://github.com/GeertJohan/yubigo/blob/master/LICENSE\n [getapikey]: https://upgrade.yubico.com/getapikey/\n [pkgdoc]: http://go.pkgdoc.org/github.com/GeertJohan/yubigo\n [validationProtocolV20]: http://code.google.com/p/yubikey-val-server-php/wiki/ValidationProtocolV20","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeertJohan%2Fyubigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGeertJohan%2Fyubigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeertJohan%2Fyubigo/lists"}