Comments (3)
Wouldn't it be simpler to pattern match on the IntDate
? That way you can use
currentTime <- getPOSIXTime
let IntDate iat' = iat
if abs (iat' - currentTime) < 30
...
from jose-jwt.
It's a matter of preference I suppose, I just thought it made sense that IntDate would have a Num
instance since it's a newtype over a Num
type.
from jose-jwt.
If I remember, the only reason for adding that type was to avoid an orphan instance for ToJSON and FromJSON for POSIXTime. I don't really like it much and it's something I'd like to be able to change easily in future with minimal impact, so I'd prefer to avoid encouraging its use much beyond encoding and decoding. Pattern-matching as above seems more or less as straightforward as your original code.
from jose-jwt.
Related Issues (20)
- Jose.Jwk Haddocks and Questions HOT 3
- benchmark build failure HOT 6
- Test files missing in release tarball HOT 1
- rsaDecode gives "Exception: Invalid Base64" for invalid input HOT 2
- Add ParseError for invalid JWT structures
- Example in README.md does not work HOT 2
- Secure against invalid curve attack? HOT 1
- Unable to decode JWK set HOT 1
- Ability to decode non predefined fields HOT 2
- Trouble exporting and importing keys HOT 2
- README link to hackage should use https
- Export IntDate HOT 4
- MonadRandom for decoding? HOT 1
- build fails with aeson-2.0
- `decodeClaims` uses `decodeStrict'` HOT 1
- Version 0.9.4 on hackage doesn't build with ghc-9.6 HOT 4
- Move to 'crypton' HOT 3
- Precision loss in IntDate serialisation
- Document AES GCM symmetric JWE? HOT 3
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 jose-jwt.