{"id":23605739,"url":"https://github.com/rishabhv471/shield-storage","last_synced_at":"2026-05-03T01:44:41.727Z","repository":{"id":269321403,"uuid":"906696531","full_name":"rishabhv471/shield-storage","owner":"rishabhv471","description":"shield-storage is a lightweight JavaScript library that helps secure browser storage.","archived":false,"fork":false,"pushed_at":"2024-12-22T17:26:01.000Z","size":5389,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-22T18:27:26.296Z","etag":null,"topics":["development","localstorage","npm","npm-package","secure-storage","security","sessionstorage"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/shield-storage","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/rishabhv471.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-21T16:31:21.000Z","updated_at":"2024-12-22T17:35:29.000Z","dependencies_parsed_at":"2024-12-22T18:28:18.481Z","dependency_job_id":"17c50bfd-2858-487a-bcbe-8247f242ae03","html_url":"https://github.com/rishabhv471/shield-storage","commit_stats":null,"previous_names":["rishabhv471/shield-storage"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishabhv471%2Fshield-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishabhv471%2Fshield-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishabhv471%2Fshield-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishabhv471%2Fshield-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rishabhv471","download_url":"https://codeload.github.com/rishabhv471/shield-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239458912,"owners_count":19642099,"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":["development","localstorage","npm","npm-package","secure-storage","security","sessionstorage"],"created_at":"2024-12-27T13:12:50.074Z","updated_at":"2025-11-05T12:30:26.587Z","avatar_url":"https://github.com/rishabhv471.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shield Storage\n\n`shield-storage` is a lightweight JavaScript library that helps secure browser storage (`localStorage` and `sessionStorage`) with AES encryption. This library ensures sensitive data is encrypted before being stored in the browser and decrypted when retrieved. It's ideal for web applications that need to store user-related data securely in the browser.\n\n## Features\n\n- Encrypts data before storing it in `sessionStorage` or `localStorage`.\n- Decrypts stored data when retrieved from storage.\n- Supports AES encryption for high security.\n- Simple API for easy integration.\n- Works in modern browsers.\n\n## Installation\n\nYou can install the library via npm:\n\n```bash\nnpm install shield-storage\n```\n\n\nAlternatively, you can add it via yarn:\n\n```bash\nyarn add shield-storage\n```\nUsage\n\nEncrypt and store data\nTo store encrypted data in sessionStorage or localStorage, you can use the setItem method. It automatically encrypts the data before saving it.\n```bash\nimport { setItem } from 'shield-storage';\n\n// Example data to store\nconst userData = { username: \"testUser\", role: \"admin\" };\n\n// Encrypt and store the data in sessionStorage\nsetItem('userData', userData);\n```\n\nRetrieve and decrypt data\nTo retrieve the stored data and decrypt it, use the getItem method.\n```bash\nimport { getItem } from 'shield-storage';\n\n// Retrieve and decrypt the data\nconst decryptedData = getItem('userData');\nconsole.log(decryptedData); // { username: \"testUser\", role: \"admin\" }\n```\n\nRemove data\nTo remove data from sessionStorage or localStorage, use the removeItem method:\n\n```bash\nimport { removeItem } from 'shield-storage';\n\n// Remove the item from storage\nremoveItem('userData');\n\nClear all data\nTo clear all items from sessionStorage or localStorage, use the clear method:\n\nimport { clear } from 'shield-storage';\n\n// Clear all items from storage\nclear();\n```\n\n## Methods\nsetItem(key, value): Encrypts the value and stores it under the key in sessionStorage.\ngetItem(key): Retrieves the encrypted value from sessionStorage, decrypts it, and returns the original value.\nremoveItem(key): Removes the item with the specified key from sessionStorage.\nclear(): Clears all items stored in sessionStorage.\n\n## Encryption\nThis library uses AES encryption for securing the stored data. The encryption key (SECRET_KEY) should ideally be retrieved from an environment variable or a secure configuration file. In this example, the default encryption key is hardcoded (this should be updated for production).\n\n## Security\nWhile the data is encrypted before being stored, it is essential to remember that client-side encryption alone does not fully protect against all security threats. It’s important to combine this with server-side security measures such as HTTPS and secure authentication.\n\n## Contributing\nWe welcome contributions! If you'd like to improve this library or add new features, feel free to open a pull request.\n\n## Steps to contribute:\nFork the repository.\nClone your fork and create a new branch for your changes.\nMake your changes and run tests.\nOpen a pull request.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishabhv471%2Fshield-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishabhv471%2Fshield-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishabhv471%2Fshield-storage/lists"}