summaryrefslogtreecommitdiff
path: root/tests/jkt.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2020-01-01 00:00:00 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2021-05-11 00:14:32 +0200
commitd36c331137eb2016d044ce948cf0989c23fecab0 (patch)
tree331ff74d1773c40622deb9eaf89e1eddf3809415 /tests/jkt.scm
parentfccfd5e7845fa849a9c398e8803accb36f35249d (diff)
Add a function to hash a public key for DPoP.
Diffstat (limited to 'tests/jkt.scm')
-rw-r--r--tests/jkt.scm23
1 files changed, 23 insertions, 0 deletions
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)))))