Giter Club home page Giter Club logo

Comments (10)

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

Yes, I think that would be a better design. I was trying to oversimplify before.

from paseto.

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

63c2af7 side-steps the anti-patterns with the parser. I'll make sure the builder doesn't do anything weird either.

from paseto.

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

I believe this is closable now?

from paseto.

aidantwoods avatar aidantwoods commented on August 23, 2024

Will this not still cause a type mismatch?

->setKey($this->key)

As ->setKey still requires a secret key in the asymmetric crypto case, but the parser has a public one.

i.e. shouldn't the parser produce a JsonToken (since they now do not require a key)

from paseto.

aidantwoods avatar aidantwoods commented on August 23, 2024

I think if you add a test case where the parser uses a 'public' purpose you'll get an error when trying to construct the builder (at present the tests only use 'local' in the parser and then convert the resulting object to the asymmetric case).

from paseto.

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

Shit, you're right.

from paseto.

aidantwoods avatar aidantwoods commented on August 23, 2024

An idea I had was to make a couple of empty interfaces extending KeyInterface named SendingKey and ReceivingKey (would match language in cbd01fe#diff-fa390ca15b142c05e438dcbc19a23aa5R65) and make AsymetricPublicKey implement ReceivingKey, AsymetricSecretKey implement SendingKey and SymmetricKey implement both. This might help declare the key intent upfront to catch this earlier in future ;-)

from paseto.

aidantwoods avatar aidantwoods commented on August 23, 2024

I'll update #37 for the current master, since it defers the key intent just configuring a couple of array consts in Purpose, and then allows you to defer key and purpose validity checks there depending on intent.

from paseto.

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

Okay, I'll stop making changes to dev-master for the evening then. :)

from paseto.

aidantwoods avatar aidantwoods commented on August 23, 2024

Closing due to 63c2af7 :)

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.