uplink: add api key back to inspect

Change-Id: I9aa46f3910a76a81a399597d7512056b218e55af
This commit is contained in:
JT Olio 2021-02-12 17:10:07 -07:00 committed by Caleb Case
parent ac8c70e20d
commit e23f423107

View File

@ -99,8 +99,9 @@ func (b base64url) MarshalJSON() ([]byte, error) {
} }
type accessInfo struct { type accessInfo struct {
SatelliteAddr string `json:"satellite_addr,omitempty"` SatelliteAddr string `json:"satellite_addr"`
EncryptionAccess *pb.EncryptionAccess `json:"encryption_access,omitempty"` EncryptionAccess *pb.EncryptionAccess `json:"encryption_access"`
APIKey string `json:"api_key"`
Macaroon accessInfoMacaroon `json:"macaroon"` Macaroon accessInfoMacaroon `json:"macaroon"`
} }
@ -133,9 +134,16 @@ func accessInspect(cmd *cobra.Command, args []string) (err error) {
return err return err
} }
// TODO: this could be better
apiKey, err := macaroon.ParseRawAPIKey(p.ApiKey)
if err != nil {
return err
}
ai := accessInfo{ ai := accessInfo{
SatelliteAddr: p.SatelliteAddr, SatelliteAddr: p.SatelliteAddr,
EncryptionAccess: p.EncryptionAccess, EncryptionAccess: p.EncryptionAccess,
APIKey: apiKey.Serialize(),
Macaroon: accessInfoMacaroon{ Macaroon: accessInfoMacaroon{
Head: m.Head(), Head: m.Head(),
Caveats: []macaroon.Caveat{}, Caveats: []macaroon.Caveat{},