bgutils-js
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -9,4 +9,4 @@ import type { PoTokenArgs } from '../utils/index.js'; | ||
* Creates a placeholder PoToken. This can be used while `sps` (StreamProtectionStatus) is 2, but will not work once it changes to 3. | ||
* @param identity - Visitor data or datasync ID. | ||
* @param identifier - Visitor ID or Data Sync ID. | ||
*/ | ||
export declare function generatePlaceholder(identity: string): string; | ||
export declare function generatePlaceholder(identifier: string): string; |
@@ -19,3 +19,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const { program, bgConfig, globalName } = args; | ||
const { identity } = bgConfig; | ||
const { identifier } = bgConfig; | ||
const bg = yield invokeBotguard(program, globalName, bgConfig); | ||
@@ -29,3 +29,3 @@ if (bg.postProcessFunctions.length) { | ||
throw new BGError(16, 'APF:Failed'); | ||
const buffer = yield acquirePo(new TextEncoder().encode(identity)); | ||
const buffer = yield acquirePo(new TextEncoder().encode(identifier)); | ||
const poToken = u8ToBase64(buffer, true); | ||
@@ -102,6 +102,6 @@ if (poToken.length > 80) | ||
* Creates a placeholder PoToken. This can be used while `sps` (StreamProtectionStatus) is 2, but will not work once it changes to 3. | ||
* @param identity - Visitor data or datasync ID. | ||
* @param identifier - Visitor ID or Data Sync ID. | ||
*/ | ||
export function generatePlaceholder(identity) { | ||
if (identity.length > 118) | ||
export function generatePlaceholder(identifier) { | ||
if (identifier.length > 118) | ||
throw new BGError(19, 'DFO:Invalid'); | ||
@@ -118,7 +118,7 @@ const currentTimeInSeconds = Math.floor(Date.now() / 1000); | ||
]); | ||
const result = new Uint8Array(2 + byteArray.length + identity.length); | ||
const result = new Uint8Array(2 + byteArray.length + identifier.length); | ||
result[0] = 34; | ||
result[1] = byteArray.length + identity.length; | ||
result[1] = byteArray.length + identifier.length; | ||
result.set(byteArray, 2); | ||
result.set(new TextEncoder().encode(identity), 2 + byteArray.length); | ||
result.set(new TextEncoder().encode(identifier), 2 + byteArray.length); | ||
const dataArray = result.subarray(2); | ||
@@ -125,0 +125,0 @@ for (let i = randomValues.length; i < dataArray.length; ++i) { |
@@ -37,4 +37,4 @@ export type PoTokenArgs = { | ||
globalObj: Record<string, any>; | ||
identity: string; | ||
identifier: string; | ||
requestKey: string; | ||
}; |
export {}; | ||
// Ignores: [ | ||
// "**/dist/*", | ||
// "**/bundle/*" | ||
// ], | ||
// }, | ||
// { | ||
// Files: ["**/*.{js,mjs,cjs,ts}"], |
{ | ||
"name": "bgutils-js", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "A JavaScript library for interfacing with Botguard.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -138,5 +138,5 @@ # What Is This? | ||
If this call succeeds, you should get another function. Call it with your visitor data ID (or datasync ID if you're signed in) as its first argument. | ||
If this call succeeds, you should get another function. Call it with your Visitor ID (or Data Sync ID if you're signed in) as its first argument. | ||
```js | ||
const buffer = await acquirePo(new TextEncoder().encode(identity)); | ||
const buffer = await acquirePo(new TextEncoder().encode(identifier)); | ||
@@ -143,0 +143,0 @@ const poToken = u8ToBase64(buffer, true); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
49643
26
617
1