From bae1843f1a1d644fb3bd4f8c40b1dbb900aa3325 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Sun, 1 Aug 2021 14:51:28 +0200 Subject: Use guile parameters With parameters, the API does not need to care about the directory where to load files and how to get the time. --- tests/dpop-proof-valid.scm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'tests/dpop-proof-valid.scm') diff --git a/tests/dpop-proof-valid.scm b/tests/dpop-proof-valid.scm index 52da33b..ec6b32a 100644 --- a/tests/dpop-proof-valid.scm +++ b/tests/dpop-proof-valid.scm @@ -18,6 +18,7 @@ (webid-oidc jti) (webid-oidc jwk) (webid-oidc testing) + ((webid-oidc parameters) #:prefix p:) (web uri) (srfi srfi-19) (web response)) @@ -27,20 +28,18 @@ (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)))) + (parameterize ((p:current-date 0)) + (issue-dpop-proof + jwk + #:alg 'RS256 + #:htm 'GET + #:htu (string->uri "https://example.com/res#frag")))) (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)) + (parameterize ((p:current-date 10)) + (dpop-proof-decode 'GET + (string->uri "https://example.com/res?query") + proof + cnf))) (unless decoded (exit 1)))) -- cgit v1.2.3