{"id":17366717,"url":"https://github.com/image357/password","last_synced_at":"2026-05-10T19:22:51.570Z","repository":{"id":257811859,"uuid":"865032378","full_name":"image357/password","owner":"image357","description":"This is a simple password manger (library) written in Go. You can use it with Go, REST calls and any other language that links with C.","archived":false,"fork":false,"pushed_at":"2025-03-18T21:27:05.000Z","size":206,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T22:27:59.320Z","etag":null,"topics":["c","cpp","encryption","go","golang","password","password-manager","password-store","rest","rest-api","restapi","restful","restful-api","restfulapi","simple"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/image357.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":"2024-09-29T20:00:29.000Z","updated_at":"2025-03-18T21:24:13.000Z","dependencies_parsed_at":"2024-10-06T05:24:50.504Z","dependency_job_id":"c5b192f9-5fa4-404f-a475-0831cb2f1c04","html_url":"https://github.com/image357/password","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"d1c236c630dc2ed17f9fc866ba4308110e35187e"},"previous_names":["image357/password","image357/simple-password-manager"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image357%2Fpassword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image357%2Fpassword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image357%2Fpassword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/image357%2Fpassword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/image357","download_url":"https://codeload.github.com/image357/password/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245898335,"owners_count":20690466,"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":["c","cpp","encryption","go","golang","password","password-manager","password-store","rest","rest-api","restapi","restful","restful-api","restfulapi","simple"],"created_at":"2024-10-15T22:04:31.110Z","updated_at":"2026-05-10T19:22:46.549Z","avatar_url":"https://github.com/image357.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Go workflow](https://github.com/image357/password/workflows/Go/badge.svg)\n![CMake workflow](https://github.com/image357/password/workflows/CMake/badge.svg)\n\n# simple-password-manager\n\nEver needed a simple key-value store with an encryption backend to handle your app passwords?\n\n**Look no further!** This is a simple password manger (library) written in Go.\nYou can use it with Go, REST calls and any other language that links with C.\n\nAnd the best of it all: **it's free** - BSD licensed - just don't sue me if you loose your passwords (no pun intended, ha!)\n\n\n## Setup / Build\n\n### Go\n\n`go mod tidy` automatically fetches the necessary dependencies when you add the import statement to your code (see also: [Go's module support](https://go.dev/wiki/Modules#how-to-use-modules)):\n```golang\nimport \"github.com/image357/password\"\n```\nAlternatively, use `go get` in your project to prefetch all dependencies:\n```shell\ngo get -u github.com/image357/password/...@latest\n```\n\n### C/C++\n\nYou can use `cmake` to build and install the C interface library:\n```shell\nmkdir build; cd build\ncmake -DCMAKE_INSTALL_PREFIX=/full/path/to/install/dir ..\ncmake --build .\ncmake --install .\n```\n\nThen, simply find the installed package in your `CMakeLists.txt`:\n```cmake\nfind_package(password)\nmessage(STATUS \"${password_DLL_FILE}\")\n\nadd_executable(main main.cpp)\ntarget_link_libraries(main PRIVATE password::cinterface)\n```\n\nOn Windows you will need MinGW to *build* the library.\nThis is because [cgo](https://go.dev/wiki/cgo) doesn't support any other compiler backend yet.\nOnce compiled, you can *use* the library with any compiler, though.\nYou can also have a look at the [release section](https://github.com/image357/password/releases) to see if there are any pre-built binaries for your platform.\n\n\n## Usage\n\n### Go\n```golang\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/image357/password\"\n    \"github.com/image357/password/log\"\n    \"github.com/image357/password/rest\"\n)\n\nfunc main() {\n    // create password with id\n    password.Overwrite(\"myid\", \"mypassword\", \"storage_key\")\n    \n    // get password with id\n    pwd, _ := password.Get(\"myid\", \"storage_key\")\n    fmt.Println(pwd)\n    \n    // start a multi password rest service on localhost:8080\n    rest.StartMultiService(\n        \":8080\", \"/prefix\", \"storage_key\",\n        func(string, string, string, string) bool { return true },\n    )\n    \n    // make logging more verbose\n    log.Level(log.LevelDebug)\n}\n```\n\n### C/C++:\n```cpp\n#include \u003cstdio.h\u003e\n#include \u003cpassword/cinterface.h\u003e\n\nbool callback(cchar_t *token, cchar_t *ip, cchar_t *resource, cchar_t *id) {\n    return true;\n}\n\nint main() {\n    // create password with id \n    CPWD__Overwrite(\"myid\", \"mypassword\", \"storage_key\");\n    \n    // get password with id\n    char buffer[256];\n    CPWD__Get(\"myid\", \"storage_key\", buffer, 256);\n    printf(\"%s\\n\", buffer);\n    \n    // start a multi password rest service on localhost:8080\n    CPWD__StartMultiService(\":8080\", \"/prefix\", \"storage_key\", callback);\n    \n    // make logging more verbose\n    CPWD__LogLevel(CPWD__LevelDebug);\n    \n    return 0;\n}\n```\n\n### Example Service\nThere is an example REST service, which you can use for testing.\nInstall it with:\n\n```shell\ngo install github.com/image357/password/cmd/exampleservice@latest\n```\n\nWarning: do not use this service for production use-cases.\nIt doesn't have any access control and the storage key hides in [plain sight](./cmd/exampleservice/main.go)!\n\n### REST\nWhen you have your REST service running (see above) you can make calls with, e.g., python\n```python\nimport requests\n\n# create password with id\nrequests.put(\"http://localhost:8080/prefix/overwrite\", json={\"id\": \"myid\", \"password\": \"mypassword\", \"accessToken\": \"some_token\"})\n\n# get password with id\nr = requests.get(\"http://localhost:8080/prefix/get\", json={\"id\": \"myid\", \"accessToken\": \"some_token\"})\nprint(r.content)\n\n# output: b'{\"password\":\"mypassword\"}'\n```\n\n\n# Details\n\n### API\nThe REST API mirrors the [Go](./docs/password.md) and [C\\C++](./docs/cinterface.md) interface.\nThis means that the signature is the same - with three exceptions:\n\n1. For REST, you need an `accessToken`. For `Go/C/C++` you need a `storage_key`.\n2. The C/C++ API accepts result pointers and returns status codes. The Go API directly returns values and errors.\n3. The [simple service](./docs/rest.md#StartSimpleService) does not require \"id\" properties and will not bind to `Clean` and `List` calls.\n\nHere is a full overview:\n\nOverwrite:\n```text\nGo:   -\u003e password.Overwrite(id string, password string, key string)\nC/C++ -\u003e CPWD__Overwrite(const char *id, const char *password, const char *key)\nREST: -\u003e (PUT) /prefix/overwrite\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n    \"password\": \"my_password\"\n}\n\nReturn: {}\n```\n\nGet:\n```text\nGo:   -\u003e password.Get(id string, key string)\nC/C++ -\u003e CPWD__Get(const char *id, const char *key, char *buffer, int length)\nREST: -\u003e (GET) /prefix/get\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n}\n\nReturn: {\"password\": \"stored_password\"}\n```\n\nCheck:\n```text\nGo:   -\u003e password.Get(id string, password string, key string)\nC/C++ -\u003e CPWD__Check(const char *id, const char *password, const char *key, bool *result)\nREST: -\u003e (GET) /prefix/check\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n    \"password\": \"password_to_check\"\n}\n\nReturn: {\"result\": true/false}\n```\n\nSet:\n```text\nGo:   -\u003e password.Set(id string, oldPassword string, newPassword string, key string)\nC/C++ -\u003e CPWD__Set(const char *id, const char *oldPassword, const char *newPassword, const char *key)\nREST: -\u003e (PUT) /prefix/set\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n    \"oldPassword\": \"password1\"\n    \"newPassword\": \"password2\"\n}\n\nReturn: {}\n```\n\nUnset:\n```text\nGo:   -\u003e password.Unset(id string, password string, key string)\nC/C++ -\u003e CPWD__Unset(const char *id, const char *password, const char *key)\nREST: -\u003e (DELETE) /prefix/unset\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n    \"password\": \"password_to_check\"\n}\n\nReturn: {}\n```\n\nExists:\n```text\nGo:   -\u003e password.Exists(id string)\nC/C++ -\u003e CPWD__Exists(const char *id, bool *result)\nREST: -\u003e (GET) /prefix/exists\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n}\n\nReturn: {\"result\": true/false}\n```\n\nList:\n```text\nGo:   -\u003e password.List()\nC/C++ -\u003e CPWD__List(char *buffer, int length, const char *delim)\nREST: -\u003e (GET) /prefix/list\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n}\n\nReturn: {\"ids\": [\"stored_id\", \"another_stored_id\", ...]}\n```\n\nDelete:\n```text\nGo:   -\u003e password.Delete(id string)\nC/C++ -\u003e CPWD__Delete(const char *id)\nREST: -\u003e (DELETE) /prefix/delete\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n    \"id\": \"my_id\"\n}\n\nReturn: {}\n```\n\nClean:\n```text\nGo:   -\u003e password.Clean()\nC/C++ -\u003e CPWD__Clean()\nREST: -\u003e (DELETE) /prefix/clean\n\nExample JSON for REST request:\n{\n    \"accessToken\": \"my_token\"\n}\n\nReturn: {}\n```\n\n### Storage\nFiles and folders - it's that simple.\nTo make the storage backend cross-platform compatible, ids have the following constraints:\n\n1. Forward- and backward-slashes are treated as the same character.\n2. Upper- and lower-case characters are treated as the same character.\n\nYou can also switch to temporary (in-memory) storage or serialize to JSON (see below for full docs).\n\n### Encryption\nYes, the usual - AES256, hashed secrets, etc.\nFor more info have a look at the [source code](./encryption.go).\n\n### Documentation\nFor full documentation see: [docs](./docs/README.md)\n\nThere are some additional convenience functions in Go and C/C++ that control\nstorage path, logging, recovery mode and changing storage keys.\nAdditionally, you can just explore the source code with any godoc compatible IDE.\n\nCheck it out!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimage357%2Fpassword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimage357%2Fpassword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimage357%2Fpassword/lists"}