@@ -15,6 +15,14 @@ import (
15
15
crusoeapi "github.com/crusoecloud/client-go/swagger/v1alpha5"
16
16
)
17
17
18
+ const (
19
+ timestampHeader = "X-Crusoe-Timestamp"
20
+ authHeader = "Authorization"
21
+ authVersion = "1.0"
22
+ )
23
+
24
+ var errSemicolonSeparator = errors .New ("invalid semicolon separator in query" )
25
+
18
26
// AuthenticatingTransport is a struct implementing http.Roundtripper
19
27
// that authenticates a request to Crusoe Cloud before sending it out.
20
28
type AuthenticatingTransport struct {
@@ -44,12 +52,6 @@ func (t AuthenticatingTransport) RoundTrip(r *http.Request) (*http.Response, err
44
52
return t .RoundTripper .RoundTrip (r )
45
53
}
46
54
47
- const (
48
- timestampHeader = "X-Crusoe-Timestamp"
49
- authHeader = "Authorization"
50
- authVersion = "1.0"
51
- )
52
-
53
55
// Verifies if the token signature is valid for a given request.
54
56
func addSignature (req * http.Request , encodedKeyID , encodedKey string ) error {
55
57
req .Header .Set (timestampHeader , time .Now ().UTC ().Format (time .RFC3339 ))
@@ -109,8 +111,6 @@ func generateMessageV1_0(req *http.Request) ([]byte, error) {
109
111
return []byte (messageString .String ()), nil
110
112
}
111
113
112
- var errSemicolonSeparator = errors .New ("invalid semicolon separator in query" )
113
-
114
114
// Canonicalizes the query into a deterministic string.
115
115
// see https://cs.opensource.google/go/go/+/refs/tags/go1.18.8:src/net/url/url.go;l=921
116
116
func canonicalizeQuery (query string ) (canonicalQuery string , err error ) {
0 commit comments