Official API
- Package version: 0.0.1
NodeJS 8.11.4+
To install this package you must have NodeJS installed, please follow those instructions for your OS before attempting to use this package.
Install via NPM (easiest method).
npm install --save @variably/adscore-node
Then import the package:
const adscoreNode = require('@variably/adscore-node');
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
}
*/
All endpoints require authorization, please see adscore.com for more information.
Variably