{"id":14973481,"url":"https://github.com/nour-karoui/encrypt-storage","last_synced_at":"2025-10-27T01:30:36.111Z","repository":{"id":54196590,"uuid":"344071414","full_name":"nour-karoui/encrypt-storage","owner":"nour-karoui","description":"NPM package that encrypts Local/Session Storage (available for TS \u0026 JS)","archived":false,"fork":false,"pushed_at":"2021-04-19T13:11:20.000Z","size":6437,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T01:25:22.772Z","etag":null,"topics":["angular","client-side","encryption","javascript","localstorage","reactjs","security","sessionstorage","storage","typescript"],"latest_commit_sha":null,"homepage":"","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/nour-karoui.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}},"created_at":"2021-03-03T09:29:22.000Z","updated_at":"2024-06-07T14:19:03.000Z","dependencies_parsed_at":"2022-08-13T09:00:24.193Z","dependency_job_id":null,"html_url":"https://github.com/nour-karoui/encrypt-storage","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/nour-karoui%2Fencrypt-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nour-karoui%2Fencrypt-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nour-karoui%2Fencrypt-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nour-karoui%2Fencrypt-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nour-karoui","download_url":"https://codeload.github.com/nour-karoui/encrypt-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238418225,"owners_count":19468868,"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":["angular","client-side","encryption","javascript","localstorage","reactjs","security","sessionstorage","storage","typescript"],"created_at":"2024-09-24T13:48:49.970Z","updated_at":"2025-10-27T01:30:35.833Z","avatar_url":"https://github.com/nour-karoui.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Encrypt your client storage (available for TS \u0026 JS)\n\n\u003ch1 align=\"center\"\u003eWelcome to Encrypt Storage 👋\u003c/h1\u003e\n\u003cp\u003e\n  \u003ca href=\"https://www.npmjs.com/package/storage-encryption\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Version\" src=\"https://img.shields.io/npm/v/storage-encryption.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/nour-karoui/encrypt-storage#readme\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/badge/documentation-yes-brightgreen.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/nour-karoui/encrypt-storage/graphs/commit-activity\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Maintenance\" src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/nour-karoui/encrypt-storage/blob/master/LICENSE\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/github/license/bishkou/password-pwnd\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n* **Encrypt your storage using AES symmetric encryption algorithm**\n\n* **JS and TS**\n\n\n### 🏠 [Homepage](https://github.com/nour-karoui/encrypt-storage)\n\n## Install\n\n```sh\nnpm i storage-encryption\n```\n\n## How it works\n\n* **The constructor of EncryptStorage takes two arguments:**\n    * **secret**(required): the secret key (a string) that we'll use in the encryption\n    * **storage**(optional): localStorage / sessionStorage.\n     storage is localStorage by default.\n     \n* **Methods provided by encryptStorage:**\n    * **encrypt**(storage_key: string, data: any): void\n    * **decrypt**(storage_key: string): any\n    * **remove**(storage_key: string): void\n    \n\n## Encrypt Local/Session Storage (For Typescript)\n\n```ts\nimport {EncryptStorage} from 'storage-encryption';\n\n// the constructor takes the secret key as a first parameter and an optional\n// second parameter as the storage type\n// if none is provided it'll be localStorage by default\nconst encryptStorage = new EncryptStorage(SECRET_KEY, 'sessionStorage');\n/*** for a string ***/\nencryptStorage.encrypt('storage_key', 'Hello world');\nconst stringValue = encryptStorage.decrypt('storage_key');\n\n/*** for an object ***/\nencryptStorage.encrypt('storage_key', {'name': 'Hello world'});\nconst objectValue = encryptStorage.decrypt('storage_key');\n\n/*** for a number ***/\nencryptStorage.encrypt('storage_key', 1);\nconst numberValue = encryptStorage.decrypt('storage_key');\n\n/*** for an array ***/\nencryptStorage.encrypt('storage_key', [1, 2, 3]);\nconst arrayValue = encryptStorage.decrypt('storage_key');\n\nencryptStorage.remove('storage_key'); \n```\n\n## Encrypt Local/Session Storage (For Javascript)\n```js\nconst { EncryptStorage } = require('storage-encryption')\n\nconst encryptStorage = new EncryptStorage(SECRET_KEY, 'localStorage');\n\n/*** for a string ***/\nencryptStorage.encrypt('storage_key', 'Hello world');\nconst stringValue = encryptStorage.decrypt('storage_key');\n\n/*** for an object ***/\nencryptStorage.encrypt('storage_key', {'name': 'Hello world'});\nconst objectValue = encryptStorage.decrypt('storage_key');\n\n/*** for a number ***/\nencryptStorage.encrypt('storage_key', 1);\nconst numberValue = encryptStorage.decrypt('storage_key');\n\n/*** for an array ***/\nencryptStorage.encrypt('storage_key', [1, 2, 3]);\nconst arrayValue = encryptStorage.decrypt('storage_key');\n\nencryptStorage.remove('storage_key'); \n```\n\n## A BETTER WAY TO DO IT\n* **Instantiate the encryptStorage object in a shared folder and export it**\n* **So you won't have to instantiate it in each file**\n\n````ts\nimport EncryptStorage from 'storage-encryption';\n\nexport const encryptSessionStorage = EncryptStorage(SECRET_KEY, 'sessionStorage');\nexport const encryptLocalStorage = EncryptStorage(SECRET_KEY);\n\n````\n## Author\n\n👤 **Nour**\n\n* Github: [@nour-karoui](https://github.com/nour-karoui)\n* LinkedIn: [@nourkaroui](https://www.linkedin.com/in/nourkaroui/)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check [issues page](https://github.com/nour-karoui/encrypt-storage/issues). You can also take a look at the [contributing guide](https://github.com/nour-karoui/encrypt-storage/blob/master/CONTRIBUTING.md).\n\n## Show your support\n\nGive a [STAR](https://github.com/nour-karoui/encrypt-storage) if this project helped you!\n\n## 📝 License\n\n* Copyright © 2021 [Nour](https://github.com/nour-karoui).\n* This project is [MIT](https://github.com/nour-karoui/encrypt-storage/blob/master/LICENSE) licensed.\n\n***\n_This README was generated with by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnour-karoui%2Fencrypt-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnour-karoui%2Fencrypt-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnour-karoui%2Fencrypt-storage/lists"}