Open KendallWeihe opened 6 months ago
super good point @KendallWeihe. which makes me wonder whether we should even return ok
? @alecthomas thoughts on all this from a go idioms perspective?
If you're always returning an error in the false case then it makes sense for the function to just return the error. It would make sense if you need to distinguish between invalid for some reason and any other error.
This is fixed for the jws.Verify()
and jwt.Verify()
which now return (Decoded, err)
in this PR
Issue still present in the Verify()
functions within the crypto/
directory
I had started down this path last week but didn't get all the way https://github.com/TBD54566975/web5-go/tree/kendallw/verify-return-types
If
ok
isfalse
thenerr
will always benil
Which raises the question, do we want this? Because as it is now requires one extra
if
statement for the same semantic situation, which is boilerplate