summaryrefslogtreecommitdiff
path: root/tests/dpop-proof-valid.scm
blob: a05a223aedc9d93bdcb6bc55b43314effb691b24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(use-modules (webid-oidc dpop-proof)
             (webid-oidc jti)
             (webid-oidc jwk)
             (webid-oidc testing)
             (web uri)
             (srfi srfi-19)
             (web response))

(with-test-environment
 "dpop-proof-valid"
 (lambda ()
   (define jwk (generate-key #:n-size 2048))
   (define cnf (jkt jwk))
   (define blacklist (make-jti-list))
   (define proof
     (issue-dpop-proof
      jwk
      #:alg 'RS256
      #:htm 'GET
      #:htu (string->uri "https://example.com/res#frag")
      #:iat (time-utc->date (make-time time-utc 0 0))))
   (define decoded
     (dpop-proof-decode (time-utc->date (make-time time-utc 0 10))
                        blacklist
                        'GET
                        (string->uri "https://example.com/res?query")
                        proof
                        cnf))
   (unless decoded
     (exit 1))))