oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1package protocol
2
3import (
4 "crypto/sha256"
5 "encoding/hex"
6 "strings"
7)
8
9// AuthenticationCode lets a person compare the browser's authorization request
10// with the one they initiated in their app. It is a label, never a credential.
11func AuthenticationCode(id string) string {
12 sum := sha256.Sum256([]byte(id))
13 code := strings.ToUpper(hex.EncodeToString(sum[:4]))
14 return code[:4] + "-" + code[4:]
15}
16