feat: install tokenizer package & enrich google pay callback data#64
Open
SanthoshCharanBolt wants to merge 1 commit intomainfrom
Open
feat: install tokenizer package & enrich google pay callback data#64SanthoshCharanBolt wants to merge 1 commit intomainfrom
SanthoshCharanBolt wants to merge 1 commit intomainfrom
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
bd0d6a0 to
82b6cbd
Compare
82b6cbd to
148fedd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves wallet-payment tokenization (Apple Pay, Google Pay) from the native iOS/Android modules onto the JS side using the
@boltpay/tokenizerpackage. Native modules now return the raw PKPayment / Google Pay payload, and a newuseTkClient()hook tokenizes viaTkClient.postApplePayToken()/postGooglePayToken(), which performs an asymmetric-encrypted POST to Bolt's tokenizer service. This aligns the RN SDK with the tokenizer pattern used on web and deletes the native HTTP tokenizer code (ApplePayModule.swift, GooglePayModule.kt) plus its fallback logic.react-native-get-random-valuesis added as a peerDependency so tweetnacl (inside@boltpay/tokenizer) has a secure PRNG on Hermes/JSC — the SDK side-effect-imports it internally, so consumers install the package once (documented in the README) and need no code changes.ApplePayResultdropslast4(the Apple Pay tokenizer never populates it — the decrypted payload only carries the DPAN) and keepsboltReferenceas an optional webview-only field.Testing
src/__tests__/ApplePay.test.tsx,src/__tests__/WalletTypes.test.ts,src/__tests__/GoogleWallet.test.tsx) — 159/159 tests, plus typecheck + lint clean.tkClient.postApplePayToken()→ tokenized result delivered viaonComplete.tkClient.postGooglePayToken()→ tokenized result withbin,last4,expiry.ApplePayResulttype which now haslast4?added), error paths wheretkClient.post*Token()returns anError(re-thrown intoonError), and fallback behavior if the tokenizer's primary host fails (TkClient retries the alternative host internally).Security Review
Important
A security review is required for every PR in this repository to comply with PCI requirements.
Security Impact Summary
This PR touches a PCI-relevant flow: wallet payment tokenization. The material change is where the encrypted tokenization request is assembled — previously the native module POSTed the raw PKPayment / Google Pay payload as JSON over HTTPS to
*.bolttk.com; now the JS-side@boltpay/tokenizerencrypts the request body with the tokenizer service's public key (tweetnaclbox) before POSTing. The payment payload is therefore end-to-end-encrypted between the device and the tokenizer service rather than relying only on TLS. No payment data is stored, logged, or exposed to consumer app code — the raw payload passes straight from the native module toTkClientand is discarded after tokenization.react-native-get-random-values(peer dep) is the widely-used RN bridge to platform CSPRNGs (SecRandomCopyBytes/java.security.SecureRandom); it is required because Hermes/JSC do not shipcrypto.getRandomValues, and without it tweetnacl throws at keypair generation. No changes to stored tokens, Bolt API surface, or authentication.