Skip to content

Commit ca396b7

Browse files
committed
Updating the entropy documentation to be a little more consistent with the UUID implementation
1 parent f95631f commit ca396b7

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# NewsPassID
22

3-
A first-party identity and targeting solution for publishers.
3+
First-Party Identity and Targeting Solution for Publishers
44

55
## Features
66

7-
- Simple, one-line implementation for publishers
8-
- Privacy-compliant with IAB GPP API integration
9-
- Automatic ad targeting with first-party segments
10-
- High-entropy ID generation supporting 500M+ unique visitors
7+
- First-party ID generation and management
8+
- Segment-based targeting
9+
- GPP consent integration
10+
- Meta tag injection for segments
11+
- Publisher-specific namespace support
12+
- GDPR and CCPA compliant
13+
- Lightweight and fast implementation
1114
- Seamless integration with Google Ad Manager and other ad platforms
1215

1316
## Quick Start

test/unit/random.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { generateId } from '../../src/utils/random';
2+
3+
describe('Random ID Generation', () => {
4+
test('should generate unique IDs with sufficient entropy', () => {
5+
const namespace = 'test';
6+
const iterations = 1000;
7+
const generatedIds = new Set<string>();
8+
9+
// Generate multiple IDs and check for uniqueness
10+
for (let i = 0; i < iterations; i++) {
11+
const id = generateId(namespace);
12+
expect(id).toMatch(/^test-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
13+
expect(generatedIds.has(id)).toBe(false);
14+
generatedIds.add(id);
15+
}
16+
17+
// Verify we got the expected number of unique IDs
18+
expect(generatedIds.size).toBe(iterations);
19+
});
20+
});

0 commit comments

Comments
 (0)