You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in which case it will be converted to a @racket[date?] value.
301
+
If conversion fails, an @racket[exn:fail:contract?] is raised.
290
302
}
291
303
292
304
@defproc[(cookie->header [c cookie?]) header?]{
@@ -348,50 +360,101 @@ FAQ} lists a few options. A convenient purely Racket-based option is
348
360
available (@racket[make-secret-salt/file]),
349
361
which is implemented using @racket[crypto-random-bytes].
350
362
351
-
@defproc[(make-id-cookie
352
-
[name cookie-name?]
353
-
[secret-salt bytes?]
354
-
[value cookie-value?]
355
-
[#:path path (or/c false/c string?) #f])
356
-
cookie?]{
363
+
@defproc*[([(make-id-cookie
364
+
[name (and/c string? cookie-name?)]
365
+
[value (and/c string? cookie-value?)]
366
+
[#:key secret-salt bytes?]
367
+
[#:path path (or/c path/extension-value? #f) #f]
368
+
[#:expires expires (or/c date? #f) #f]
369
+
[#:max-age max-age
370
+
(or/c (and/c integer? positive?) #f) #f]
371
+
[#:domain domain (or/c domain-value? #f) #f]
372
+
[#:secure? secure? any/c #f]
373
+
[#:http-only? http-only? any/c #f]
374
+
[#:extension extension
375
+
(or/c path/extension-value? #f) #f])
376
+
cookie?]
377
+
[(make-id-cookie
378
+
[name (and/c string? cookie-name?)]
379
+
[secret-salt bytes?]
380
+
[value (and/c string? cookie-value?)]
381
+
[#:path path (or/c path/extension-value? #f) #f]
382
+
[#:expires expires (or/c date? #f) #f]
383
+
[#:max-age max-age
384
+
(or/c (and/c integer? positive?) #f) #f]
385
+
[#:domain domain (or/c domain-value? #f) #f]
386
+
[#:secure? secure? any/c #f]
387
+
[#:http-only? http-only? any/c #t]
388
+
[#:extension extension
389
+
(or/c path/extension-value? #f) #f])
390
+
cookie?])]{
357
391
Generates an authenticated cookie named @racket[name] containing @racket[value], signed with @racket[secret-salt].
392
+
393
+
The calling conventions allow @racket[secret-salt] to be given either as a keyword
394
+
argument (mirroring the style of @racket[make-cookie]) or a by-position argument
395
+
(for compatability with older versions of this library).
396
+
397
+
The other arguments are passed to @racket[make-cookie]; however, note that the
398
+
default value for @racket[http-only?] is @racket[#t]. Users will also likely
399
+
want to set @racket[secure?] to @racket[#t] when using HTTPS.
358
400
}
359
401
360
-
@defproc[(request-id-cookie
361
-
[name cookie-name?]
362
-
[secret-salt bytes?]
363
-
[request request?]
364
-
[#:timeout timeout +inf.0])
365
-
(or/c false/c cookie-value?)]{
366
-
Extracts the first authenticated cookie named @racket[name] that was previously signed with @racket[secret-salt] before @racket[timeout] from @racket[request]. If no valid cookie is available, returns @racket[#f].
0 commit comments