X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dfe0ec7bfec3fd72cd40d3962e5c8af08d2413d2..86a78a669f01d15ec8fa5da8a3dfa29f5ef28128:/services/keepstore/perms.go diff --git a/services/keepstore/perms.go b/services/keepstore/perms.go index 38445d982b..7205a4594d 100644 --- a/services/keepstore/perms.go +++ b/services/keepstore/perms.go @@ -1,14 +1,20 @@ -package main +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +package keepstore import ( - "git.curoverse.com/arvados.git/sdk/go/keepclient" "time" + + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/keepclient" ) // SignLocator takes a blobLocator, an apiToken and an expiry time, and // returns a signed locator string. -func SignLocator(blobLocator, apiToken string, expiry time.Time) string { - return keepclient.SignLocator(blobLocator, apiToken, expiry, theConfig.BlobSignatureTTL.Duration(), theConfig.blobSigningKey) +func SignLocator(cluster *arvados.Cluster, blobLocator, apiToken string, expiry time.Time) string { + return keepclient.SignLocator(blobLocator, apiToken, expiry, cluster.Collections.BlobSigningTTL.Duration(), []byte(cluster.Collections.BlobSigningKey)) } // VerifySignature returns nil if the signature on the signedLocator @@ -16,8 +22,8 @@ func SignLocator(blobLocator, apiToken string, expiry time.Time) string { // either ExpiredError (if the timestamp has expired, which is // something the client could have figured out independently) or // PermissionError. -func VerifySignature(signedLocator, apiToken string) error { - err := keepclient.VerifySignature(signedLocator, apiToken, theConfig.BlobSignatureTTL.Duration(), theConfig.blobSigningKey) +func VerifySignature(cluster *arvados.Cluster, signedLocator, apiToken string) error { + err := keepclient.VerifySignature(signedLocator, apiToken, cluster.Collections.BlobSigningTTL.Duration(), []byte(cluster.Collections.BlobSigningKey)) if err == keepclient.ErrSignatureExpired { return ExpiredError } else if err != nil {