package locker import ( "os" "git.pspay.io/crypto-stories/custodial/pkg/crypto" ) var PUBLIC_KEY = getenv("PUBLIC_KEY", DEFAULT_PUBLIC_KEY) var PRIVATE_KEY = getenv("PRIVATE_KEY", DEFAULT_PRIVATE_KEY) var PrivKey crypto.RSAKey = crypto.RSAKey(PRIVATE_KEY) var PubKey crypto.RSAKey = crypto.RSAKey(PUBLIC_KEY) type RSABase64Value string type StringValue string func (v RSABase64Value) String() string { return string(v) } func (v RSABase64Value) Decrypt() string { return PrivKey.DecryptToString(v.String()) } func (v StringValue) String() string { return string(v) } func (v StringValue) Encrypt() RSABase64Value { return RSABase64Value(PubKey.EncryptToString(v.String())) } func getenv(key, defaultValue string) string { value := os.Getenv(key) if len(value) == 0 { return defaultValue } return value }