diff --git a/nix/tests/expected/pgjwt.out b/nix/tests/expected/pgjwt.out new file mode 100644 index 000000000..4e4500fd4 --- /dev/null +++ b/nix/tests/expected/pgjwt.out @@ -0,0 +1,22 @@ +select + sign( + payload := '{"sub":"1234567890","name":"John Doe","iat":1516239022}', + secret := 'secret', + algorithm := 'HS256' + ); + sign +------------------------------------------------------------------------------------------------------------------------------------------------------------- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.XbPfbIHMI6arZ3Y922BhjWgQzWXcXNrz0ogtVhfEd2o +(1 row) + +select + verify( + token := 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRm9vIn0.Q8hKjuadCEhnCPuqIj9bfLhTh_9QSxshTRsA5Aq4IuM', + secret := 'secret', + algorithm := 'HS256' + ); + verify +---------------------------------------------------------------- + ("{""alg"":""HS256"",""typ"":""JWT""}","{""name"":""Foo""}",t) +(1 row) + diff --git a/nix/tests/sql/pgjwt.sql b/nix/tests/sql/pgjwt.sql new file mode 100644 index 000000000..24179e7a0 --- /dev/null +++ b/nix/tests/sql/pgjwt.sql @@ -0,0 +1,13 @@ +select + sign( + payload := '{"sub":"1234567890","name":"John Doe","iat":1516239022}', + secret := 'secret', + algorithm := 'HS256' + ); + +select + verify( + token := 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRm9vIn0.Q8hKjuadCEhnCPuqIj9bfLhTh_9QSxshTRsA5Aq4IuM', + secret := 'secret', + algorithm := 'HS256' + );