1

I want to encrypt my data always before setting to sessionStorage and decrypt after reading form it. Is it possible to override this functions or is there any other solution for this issue.

I don't want to do the encryption and decryption on all codes that I've written before ...

for example:

sessionStorage.setItem('token', 'my token');

in the code above, I want the sessionStorage.setItem function to do the encryption on 'my token'.

I know how to encrypt it but I want to implement it in sessionStorage.setItem function.

any help will be appreciated ...

Hamid Hosseini
  • 217
  • 4
  • 8
  • 1
    Looking for something like this? It can be used in Angular aswell [Override Local and SessionStorage](https://stackoverflow.com/questions/13612643/is-it-possible-to-override-local-storage-and-session-storage-separately-in-html5?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) – theriddle2 May 07 '18 at 12:32
  • Instead of modifying the prototype of a native API (which is considered a bad practice) you could use https://github.com/localForage/localForage package – t3__rry May 07 '18 at 12:41

0 Answers0