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

Allow for cookies to be secure #285

Closed
wants to merge 1 commit into from
Closed

Allow for cookies to be secure #285

wants to merge 1 commit into from

Conversation

tam5
Copy link

@tam5 tam5 commented Jul 19, 2018

closes #269

@@ -25,11 +25,11 @@ var storeAPI = {

// set will store the given value at key and returns value.
// Calling set with value === undefined is equivalent to calling remove.
set: function(key, value) {
set: function(key, value, isSecure = false) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using default parameter values will break compatibility with a bunch of browsers that Store.js is supposed to support.

Copy link

@Lawlez Lawlez Aug 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about something like this:

set: function(key, value, options) { ...

this.storage.write(this._namespacePrefix + key, this._serialize(value), options)

and in cookieStorage.js:
function write(key, data, options) {
if(!key) { return }
var opts = options ? options : ""
doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/" + options
} }`

the user could then set a cookie like:
store.set('myName', 'data', ';Secure;SameSite=strict')

Copy link

@diegocr diegocr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using default parameter values will break compatibility with a bunch of browsers that Store.js is supposed to support.

@tam5 tam5 closed this by deleting the head repository Feb 28, 2023
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

Successfully merging this pull request may close these issues.

Ability to set a cookie as 'secure'
4 participants