{"id":15497490,"url":"https://github.com/heapwolf/level-users","last_synced_at":"2025-04-22T22:14:38.433Z","repository":{"id":10030201,"uuid":"12072545","full_name":"heapwolf/level-users","owner":"heapwolf","description":"Store and get users, salt their passwords, persist them to disk, etc.","archived":false,"fork":false,"pushed_at":"2015-03-30T19:07:05.000Z","size":165,"stargazers_count":38,"open_issues_count":0,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-22T22:14:32.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heapwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-13T03:43:17.000Z","updated_at":"2024-07-08T20:36:18.000Z","dependencies_parsed_at":"2022-08-17T15:31:21.851Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/level-users","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/heapwolf%2Flevel-users","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Flevel-users/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Flevel-users/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Flevel-users/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/level-users/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250331823,"owners_count":21413103,"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-10-02T08:38:38.158Z","updated_at":"2025-04-22T22:14:38.375Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SYNOPSIS\nStore and get users. Salt their passwords, persist them to disk.\n\n# USAGE\nPass a leveldb instance to the `Users` constructor. I recommend using\n[`sublevel`][0] to bucket your database's meta data and [`multilevel`][1]\nif your database is on the network. See [`level-user`][2] for client side\nsupport.\n\n```js\nvar db = level('./db')\nvar users = Users(db)\n```\n\n# API\n\n### `create`\nCreate a new user by passing a user object. Only `username` is required.\nWhen a new user is created, a uuid is returned.\n\n```js\nvar user = {\n  username: 'test',\n  password: 'pass',\n  foo: 100,\n  email: 'test@tap.com'\n}\n\nusers.create(user, function(err, id) {\n  // id =\u003e 'a3a1d270-75fe-4bfc-a2bc-e358903bc540'\n})\n```\n\n### `remove`\nRemoves a user and any indexs that have been created for their records\n\n```js\nusers.remove(id, function(err) {\n})\n```\n\n### `addIndexes`\nAdd indexes that can be used to `get` a user. You can use any arbitrary \nfield that is in your user object. In this example we index on `email`.\n\n```js\nusers.addIndexes(['email'], function(err) {\n})\n```\n\n### `get`\nGet a user by their uuid. Returns the user object and a put method that\ncan be used to update the user data.\n\n```js\nusers.get(id, function(err, user, put) {\n})\n```\n\nHere's an example using an index. returns the user's id.\n\n```js\nusers.get({ email: 'test@tap.com' }, function(err, id) {\n})\n```\n\n### `auth`\nFind out if the proposed password matches with the a salt stored for a \ngiven user id. If auth is successful, you get a the user object and\na put function so that you can write some new user information. If the\nauth fails, the `user` object will be null.\n\n```js\nusers.auth(id, password, function(err, user, put) {\n  user.isCool = true\n  put(user, function(err) {\n    // ...\n  })\n})\n```\n\n### `addGroups`\nAdd groups to a user, this is just sugar for array index checking.\n\n```js\nusers.addGroups(id, ['super','rooty'], function(err, user, put) {\n})\n```\n\n### `removeGroups`\nRemove groups from a user, also just sugar for array index checking.\n\n```js\nusers.removeGroups(id, ['rooty'], function(err, user, put) {\n})\n```\n\n[0]:https://github.com/dominictarr/level-sublevel\n[1]:https://github.com/juliangruber/multilevel\n[2]:https://github.com/maxogden/level-user\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Flevel-users","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Flevel-users","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Flevel-users/lists"}