Giter VIP home page Giter VIP logo

Comments (5)

aseemk avatar aseemk commented on June 14, 2024

Hey guys, I'm new to this library, and have a naive question: why are Harmony proxies needed by this middleware at all? Can't it just take the session object and serialize it when the request headers are sent? Why does it need to do something anytime a session property is set/etc.?

from node-client-sessions.

aseemk avatar aseemk commented on June 14, 2024

Ah I see from #42 that it gives a performance win, since encryption is expensive. If that's it, thanks.

from node-client-sessions.

seanmonstar avatar seanmonstar commented on June 14, 2024

Exactly, in order to keep requests as fast as possible, the cookie is only re-encrypted when it needs to be.

from node-client-sessions.

aseemk avatar aseemk commented on June 14, 2024

Is there a hybrid option here? Only re-encrypt on changes, but check before each response if the session object has been reassigned, and if so, re-encrypt?

from node-client-sessions.

seanmonstar avatar seanmonstar commented on June 14, 2024

Well, if it's reassigned, it is no longer a Proxy. Then we can no longer watch if properties change. Maybe we could use a setter for the property on req to iterate over the newly assigned object, and set each property on the proxy.

Object.defineProperty(req, requestKey, {
  set: function(val) {
    // clear all keys from proxy
    // for key in val
       // proxy[key] = val[key];
  }
});

But I dunno, just thinking aloud.

from node-client-sessions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.