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-nodeThen import the package:
constadscoreNode=require('@variably/adscore-node');Please follow the installation procedure and then you may run the following:
constadscoreNode=require('@variably/adscore-node');constsignatureExpiry=3600;// in seconds, the length of time before the signature is considered expiredconstsignatureKey=adscoreNode.keyDecode('<base64 adscore validation key>');constipA='';// user ipconstipB='';// another ip (likely situation is ipv4 and ipv6)constipAddresses=[ipA,ipB];constuserAgent='';// user agentconstsignature='';// adscore signatureconstsignRole='customer';// standard signing roleconstresult=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