{"id":13763490,"url":"https://github.com/ShinoharaTa/nostr-key-value","last_synced_at":"2025-05-10T17:30:34.914Z","repository":{"id":183042833,"uuid":"669176369","full_name":"ShinoharaTa/nostr-key-value","owner":"ShinoharaTa","description":"Use nostr NIP-78 (kind: 30078) Key Value Storage","archived":false,"fork":false,"pushed_at":"2025-01-06T17:14:39.000Z","size":244,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T08:15:01.923Z","etag":null,"topics":["library","nostr"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nostr-key-value","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShinoharaTa.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}},"created_at":"2023-07-21T14:26:47.000Z","updated_at":"2025-01-31T12:19:13.000Z","dependencies_parsed_at":"2024-01-12T23:45:51.324Z","dependency_job_id":"4d6a12a9-70b2-48e5-a5dc-0f13d72c9e08","html_url":"https://github.com/ShinoharaTa/nostr-key-value","commit_stats":null,"previous_names":["shinoharata/nostr-key-value"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinoharaTa%2Fnostr-key-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinoharaTa%2Fnostr-key-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinoharaTa%2Fnostr-key-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShinoharaTa%2Fnostr-key-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShinoharaTa","download_url":"https://codeload.github.com/ShinoharaTa/nostr-key-value/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253453147,"owners_count":21911049,"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":["library","nostr"],"created_at":"2024-08-03T15:00:48.625Z","updated_at":"2025-05-10T17:30:34.904Z","avatar_url":"https://github.com/ShinoharaTa.png","language":"TypeScript","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Nostr-Key-Value\n\nNOTE: This README is translated by DeepL.\n\nThis is a project that wants to use Nostr as a Key-Value DB.\nJavaScript/TypeScript support.\n\n-\u003e[日本語のREADMEはこちら (to Japanese)](./README_jp.md)\n\nThis library uses NIP-78, which is a system that provides something like remoteStorage. NIP-78 is a system that provides something like remoteStorage; it is a post with Kind: 30078 and extends NIP-33 (Kind: 3xxxx).\n\n-\u003e [NIP-78](https://github.com/nostr-protocol/nips/blob/master/78.md)\n\n※ v0.3.x docs -\u003e [./docs/v0.3/README.md](./docs/v0.3/README.md)\n\n## Who made it\n\nShino3 (Shino-san) from:🇯🇵\n\n- GitHub: @ShinoharaTa (https://github.com/ShinoharaTa)\n- nostr: shino3 (https://nostx.io/_@shino3.net)\n- NIP-05: _@shino3.net\n- ⚡LN addr: shino3@walletofsatoshi.com\n\n## License\n\nMIT applies to this library.\n\n## Data configuration\n\nThis project is intended to be used to create KeyValue storage as follows.  \nThe content of the value can be anything, but it must be a string. For example, you can set up a JSON-format object, but it must be encoded as a string.\n\n- Author:\n  - Table 1\n    - Key: value\n    - Key: value\n    - Key: value\n  - Table 2\n    - Key: value\n    - Key: value\n    - Key: value\n  - Table 3\n    - Key: value\n    - Key: value\n    - Key: value\n\n## Installation\n\nYou can install it with the following command:\n\n```shell\nnpm install nostr-key-value\n```\n\n## How to use\n\nAfter installing via npm in your project, use the following code. Using initialize class.\n\n```typescript\nconst npub = process.env.NPUB_HEX ?? \"\";\nconst relays = [\"wss://nos.lol\"];\nconst nostrKeyValue: NostrKeyValue = new NostrKeyValue(\n  relays,\n  npub,\n  \"nostr_key_value_update_test\",\n);\n\nawait nostrKeyValue.setItem(\"item\", \"Hello!\");\nconst result_1 = await nostrKeyValue.getItem(\"item\");\nconsole.log(\"getValue: \", result_1);\n// \u003e Hello!\nawait nostrKeyValue.dropItem(\"item\", );\nconst result_2 = await nostrKeyValue.getItem(\"item\");\nconsole.log(\"getValue: \", result_2);\n// \u003e null\n```\n\n### `getItem`\n\nSearches a table from `kind: 30078` which Author has, and gets the specified key of the table.\n\n- Arguments\n  - key: string type (required)\n- Return value\n  - string type or Null\n  - If no match is found, the response will be null.\n\n### `setItem`\n\nThis function returns the JSON required to create a new table.  \nThe table creation is complete when the JSON is signed and submitted to the relay.\n\nPlease use nostr-tools or other tools to sign and submit the JSON. This library does not support it.\nNote: If an identical table already exists on the relay, it will be overwritten.\n\n- Arguments\n  - key: string (required)\n  - value: string | number | null (required)\n- Return values\n  - JSON object\n\nexample: `./tests/index.test.ts` see in create or update section.\n\n### `dropItem`\n\nThis function deletes the specified key in the table.\n\nPlease use nostr-tools or other tools to sign and send JSON; this is not supported by this library.\n`note` Please note that rollback is not available.\n\n- Arguments\n  - key: string (required)\n- Return value\n  - JSON object or null\n  - If there is no matching table, the response will be null.\n\nexample: `./tests/index.test.ts` in drop section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShinoharaTa%2Fnostr-key-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShinoharaTa%2Fnostr-key-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShinoharaTa%2Fnostr-key-value/lists"}