Skip to content

feat: add privacy string accessors - #138

Closed
ethanpschoen wants to merge 2 commits into
ethanpschoen/refactor/device-locale-helpersfrom
ethanpschoen/feat/privacy-string-accessors
Closed

feat: add privacy string accessors#138
ethanpschoen wants to merge 2 commits into
ethanpschoen/refactor/device-locale-helpersfrom
ethanpschoen/feat/privacy-string-accessors

Conversation

@ethanpschoen

@ethanpschoen ethanpschoen commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description of this change

Adds accessors for the IAB privacy strings the tag writes to native storage: TCF TC string, US Privacy string, GPP header string, and a generic getSavedString helper.

The util barrel export (util/index.ts) also picks up ./deviceLocale from the PR below this one in the stack, since both additions land in the same import block.

Part 2/5 of the split of #126. Full stack: #137#138#139#140#141.

Review finding fixed here: Getters miss preferenceStorage valuesgetSavedString and the IAB helpers always read via nativeStorage, so they never saw values persisted through a custom preferenceStorage backend (required for Expo Android per the README). Fixed by accepting an optional reader parameter, defaulting to the existing nativeStorage.read. The provider wiring that builds a reader from the configured preferenceStorage and binds these accessors to it lands in #141.

Why is this change being made?

  • Chore (non-functional changes)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How was this tested? How can the reviewer verify your testing?

npm run lint and npm run typecheck pass standalone on this branch. No dedicated unit tests exist for privacyStrings.ts on the source branch — the functions are thin wrappers around nativeStorage, exercised indirectly once the KetchService members are exposed in #141.

The full 5-PR stack was verified as a faithful, complete split of #126 before publishing: git diff --exit-code <top-of-stack> origin/ethanpschoen/feat/headless-api is empty (exit 0), and the top of the stack passes the full local gate (lint, typecheck, build, npm test).

Related issues

Refs #126.

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have evaluated the security impact of this change, and OWASP Secure Coding Practices have been observed.
  • I have informed stakeholders of my changes.

Adds accessors for the IAB privacy strings the tag writes to native storage (TCF TC string, US Privacy string, GPP header string) and a generic getSavedString helper.

The util barrel export also picks up the device-locale module from the prior PR in this stack, since both additions land in the same import block.

Part 2/5 of the split of #126.
@ethanpschoen ethanpschoen changed the title ethanpschoen/feat/privacy string accessors feat: add privacy string accessors Aug 6, 2026
@ethanpschoen
ethanpschoen marked this pull request as ready for review August 6, 2026 20:59
@ethanpschoen
ethanpschoen requested review from a team as code owners August 6, 2026 20:59

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 98a034a. Configure here.

Comment thread package/src/util/privacyStrings.ts Outdated
getSavedString and the IAB helpers always read through nativeStorage.read, so they never saw values persisted via a custom preferenceStorage backend. That backend is required for Expo Android in the README, and on that setup crossPlatformRead falls back to React Native Settings, which is a no-op on Android — so these accessors returned empty strings after consent updates whenever preferenceStorage was configured.

This PR adds the capability (an optional reader parameter, defaulting to the existing nativeStorage.read). The provider wiring that actually builds a reader from the configured preferenceStorage and binds these accessors to it lands in #141, alongside the rest of the KetchService exposure.

Refs #126.
@ethanpschoen
ethanpschoen deleted the ethanpschoen/feat/privacy-string-accessors branch August 7, 2026 23:29
@ethanpschoen
ethanpschoen restored the ethanpschoen/feat/privacy-string-accessors branch August 7, 2026 23:31
@ethanpschoen ethanpschoen reopened this Aug 7, 2026
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.

1 participant