{"id":26221531,"url":"https://github.com/adrianosela/authio","last_synced_at":"2025-08-21T07:13:48.756Z","repository":{"id":65145951,"uuid":"583163709","full_name":"adrianosela/authio","owner":"adrianosela","description":"Authenticated message implementations of io.Reader and io.Writer","archived":false,"fork":false,"pushed_at":"2023-01-03T02:47:17.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T16:22:38.273Z","etag":null,"topics":["auth","authentication","golang","hmac","io","message-authentication-code","sha256"],"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/adrianosela.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":"2022-12-29T00:39:35.000Z","updated_at":"2023-02-27T19:58:59.000Z","dependencies_parsed_at":"2023-02-01T05:00:44.606Z","dependency_job_id":null,"html_url":"https://github.com/adrianosela/authio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adrianosela/authio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianosela%2Fauthio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianosela%2Fauthio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianosela%2Fauthio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianosela%2Fauthio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianosela","download_url":"https://codeload.github.com/adrianosela/authio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianosela%2Fauthio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271441954,"owners_count":24760350,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["auth","authentication","golang","hmac","io","message-authentication-code","sha256"],"created_at":"2025-03-12T16:20:50.008Z","updated_at":"2025-08-21T07:13:48.735Z","avatar_url":"https://github.com/adrianosela.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# authio\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/adrianosela/authio)](https://goreportcard.com/report/github.com/adrianosela/authio)\n[![Documentation](https://godoc.org/github.com/adrianosela/authio?status.svg)](https://godoc.org/github.com/adrianosela/authio)\n[![GitHub issues](https://img.shields.io/github/issues/adrianosela/authio.svg)](https://github.com/adrianosela/authio/issues)\n[![license](https://img.shields.io/github/license/adrianosela/authio.svg)](https://github.com/adrianosela/authio/blob/master/LICENSE)\n\nAuthenticated message implementations of io.Reader and io.Writer\n\n### Summary\n\n- `authio.AppendMACWriter`: computes and appends MACs on every message written\n- `authio.VerifyMACReader`: verifies and removes MACs from every message read\n- `authio.AppendMACReader`: computes and appends MACs on every message read\n- `authio.VerifyMACWriter`: verifies and removes MACs from every message written\n\nNote that `authio.Writer` and `authio.Reader` are aliases for other types in this package. Under the hood they point to `authio.AppendMACWriter` and `authio.VerifyMACReader` respectively, which are considered \"default\" because they will be used in the vast majority of scenarios.\n\n### Road Map\n\n- Timestamp/SequenceNum/Nonces i.e. replay attack mitigation\n- Need to account for case where buffer given to Read(buf) is too small to fit all the data read from underlying io.Reader\n   - e.g. keep a buffer of already-verified bytes in-memory and copy those bytes first on the next Read(buf)\n- Unit tests for all functions\n- Better naming convention\n- Better message authentication (e.g. hash algo, size, etc) parameter setting on reader/writer building\n- Support asymmetric signing algorithms\n- Support OpenPGP / PGP key server integration\n\n### Usage\n\n- `authio.AppendMACWriter`: computes and appends MACs on every message written\n\n\u003e common use case: adding MACs to data written to a net.Conn\n\n```\n// initialize new writer\nauthedWriter := authio.NewAppendMACWriter(conn, []byte(\"mysupersecretpassword\"))\n\n// writing an (unauthenticated) message results in an MAC being prepended\n// to the message before getting written to the underlying io.Writer\nn, err := authedWriter.Write(message)\n\n// ...\n```\n\n- `authio.VerifyMACReader`: verifies and removes MACs from every message read\n\n\u003e common use case: verifying MAC on authenticated messages received over a net.Conn\n\n```\n// initialize new authenticated reader\nauthedReader := authio.NewVerifyMACReader(conn, []byte(\"mysupersecretpassword\"))\n\n// reading results in an (authenticated) message being read from the\n// underlying io.Reader. The MAC on the message is verified and removed\n// before the raw message is loaded onto the given buffer\nauthedWriter.Read(buffer)\n\n// ...\n```\n\n- `authio.AppendMACReader`: computes and appends MACs on every message read\n\n\u003e common use case: adding MACs to data read from stdin\n\n```\n// initialize new authenticated reader\nauthedReader := authio.NewAppendMACReader(os.Stdin, []byte(\"mysupersecretpassword\"))\n\n// reading results in an (unauthenticated) message being read from the\n// underlying io.Reader. An MAC is computed and prepended with every\n// message read.\nauthedWriter.Read(buffer)\n\n// ...\n```\n\n- `authio.VerifyMACWriter`: verifies and removes MACs from every message written\n\n\u003e common use case: verifying MAC on authenticated messages before writing raw message to stdout\n \n```\n// initialize new writer\nauthedWriter := authio.NewVerifyMACWriter(os.Stdout, []byte(\"mysupersecretpassword\"))\n\n// writing an (authenticated) message results in the MAC being verified and\n// removed before writing the raw message to the underlying io.Writer \nn, err := authedWriter.Write(message)\n\n// ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianosela%2Fauthio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianosela%2Fauthio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianosela%2Fauthio/lists"}