Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom storage type #10

Open
paulcpk opened this issue Jul 9, 2018 · 5 comments
Open

Add support for custom storage type #10

paulcpk opened this issue Jul 9, 2018 · 5 comments

Comments

@paulcpk
Copy link

paulcpk commented Jul 9, 2018

Adding support for a different storage type like sessionStorage or a custom solution might be useful. I made and tested the changes in a fork, PR coming soon.

@konsultaner
Copy link
Contributor

@fonkgoku you can actually replace the localstorage and write a wrapper that uses the local storage interface.

lib = new SecureLS();
lib.ls = {
    setItem: (key, value) => {},
    getItem: (key) => {},
    removeItem: (key) => {},
    get length() {},
    key: (i) => {}
};

@worst-developer
Copy link

Sorry I didn't get. Do you mean that I can write custom wrapper?
like this:

lib = new SecureLS();
lib.ls = {
    setItem: (key, value) => {
     sessionStorage.setItem(key, value)
  },
};

@konsultaner
Copy link
Contributor

@zorianiy-sapfir yes

@PierreProdel
Copy link

Will this be merged into the main repo at some point or is it a temp fix waiting for #11 ?

@konsultaner
Copy link
Contributor

@PierreProdel IMO there is no need to merge anything. I would close this issue since exchanging the storage is already possible.

lib = new SecureLS();
lib.ls = {
    setItem: (key, value) => {},
    getItem: (key) => {},
    removeItem: (key) => {},
    get length() {},
    key: (i) => {}
};

konsultaner added a commit to konsultaner/secure-ls that referenced this issue Apr 3, 2019
konsultaner added a commit to konsultaner/secure-ls that referenced this issue Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants