Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Aug 29, 2024
1 parent cb5deeb commit 61983b1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/potoken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ async function invokeBotguard(program: string, globalName: string, bgConfig: BgC

/**
* 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: string): string {
if (identity.length > 118)
export function generatePlaceholder(identifier: string): string {
if (identifier.length > 118)
throw new BGError(19, 'DFO:Invalid');

const currentTimeInSeconds = Math.floor(Date.now() / 1000);
Expand All @@ -151,13 +151,13 @@ export function generatePlaceholder(identity: string): string {
currentTimeInSeconds & 255
]);

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);

Expand Down

0 comments on commit 61983b1

Please sign in to comment.