{"id":29916266,"url":"https://github.com/ibeizhu/react-secure-state","last_synced_at":"2026-03-11T10:02:31.853Z","repository":{"id":304594437,"uuid":"1019245740","full_name":"ibeizhu/react-secure-state","owner":"ibeizhu","description":"React Secure State","archived":false,"fork":false,"pushed_at":"2025-10-23T07:28:31.000Z","size":5140,"stargazers_count":171,"open_issues_count":0,"forks_count":7,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-10-25T21:43:44.998Z","etag":null,"topics":["access-control","privilege","react","react-context","react-secure-state","secure","state-management","store"],"latest_commit_sha":null,"homepage":"https://ibeizhu.github.io/react-secure-state/","language":"TypeScript","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/ibeizhu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2025-07-14T03:18:46.000Z","updated_at":"2025-10-23T07:24:15.000Z","dependencies_parsed_at":"2025-07-14T06:10:00.444Z","dependency_job_id":"8b40f466-73b7-4308-800f-7e15d51711cd","html_url":"https://github.com/ibeizhu/react-secure-state","commit_stats":null,"previous_names":["ibeizhu/react-secure-state"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ibeizhu/react-secure-state","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibeizhu%2Freact-secure-state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibeizhu%2Freact-secure-state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibeizhu%2Freact-secure-state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibeizhu%2Freact-secure-state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibeizhu","download_url":"https://codeload.github.com/ibeizhu/react-secure-state/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibeizhu%2Freact-secure-state/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30377837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["access-control","privilege","react","react-context","react-secure-state","secure","state-management","store"],"created_at":"2025-08-02T04:43:12.861Z","updated_at":"2026-03-11T10:02:31.828Z","avatar_url":"https://github.com/ibeizhu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-secure-state\n\n[![NPM version](https://img.shields.io/npm/v/react-secure-state.svg?style=flat)](https://npmjs.org/package/react-secure-state)\n[![NPM downloads](http://img.shields.io/npm/dm/react-secure-state.svg?style=flat)](https://npmjs.org/package/react-secure-state)\n\nA secure and reliable state management tool with fine-grained permission control and ultimate rendering performance.\n\nFeatures:\n\n- 💎 Store: State Management Framework\n- 🛡️ Secure: Field-level Access Control\n- 🚀 Extreme Performance: Support point-to-point rendering for store data updates\n- 📝 Typed: Powerful Type Inference\n- 🚀 Lightweight: Zero Dependencies\n\n[中文文档](https://ibeizhu.github.io/react-secure-state)\n\n[English Document](https://ibeizhu.github.io/react-secure-state/en-US)\n\n## Installation\n\n```\nnpm i react-secure-state -S\n```\n\n## Usage\n\n`react-secure-state` is designed to strictly control store data read and write permissions. Developers can explicitly declare and request read or write access to specific fields. If a field is not included in the declared permissions, modifications will not be permitted.\n\n### createStore\n\n`./store.tsx`\n\n```tsx | pure\nimport { createStore } from 'react-secure-state';\n\nexport interface StoreType {\n  name: string;\n  height: number;\n}\n\nconst { StoreProvider, useStoreValues } = createStore\u003cStoreType\u003e();\n\nexport { StoreProvider, useStoreValues };\n```\n\n### initialize store\n\n`./App.tsx`\n\n```tsx | pure\nimport { StoreProvider } from './store';\nimport { Child1, Child2 } from './Child';\n\nfunction App() {\n  const data = {\n    name: 'Bob',\n    height: 180,\n  };\n  return (\n    \u003cStoreProvider initialValue={data}\u003e\n      \u003cChild1 /\u003e\n      \u003cChild2 /\u003e\n    \u003c/StoreProvider\u003e\n  );\n}\n```\n\n### use store value\n\n`./Child.tsx`\n\n```tsx | pure\nimport { useStoreValues } from './store';\n\nexport function Child1() {\n  // apply field `name` read \u0026 write permission\n  // note: `setFieldValue` can only update field `name`, has no permission to update other fields\n  const [values, { setFieldValue }] = useStoreValues(['name']);\n\n  console.log(data);\n  // data = { name }\n\n  const handleClick = () =\u003e {\n    // has no permission to update other fields\n    setFieldValue('name', 'James');\n  };\n\n  return (\n    \u003cdiv\u003e\n      {data.name}\n      \u003cbutton onClick={handleClick}\u003eupdate name\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport function Child2() {\n  // apply field `height` read \u0026 write permission\n  // note: `setFieldValue` can only update field `height`, has no permission to update other fields\n  const [values, { setFieldValue }] = useStoreValues(['height']);\n\n  console.log(data);\n  // data = { height }\n\n  const handleClick = () =\u003e {\n    // has no permission to update other fields\n    setFieldValue('height', 110);\n  };\n\n  return (\n    \u003cdiv\u003e\n      {data.height}\n      \u003cbutton onClick={handleClick}\u003eupdate height\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibeizhu%2Freact-secure-state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibeizhu%2Freact-secure-state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibeizhu%2Freact-secure-state/lists"}