Make struct field naming more consistent
This commit is contained in:
parent
a02a6fd302
commit
06fca3e3fe
@ -87,7 +87,7 @@ func (c Client) Lookup(id string) (*Descriptor, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkey, err = base64.StdEncoding.DecodeString(info.Pubkey)
|
pubkey, err = base64.StdEncoding.DecodeString(info.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func (c Client) Lookup(id string) (*Descriptor, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
newPubkey, err := base64.StdEncoding.DecodeString(info.Pubkey)
|
newPubkey, err := base64.StdEncoding.DecodeString(info.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ type ServerInfoHandler struct {
|
|||||||
// PreviousNames should contain any previous names this server used.
|
// PreviousNames should contain any previous names this server used.
|
||||||
PreviousNames []string
|
PreviousNames []string
|
||||||
|
|
||||||
// Pubkey should contain the server's public Ed25519 key.
|
// PublicKey should contain the server's public Ed25519 key.
|
||||||
Pubkey ed25519.PublicKey
|
PublicKey ed25519.PublicKey
|
||||||
// Privkey should contain the server's private Ed25519 key.
|
// PrivateKey should contain the server's private Ed25519 key.
|
||||||
Privkey ed25519.PrivateKey
|
PrivateKey ed25519.PrivateKey
|
||||||
// PreviousKeys should contain any previously-used private keys.
|
// PreviousKeys should contain any previously-used private keys.
|
||||||
// If this is not provided when the key changes, servers will not
|
// If this is not provided when the key changes, servers will not
|
||||||
// trust the new key and all responses will be rejected.
|
// trust the new key and all responses will be rejected.
|
||||||
@ -32,7 +32,7 @@ type ServerInfoHandler struct {
|
|||||||
type serverInfoData struct {
|
type serverInfoData struct {
|
||||||
ServerName string `json:"server_name"`
|
ServerName string `json:"server_name"`
|
||||||
PreviousNames []string `json:"previous_names"`
|
PreviousNames []string `json:"previous_names"`
|
||||||
Pubkey string `json:"pubkey"`
|
PublicKey string `json:"pubkey"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeHTTP implements the http.Handler interface
|
// ServeHTTP implements the http.Handler interface
|
||||||
@ -40,7 +40,7 @@ func (sih ServerInfoHandler) ServeHTTP(res http.ResponseWriter, req *http.Reques
|
|||||||
data, err := json.Marshal(serverInfoData{
|
data, err := json.Marshal(serverInfoData{
|
||||||
ServerName: sih.ServerName,
|
ServerName: sih.ServerName,
|
||||||
PreviousNames: sih.PreviousNames,
|
PreviousNames: sih.PreviousNames,
|
||||||
Pubkey: base64.StdEncoding.EncodeToString(sih.Pubkey),
|
PublicKey: base64.StdEncoding.EncodeToString(sih.PublicKey),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sih.ErrorHandler(err, res)
|
sih.ErrorHandler(err, res)
|
||||||
@ -52,7 +52,7 @@ func (sih ServerInfoHandler) ServeHTTP(res http.ResponseWriter, req *http.Reques
|
|||||||
res.Header().Add("X-ProfileFed-Previous", base64.StdEncoding.EncodeToString(sig))
|
res.Header().Add("X-ProfileFed-Previous", base64.StdEncoding.EncodeToString(sig))
|
||||||
}
|
}
|
||||||
|
|
||||||
sig := ed25519.Sign(sih.Privkey, data)
|
sig := ed25519.Sign(sih.PrivateKey, data)
|
||||||
res.Header().Set("X-ProfileFed-Sig", base64.StdEncoding.EncodeToString(sig))
|
res.Header().Set("X-ProfileFed-Sig", base64.StdEncoding.EncodeToString(sig))
|
||||||
|
|
||||||
_, err = res.Write(data)
|
_, err = res.Write(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user