This library supports RTB development for Open RTB common price encryption in Golang.
$ go get github.com/benjaminch/pricers
Specs https://developers.google.com/ad-exchange/rtb/response-guide/decrypt-price
import "github.com/benjaminch/pricers/doubleclick"
var pricer *doubleclick.DoubleClickPricer
var err error
pricer, err = doubleclick.NewDoubleClickPricer(
"ZS-DraBUUVeht_sMDgn1nnM3My_nq9TrEESbjubDkTU", // Encryption key
"vQo9-4KtlcXmPhWaYvc8asqYuiSVMiGUdZ1RLXfrK7U", // Integrity key
true, // Keys are base64
helpers.Utf8, // Keys should be ingested as Utf-8
1000000, // Price scale Factor Micro
false, // No debug
)
import "github.com/benjaminch/pricers/doubleclick"
var result string
var err error
price := 42 // Clear price
seed := ""
result, err = pricer.Encrypt(seed, price)
if err != nil {
err = errors.New("Encryption failed. Error : %s", err)
}
import "github.com/benjaminch/pricers/doubleclick"
var result float64
var err error
encryptedPrice := "WEp8nQAAAAADG-y45xxIC1tMWuTjzmDW6HtroQ"
result, err = pricer.Decrypt(encryptedPrice)
if err != nil {
err = errors.New("Decryption failed. Error : %s", err)
}
- Re-organize directory layout following https://github.com/golang-standards/project-layout
- Complete documentation:
- How to use the Pricer Builder (describing all params)
- How to use the Pricer Encrypt function (describing all params)
- How to use the Pricer Decrypt function (describing all params)
- Complete tests for helpers
- Complete tests for Google Private Data, including various key formats (hex, utf8, base64, etc.)
- Add other most common price encryption protocols (AES, etc.)
- BlowFish
- Symetric Algorithm
- XOR