zitadel-oidc/pkg/op/crypto.go
Livio Amstutz 0ab5ea5a57 refactor: remove utils pkg
BREAKING CHANGE: utils package has been removed in favor of specific new
packages (http, crypto, strings)
2021-09-27 11:58:28 +02:00

26 lines
466 B
Go

package op
import (
"github.com/caos/oidc/pkg/crypto"
)
type Crypto interface {
Encrypt(string) (string, error)
Decrypt(string) (string, error)
}
type aesCrypto struct {
key string
}
func NewAESCrypto(key [32]byte) Crypto {
return &aesCrypto{key: string(key[:32])}
}
func (c *aesCrypto) Encrypt(s string) (string, error) {
return crypto.EncryptAES(s, c.key)
}
func (c *aesCrypto) Decrypt(s string) (string, error) {
return crypto.DecryptAES(s, c.key)
}