* chore: move to new org * chore: change import * fix: update logging lib Co-authored-by: Fabienne <fabienne.gerschwiler@gmail.com> Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
26 lines
469 B
Go
26 lines
469 B
Go
package op
|
|
|
|
import (
|
|
"github.com/zitadel/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)
|
|
}
|