10// GetChallenge generates a PKCE verifier and its corresponding challenge.
11func GetChallenge() (verifier string, challenge string, err error) {
12 bytes := make([]byte, 32)
13 if _, err := rand.Read(bytes); err != nil {
16 verifier = encodeBase64(bytes)
17 hash := sha256.Sum256([]byte(verifier))
18 challenge = encodeBase64(hash[:])
19 return verifier, challenge, nil
22func encodeBase64(input []byte) (encoded string) {
23 encoded = base64.StdEncoding.EncodeToString(input)
24 encoded = strings.ReplaceAll(encoded, "=", "")
25 encoded = strings.ReplaceAll(encoded, "+", "-")
26 encoded = strings.ReplaceAll(encoded, "/", "_")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list