diff options
author | Vivien Kraus <vivien@planete-kraus.eu> | 2020-01-01 00:00:00 +0100 |
---|---|---|
committer | Vivien Kraus <vivien@planete-kraus.eu> | 2021-06-05 16:11:26 +0200 |
commit | c37b145a323ec5353c1f57fa7d41d6c5cfea5c46 (patch) | |
tree | a5edcd0017a9201ca6a001d959b5c66ebeb4b603 /tests | |
parent | 1a5e600b5c0ec3730fd01ec97e81d609f981af45 (diff) |
Add a function to hash a public key for DPoP.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/jkt.scm | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index cb41e05..e279463 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,7 +7,8 @@ TESTS = %reldir%/load-library.scm \ %reldir%/jwk-kty-rsa-correct.scm \ %reldir%/jwk-kty-rsa-incorrect.scm \ %reldir%/hash-ok.scm \ - %reldir%/hash-unsupported.scm + %reldir%/hash-unsupported.scm \ + %reldir%/jkt.scm EXTRA_DIST += $(TESTS) diff --git a/tests/jkt.scm b/tests/jkt.scm new file mode 100644 index 0000000..ca20f89 --- /dev/null +++ b/tests/jkt.scm @@ -0,0 +1,23 @@ +(use-modules (webid-oidc stubs) + (webid-oidc testing)) + +(with-test-environment + "jkt" + (lambda () + (let* ((key (json-string->scm "{ + \"kty\":\"EC\", + \"x\":\"l8tFrhx-34tV3hRICRDY9zCkDlpBhF42UQUfWVAWBFs\", + \"y\":\"9VE4jf_Ok_o64zbTTlcuNJajHmt6v9TDVrU0CdvGRDA\", + \"crv\":\"P-256\" + }")) + (jkt (jkt key)) + (expected "0ZcOCORZNYy-DWpqq30jZyJGHTN0d2HglBV3uiguA4I")) + (unless (string=? jkt expected) + (format (current-error-port) + "The JKT algorithm is not correct: +expected: ~a +obtained: ~a +" + expected + jkt) + (exit 1))))) |