Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Don't add a new struct in the interface just for local usage, use unnamed struct instead

Co-authored-by: alexzorin <alex@zorin.au>
  • Loading branch information
cyril42e and alexzorin authored Jan 16, 2023
1 parent fe5d4fa commit c2ad78d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 6 additions & 3 deletions cmd/authy-export/authy-export.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ type deviceRegistration struct {
}

func main() {
savePtr := flag.String("save", "", "Save encrypted tokens and apps to this json file")
loadPtr := flag.String("load", "", "Load tokens from this json file instead of the server")
savePtr := flag.String("save", "", "Save encrypted tokens and apps to this JSON file")
loadPtr := flag.String("load", "", "Load tokens from this JSON file instead of the server")
flag.Parse()

var resp authy.AuthenticatorResponse
var resp struct {
Tokens authy.AuthenticatorTokensResponse `json:"tokens"`
Apps authy.AuthenticatorAppsResponse `json:"apps"`
}
if *loadPtr != "" {
// Get tokens from the json file
f, err := os.Open(*loadPtr)
Expand Down
7 changes: 0 additions & 7 deletions objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,3 @@ func (a AuthenticatorApp) Token() (string, error) {
encoder := base32.StdEncoding.WithPadding(base32.NoPadding)
return encoder.EncodeToString(decoded), nil
}

type AuthenticatorResponse struct {
Tokens AuthenticatorTokensResponse `json:"tokens"`

Apps AuthenticatorAppsResponse `json:"apps"`
}

0 comments on commit c2ad78d

Please sign in to comment.