@trustpin/react-native-attest 7.1.1 → 8.0.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/Package.swift +79 -0
- package/README.md +67 -60
- package/TrustPinReactNativeAttest.podspec +16 -4
- package/android/build.gradle +10 -8
- package/package.json +6 -2
package/Package.swift
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
|
+
//
|
|
3
|
+
// Swift Package Manager manifest for React Native's SwiftPM mode (React Native
|
|
4
|
+
// 0.88 and later, `npx react-native spm add`). CocoaPods apps use
|
|
5
|
+
// TrustPinReactNativeAttest.podspec instead and never read this file.
|
|
6
|
+
//
|
|
7
|
+
// React Native's autolinker treats a hand-written manifest as self-managed: it
|
|
8
|
+
// references it through <app>/build/generated/autolinking/libs/TrustPinReactNativeAttest and
|
|
9
|
+
// depends on the product named like the package (`swiftpmConfig.name` in
|
|
10
|
+
// package.json). SwiftPM resolves the relative paths below against that link,
|
|
11
|
+
// so React Native's own packages are at fixed places, as in the manifests
|
|
12
|
+
// `npx react-native spm scaffold` writes:
|
|
13
|
+
// ../../../../xcframeworks React Native (ReactHeaders, ReactNativeHeaders, ...)
|
|
14
|
+
// ../../../ios the app's codegen package (ReactAppHeaders)
|
|
15
|
+
// The manifest therefore resolves inside a React Native app only.
|
|
16
|
+
//
|
|
17
|
+
// SwiftPM cannot compile Swift and Objective-C++ in one target, so the Swift
|
|
18
|
+
// bridge and the TurboModule adapter are two targets behind one product.
|
|
19
|
+
|
|
20
|
+
import PackageDescription
|
|
21
|
+
|
|
22
|
+
let package = Package(
|
|
23
|
+
name: "TrustPinReactNativeAttest",
|
|
24
|
+
platforms: [.iOS("15.1")],
|
|
25
|
+
products: [
|
|
26
|
+
.library(name: "TrustPinReactNativeAttest", targets: ["TrustPinReactNativeAttest", "TrustPinReactNativeAttestObjC"]),
|
|
27
|
+
],
|
|
28
|
+
dependencies: [
|
|
29
|
+
// Same package and requirement as TrustPinReactNativeAttest.podspec and
|
|
30
|
+
// scripts/trustpin_pods.rb (scripts/check-version-lockstep.sh asserts it).
|
|
31
|
+
.package(url: "https://github.com/trustpin-cloud/swift.sdk", .upToNextMinor(from: "8.0.0")),
|
|
32
|
+
.package(name: "ReactNative", path: "../../../../xcframeworks"),
|
|
33
|
+
.package(name: "React-GeneratedCode", path: "../../../ios"),
|
|
34
|
+
],
|
|
35
|
+
targets: [
|
|
36
|
+
// The Swift bridge: the module an app imports to call start(). Its
|
|
37
|
+
// generated -Swift.h header exposes it to the adapter below.
|
|
38
|
+
.target(
|
|
39
|
+
name: "TrustPinReactNativeAttest",
|
|
40
|
+
dependencies: [
|
|
41
|
+
.product(name: "TrustPinAttestKit", package: "swift.sdk"),
|
|
42
|
+
.product(name: "TrustPinKit", package: "swift.sdk"),
|
|
43
|
+
],
|
|
44
|
+
path: "ios",
|
|
45
|
+
sources: [
|
|
46
|
+
"TrustPinAttestBridge.swift",
|
|
47
|
+
"TrustPinAttestEventHub.swift",
|
|
48
|
+
"TrustPinAttestWire.swift",
|
|
49
|
+
"TrustPinReactNativeAttest.swift",
|
|
50
|
+
]
|
|
51
|
+
),
|
|
52
|
+
// The TurboModule adapter (Objective-C++), registered by name through
|
|
53
|
+
// codegen.
|
|
54
|
+
.target(
|
|
55
|
+
name: "TrustPinReactNativeAttestObjC",
|
|
56
|
+
dependencies: [
|
|
57
|
+
.target(name: "TrustPinReactNativeAttest"),
|
|
58
|
+
.product(name: "ReactHeaders", package: "ReactNative"),
|
|
59
|
+
.product(name: "ReactNativeHeaders", package: "ReactNative"),
|
|
60
|
+
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
|
|
61
|
+
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
|
|
62
|
+
],
|
|
63
|
+
path: "ios",
|
|
64
|
+
sources: [
|
|
65
|
+
"TrustPinReactNativeAttestModule.mm",
|
|
66
|
+
],
|
|
67
|
+
// The adapter headers stay next to their sources, as in the podspec;
|
|
68
|
+
// nothing imports this module, its classes register by name.
|
|
69
|
+
publicHeadersPath: ".",
|
|
70
|
+
cxxSettings: [
|
|
71
|
+
.headerSearchPath("."),
|
|
72
|
+
.define("DEBUG", .when(configuration: .debug)),
|
|
73
|
+
.define("NDEBUG", .when(configuration: .release)),
|
|
74
|
+
],
|
|
75
|
+
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation")]
|
|
76
|
+
),
|
|
77
|
+
],
|
|
78
|
+
cxxLanguageStandard: .cxx20
|
|
79
|
+
)
|
package/README.md
CHANGED
|
@@ -3,30 +3,29 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@trustpin/react-native-attest)
|
|
4
4
|
|
|
5
5
|
Proves to your API that a request comes from **your genuine app on a genuine
|
|
6
|
-
device** that meets your policy. The device attests
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
device** that meets your policy. The device attests to **your own** TrustPin
|
|
7
|
+
verifier (Apple App Attest, Android Key Attestation or Play Integrity) and
|
|
8
|
+
receives a short-lived token, which travels in the `TrustPin-Attestation`
|
|
9
|
+
header; your API or gateway verifies it.
|
|
10
10
|
|
|
11
|
-
This package
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
the pinning package
|
|
15
|
-
verifier, and adds the header to your app's requests.
|
|
11
|
+
This package wraps the native attestation modules, `TrustPinAttestKit` and
|
|
12
|
+
`cloud.trustpin:kotlin-attest` 8.0.x. It requires
|
|
13
|
+
[`@trustpin/react-native`](https://www.npmjs.com/package/@trustpin/react-native),
|
|
14
|
+
the pinning package.
|
|
16
15
|
|
|
17
|
-
Attestation is not runtime protection
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
Attestation is not runtime protection. Setup, the policy, deploying the
|
|
17
|
+
verifier and verifying tokens are covered at
|
|
18
|
+
[docs.trustpin.cloud](https://docs.trustpin.cloud).
|
|
20
19
|
|
|
21
20
|
## Requirements
|
|
22
21
|
|
|
23
22
|
| | Minimum |
|
|
24
23
|
|---|---|
|
|
25
24
|
| React Native | **0.85** (New Architecture only) |
|
|
26
|
-
| `@trustpin/react-native` | the same version, **
|
|
25
|
+
| `@trustpin/react-native` | the same version, **8.0.x** |
|
|
27
26
|
| iOS | 15.0+ |
|
|
28
|
-
| Android | minSdk 25 (Android 7.1), **Kotlin 2.
|
|
29
|
-
| Verifier |
|
|
27
|
+
| Android | minSdk 25 (Android 7.1), **Kotlin 2.2.0+** |
|
|
28
|
+
| Verifier | 1.0.0 or later |
|
|
30
29
|
|
|
31
30
|
## Installation
|
|
32
31
|
|
|
@@ -34,7 +33,21 @@ verifying tokens are covered at [docs.trustpin.cloud](https://docs.trustpin.clou
|
|
|
34
33
|
npm install @trustpin/react-native @trustpin/react-native-attest
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
Both packages must be on the same version.
|
|
36
|
+
Both packages must be on the same version. React Native's Swift Package
|
|
37
|
+
Manager mode (React Native 0.88 and later) is supported experimentally.
|
|
38
|
+
|
|
39
|
+
## Migrating to 8.0.0
|
|
40
|
+
|
|
41
|
+
8.0.0 requires `@trustpin/react-native` 8.0.x and the TrustPin native SDKs
|
|
42
|
+
8.0.x. Downgrading to 7.x is not supported.
|
|
43
|
+
|
|
44
|
+
- iOS: the native SDK is installed through Swift Package Manager; the
|
|
45
|
+
`trustpin_post_install(installer)` Podfile line from `@trustpin/react-native`
|
|
46
|
+
covers this package too.
|
|
47
|
+
- Attested hosts must be written in ASCII form (an internationalized name in
|
|
48
|
+
its `xn--` form).
|
|
49
|
+
- Apply the changes listed in "Migrating to 8.0.0" in the
|
|
50
|
+
[`@trustpin/react-native` README](https://github.com/trustpin-cloud/react-native.sdk#migrating-to-800).
|
|
38
51
|
|
|
39
52
|
## Before you write code
|
|
40
53
|
|
|
@@ -42,9 +55,7 @@ Both packages must be on the same version.
|
|
|
42
55
|
ID, or package name and signing-certificate digests) and publish the policy.
|
|
43
56
|
- **Your verifier:** deployed and reachable from the app, and its host
|
|
44
57
|
registered as a domain of your TrustPin project, because verifier calls are
|
|
45
|
-
pinned.
|
|
46
|
-
(`VERIFIER_UNAVAILABLE`) and no header is sent. An older verifier is refused
|
|
47
|
-
(`VERIFIER_INCOMPATIBLE`).
|
|
58
|
+
pinned.
|
|
48
59
|
- **iOS:** the **App Attest** capability, which adds the entitlement
|
|
49
60
|
`com.apple.developer.devicecheck.appattest-environment`: `development` for
|
|
50
61
|
builds run from Xcode, `production` for TestFlight and the App Store.
|
|
@@ -77,8 +88,8 @@ development build.
|
|
|
77
88
|
|
|
78
89
|
| Prop | Type | Notes |
|
|
79
90
|
|------|------|-------|
|
|
80
|
-
| `verifierUrl` | string | Your verifier
|
|
81
|
-
| `attestedHosts` | string[] | The hosts that receive the header: exact names, or `*.example.com
|
|
91
|
+
| `verifierUrl` | string | Your verifier's HTTPS URL. Set it with `attestedHosts`, or neither when your pinning `configFile`s already carry the keys. |
|
|
92
|
+
| `attestedHosts` | string[] | The hosts that receive the header, in ASCII form: exact names, or `*.example.com`. No other host receives it. |
|
|
82
93
|
| `googleCloudProjectNumber` | string | Android, when the policy uses Play Integrity. |
|
|
83
94
|
| `appAttestEnvironment` | `development` \| `production` | The iOS entitlement's value. Defaults to `production`. |
|
|
84
95
|
| `logLevel` | `none` \| `error` \| `warning` \| `info` \| `debug` | Passed to the native init helper. |
|
|
@@ -109,7 +120,7 @@ To the files the pinning setup reads.
|
|
|
109
120
|
```
|
|
110
121
|
|
|
111
122
|
Leave `google_cloud_project_number` out unless the policy uses Play
|
|
112
|
-
Integrity
|
|
123
|
+
Integrity.
|
|
113
124
|
|
|
114
125
|
### 2. Start attestation after pinning
|
|
115
126
|
|
|
@@ -137,10 +148,12 @@ override fun onCreate() {
|
|
|
137
148
|
}
|
|
138
149
|
```
|
|
139
150
|
|
|
140
|
-
Then `cd ios && pod install`, and rebuild.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
151
|
+
Then `cd ios && pod install`, and rebuild. The Podfile's
|
|
152
|
+
`trustpin_post_install(installer)` line from the
|
|
153
|
+
[`@trustpin/react-native` setup](https://github.com/trustpin-cloud/react-native.sdk#3-ios--embed-the-native-sdk)
|
|
154
|
+
also covers this package; there is no second line to add. A setup failure
|
|
155
|
+
never crashes the app; it shows in the log and the state, and requests go out
|
|
156
|
+
without the header.
|
|
144
157
|
|
|
145
158
|
## Send the header
|
|
146
159
|
|
|
@@ -148,12 +161,10 @@ go out without the header.
|
|
|
148
161
|
`XMLHttpRequest`, axios) carries the header to the attested hosts, added
|
|
149
162
|
natively:
|
|
150
163
|
|
|
151
|
-
- Requests are never failed by the SDK: when no token is ready
|
|
152
|
-
|
|
153
|
-
decides.
|
|
164
|
+
- Requests are never failed by the SDK: when no token is ready, the request
|
|
165
|
+
goes out **without** the header, and your API decides.
|
|
154
166
|
- A header the request already carries is kept.
|
|
155
|
-
- A redirect never carries the header to another host
|
|
156
|
-
header for its own URL only.
|
|
167
|
+
- A redirect never carries the header to another host.
|
|
157
168
|
|
|
158
169
|
For transports React Native's networking doesn't carry (gRPC, some WebSocket
|
|
159
170
|
clients), send `await TrustPinAttest.getToken()` in the `TrustPin-Attestation`
|
|
@@ -169,10 +180,11 @@ await TrustPinAttest.bindToHeader('Authorization');
|
|
|
169
180
|
TrustPinAttest.prefetch();
|
|
170
181
|
```
|
|
171
182
|
|
|
172
|
-
Each token is then bound to the request's `Authorization` value
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
the
|
|
183
|
+
Each token is then bound to the request's `Authorization` value, so a token
|
|
184
|
+
taken from one session is useless with another. `setTokenBinding(value)` binds
|
|
185
|
+
to a fixed value instead; each mode clears the other. `setTokenBinding(null)`
|
|
186
|
+
removes the fixed binding only; `bindToHeader(null)` stops header binding and
|
|
187
|
+
also clears a fixed binding.
|
|
176
188
|
|
|
177
189
|
## Sensitive operations: assertions
|
|
178
190
|
|
|
@@ -183,17 +195,18 @@ digest of your choice, typically the request body:
|
|
|
183
195
|
```ts
|
|
184
196
|
const body = JSON.stringify({ amount: '1.00', to: 'demo' });
|
|
185
197
|
const headers = { Authorization: `Bearer ${session}`, 'Content-Type': 'application/json' };
|
|
198
|
+
// With header binding, ask for this request's token first, so it is bound to
|
|
199
|
+
// this Authorization value; then add the assertion.
|
|
200
|
+
Object.assign(headers, await TrustPinAttest.attestationHeaders(url, { method: 'POST', headers }));
|
|
186
201
|
Object.assign(headers, await TrustPinAttest.assertionHeaders(sha256(body))); // 32 bytes
|
|
187
202
|
await fetch(url, { method: 'POST', headers, body });
|
|
188
203
|
```
|
|
189
204
|
|
|
190
205
|
- `assertionHeaders` takes the digest as 32 bytes (`Uint8Array` or
|
|
191
206
|
`ArrayBuffer`) or 64 hex characters, and returns both headers: the token and
|
|
192
|
-
`TrustPin-Assertion`.
|
|
207
|
+
`TrustPin-Assertion`. Make one call per operation.
|
|
193
208
|
- Your backend passes both headers and its own digest of what it received to
|
|
194
209
|
your verifier.
|
|
195
|
-
- It rejects with `INVALID_DIGEST` for a digest that isn't 32 bytes, and with
|
|
196
|
-
the usual codes when no token is available.
|
|
197
210
|
|
|
198
211
|
React Native has no built-in digest API; use your crypto library of choice.
|
|
199
212
|
|
|
@@ -206,10 +219,12 @@ the build, never from a file:
|
|
|
206
219
|
environment, or pass `TrustPinReactNativeAttest.start(debugToken:)` from a
|
|
207
220
|
debug-only build setting. Ignored on devices.
|
|
208
221
|
- **Android:** pass `TrustPinReactNativeAttest.start(this, level, debugToken)`
|
|
209
|
-
from a debug-only `BuildConfig` field. Used only in debuggable builds.
|
|
222
|
+
from a debug-only `BuildConfig` field. Used only in debuggable builds. A
|
|
223
|
+
debug build with an `applicationIdSuffix` must be listed in the policy as
|
|
224
|
+
its own package.
|
|
210
225
|
|
|
211
226
|
Your policy (**Allow debug tokens**) and your verifier must both allow debug
|
|
212
|
-
tokens.
|
|
227
|
+
tokens. Production APIs should refuse them.
|
|
213
228
|
|
|
214
229
|
## State, events, errors and logging
|
|
215
230
|
|
|
@@ -225,16 +240,10 @@ const subscription = TrustPinAttest.onStateChange(state => {
|
|
|
225
240
|
```
|
|
226
241
|
|
|
227
242
|
- `onStateChange` delivers the current state first, then every change.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
- `onEvent` reports what the SDK did, for your monitoring: keys generated or
|
|
233
|
-
replaced, attestations and renewals with their durations, refusals and waits
|
|
234
|
-
with their end, unsupported devices, an unreachable verifier, and
|
|
235
|
-
assertions. Events never contain a token, a key or a device identifier, and
|
|
236
|
-
those from before JavaScript was running replay to the first subscriber.
|
|
237
|
-
New event types can appear in a minor release: keep a default case.
|
|
243
|
+
`getState()` returns the current state.
|
|
244
|
+
- `onEvent` reports what the SDK did, for your monitoring. Events never
|
|
245
|
+
contain a token, a key or a device identifier. New event types can appear
|
|
246
|
+
in a minor release: keep a default case.
|
|
238
247
|
- Errors are `TrustPinAttestError` with a stable `code`:
|
|
239
248
|
|
|
240
249
|
| Code | Meaning |
|
|
@@ -242,26 +251,27 @@ const subscription = TrustPinAttest.onStateChange(state => {
|
|
|
242
251
|
| `INVALID_CONFIGURATION` | A configuration value was rejected, or the file is missing |
|
|
243
252
|
| `ALREADY_INITIALIZED` | Setup ran twice |
|
|
244
253
|
| `NOT_SET_UP` | The native init helper never ran |
|
|
245
|
-
| `UNSUPPORTED_DEVICE` |
|
|
254
|
+
| `UNSUPPORTED_DEVICE` | This device can't attest the app |
|
|
246
255
|
| `EVIDENCE_UNAVAILABLE` | The device can't produce the evidence the policy requires |
|
|
247
256
|
| `BINDING_REQUIRED` | The policy requires a binding and none is set yet |
|
|
248
257
|
| `ATTESTATION_FAILED` | The verifier refused; see `reasons` |
|
|
249
|
-
| `VERIFIER_UNAVAILABLE` | The verifier couldn't be reached
|
|
258
|
+
| `VERIFIER_UNAVAILABLE` | The verifier couldn't be reached |
|
|
250
259
|
| `VERIFIER_INCOMPATIBLE` | The verifier is too old for this SDK; update it |
|
|
251
260
|
| `INVALID_DIGEST` | `assertionHeaders` got a digest that isn't 32 bytes |
|
|
261
|
+
| `INVALID_ARGUMENTS` | An argument was rejected |
|
|
262
|
+
| `CANCELLED` | The operation was cancelled |
|
|
263
|
+
| `ATTEST_ERROR` | Another attestation error |
|
|
252
264
|
|
|
253
265
|
New codes can appear in a minor release: handle unknown ones.
|
|
254
266
|
|
|
255
267
|
- Logging is off by default: `setLogLevel('debug')` in development, and
|
|
256
268
|
`onLogEvent` to route messages. Logs never contain tokens, key
|
|
257
269
|
certificates, bound values or debug tokens.
|
|
258
|
-
- `reset()` discards the device key
|
|
259
|
-
support flows, not routine use, and does nothing before setup.
|
|
270
|
+
- `reset()` discards the device key. It's for support flows, not routine use.
|
|
260
271
|
|
|
261
272
|
## Backups and privacy
|
|
262
273
|
|
|
263
|
-
- Device keys
|
|
264
|
-
app attests again.
|
|
274
|
+
- Device keys are never backed up or synced: a restored app attests again.
|
|
265
275
|
- Evidence and tokens go only to your verifier, nothing to TrustPin.
|
|
266
276
|
- iOS: the native framework ships a privacy manifest (no tracking, no
|
|
267
277
|
collected data).
|
|
@@ -272,10 +282,7 @@ const subscription = TrustPinAttest.onStateChange(state => {
|
|
|
272
282
|
|
|
273
283
|
The repository's [`example/`](https://github.com/trustpin-cloud/react-native.sdk/tree/main/example)
|
|
274
284
|
and [`example-expo/`](https://github.com/trustpin-cloud/react-native.sdk/tree/main/example-expo)
|
|
275
|
-
have an **Attestation** tab, next to the **Pinning** one
|
|
276
|
-
with a token bound to the `Authorization` header, a sensitive call with an
|
|
277
|
-
assertion, sign-out and reset, with the SDK's state, events and logs in the
|
|
278
|
-
tab's own log.
|
|
285
|
+
have an **Attestation** tab, next to the **Pinning** one.
|
|
279
286
|
|
|
280
287
|
## License
|
|
281
288
|
|
|
@@ -22,11 +22,23 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
s.private_header_files = ["ios/TrustPinReactNativeAttestModule.h"]
|
|
23
23
|
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
|
|
24
24
|
|
|
25
|
-
# Native attestation module, locked to the
|
|
25
|
+
# Native attestation module, locked to the 8.0.x line, the same line as
|
|
26
26
|
# @trustpin/react-native: it registers itself on the pinning SDK's default
|
|
27
|
-
# instance, so both resolve one TrustPinKit.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
# instance, so both resolve one TrustPinKit. Both come from the swift.sdk
|
|
28
|
+
# Swift package, added to the Pods project by React Native's spm_dependency
|
|
29
|
+
# helper at `pod install`. The URL and requirement match
|
|
30
|
+
# TrustPinReactNative.podspec exactly: the helper adds the package once, with
|
|
31
|
+
# the requirement of whichever podspec it sees first.
|
|
32
|
+
unless defined?(spm_dependency)
|
|
33
|
+
raise Pod::Informative, "#{s.name} needs React Native's spm_dependency " \
|
|
34
|
+
"helper (react-native >= 0.85): run `pod install` from a React Native app " \
|
|
35
|
+
"whose Podfile requires react_native_pods.rb."
|
|
36
|
+
end
|
|
37
|
+
spm_dependency(s,
|
|
38
|
+
url: "https://github.com/trustpin-cloud/swift.sdk",
|
|
39
|
+
requirement: { kind: "upToNextMinorVersion", minimumVersion: "8.0.0" },
|
|
40
|
+
products: ["TrustPinAttestKit", "TrustPinKit"]
|
|
41
|
+
)
|
|
30
42
|
|
|
31
43
|
# React Native core + New Architecture (TurboModule codegen) dependencies.
|
|
32
44
|
install_modules_dependencies(s)
|
package/android/build.gradle
CHANGED
|
@@ -2,7 +2,7 @@ def safeExtGet(prop, fallback) {
|
|
|
2
2
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
def requiredKotlinVersion = "2.
|
|
5
|
+
def requiredKotlinVersion = "2.2.0"
|
|
6
6
|
|
|
7
7
|
static def versionAtLeast(String actual, String required) {
|
|
8
8
|
def parse = { it.split("[.-]").findAll { p -> p.isInteger() }.collect { p -> p.toInteger() } }
|
|
@@ -18,8 +18,9 @@ static def versionAtLeast(String actual, String required) {
|
|
|
18
18
|
apply plugin: "com.android.library"
|
|
19
19
|
apply plugin: "kotlin-android"
|
|
20
20
|
|
|
21
|
-
// The `cloud.trustpin:kotlin-attest` artifact is published with Kotlin 2.3
|
|
22
|
-
//
|
|
21
|
+
// The `cloud.trustpin:kotlin-attest` artifact is published with Kotlin 2.3 binary
|
|
22
|
+
// metadata; Kotlin 2.2.0 is the oldest compiler that reads it (2.0 and 2.1
|
|
23
|
+
// fail on the metadata and on the transitive kotlin-stdlib 2.3.0). Without this
|
|
23
24
|
// check the build fails with dozens of "incompatible version of Kotlin" errors
|
|
24
25
|
// that say nothing about how to fix them.
|
|
25
26
|
//
|
|
@@ -38,8 +39,9 @@ try {
|
|
|
38
39
|
if (!versionAtLeast(resolvedKotlinVersion.toString(), requiredKotlinVersion)) {
|
|
39
40
|
throw new GradleException(
|
|
40
41
|
"@trustpin/react-native-attest requires Kotlin ${requiredKotlinVersion} or newer, " +
|
|
41
|
-
"but this app builds with ${resolvedKotlinVersion}. The TrustPin Kotlin SDK
|
|
42
|
-
"
|
|
42
|
+
"but this app builds with ${resolvedKotlinVersion}. The TrustPin Kotlin SDK " +
|
|
43
|
+
"carries Kotlin 2.3 metadata, which Kotlin ${requiredKotlinVersion} or newer reads. " +
|
|
44
|
+
"Pin the Kotlin plugin " +
|
|
43
45
|
"in your android/build.gradle buildscript classpath:\n" +
|
|
44
46
|
" classpath(\"org.jetbrains.kotlin:kotlin-gradle-plugin:${requiredKotlinVersion}\")\n" +
|
|
45
47
|
"(The Expo config plugin does this for you.)"
|
|
@@ -94,7 +96,7 @@ dependencies {
|
|
|
94
96
|
// Version supplied by the consuming app's React Native Gradle plugin.
|
|
95
97
|
implementation "com.facebook.react:react-android"
|
|
96
98
|
|
|
97
|
-
// Pin the native modules to the
|
|
99
|
+
// Pin the native modules to the 8.0.x patch line from 8.0.0, the same range as
|
|
98
100
|
// @trustpin/react-native: the attestation module registers itself on the
|
|
99
101
|
// pinning SDK's default instance, so both must resolve one kotlin-sdk.
|
|
100
102
|
// `strictly` prevents Gradle's conflict resolution from silently selecting
|
|
@@ -104,12 +106,12 @@ dependencies {
|
|
|
104
106
|
// `TrustPinAttestLogLevel`, so consumers see that type.
|
|
105
107
|
api("cloud.trustpin:kotlin-attest") {
|
|
106
108
|
version {
|
|
107
|
-
strictly("[
|
|
109
|
+
strictly("[8.0.0, 8.1.0)")
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
implementation("cloud.trustpin:kotlin-sdk") {
|
|
111
113
|
version {
|
|
112
|
-
strictly("[
|
|
114
|
+
strictly("[8.0.0, 8.1.0)")
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustpin/react-native-attest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "TrustPin app attestation for React Native — proves to your API that requests come from your genuine app on a genuine device, checked by your own TrustPin verifier",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"android",
|
|
13
13
|
"ios",
|
|
14
14
|
"TrustPinReactNativeAttest.podspec",
|
|
15
|
+
"Package.swift",
|
|
15
16
|
"LICENSE",
|
|
16
17
|
"README.md",
|
|
17
18
|
"app.plugin.js",
|
|
@@ -24,6 +25,9 @@
|
|
|
24
25
|
"!android/src/test",
|
|
25
26
|
"!plugin/build/__tests__"
|
|
26
27
|
],
|
|
28
|
+
"swiftpmConfig": {
|
|
29
|
+
"name": "TrustPinReactNativeAttest"
|
|
30
|
+
},
|
|
27
31
|
"scripts": {
|
|
28
32
|
"build": "tsc -p tsconfig.build.json && tsc -p plugin/tsconfig.json",
|
|
29
33
|
"typecheck": "tsc --noEmit && tsc -p plugin/tsconfig.json --noEmit",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"url": "https://github.com/trustpin-cloud/react-native.sdk/issues"
|
|
51
55
|
},
|
|
52
56
|
"peerDependencies": {
|
|
53
|
-
"@trustpin/react-native": "~
|
|
57
|
+
"@trustpin/react-native": "~8.0.0",
|
|
54
58
|
"expo": "*",
|
|
55
59
|
"react": "*",
|
|
56
60
|
"react-native": ">=0.85.0"
|