Skip to content

variably/adscore-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@variably/adscore-node

Official API

  • Package version: 0.0.1

Requirements.

NodeJS 8.11.4+

NodeJS

To install this package you must have NodeJS installed, please follow those instructions for your OS before attempting to use this package.

NPM

Install via NPM (easiest method).

npm install --save @variably/adscore-node

Then import the package:

const adscoreNode = require('@variably/adscore-node');

Basic Usage

Please follow the installation procedure and then you may run the following:

const adscoreNode = require('@variably/adscore-node');

const signatureExpiry = 3600; // in seconds, the length of time before the signature is considered expired
const signatureKey = adscoreNode.keyDecode('<base64 adscore validation key>');

const ipA = ''; // user ip
const ipB = ''; // another ip (likely situation is ipv4 and ipv6)
const ipAddresses = [
  ipA,
  ipB
];
const userAgent = ''; // user agent
const signature = ''; // adscore signature

const signRole = 'customer'; // standard signing role

const result = adscoreNode.verify({
  key: signatureKey, 
  expiry: signatureExpiry,

  signature,
  userAgent,
  ipAddresses,
  signRole
});
console.log('result', result);

/*
result {
  expired: true, // if present, the provided signature is expired

  error: '', // if present, the signature verification has raised an error

  score: , // integer score: [0, 3, 6, 9]
  verdict: '', // string verdict: ['ok', 'junk', 'proxy', 'bot']
  ipAddress: '', // ip address that matched this signature
  requestTime: , // time the signature was requested
  signatureTime: // time the signature was signed
}
*/

Documentation For Authorization

All endpoints require authorization, please see adscore.com for more information.

Author

Variably

About

adscore node validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published