4 "git.curoverse.com/arvados.git/sdk/go/keepclient"
8 // The PermissionSecret is the secret key used to generate SHA1
9 // digests for permission hints. apiserver and Keep must use the same
11 var PermissionSecret []byte
13 // SignLocator takes a blobLocator, an apiToken and an expiry time, and
14 // returns a signed locator string.
15 func SignLocator(blobLocator, apiToken string, expiry time.Time) string {
16 return keepclient.SignLocator(blobLocator, apiToken, expiry, PermissionSecret)
19 // VerifySignature returns nil if the signature on the signedLocator
20 // can be verified using the given apiToken. Otherwise it returns
21 // either ExpiredError (if the timestamp has expired, which is
22 // something the client could have figured out independently) or
24 func VerifySignature(signedLocator, apiToken string) error {
25 err := keepclient.VerifySignature(signedLocator, apiToken, PermissionSecret)
26 if err == keepclient.ErrSignatureExpired {
28 } else if err != nil {
29 return PermissionError