Skip to content

Commit

Permalink
Document sign-uri; fixes #69
Browse files Browse the repository at this point in the history
Add a defproc for sign-uri and include the example there.
  • Loading branch information
greghendershott committed Sep 1, 2023
1 parent ddeee9c commit 99c2831
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions aws/aws.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,6 @@ over again. Instead, you want to supply the request header
@litchar{Expect: 100-continue}, which lets S3 respond @italic{before}
you transmit the body.

For creating "Pre-signed url's", please see @racket[(sign-uri)] call in
that section below.

@subsection{Request Method}

@defparam[s3-path-requests? v boolean?]{
Expand Down Expand Up @@ -539,6 +536,39 @@ Constructs an @litchar{Authorization} header based on the inputs.

}


@defproc[(sign-uri
[b+p string?]
[method string?]
[expires (and/c exact-positive-integer? (between/c 1 604800))]
[headers dict?]
) string?]{

Return a pre-signed URI valid for @racket[expires] seconds.

Example:
@racketblock[
(require aws)
(require aws/s3)

;; Your aws_access_key_id
(public-key "akid")
;; Your aws_secret_access_key
(private-key "secret")

;; Digital Ocean Spaces is compatible with AWS
(s3-host "nyc3.digitaloceanspaces.com")
(s3-region "nyc3")
(s3-scheme "https")

(define bucket+path "unixcasts/10.mp4")
(define method "GET")
(define expires 900)
(sign-uri bucket+path method expires '())
]

}

@subsection{Conveniences}

@defproc[(create-bucket
Expand Down

0 comments on commit 99c2831

Please sign in to comment.