google authenticator两步验证golang实现
go get github.com/jmolboy/googleauth
//strSize:随机的源字符串长度
//RandType:随机源字符串类型:RandTypeAlphaNum=数字&字符 , RandTypeAlpha = 字母 , RandTypeNum=仅数字
secretKey := googleauth.RandSecret(16,googleauth.RandTypeAlphaNum)
img,_ :=googleauth.QrCode(secretKey,"jmol","jmolboy",200)
base64Img,_ :=googleauth.QrBase64(secretKey,"jmol","jmolboy",200)
fmt.Print("base64:"+base64Img)
code,_ := googleauth.GetCode(secretKey)
fmt.Println("code:",code)