Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duncdrum here

strategy:
matrix:
exist-version: [release, latest]
fail-fast: true
matrix:
exist-version: [release, 6.0.1]
experimental: [false]
# latest might contain breaking changes
include:
- exist-version: latest
experimental: true
services:
# Label used to access the service container
exist:
Expand Down
9 changes: 7 additions & 2 deletions src/content/jwt.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ declare function jwt:read ($token as xs:string, $secret as xs:string, $lifetime
};

declare function jwt:sign ($data as xs:string, $secret as xs:string) as xs:string {
(:
: This is a band-aid for the output of crypto:hmac being cast to a base64 encoded xs:string
: which uses + and / characters. Since util:base64-encode-url-safe cannot operate on binary data,
: we do a manual replacement here.
:)
crypto:hmac($data, $secret, "HMAC-SHA-256", "base64")
=> util:base64-encode-url-safe()
=> translate("+/=", "-_")
};

(:~
Expand Down Expand Up @@ -116,7 +121,7 @@ declare function jwt:epoch-to-dateTime($ts as xs:integer) as xs:dateTime {
declare
function jwt:encode ($data as item()) as xs:string {
util:base64-encode-url-safe(
serialize($data, map { "method": "json" }))
serialize($data, map { "method": "json", "indent": false() }))
};

declare
Expand Down
Loading