Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/matipan/doubleclick

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/matipan/doubleclick

  • v1.0.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

Doubleclick

Go PkgGoDev

This package implements the decryption of prices according to Google's OpenRTB-DoubleClick cryptography: https://developers.google.com/authorized-buyers/rtb/response-guide/decrypt-price.

Decoding a price using the examples that Google shows in their website:

icKey, ecKey, err := ParseKeys(base64.URLEncoding, []byte("arO23ykdNqUQ5LEoQ0FVmPkBd7xB5CO89PDZlSjpFxo="), []byte("skU7Ax_NL5pPAFyKdkfZjZz2-VhIN8bjj1rVFOaJ_5o="))
if err != { 
	log.Fatal(err)
}

price, err := DecryptPrice(icKey, ecKey, []byte("YWJjMTIzZGVmNDU2Z2hpN7fhCuPemC32prpWWw"))
if err != nil {
	log.Fatal(err)
}

fmt.Println(price)
// => 1900

Encoding a price using a custom initialization vector:

sampleIcKey, sampleEcKey, err = ParseKeys(base64.URLEncoding, []byte("arO23ykdNqUQ5LEoQ0FVmPkBd7xB5CO89PDZlSjpFxo="), []byte("skU7Ax_NL5pPAFyKdkfZjZz2-VhIN8bjj1rVFOaJ_5o="))
if err != nil {
	log.Fatal(err)
}

iv := []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
price := uint64(1900)
encPrice, err := EncryptPrice(sampleIcKey, sampleEcKey, iv, price)
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(encPrice))
// => AAECAwQFBgcICQoLDA0OD-zub_WgSbtPP9GXag

Contributing

Contributions are welcome, however this a simple project that is not bounded to change often.

FAQs

Package last updated on 05 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc