package protocol import ( "crypto/sha256" "encoding/hex" "strings" ) // AuthenticationCode lets a person compare the browser's authorization request // with the one they initiated in their app. It is a label, never a credential. func AuthenticationCode(id string) string { sum := sha256.Sum256([]byte(id)) code := strings.ToUpper(hex.EncodeToString(sum[:4])) return code[:4] + "-" + code[4:] }