Skip to content

secureSignals: add secureSignalsFromEids building GPT secure signals from cached EIDs - #339

Open
etiennelatendresse-optable wants to merge 3 commits into
masterfrom
secure-signals-filter
Open

etiennelatendresse-optable wants to merge 3 commits into
masterfrom
secure-signals-filter

Conversation

@etiennelatendresse-optable

@etiennelatendresse-optable etiennelatendresse-optable commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Why

A new setSecureSignals function would allow to filter cached EIDs and pass them to GPT secure signals

What Changed

  • secureSignalsFromEids flattens EIDs into { provider, id } pairs for installGPTSecureSignals, filtered by sources/inserters/matchers
  • Add tests
  • Update README.md under GAM secure signals.

How to Test

  • Tested
  • Docs updated

Notes

@jplaroche

jplaroche commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

SecureSignalEid duplicates a type we already have. EID from iab-openrtb/v26 declares exactly these fields (inserter?, source, matcher?, uids), and it is already imported in lib/addons/uid2-refresh.ts and lib/core/resolvers/resolveMultiTargeting.ts. lib/core/prebid/rtd.ts also hand-rolls its own local EID, so this would be the third definition of the same shape — if ORTB adds or renames a field, the local copies silently drift.

The local type is looser on purpose (cached EIDs are parsed from localStorage, so uids can be missing and a uid can lack an id — the tests cover both), which the strict ORTB type does not allow. Deriving keeps the field names and the tolerance:

import type { EID, UID } from "iab-openrtb/v26";

// Cached EIDs are parsed from storage, so ORTB's required fields may be
// absent at runtime. Derived from EID so new/renamed ORTB fields flow through.
type SecureSignalEid = Partial<Omit<EID, "uids">> & Pick<EID, "source"> & { uids?: Array<Partial<UID>> };

No behaviour change, and the existing tests (including { id: "" } and {} uids) still typecheck.

Alternative, if you would rather not carry the runtime tolerance: use EID directly and adjust the two malformed-uid fixtures. That trades defensiveness against untrusted cache contents for a simpler type — your call which side to land on.

Sent using Claude

Comment thread README.md

To build the signals from cached EIDs instead of by hand, `secureSignalsFromEids(eids, filter?)` builds one `{ provider, id }` pair per EID source — GPT keys secure signals by provider, so the first non-empty uid per source wins — optionally filtered by `sources`, `inserters` or `matchers` (an empty or missing list means no constraint on that field):

```javascript

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth it to mention the next snippers is when using the npm package, and add an example when loading the sdk.js file on the page (as the other examples shows).

@jplaroche

Copy link
Copy Markdown
Contributor

should we include this in gpt.ts instead of on it's own ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants