@tripticonsent/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/canonical.d.ts +3 -0
- package/dist/canonical.js +17 -0
- package/dist/canonical.js.map +1 -0
- package/dist/client.d.ts +112 -0
- package/dist/client.js +204 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/receipt.d.ts +19 -0
- package/dist/receipt.js +34 -0
- package/dist/receipt.js.map +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @tripticonsent/sdk
|
|
2
|
+
|
|
3
|
+
Browser + Node client for the tripticonsent consent & preference API.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @tripticonsent/sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { TripticonsentClient } from '@tripticonsent/sdk';
|
|
11
|
+
|
|
12
|
+
const tc = new TripticonsentClient({
|
|
13
|
+
baseUrl: 'https://api.tripticonsent.tripticode.com',
|
|
14
|
+
apiKey: 'pk_live_…', // sk_live_… on a server
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// record a decision
|
|
18
|
+
await tc.recordConsent(
|
|
19
|
+
{ subject: 'email:user@example.com', purpose: 'marketing_email', state: 'GRANTED', channel: 'banner' },
|
|
20
|
+
{ idempotencyKey: crypto.randomUUID() },
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// read current state (in-memory cache + ETag revalidation)
|
|
24
|
+
const state = await tc.getConsentState('email:user@example.com');
|
|
25
|
+
|
|
26
|
+
// render your banner from the site's own published definitions
|
|
27
|
+
const purposes = await tc.getPurposes({ locale: 'es' });
|
|
28
|
+
|
|
29
|
+
// tag gate — load analytics only after consent
|
|
30
|
+
await tc.gate('email:user@example.com', ['analytics'], () => loadAnalytics());
|
|
31
|
+
// after your banner writes new consent:
|
|
32
|
+
tc.notifyConsentChanged();
|
|
33
|
+
|
|
34
|
+
// Google Consent Mode v2
|
|
35
|
+
await tc.applyConsentMode('email:user@example.com', gtag);
|
|
36
|
+
|
|
37
|
+
// verify a receipt offline
|
|
38
|
+
const receipt = await tc.getReceipt('rcpt_…');
|
|
39
|
+
const ok = await tc.verifyReceipt(receipt);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`pk_` keys are origin-restricted and can only touch the referenced subject; `sk_` keys unlock
|
|
43
|
+
`createSubject` / `mergeSubjects` / full history / data requests.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalJson = canonicalJson;
|
|
4
|
+
/** Deterministic JSON — recursively sorted object keys. Matches the server's
|
|
5
|
+
* `canonicalJson` in @tripticonsent/crypto so receipt signatures verify. */
|
|
6
|
+
function canonicalJson(value) {
|
|
7
|
+
if (value === null || typeof value !== 'object')
|
|
8
|
+
return JSON.stringify(value);
|
|
9
|
+
if (Array.isArray(value))
|
|
10
|
+
return `[${value.map(canonicalJson).join(',')}]`;
|
|
11
|
+
const entries = Object.entries(value)
|
|
12
|
+
.filter(([, v]) => v !== undefined)
|
|
13
|
+
.sort(([a], [b]) => (a < b ? -1 : 1))
|
|
14
|
+
.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`);
|
|
15
|
+
return `{${entries.join(',')}}`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":";;AAEA,sCAQC;AAVD;6EAC6E;AAC7E,SAAgB,aAAa,CAAC,KAAc;IACxC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9E,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;SAC3D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;SAClC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACpC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { SignedReceipt } from './receipt';
|
|
2
|
+
export type ConsentInputState = 'GRANTED' | 'DENIED' | 'WITHDRAWN';
|
|
3
|
+
export type SubjectRef = string | {
|
|
4
|
+
identifiers: {
|
|
5
|
+
type: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export interface TripticonsentOptions {
|
|
10
|
+
/** e.g. https://api.tripticonsent.tripticode.com */
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
/** pk_… in the browser, sk_… on a server. */
|
|
13
|
+
apiKey: string;
|
|
14
|
+
/** GET response cache TTL in ms (default 60_000). */
|
|
15
|
+
cacheTtlMs?: number;
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
export interface RecordConsentParams {
|
|
19
|
+
subject: SubjectRef;
|
|
20
|
+
purpose: string;
|
|
21
|
+
state: ConsentInputState;
|
|
22
|
+
channel?: string;
|
|
23
|
+
locale?: string;
|
|
24
|
+
pageUrl?: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export declare class TripticonsentError extends Error {
|
|
28
|
+
status: number;
|
|
29
|
+
code: string;
|
|
30
|
+
hint?: string | undefined;
|
|
31
|
+
constructor(status: number, code: string, message: string, hint?: string | undefined);
|
|
32
|
+
}
|
|
33
|
+
export declare class TripticonsentClient {
|
|
34
|
+
private readonly baseUrl;
|
|
35
|
+
private readonly apiKey;
|
|
36
|
+
private readonly ttl;
|
|
37
|
+
private readonly f;
|
|
38
|
+
private readonly cache;
|
|
39
|
+
private readonly changeHandlers;
|
|
40
|
+
constructor(opts: TripticonsentOptions);
|
|
41
|
+
recordConsent(params: RecordConsentParams, opts?: {
|
|
42
|
+
idempotencyKey?: string;
|
|
43
|
+
}): Promise<unknown>;
|
|
44
|
+
recordConsentBatch(records: RecordConsentParams[], opts?: {
|
|
45
|
+
idempotencyKey?: string;
|
|
46
|
+
}): Promise<unknown>;
|
|
47
|
+
recordPreferences(params: {
|
|
48
|
+
subject: SubjectRef;
|
|
49
|
+
values: {
|
|
50
|
+
field: string;
|
|
51
|
+
value: unknown;
|
|
52
|
+
}[];
|
|
53
|
+
channel?: string;
|
|
54
|
+
}, opts?: {
|
|
55
|
+
idempotencyKey?: string;
|
|
56
|
+
}): Promise<unknown>;
|
|
57
|
+
createSubject(identifiers: {
|
|
58
|
+
type: string;
|
|
59
|
+
value: string;
|
|
60
|
+
}[]): Promise<unknown>;
|
|
61
|
+
addIdentifier(subject: string, identifier: {
|
|
62
|
+
type: string;
|
|
63
|
+
value: string;
|
|
64
|
+
isPrimary?: boolean;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
mergeSubjects(source: SubjectRef, target: SubjectRef, reason?: string): Promise<unknown>;
|
|
67
|
+
createDataRequest(subject: SubjectRef, type: 'EXPORT' | 'ERASURE' | 'RECTIFICATION', payload?: Record<string, unknown>): Promise<unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch the published banner for this site. Sends back any previously
|
|
70
|
+
* assigned A/B variant so the server returns the same variant consistently
|
|
71
|
+
* (sticky assignment). Persists the assigned variant in localStorage for 24h.
|
|
72
|
+
*/
|
|
73
|
+
getBanner(opts?: {
|
|
74
|
+
locale?: string;
|
|
75
|
+
country?: string;
|
|
76
|
+
region?: string;
|
|
77
|
+
}): Promise<unknown>;
|
|
78
|
+
getConsentState(subject: string, opts?: {
|
|
79
|
+
purpose?: string;
|
|
80
|
+
fresh?: boolean;
|
|
81
|
+
}): Promise<unknown>;
|
|
82
|
+
getPreferences(subject: string, opts?: {
|
|
83
|
+
fresh?: boolean;
|
|
84
|
+
}): Promise<unknown>;
|
|
85
|
+
getPurposes(opts?: {
|
|
86
|
+
locale?: string;
|
|
87
|
+
}): Promise<unknown>;
|
|
88
|
+
getPurpose(key: string, opts?: {
|
|
89
|
+
locale?: string;
|
|
90
|
+
}): Promise<unknown>;
|
|
91
|
+
getPreferenceTemplate(): Promise<unknown>;
|
|
92
|
+
getPolicy(opts?: {
|
|
93
|
+
country?: string;
|
|
94
|
+
}): Promise<unknown>;
|
|
95
|
+
getTcString(subject: string): Promise<unknown>;
|
|
96
|
+
getConsentMode(subject: string): Promise<unknown>;
|
|
97
|
+
getReceipt(id: string): Promise<SignedReceipt & Record<string, unknown>>;
|
|
98
|
+
verifyReceipt(receipt: SignedReceipt): Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Run `loader` once the subject has GRANTED at least one purpose in
|
|
101
|
+
* `purposeKeys` (opt-in auto-blocking). Re-runs on `notifyConsentChanged`.
|
|
102
|
+
*/
|
|
103
|
+
gate(subject: string, purposeKeys: string[], loader: () => void): Promise<void>;
|
|
104
|
+
/** Call after your banner writes new consent so gates re-evaluate. */
|
|
105
|
+
notifyConsentChanged(subjectId?: string): void;
|
|
106
|
+
/** Apply Consent Mode v2 signals to a gtag function. */
|
|
107
|
+
applyConsentMode(subject: string, gtag: (...args: unknown[]) => void): Promise<void>;
|
|
108
|
+
private get;
|
|
109
|
+
private rawGet;
|
|
110
|
+
private post;
|
|
111
|
+
private parse;
|
|
112
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TripticonsentClient = exports.TripticonsentError = void 0;
|
|
4
|
+
const receipt_1 = require("./receipt");
|
|
5
|
+
class TripticonsentError extends Error {
|
|
6
|
+
status;
|
|
7
|
+
code;
|
|
8
|
+
hint;
|
|
9
|
+
constructor(status, code, message, hint) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.hint = hint;
|
|
14
|
+
this.name = 'TripticonsentError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.TripticonsentError = TripticonsentError;
|
|
18
|
+
class TripticonsentClient {
|
|
19
|
+
baseUrl;
|
|
20
|
+
apiKey;
|
|
21
|
+
ttl;
|
|
22
|
+
f;
|
|
23
|
+
cache = new Map();
|
|
24
|
+
changeHandlers = new Set();
|
|
25
|
+
constructor(opts) {
|
|
26
|
+
this.baseUrl = opts.baseUrl.replace(/\/$/, '');
|
|
27
|
+
this.apiKey = opts.apiKey;
|
|
28
|
+
this.ttl = opts.cacheTtlMs ?? 60_000;
|
|
29
|
+
this.f = opts.fetch ?? globalThis.fetch;
|
|
30
|
+
if (!this.f)
|
|
31
|
+
throw new Error('No fetch implementation available; pass one in options.');
|
|
32
|
+
}
|
|
33
|
+
// ── writes ───────────────────────────────────────────────────────────
|
|
34
|
+
recordConsent(params, opts = {}) {
|
|
35
|
+
return this.post('/v1/consent', params, opts.idempotencyKey);
|
|
36
|
+
}
|
|
37
|
+
recordConsentBatch(records, opts = {}) {
|
|
38
|
+
return this.post('/v1/consent/batch', { records }, opts.idempotencyKey);
|
|
39
|
+
}
|
|
40
|
+
recordPreferences(params, opts = {}) {
|
|
41
|
+
return this.post('/v1/preferences', params, opts.idempotencyKey);
|
|
42
|
+
}
|
|
43
|
+
// secret-key only
|
|
44
|
+
createSubject(identifiers) {
|
|
45
|
+
return this.post('/v1/subjects', { identifiers });
|
|
46
|
+
}
|
|
47
|
+
addIdentifier(subject, identifier) {
|
|
48
|
+
return this.post(`/v1/subjects/${encodeURIComponent(subject)}/identifiers`, identifier);
|
|
49
|
+
}
|
|
50
|
+
mergeSubjects(source, target, reason) {
|
|
51
|
+
return this.post('/v1/subjects/merge', { source, target, reason });
|
|
52
|
+
}
|
|
53
|
+
createDataRequest(subject, type, payload) {
|
|
54
|
+
return this.post('/v1/data-requests', { subject, type, payload });
|
|
55
|
+
}
|
|
56
|
+
// ── reads (cached) ───────────────────────────────────────────────────
|
|
57
|
+
/**
|
|
58
|
+
* Fetch the published banner for this site. Sends back any previously
|
|
59
|
+
* assigned A/B variant so the server returns the same variant consistently
|
|
60
|
+
* (sticky assignment). Persists the assigned variant in localStorage for 24h.
|
|
61
|
+
*/
|
|
62
|
+
async getBanner(opts = {}) {
|
|
63
|
+
let abVariant;
|
|
64
|
+
if (typeof localStorage !== 'undefined') {
|
|
65
|
+
try {
|
|
66
|
+
const raw = localStorage.getItem('tc_ab_latest');
|
|
67
|
+
if (raw) {
|
|
68
|
+
const stored = JSON.parse(raw);
|
|
69
|
+
if (stored.expiresAt && stored.expiresAt > Date.now())
|
|
70
|
+
abVariant = stored.variantVersionId;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch { /* ignore */ }
|
|
74
|
+
}
|
|
75
|
+
const qs = new URLSearchParams();
|
|
76
|
+
if (opts.locale)
|
|
77
|
+
qs.set('locale', opts.locale);
|
|
78
|
+
if (opts.country)
|
|
79
|
+
qs.set('country', opts.country);
|
|
80
|
+
if (opts.region)
|
|
81
|
+
qs.set('region', opts.region);
|
|
82
|
+
if (abVariant)
|
|
83
|
+
qs.set('abVariant', abVariant);
|
|
84
|
+
const qStr = qs.toString();
|
|
85
|
+
const res = await this.get(`/v1/banner${qStr ? `?${qStr}` : ''}`);
|
|
86
|
+
const r = res;
|
|
87
|
+
if (typeof localStorage !== 'undefined' && r.abTest?.variantVersionId) {
|
|
88
|
+
try {
|
|
89
|
+
localStorage.setItem('tc_ab_latest', JSON.stringify({
|
|
90
|
+
variantVersionId: r.abTest.variantVersionId,
|
|
91
|
+
expiresAt: Date.now() + 86_400_000,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
catch { /* ignore */ }
|
|
95
|
+
}
|
|
96
|
+
return res;
|
|
97
|
+
}
|
|
98
|
+
getConsentState(subject, opts = {}) {
|
|
99
|
+
const q = opts.purpose ? `?purpose=${encodeURIComponent(opts.purpose)}` : '';
|
|
100
|
+
return this.get(`/v1/subjects/${encodeURIComponent(subject)}/consent${q}`, opts.fresh);
|
|
101
|
+
}
|
|
102
|
+
getPreferences(subject, opts = {}) {
|
|
103
|
+
return this.get(`/v1/subjects/${encodeURIComponent(subject)}/preferences`, opts.fresh);
|
|
104
|
+
}
|
|
105
|
+
getPurposes(opts = {}) {
|
|
106
|
+
return this.get(`/v1/purposes${opts.locale ? `?locale=${opts.locale}` : ''}`);
|
|
107
|
+
}
|
|
108
|
+
getPurpose(key, opts = {}) {
|
|
109
|
+
return this.get(`/v1/purposes/${encodeURIComponent(key)}/current${opts.locale ? `?locale=${opts.locale}` : ''}`);
|
|
110
|
+
}
|
|
111
|
+
getPreferenceTemplate() {
|
|
112
|
+
return this.get('/v1/preference-template');
|
|
113
|
+
}
|
|
114
|
+
getPolicy(opts = {}) {
|
|
115
|
+
return this.get(`/v1/policy${opts.country ? `?country=${opts.country}` : ''}`);
|
|
116
|
+
}
|
|
117
|
+
getTcString(subject) {
|
|
118
|
+
return this.get(`/v1/consent/tcstring?subject=${encodeURIComponent(subject)}`, true);
|
|
119
|
+
}
|
|
120
|
+
getConsentMode(subject) {
|
|
121
|
+
return this.get(`/v1/consent/google-consent-mode?subject=${encodeURIComponent(subject)}`, true);
|
|
122
|
+
}
|
|
123
|
+
// ── receipts ─────────────────────────────────────────────────────────
|
|
124
|
+
async getReceipt(id) {
|
|
125
|
+
return (await this.get(`/v1/receipts/${encodeURIComponent(id)}`, true));
|
|
126
|
+
}
|
|
127
|
+
async verifyReceipt(receipt) {
|
|
128
|
+
const jwks = (await this.rawGet('/.well-known/jwks.json'));
|
|
129
|
+
return (0, receipt_1.verifyReceipt)(receipt, jwks);
|
|
130
|
+
}
|
|
131
|
+
// ── tag gate ─────────────────────────────────────────────────────────
|
|
132
|
+
/**
|
|
133
|
+
* Run `loader` once the subject has GRANTED at least one purpose in
|
|
134
|
+
* `purposeKeys` (opt-in auto-blocking). Re-runs on `notifyConsentChanged`.
|
|
135
|
+
*/
|
|
136
|
+
async gate(subject, purposeKeys, loader) {
|
|
137
|
+
const run = async () => {
|
|
138
|
+
const state = (await this.getConsentState(subject));
|
|
139
|
+
if (purposeKeys.some((k) => state.purposes?.[k]?.state === 'GRANTED'))
|
|
140
|
+
loader();
|
|
141
|
+
};
|
|
142
|
+
await run();
|
|
143
|
+
this.changeHandlers.add(() => void run());
|
|
144
|
+
}
|
|
145
|
+
/** Call after your banner writes new consent so gates re-evaluate. */
|
|
146
|
+
notifyConsentChanged(subjectId = '') {
|
|
147
|
+
this.cache.clear();
|
|
148
|
+
for (const h of this.changeHandlers)
|
|
149
|
+
h(subjectId);
|
|
150
|
+
}
|
|
151
|
+
/** Apply Consent Mode v2 signals to a gtag function. */
|
|
152
|
+
async applyConsentMode(subject, gtag) {
|
|
153
|
+
const { signals } = (await this.getConsentMode(subject));
|
|
154
|
+
gtag('consent', 'update', signals);
|
|
155
|
+
}
|
|
156
|
+
// ── transport ────────────────────────────────────────────────────────
|
|
157
|
+
async get(path, fresh = false) {
|
|
158
|
+
const key = path;
|
|
159
|
+
const cached = this.cache.get(key);
|
|
160
|
+
if (!fresh && cached && cached.expiresAt > Date.now())
|
|
161
|
+
return cached.value;
|
|
162
|
+
const headers = { authorization: `Bearer ${this.apiKey}` };
|
|
163
|
+
if (cached?.etag)
|
|
164
|
+
headers['if-none-match'] = cached.etag;
|
|
165
|
+
const res = await this.f(this.baseUrl + path, { headers });
|
|
166
|
+
if (res.status === 304 && cached) {
|
|
167
|
+
cached.expiresAt = Date.now() + this.ttl;
|
|
168
|
+
return cached.value;
|
|
169
|
+
}
|
|
170
|
+
const body = await this.parse(res);
|
|
171
|
+
this.cache.set(key, {
|
|
172
|
+
etag: res.headers.get('etag') ?? undefined,
|
|
173
|
+
value: body,
|
|
174
|
+
expiresAt: Date.now() + this.ttl,
|
|
175
|
+
});
|
|
176
|
+
return body;
|
|
177
|
+
}
|
|
178
|
+
async rawGet(path) {
|
|
179
|
+
const res = await this.f(this.baseUrl + path, { headers: { authorization: `Bearer ${this.apiKey}` } });
|
|
180
|
+
return this.parse(res);
|
|
181
|
+
}
|
|
182
|
+
async post(path, body, idempotencyKey) {
|
|
183
|
+
const headers = {
|
|
184
|
+
authorization: `Bearer ${this.apiKey}`,
|
|
185
|
+
'content-type': 'application/json',
|
|
186
|
+
};
|
|
187
|
+
if (idempotencyKey)
|
|
188
|
+
headers['idempotency-key'] = idempotencyKey;
|
|
189
|
+
const res = await this.f(this.baseUrl + path, { method: 'POST', headers, body: JSON.stringify(body) });
|
|
190
|
+
const parsed = await this.parse(res);
|
|
191
|
+
this.cache.clear(); // any write may change a cached read
|
|
192
|
+
return parsed;
|
|
193
|
+
}
|
|
194
|
+
async parse(res) {
|
|
195
|
+
const text = await res.text();
|
|
196
|
+
const json = text ? JSON.parse(text) : {};
|
|
197
|
+
if (!res.ok) {
|
|
198
|
+
throw new TripticonsentError(res.status, json.code ?? 'error', json.message ?? res.statusText, json.hint);
|
|
199
|
+
}
|
|
200
|
+
return json;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.TripticonsentClient = TripticonsentClient;
|
|
204
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AA+BzD,MAAa,kBAAmB,SAAQ,KAAK;IAE9B;IACA;IAEA;IAJX,YACW,MAAc,EACd,IAAY,EACnB,OAAe,EACR,IAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,SAAI,GAAJ,IAAI,CAAS;QAGpB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ;AAVD,gDAUC;AAED,MAAa,mBAAmB;IACX,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,GAAG,CAAS;IACZ,CAAC,CAAe;IAChB,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IACtC,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEzE,YAAY,IAA0B;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC;QACrC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC5F,CAAC;IAED,wEAAwE;IAExE,aAAa,CAAC,MAA2B,EAAE,OAAoC,EAAE;QAC7E,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MA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I,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,qCAAqC;QACzD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,GAAa;QAC7B,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACV,MAAM,IAAI,kBAAkB,CACxB,GAAG,CAAC,MAAM,EACT,IAAI,CAAC,IAAe,IAAI,OAAO,EAC/B,IAAI,CAAC,OAAkB,IAAI,GAAG,CAAC,UAAU,EAC1C,IAAI,CAAC,IAA0B,CAClC,CAAC;QACN,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA5MD,kDA4MC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { TripticonsentClient, TripticonsentError, type TripticonsentOptions, type RecordConsentParams, type ConsentInputState, type SubjectRef, } from './client';
|
|
2
|
+
export { verifyReceipt, type SignedReceipt } from './receipt';
|
|
3
|
+
export { canonicalJson } from './canonical';
|
|
4
|
+
export declare const SDK_VERSION = "0.1.0";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SDK_VERSION = exports.canonicalJson = exports.verifyReceipt = exports.TripticonsentError = exports.TripticonsentClient = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "TripticonsentClient", { enumerable: true, get: function () { return client_1.TripticonsentClient; } });
|
|
6
|
+
Object.defineProperty(exports, "TripticonsentError", { enumerable: true, get: function () { return client_1.TripticonsentError; } });
|
|
7
|
+
var receipt_1 = require("./receipt");
|
|
8
|
+
Object.defineProperty(exports, "verifyReceipt", { enumerable: true, get: function () { return receipt_1.verifyReceipt; } });
|
|
9
|
+
var canonical_1 = require("./canonical");
|
|
10
|
+
Object.defineProperty(exports, "canonicalJson", { enumerable: true, get: function () { return canonical_1.canonicalJson; } });
|
|
11
|
+
exports.SDK_VERSION = '0.1.0';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAOkB;AANd,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAMtB,qCAA8D;AAArD,wGAAA,aAAa,OAAA;AACtB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAET,QAAA,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SignedReceipt {
|
|
2
|
+
payload: unknown;
|
|
3
|
+
signature: string;
|
|
4
|
+
kid: string;
|
|
5
|
+
}
|
|
6
|
+
interface Jwk {
|
|
7
|
+
kid?: string;
|
|
8
|
+
kty?: string;
|
|
9
|
+
crv?: string;
|
|
10
|
+
x?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Verify a consent receipt offline against a JWKS. Uses Web Crypto (Ed25519),
|
|
14
|
+
* available in modern browsers and Node ≥ 20.
|
|
15
|
+
*/
|
|
16
|
+
export declare function verifyReceipt(receipt: SignedReceipt, jwks: {
|
|
17
|
+
keys: Jwk[];
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
export {};
|
package/dist/receipt.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyReceipt = verifyReceipt;
|
|
4
|
+
const canonical_1 = require("./canonical");
|
|
5
|
+
function fromBase64Url(s) {
|
|
6
|
+
const b64 = s.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(s.length / 4) * 4, '=');
|
|
7
|
+
const bin = atob(b64); // available in browsers and Node ≥ 16
|
|
8
|
+
const out = new Uint8Array(bin.length);
|
|
9
|
+
for (let i = 0; i < bin.length; i++)
|
|
10
|
+
out[i] = bin.charCodeAt(i);
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
function toBufferSource(u8) {
|
|
14
|
+
// Detach from any SharedArrayBuffer typing so Web Crypto accepts it.
|
|
15
|
+
return u8.slice();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Verify a consent receipt offline against a JWKS. Uses Web Crypto (Ed25519),
|
|
19
|
+
* available in modern browsers and Node ≥ 20.
|
|
20
|
+
*/
|
|
21
|
+
async function verifyReceipt(receipt, jwks) {
|
|
22
|
+
const jwk = jwks.keys.find((k) => k.kid === receipt.kid);
|
|
23
|
+
if (!jwk)
|
|
24
|
+
return false;
|
|
25
|
+
try {
|
|
26
|
+
const key = await crypto.subtle.importKey('jwk', jwk, { name: 'Ed25519' }, false, ['verify']);
|
|
27
|
+
const data = toBufferSource(new TextEncoder().encode((0, canonical_1.canonicalJson)(receipt.payload)));
|
|
28
|
+
return await crypto.subtle.verify('Ed25519', key, toBufferSource(fromBase64Url(receipt.signature)), data);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=receipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../src/receipt.ts"],"names":[],"mappings":";;AAgCA,sCAUC;AA1CD,2CAA4C;AAe5C,SAAS,aAAa,CAAC,CAAS;IAC5B,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,I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,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9G,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tripticonsent/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Browser + Node SDK for the tripticonsent consent & preference API.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist"],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/tripticonsentdevops/tripticonsent.git",
|
|
22
|
+
"directory": "packages/sdk-js"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://tripticonsent.tripticode.com/docs",
|
|
25
|
+
"bugs": "https://github.com/tripticonsentdevops/tripticonsent/issues",
|
|
26
|
+
"keywords": ["consent", "cmp", "gdpr", "privacy", "preference-center", "consent-management"],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
+
"lint": "eslint src",
|
|
34
|
+
"test": "jest"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@tripticonsent/config": "*"
|
|
38
|
+
}
|
|
39
|
+
}
|