15e74c8c3d
* cmd/uplink: add share command to restrict an api key This commit is an early bit of work to just implement restricting macaroon api keys from the command line. It does not convert api keys to be macaroons in general. It also does not apply the path restriction caveats appropriately yet because it does not encrypt them. * cmd/uplink: fix path encryption for shares It should now properly encrypt the path prefixes when adding caveats to a macaroon. * fix up linting problems * print summary of caveat and require iso8601 * make clone part more clear
20 lines
409 B
Go
20 lines
409 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package uplink
|
|
|
|
// APIKey represents an access credential to certain resources
|
|
type APIKey struct {
|
|
key string
|
|
}
|
|
|
|
// Serialize serializes the API key to a string
|
|
func (a APIKey) Serialize() string {
|
|
return a.key
|
|
}
|
|
|
|
// ParseAPIKey parses an API key
|
|
func ParseAPIKey(val string) (APIKey, error) {
|
|
return APIKey{key: val}, nil
|
|
}
|