Esempio n. 1
0
func NewClient(redirect string, name string, email string) *Client {
	idBuff, secretBuff := make([]byte, 32), make([]byte, 128)
	if _, err := rand.Read(idBuff); err != nil {
		panic(err)
	}
	if _, err := rand.Read(secretBuff); err != nil {
		panic(err)
	}

	return &Client{
		hex.EncodeToString(idBuff),
		secretBuff,
		encryption.AESEncrypt(redirect, "oauthclient.redirect"),
		encryption.AESEncrypt(name, "oauthclient.name"),
		encryption.AESEncrypt(email, "oauthclient.email"),
	}
}
Esempio n. 2
0
func NewUser(email string) *User {
	return &User{
		encryption.AESEncrypt(email, "user.email"),
		hash(strings.ToLower(email), encryption.ConfigKey("user.emailHash")),
	}
}