summaryrefslogtreecommitdiff
path: root/tests/jkt.scm
blob: ca20f89c6ff7293f369c1bb4c65701c1dfce68b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)))))