You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicKey, err:=paseto.NewV4AsymmetricPublicKeyFromHex("1eb9dbbbbc047c03fd70604e0071f0987e16b28b757225c11f00415d0e20b1a2") // this wil fail if given key in an invalid formatsigned:="v4.public.eyJkYXRhIjoidGhpcyBpcyBhIHNpZ25lZCBtZXNzYWdlIiwiZXhwIjoiMjAyMi0wMS0wMVQwMDowMDowMCswMDowMCJ9v3Jt8mx_TdM2ceTGoqwrh4yDFn0XsHvvV_D0DtwQxVrJEBMl0F2caAdgnpKlt4p7xBnx1HcO-SPo8FPp214HDw.eyJraWQiOiJ6VmhNaVBCUDlmUmYyc25FY1Q3Z0ZUaW9lQTlDT2NOeTlEZmdMMVc2MGhhTiJ9"parser:=paseto.NewParserWithoutExpiryCheck() // only used because this example token has expired, use NewParser() (which checks expiry by default)token, err:=parser.ParseV4Public(publicKey, signed, nil) // this will fail if parsing failes, cryptographic checks fail, or validation rules fail// the following will succeedrequire.JSONEq(t,
"{\"data\":\"this is a signed message\",\"exp\":\"2022-01-01T00:00:00+00:00\"}",
string(token.ClaimsJSON()),
)
require.Equal(t,
"{\"kid\":\"zVhMiPBP9fRf2snEcT7gFTioeA9COcNy9DfgL1W60haN\"}",
string(token.Footer()),
)
require.NoError(t, err)
As you can see in this example, the payload data is checked with the token.
We should implement this to avoid replay attacks with the token.
The text was updated successfully, but these errors were encountered:
Improve Paseto Authentication by sign also the entire payload, as suggested in Paseto V4 implementations.
Following example, explains the ways to do: https://github.com/aidantwoods/go-paseto#go-paseto
As you can see in this example, the payload data is checked with the token.
We should implement this to avoid replay attacks with the token.
The text was updated successfully, but these errors were encountered: