Comments (10)
Yes, I think that would be a better design. I was trying to oversimplify before.
from paseto.
63c2af7 side-steps the anti-patterns with the parser. I'll make sure the builder doesn't do anything weird either.
from paseto.
I believe this is closable now?
from paseto.
Will this not still cause a type mismatch?
Line 207 in 851a5f5
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.
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.
Shit, you're right.
from paseto.
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.
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.
Okay, I'll stop making changes to dev-master for the evening then. :)
from paseto.
Closing due to 63c2af7 :)
from paseto.
Related Issues (20)
- Builder toString() return claims as JSON array instead of object on v2 public mode
- obscene amount of avertisement for a protocol?
- How to use public private key pair? HOT 1
- PHP 8 support HOT 2
- DOWN : paseto.io HOT 1
- New Registered Claim: Token Generation? HOT 2
- Support Multiple Keys in Builders/Parsers HOT 1
- Null salt? HOT 5
- Mention paserk-php in README HOT 2
- Parser::parse(): Expiration check skipped if no other rules are defined HOT 1
- Class \"ParagonIE\\Paseto\\Protocol\\Version4\ Not found HOT 5
- Non-string claim values? HOT 3
- Is there a standard way to generate paseto tokens with human-readable payload without verification? HOT 2
- Questions on Assymetric Keys HOT 5
- I can't get Version 3 working HOT 2
- Invalid MAC for given ciphertext HOT 2
- Attempting to Catch Invalid ed25519 Private Keys HOT 6
- Cannot read pem created with encodePem HOT 4
- [Version 3] Cannot create token from encoded private key
- Undefined array key "ParagonIE\Paseto\Keys\SymmetricKey" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paseto.