Giter Club home page Giter Club logo

Comments (2)

paragonie-scott avatar paragonie-scott commented on August 23, 2024

Right now, the payload, as defined, seems to have only one key, exp.

https://github.com/paragonie/past/blob/master/src/Traits/RegisteredClaims.php

Of course, this depends if you're using the library's public API or writing arbitrary data directly to a token.

It seems like, somewhere and somewhen, somebody is going to try to stick a colliding key into the payload. Also, down the line, it strikes me that there may be additional metadata to add to the token (which could cause forward-upgrade issues for users with colliding keys). Maybe it'd be better for the basic payload structure to be:

{
  "exp": <expiry>,
  "d": <any legal JSON token>
}

Well, if you run this:

$parser = (new JsonToken())
    ->setPurpose('auth')
    ->setKey($someAuthKey)
    ->setIssuedAt(new DateTime())
    ->setExpiration(
        (new \DateTime())->add(
            new DateInterval('PT01H') // one hour
        )
    )
    ->set('d', $arbitrary_data_as_array);
var_dump((string) $parser);

...you'll see that you can define expiration, etc.

from paseto.

paragonie-scott avatar paragonie-scott commented on August 23, 2024

I suspect this may be a documentation issue, which has hopefully been resolved since January. Please feel free to correct me if I'm mistaken.

from paseto.

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.