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