Commit e066f616 authored by Dave Grijalva's avatar Dave Grijalva

yet more documentation

parent a94bf184
...@@ -80,7 +80,8 @@ func loadData(p string) ([]byte, error) { ...@@ -80,7 +80,8 @@ func loadData(p string) ([]byte, error) {
return ioutil.ReadAll(rdr) return ioutil.ReadAll(rdr)
} }
// Verify a token and output the claims // Verify a token and output the claims. This is a great example
// of how to verify and view a token.
func verifyToken() error { func verifyToken() error {
// get the token // get the token
tokData, err := loadData(*flagVerify) tokData, err := loadData(*flagVerify)
...@@ -95,7 +96,7 @@ func verifyToken() error { ...@@ -95,7 +96,7 @@ func verifyToken() error {
// Print an error if we can't parse for some reason // Print an error if we can't parse for some reason
if err != nil { if err != nil {
return err return fmt.Errorf("Couldn't parse token: %v", err)
} }
// Is token invalid? // Is token invalid?
...@@ -114,9 +115,10 @@ func verifyToken() error { ...@@ -114,9 +115,10 @@ func verifyToken() error {
return nil return nil
} }
// Create, sign, and output a token // Create, sign, and output a token. This is a great, simple example of
// how to use this library to create and sign a token.
func signToken() error { func signToken() error {
// get the token // get the token data from command line arguments
tokData, err := loadData(*flagSign) tokData, err := loadData(*flagSign)
if err != nil { if err != nil {
return fmt.Errorf("Couldn't read token: %v", err) return fmt.Errorf("Couldn't read token: %v", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment