{"id":15570355,"url":"https://github.com/danieljoos/wincred","last_synced_at":"2025-05-16T07:05:47.326Z","repository":{"id":18488237,"uuid":"21683884","full_name":"danieljoos/wincred","owner":"danieljoos","description":"Go wrapper around the Windows Credential Manager API functions","archived":false,"fork":false,"pushed_at":"2024-10-07T08:52:25.000Z","size":56,"stargazers_count":130,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T19:06:00.835Z","etag":null,"topics":["credential-storage","credentials","go","golang","windows"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gorgonia/gorgonia","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danieljoos.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}},"created_at":"2014-07-10T07:14:21.000Z","updated_at":"2025-03-17T03:38:30.000Z","dependencies_parsed_at":"2024-02-12T10:48:41.195Z","dependency_job_id":"410b5f28-8d8f-44e7-b872-f964a01209f4","html_url":"https://github.com/danieljoos/wincred","commit_stats":{"total_commits":71,"total_committers":8,"mean_commits":8.875,"dds":0.5774647887323944,"last_synced_commit":"28dd5b4a5c520aab6b6e5cd76ff0403d56138d5b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieljoos%2Fwincred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieljoos%2Fwincred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieljoos%2Fwincred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieljoos%2Fwincred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danieljoos","download_url":"https://codeload.github.com/danieljoos/wincred/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485062,"owners_count":22078767,"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":["credential-storage","credentials","go","golang","windows"],"created_at":"2024-10-02T17:42:04.182Z","updated_at":"2025-05-16T07:05:44.207Z","avatar_url":"https://github.com/danieljoos.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"wincred\n=======\n\nGo wrapper around the Windows Credential Manager API functions.\n\n[![GitHub release](https://img.shields.io/github/release/danieljoos/wincred.svg?style=flat-square)](https://github.com/danieljoos/wincred/releases/latest)\n[![Test Status](https://img.shields.io/github/actions/workflow/status/danieljoos/wincred/test.yml?label=test\u0026logo=github\u0026style=flat-square)](https://github.com/danieljoos/wincred/actions?query=workflow%3Atest)\n[![Go Report Card](https://goreportcard.com/badge/github.com/danieljoos/wincred)](https://goreportcard.com/report/github.com/danieljoos/wincred)\n[![Codecov](https://img.shields.io/codecov/c/github/danieljoos/wincred?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/danieljoos/wincred)\n[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/danieljoos/wincred)\n\nInstallation\n------------\n\n```Go\ngo get github.com/danieljoos/wincred\n```\n\n\nUsage\n-----\n\nSee the following examples:\n\n### Create and store a new generic credential object\n```Go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/danieljoos/wincred\"\n)\n\nfunc main() {\n    cred := wincred.NewGenericCredential(\"myGoApplication\")\n    cred.CredentialBlob = []byte(\"my secret\")\n    err := cred.Write()\n    \n    if err != nil {\n        fmt.Println(err)\n    }\n} \n```\n\n### Retrieve a credential object\n```Go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/danieljoos/wincred\"\n)\n\nfunc main() {\n    cred, err := wincred.GetGenericCredential(\"myGoApplication\")\n    if err == nil {\n        fmt.Println(string(cred.CredentialBlob))\n    }\n} \n```\n\n### Remove a credential object\n```Go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/danieljoos/wincred\"\n)\n\nfunc main() {\n    cred, err := wincred.GetGenericCredential(\"myGoApplication\")\n    if err != nil {\n        fmt.Println(err)\n        return\n    }\n    cred.Delete()\n} \n```\n\n### List all available credentials\n```Go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/danieljoos/wincred\"\n)\n\nfunc main() {\n    creds, err := wincred.List()\n    if err != nil {\n        fmt.Println(err)\n        return\n    }\n    for i := range(creds) {\n        fmt.Println(creds[i].TargetName)\n    }\n}\n```\n\nHints\n-----\n\n### Encoding\n\nThe credential objects simply store byte arrays without specific meaning or encoding.\nFor sharing between different applications, it might make sense to apply an explicit string encoding - for example **UTF-16 LE** (used nearly everywhere in the Win32 API).\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/danieljoos/wincred\"\n\t\"golang.org/x/text/encoding/unicode\"\n\t\"golang.org/x/text/transform\"\n)\n\nfunc main() {\n\tcred := wincred.NewGenericCredential(\"myGoApplication\")\n\n\tencoder := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder()\n\tblob, _, err := transform.Bytes(encoder, []byte(\"mysecret\"))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tcred.CredentialBlob = blob\n\terr = cred.Write()\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}\n\n```\n\n### Limitations\n\nThe size of a credential blob is limited to **2560 Bytes** by the Windows API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieljoos%2Fwincred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanieljoos%2Fwincred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieljoos%2Fwincred/lists"}