daf391e473
* Refactor List in Pointer DB * Fix pointerdb-client example * Fix issue in Path type related to empty paths * Test for the PointerDB service with some fixes * Fixed debug message in example: trancated --> more * GoDoc comments for unexported methods * TODO comment to check if Put is overwriting * Log warning if protobuf timestamp cannot be converted * TODO comment to make ListPageLimit configurable * Rename 'segment' package to 'segments' to reflect folder name
27 lines
581 B
Go
27 lines
581 B
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package auth
|
|
|
|
import (
|
|
"crypto/subtle"
|
|
"flag"
|
|
)
|
|
|
|
var (
|
|
apiKey = flag.String("pointer-db.auth.api-key", "", "api key")
|
|
)
|
|
|
|
// ValidateAPIKey : validates the X-API-Key header to an env/flag input
|
|
func ValidateAPIKey(header string) bool {
|
|
var expected = []byte(*apiKey)
|
|
var actual = []byte(header)
|
|
|
|
// TODO(kaloyan): I had to comment this to make pointerdb_test.go running successfully
|
|
// if len(expected) <= 0 {
|
|
// return false
|
|
// }
|
|
|
|
return 1 == subtle.ConstantTimeCompare(expected, actual)
|
|
}
|