pricers

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: GPL-3.0 Imports: 0 Imported by: 0

README

pricers

Build Status GoDoc Go Report Card Maintainability Test Coverage GitHub go.mod Go version GitHub tag (latest SemVer)

Overview

This library supports RTB development for Open RTB common price encryption in Golang.

Installation

$ go get github.com/benjaminch/pricers

Supported encryption protocols

Google Private Data

Specs https://developers.google.com/ad-exchange/rtb/response-guide/decrypt-price

Examples
Creating a new Google Private Data Pricer
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
)
Encrypting a clear price
import "github.com/benjaminch/pricers/doubleclick"

var result string
var err error
result, err = pricer.Encrypt(
    "",    // Seed
    1,     // Clear price
    false  // No debug
)
if err != nil {
    err = errors.New("Encryption failed. Error : %s", err)
}
Decrypting an encrypted price
import "github.com/benjaminch/pricers/doubleclick"

var result float64
var err error
result, err = pricer.Decrypt(
    "WEp8nQAAAAADG-y45xxIC1tMWuTjzmDW6HtroQ",  // Encrypted price
    false,                                     // No debug
)
if err != nil {
    err = errors.New("Decryption failed. Error : %s", err)
}

Todos

  • 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

Documentation

Overview

Package pricers supports common Open RTB price encryptions in Golang.

See README.md for more info.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL