Adyen
Easily encrypt data for the Adyen payment platform
Install / Use
/learn @CrimsonAIO/AdyenREADME
adyen
Encrypt secrets for the Adyen payment platform.
This library uses crypto/rand to generate cryptographically secure AES keys and nonces,
and re-uses the same key and nonce for each client. Other publicly available libraries
typically use math/rand which is insecure for generating secret keys and nonces.
Example
package main
import (
"encoding/hex"
"fmt"
"github.com/CrimsonAIO/adyen"
)
func main() {
// create a public key from the public key bytes
//
// if you have a key that looks like "10001|...", then you need to
// hex decode the part after "|".
// an example of this is shown here, minus removing the front part.
const plaintextKey = "..."
b, err := hex.DecodeString(plaintextKey)
if err != nil {
panic(err)
}
// create new encrypter
enc, err := adyen.NewEncrypter("0_1_18", adyen.PubKeyFromBytes(b))
if err != nil {
panic(err)
}
// encrypt card information
//
// the number and month are automatically formatted with FormatCardNumber and
// FormatMonthYear, so formatting doesn't matter.
payload, err := enc.Encrypt(
"4871049999999910",
"737",
3,
2030,
)
if err != nil {
panic(err)
}
// print the payload to send to the server
fmt.Println(payload)
}
Check it out on The Go Playground.
Contributing
Pull requests are welcome to add new version constants or other improvements. Note that you don't need to use one of our version constants; you can use any string you like.
If you open a pull request, please use our MIT copyright header.
If you're using GoLand (or any JetBrains IDE) you can do this by going in Settings -> Editor -> Copyright
and selecting the copyright profile found in .idea/copyright/MIT_Crimson_Technologies_LLC.xml.
You are welcome to add your own name for your contributions.
Related Skills
node-connect
329.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
81.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
329.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
81.2kCommit, push, and open a PR
