From 06fca3e3fe2d6ee3b3cd7bd03ab684670f7272e0 Mon Sep 17 00:00:00 2001 From: Elara6331 Date: Sat, 9 Mar 2024 21:38:01 -0800 Subject: [PATCH] Make struct field naming more consistent --- client.go | 4 ++-- server_info.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client.go b/client.go index 06c40f3..203444f 100644 --- a/client.go +++ b/client.go @@ -87,7 +87,7 @@ func (c Client) Lookup(id string) (*Descriptor, error) { return nil, err } - pubkey, err = base64.StdEncoding.DecodeString(info.Pubkey) + pubkey, err = base64.StdEncoding.DecodeString(info.PublicKey) if err != nil { return nil, err } @@ -148,7 +148,7 @@ func (c Client) Lookup(id string) (*Descriptor, error) { return nil, err } - newPubkey, err := base64.StdEncoding.DecodeString(info.Pubkey) + newPubkey, err := base64.StdEncoding.DecodeString(info.PublicKey) if err != nil { return nil, err } diff --git a/server_info.go b/server_info.go index fe1366d..684fc91 100644 --- a/server_info.go +++ b/server_info.go @@ -16,10 +16,10 @@ type ServerInfoHandler struct { // PreviousNames should contain any previous names this server used. PreviousNames []string - // Pubkey should contain the server's public Ed25519 key. - Pubkey ed25519.PublicKey - // Privkey should contain the server's private Ed25519 key. - Privkey ed25519.PrivateKey + // PublicKey should contain the server's public Ed25519 key. + PublicKey ed25519.PublicKey + // PrivateKey should contain the server's private Ed25519 key. + PrivateKey ed25519.PrivateKey // PreviousKeys should contain any previously-used private keys. // If this is not provided when the key changes, servers will not // trust the new key and all responses will be rejected. @@ -32,7 +32,7 @@ type ServerInfoHandler struct { type serverInfoData struct { ServerName string `json:"server_name"` PreviousNames []string `json:"previous_names"` - Pubkey string `json:"pubkey"` + PublicKey string `json:"pubkey"` } // 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{ ServerName: sih.ServerName, PreviousNames: sih.PreviousNames, - Pubkey: base64.StdEncoding.EncodeToString(sih.Pubkey), + PublicKey: base64.StdEncoding.EncodeToString(sih.PublicKey), }) if err != nil { 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)) } - sig := ed25519.Sign(sih.Privkey, data) + sig := ed25519.Sign(sih.PrivateKey, data) res.Header().Set("X-ProfileFed-Sig", base64.StdEncoding.EncodeToString(sig)) _, err = res.Write(data)