Skip to content

Commit c08ef38

Browse files
committed
Update SensitiveInfo version and improve Swift attribute handling
Bump SensitiveInfo to 6.0.0-rc.2 in package.json and Podfile.lock. Refactor HybridSensitiveInfo.swift to set kSecAttrAccessible only if kSecAttrAccessControl is not present, improving keychain attribute handling. Minor formatting and structure improvements in post-script.js.
1 parent 0789b30 commit c08ef38

File tree

4 files changed

+35
-37
lines changed

4 files changed

+35
-37
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ PODS:
24372437
- React-perflogger (= 0.82.0)
24382438
- React-utils (= 0.82.0)
24392439
- SocketRocket
2440-
- SensitiveInfo (6.0.0):
2440+
- SensitiveInfo (6.0.0-rc.1):
24412441
- boost
24422442
- DoubleConversion
24432443
- fast_float
@@ -2784,7 +2784,7 @@ SPEC CHECKSUMS:
27842784
ReactAppDependencyProvider: c5c4f5280e4ae0f9f4a739c64c4260fe0b3edaf1
27852785
ReactCodegen: 56b06c499623e25e6652cd2cc00c10fd87dae70b
27862786
ReactCommon: 25c7f94aee74ddd93a8287756a8ac0830a309544
2787-
SensitiveInfo: 8aac8fad2ea33cca5ec5a867d7095def6cc745ff
2787+
SensitiveInfo: fed786b6300b9b324f025b881710d333b2c82aa5
27882788
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
27892789
Yoga: edeb9900b9e5bb5b27b9a6a2d5914e4fe4033c1b
27902790

ios/HybridSensitiveInfo.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ final class HybridSensitiveInfo: HybridSensitiveInfoSpec {
6767

6868
var attributes = query
6969
attributes[kSecValueData as String] = Data(request.value.utf8)
70-
attributes[kSecAttrAccessible as String] = resolved.accessible
7170
if let accessControlRef = resolved.accessControlRef {
7271
attributes[kSecAttrAccessControl as String] = accessControlRef
72+
} else {
73+
attributes[kSecAttrAccessible as String] = resolved.accessible
7374
}
7475
attributes[kSecAttrGeneric as String] = try encoder.encode(PersistedMetadata(metadata: metadata))
7576

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-sensitive-info",
3-
"version": "6.0.0-rc.1",
3+
"version": "6.0.0-rc.2",
44
"description": "react-native-sensitive-info is a react native package built with Nitro",
55
"main": "./lib/commonjs/index.js",
66
"module": "./lib/module/index.js",

post-script.js

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/**
2-
* @file This script is auto-generated by create-nitro-module and should not be edited.
3-
*
4-
* @description This script applies a workaround for Android by modifying the '<ModuleName>OnLoad.cpp' file.
5-
* It reads the file content and removes the 'margelo/nitro/' string from it. This enables support for custom package names.
6-
*
7-
* @module create-nitro-module
8-
*/
2+
* @file This script is auto-generated by create-nitro-module and should not be edited.
3+
*
4+
* @description This script applies a workaround for Android by modifying the '<ModuleName>OnLoad.cpp' file.
5+
* It reads the file content and removes the 'margelo/nitro/' string from it. This enables support for custom package names.
6+
*
7+
* @module create-nitro-module
8+
*/
99
const path = require('node:path')
1010
const { writeFile, readFile } = require('node:fs/promises')
1111
const { readdir } = require('node:fs/promises')
1212

13-
1413
const updateViewManagerFiles = async (file) => {
1514
const viewManagerFile = path.join(
1615
process.cwd(),
@@ -26,35 +25,33 @@ const updateViewManagerFiles = async (file) => {
2625
'com.sensitiveinfo.*'
2726
)
2827
)
29-
}
30-
28+
}
3129

3230
const androidWorkaround = async () => {
33-
const androidOnLoadFile = path.join(
34-
process.cwd(),
35-
'nitrogen/generated/android',
36-
'SensitiveInfoOnLoad.cpp'
37-
)
38-
39-
const viewManagerDir = await readdir(
40-
path.join(
31+
const androidOnLoadFile = path.join(
4132
process.cwd(),
42-
'nitrogen/generated/android/kotlin/com/margelo/nitro/sensitiveinfo/views'
33+
'nitrogen/generated/android',
34+
'SensitiveInfoOnLoad.cpp'
35+
)
36+
37+
const viewManagerDir = await readdir(
38+
path.join(
39+
process.cwd(),
40+
'nitrogen/generated/android/kotlin/com/margelo/nitro/sensitiveinfo/views'
41+
)
42+
)
43+
const viewManagerFiles = viewManagerDir.filter((file) =>
44+
file.endsWith('Manager.kt')
45+
)
46+
const res = await Promise.allSettled(
47+
viewManagerFiles.map(updateViewManagerFiles)
4348
)
44-
)
45-
const viewManagerFiles = viewManagerDir.filter((file) =>
46-
file.endsWith('Manager.kt')
47-
)
48-
const res = await Promise.allSettled(
49-
viewManagerFiles.map(updateViewManagerFiles)
50-
)
5149

52-
if (res.some((r) => r.status === 'rejected')) {
53-
throw new Error(`Error updating view manager files: ${res}`)
54-
}
50+
if (res.some((r) => r.status === 'rejected')) {
51+
throw new Error(`Error updating view manager files: ${res}`)
52+
}
5553

56-
57-
const str = await readFile(androidOnLoadFile, { encoding: 'utf8' })
58-
await writeFile(androidOnLoadFile, str.replace(/margelo\/nitro\//g, ''))
54+
const str = await readFile(androidOnLoadFile, { encoding: 'utf8' })
55+
await writeFile(androidOnLoadFile, str.replace(/margelo\/nitro\//g, ''))
5956
}
60-
androidWorkaround()
57+
androidWorkaround()

0 commit comments

Comments
 (0)