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
18 lines
378 B
Go
18 lines
378 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package macaroon
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"time"
|
|
)
|
|
|
|
// NewCaveat returns a Caveat with a nonce initialized to the current timestamp
|
|
// in nanoseconds.
|
|
func NewCaveat() Caveat {
|
|
var buf [8]byte
|
|
binary.BigEndian.PutUint64(buf[:], uint64(time.Now().UnixNano()))
|
|
return Caveat{Nonce: buf[:]}
|
|
}
|