summaryrefslogtreecommitdiff
path: root/tests/jkt.scm
diff options
context:
space:
mode:
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)))))