@react-native-ohos/react-native-sensitive-info 6.0.1-rc.1
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/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +13 -0
- package/build/index.es.js +33 -0
- package/build/index.es.js.map +1 -0
- package/build/index.js +35 -0
- package/build/index.js.map +1 -0
- package/harmony/react_native_sensitive_info/BuildProfile.ets +17 -0
- package/harmony/react_native_sensitive_info/build-profile.json5 +28 -0
- package/harmony/react_native_sensitive_info/hvigorfile.ts +6 -0
- package/harmony/react_native_sensitive_info/index.ets +7 -0
- package/harmony/react_native_sensitive_info/obfuscation-rules.txt +18 -0
- package/harmony/react_native_sensitive_info/oh-package.json5 +13 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/SensitiveInfoPackage.h +19 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/RNOH/generated/BaseReactNativeSensitiveInfoPackage.h +72 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/RNOH/generated/turbo_modules/SensitiveInfoNativeModule.cpp +24 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/RNOH/generated/turbo_modules/SensitiveInfoNativeModule.h +16 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/ComponentDescriptors.h +24 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/EventEmitters.cpp +16 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/EventEmitters.h +17 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/Props.cpp +19 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/Props.h +18 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/ShadowNodes.cpp +17 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/ShadowNodes.h +23 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/States.cpp +16 -0
- package/harmony/react_native_sensitive_info/src/main/cpp/generated/react/renderer/components/react_native_sensitive_info/States.h +19 -0
- package/harmony/react_native_sensitive_info/src/main/ets/Logger.ts +64 -0
- package/harmony/react_native_sensitive_info/src/main/ets/RNSensitiveInfoPackage.ts +46 -0
- package/harmony/react_native_sensitive_info/src/main/ets/RNSensitiveInfoTurboModule.ts +230 -0
- package/harmony/react_native_sensitive_info/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/react_native_sensitive_info/src/main/ets/generated/index.ets +5 -0
- package/harmony/react_native_sensitive_info/src/main/ets/generated/ts.ts +6 -0
- package/harmony/react_native_sensitive_info/src/main/ets/generated/turboModules/SensitiveInfoNativeModule.ts +34 -0
- package/harmony/react_native_sensitive_info/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/react_native_sensitive_info/src/main/ets/pages/index.ets +26 -0
- package/harmony/react_native_sensitive_info/src/main/ets/tools.ts +60 -0
- package/harmony/react_native_sensitive_info/src/main/ets/utils/Calc.ets +9 -0
- package/harmony/react_native_sensitive_info/src/main/module.json5 +11 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/element/color.json +8 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/element/string.json +16 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/media/background.png +0 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/media/foreground.png +0 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/media/layered_image.json +7 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/media/startIcon.png +0 -0
- package/harmony/react_native_sensitive_info/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/react_native_sensitive_info/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/react_native_sensitive_info/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/react_native_sensitive_info/src/mock/mock-config.json5 +2 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/ets/test/Ability.test.ets +41 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/ets/test/List.test.ets +11 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/ets/testability/TestAbility.ets +61 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/ets/testability/pages/Index.ets +23 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +98 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/module.json5 +28 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/resources/base/element/color.json +8 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/resources/base/element/string.json +16 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/resources/base/media/icon.png +0 -0
- package/harmony/react_native_sensitive_info/src/ohosTest/resources/base/profile/test_pages.json +5 -0
- package/harmony/react_native_sensitive_info/src/test/List.test.ets +11 -0
- package/harmony/react_native_sensitive_info/src/test/LocalUnit.test.ets +39 -0
- package/harmony/react_native_sensitive_info/ts.ts +9 -0
- package/harmony/react_native_sensitive_info.har +0 -0
- package/index.d.ts +74 -0
- package/package.json +70 -0
- package/react-native-sensitive-info.podspec +19 -0
- package/src/NativeSensitiveInfo.ts +81 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
@Entry
|
|
8
|
+
@Component
|
|
9
|
+
struct Index {
|
|
10
|
+
@State message: string = 'Hello World';
|
|
11
|
+
|
|
12
|
+
build() {
|
|
13
|
+
Row() {
|
|
14
|
+
Column() {
|
|
15
|
+
Text(this.message)
|
|
16
|
+
.fontSize(50)
|
|
17
|
+
.fontWeight(FontWeight.Bold)
|
|
18
|
+
}
|
|
19
|
+
.width('100%')
|
|
20
|
+
}
|
|
21
|
+
.height('100%')
|
|
22
|
+
}
|
|
23
|
+
}
|
package/harmony/react_native_sensitive_info/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
|
|
8
|
+
import { UIAbility, Want } from '@kit.AbilityKit';
|
|
9
|
+
import { BusinessError } from '@kit.BasicServicesKit';
|
|
10
|
+
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
11
|
+
import { resourceManager } from '@kit.LocalizationKit';
|
|
12
|
+
import { util } from '@kit.ArkTS';
|
|
13
|
+
|
|
14
|
+
let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
|
|
15
|
+
let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
|
|
16
|
+
let jsonPath: string = 'mock/mock-config.json';
|
|
17
|
+
let tag: string = 'testTag';
|
|
18
|
+
|
|
19
|
+
async function onAbilityCreateCallback(data: UIAbility) {
|
|
20
|
+
hilog.info(0x0000, 'testTag', 'onAbilityCreateCallback, data: ${}', JSON.stringify(data));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function addAbilityMonitorCallback(err: BusinessError) {
|
|
24
|
+
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default class OpenHarmonyTestRunner implements TestRunner {
|
|
28
|
+
constructor() {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onPrepare() {
|
|
32
|
+
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async onRun() {
|
|
36
|
+
let tag = 'testTag';
|
|
37
|
+
hilog.info(0x0000, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
|
|
38
|
+
abilityDelegatorArguments = abilityDelegatorRegistry.getArguments()
|
|
39
|
+
abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
|
|
40
|
+
let moduleName = abilityDelegatorArguments.parameters['-m'];
|
|
41
|
+
let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
|
|
42
|
+
let mResourceManager = context.resourceManager;
|
|
43
|
+
await checkMock(abilityDelegator, mResourceManager);
|
|
44
|
+
const bundleName = abilityDelegatorArguments.bundleName;
|
|
45
|
+
const testAbilityName: string = 'TestAbility';
|
|
46
|
+
let lMonitor: abilityDelegatorRegistry.AbilityMonitor = {
|
|
47
|
+
abilityName: testAbilityName,
|
|
48
|
+
onAbilityCreate: onAbilityCreateCallback,
|
|
49
|
+
moduleName: moduleName
|
|
50
|
+
};
|
|
51
|
+
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
|
|
52
|
+
const want: Want = {
|
|
53
|
+
bundleName: bundleName,
|
|
54
|
+
abilityName: testAbilityName,
|
|
55
|
+
moduleName: moduleName
|
|
56
|
+
};
|
|
57
|
+
abilityDelegator.startAbility(want, (err: BusinessError, data: void) => {
|
|
58
|
+
hilog.info(0x0000, tag, 'startAbility : err : %{public}s', JSON.stringify(err) ?? '');
|
|
59
|
+
hilog.info(0x0000, tag, 'startAbility : data : %{public}s', JSON.stringify(data) ?? '');
|
|
60
|
+
})
|
|
61
|
+
hilog.info(0x0000, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator,
|
|
66
|
+
resourceManager: resourceManager.ResourceManager) {
|
|
67
|
+
let rawFile: Uint8Array;
|
|
68
|
+
try {
|
|
69
|
+
rawFile = resourceManager.getRawFileContentSync(jsonPath);
|
|
70
|
+
hilog.info(0x0000, tag, 'MockList file exists');
|
|
71
|
+
let mockStr: string = util.TextDecoder.create('utf-8', { ignoreBOM: true }).decodeWithStream(rawFile);
|
|
72
|
+
let mockMap: Record<string, string> = getMockList(mockStr);
|
|
73
|
+
try {
|
|
74
|
+
abilityDelegator.setMockList(mockMap)
|
|
75
|
+
} catch (error) {
|
|
76
|
+
let code = (error as BusinessError).code;
|
|
77
|
+
let message = (error as BusinessError).message;
|
|
78
|
+
hilog.error(0x0000, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
let code = (error as BusinessError).code;
|
|
82
|
+
let message = (error as BusinessError).message;
|
|
83
|
+
hilog.error(0x0000, tag,
|
|
84
|
+
`ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getMockList(jsonStr: string) {
|
|
89
|
+
let jsonObj: Record<string, Object> = JSON.parse(jsonStr);
|
|
90
|
+
let map: Map<string, object> = new Map<string, object>(Object.entries(jsonObj));
|
|
91
|
+
let mockList: Record<string, string> = {};
|
|
92
|
+
map.forEach((value: object, key: string) => {
|
|
93
|
+
let realValue: string = value['source'].toString();
|
|
94
|
+
mockList[key] = realValue;
|
|
95
|
+
});
|
|
96
|
+
hilog.info(0x0000, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
|
|
97
|
+
return mockList;
|
|
98
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "react_native_sensitive_info_test",
|
|
4
|
+
"type": "feature",
|
|
5
|
+
"description": "$string:module_test_desc",
|
|
6
|
+
"mainElement": "TestAbility",
|
|
7
|
+
"deviceTypes": [
|
|
8
|
+
"phone",
|
|
9
|
+
"tablet",
|
|
10
|
+
"2in1"
|
|
11
|
+
],
|
|
12
|
+
"deliveryWithInstall": true,
|
|
13
|
+
"installationFree": false,
|
|
14
|
+
"pages": "$profile:test_pages",
|
|
15
|
+
"abilities": [
|
|
16
|
+
{
|
|
17
|
+
"name": "TestAbility",
|
|
18
|
+
"srcEntry": "./ets/testability/TestAbility.ets",
|
|
19
|
+
"description": "$string:TestAbility_desc",
|
|
20
|
+
"icon": "$media:icon",
|
|
21
|
+
"label": "$string:TestAbility_label",
|
|
22
|
+
"exported": true,
|
|
23
|
+
"startWindowIcon": "$media:icon",
|
|
24
|
+
"startWindowBackground": "$color:start_window_background"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import localUnitTest from './LocalUnit.test';
|
|
8
|
+
|
|
9
|
+
export default function testsuite() {
|
|
10
|
+
localUnitTest();
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
|
8
|
+
|
|
9
|
+
export default function localUnitTest() {
|
|
10
|
+
describe('localUnitTest', () => {
|
|
11
|
+
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
// Presets an action, which is performed only once before all test cases of the test suite start.
|
|
14
|
+
// This API supports only one parameter: preset action function.
|
|
15
|
+
});
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
// Presets an action, which is performed before each unit test case starts.
|
|
18
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
19
|
+
// This API supports only one parameter: preset action function.
|
|
20
|
+
});
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
// Presets a clear action, which is performed after each unit test case ends.
|
|
23
|
+
// The number of execution times is the same as the number of test cases defined by **it**.
|
|
24
|
+
// This API supports only one parameter: clear action function.
|
|
25
|
+
});
|
|
26
|
+
afterAll(() => {
|
|
27
|
+
// Presets a clear action, which is performed after all test cases of the test suite end.
|
|
28
|
+
// This API supports only one parameter: clear action function.
|
|
29
|
+
});
|
|
30
|
+
it('assertContain', 0, () => {
|
|
31
|
+
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
|
32
|
+
let a = 'abc';
|
|
33
|
+
let b = 'b';
|
|
34
|
+
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
|
35
|
+
expect(a).assertContain(b);
|
|
36
|
+
expect(a).assertEqual(a);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export * from './src/main/ets/RNSensitiveInfoPackage';
|
|
8
|
+
export * from './src/main/ets/RNSensitiveInfoTurboModule';
|
|
9
|
+
|
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
type RNSensitiveInfoBiometryType = 'Touch ID' | 'Face ID';
|
|
2
|
+
|
|
3
|
+
type RNSensitiveInfoAccessControlOptions =
|
|
4
|
+
| 'kSecAccessControlApplicationPassword'
|
|
5
|
+
| 'kSecAccessControlPrivateKeyUsage'
|
|
6
|
+
| 'kSecAccessControlDevicePasscode'
|
|
7
|
+
| 'kSecAccessControlTouchIDAny'
|
|
8
|
+
| 'kSecAccessControlTouchIDCurrentSet'
|
|
9
|
+
| 'kSecAccessControlUserPresence'
|
|
10
|
+
| 'kSecAccessControlBiometryAny'
|
|
11
|
+
| 'kSecAccessControlBiometryCurrentSet';
|
|
12
|
+
|
|
13
|
+
type RNSensitiveInfoAttrAccessibleOptions =
|
|
14
|
+
| 'kSecAttrAccessibleAfterFirstUnlock'
|
|
15
|
+
| 'kSecAttrAccessibleAlways'
|
|
16
|
+
| 'kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly'
|
|
17
|
+
| 'kSecAttrAccessibleWhenUnlockedThisDeviceOnly'
|
|
18
|
+
| 'kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly'
|
|
19
|
+
| 'kSecAttrAccessibleAlwaysThisDeviceOnly'
|
|
20
|
+
| 'kSecAttrAccessibleWhenUnlocked';
|
|
21
|
+
|
|
22
|
+
interface RNSensitiveInfoAndroidDialogStrings {
|
|
23
|
+
header?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
hint?: string;
|
|
26
|
+
success?: string;
|
|
27
|
+
notRecognized?: string;
|
|
28
|
+
cancel?: string;
|
|
29
|
+
cancelled?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RNSensitiveInfoOptions {
|
|
33
|
+
kSecAccessControl?: RNSensitiveInfoAccessControlOptions;
|
|
34
|
+
kSecAttrAccessible?: RNSensitiveInfoAttrAccessibleOptions;
|
|
35
|
+
kSecAttrSynchronizable?: boolean;
|
|
36
|
+
keychainService?: string;
|
|
37
|
+
sharedPreferencesName?: string;
|
|
38
|
+
touchID?: boolean;
|
|
39
|
+
showModal?: boolean;
|
|
40
|
+
kSecUseOperationPrompt?: string;
|
|
41
|
+
kLocalizedFallbackTitle?: string;
|
|
42
|
+
strings?: RNSensitiveInfoAndroidDialogStrings;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare function setItem(
|
|
46
|
+
key: string,
|
|
47
|
+
value: string,
|
|
48
|
+
options: RNSensitiveInfoOptions,
|
|
49
|
+
): Promise<null>;
|
|
50
|
+
export declare function getItem(
|
|
51
|
+
key: string,
|
|
52
|
+
options: RNSensitiveInfoOptions,
|
|
53
|
+
): Promise<string>;
|
|
54
|
+
|
|
55
|
+
interface SensitiveInfoEntry {
|
|
56
|
+
key: string;
|
|
57
|
+
value: string;
|
|
58
|
+
service: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function getAllItems(
|
|
61
|
+
options: RNSensitiveInfoOptions,
|
|
62
|
+
): Promise<[SensitiveInfoEntry[]]>;
|
|
63
|
+
|
|
64
|
+
export declare function deleteItem(
|
|
65
|
+
key: string,
|
|
66
|
+
options: RNSensitiveInfoOptions,
|
|
67
|
+
): Promise<null>;
|
|
68
|
+
export declare function isSensorAvailable(): Promise<
|
|
69
|
+
RNSensitiveInfoBiometryType | boolean
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export declare function hasEnrolledFingerprints(): Promise<boolean>;
|
|
73
|
+
export declare function cancelFingerprintAuth(): void;
|
|
74
|
+
export declare function setInvalidatedByBiometricEnrollment(set: boolean): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-sensitive-info",
|
|
3
|
+
"version": "6.0.1-rc.1",
|
|
4
|
+
"main": "build/index.js",
|
|
5
|
+
"module": "build/index.es.js",
|
|
6
|
+
"jsnext:main": "build/index.es.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"description": "react-native-sensitive-info manages all data stored in Android Shared Preferences and iOS Keychain. You can set, get and delete keys/values using simple methods.",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rimraf -rf build && rollup -c",
|
|
11
|
+
"prepublishOnly": "yarn build",
|
|
12
|
+
"localPublish": "yalc publish && cd example && yalc add react-native-sensitive-info --yarn && cd ..",
|
|
13
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-sensitive-info --cpp-output-path ./harmony/react_native_sensitive_info/src/main/cpp/generated --ets-output-path ./harmony/react_native_sensitive_info/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeSensitiveInfo.ts"
|
|
14
|
+
},
|
|
15
|
+
"contributors": [
|
|
16
|
+
"Mateus Andrade mtw.andrade@gmail.com",
|
|
17
|
+
"Samin Shams <samin@classapp.co>"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-sensitive-info",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-sensitive-info/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git@gitcode.com:openharmony-sig/rntpc_react-native-sensitive-info.git"
|
|
26
|
+
},
|
|
27
|
+
"harmony": {
|
|
28
|
+
"alias": "react-native-sensitive-info"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"android",
|
|
32
|
+
"ios",
|
|
33
|
+
"keychain",
|
|
34
|
+
"harmony",
|
|
35
|
+
"shared-preferences",
|
|
36
|
+
"react-native",
|
|
37
|
+
"windows"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react-native": "*",
|
|
42
|
+
"react-native-sensitive-info": "6.0.0-alpha.9"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-commonjs": "^16.0.0",
|
|
46
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
47
|
+
"@rollup/plugin-node-resolve": "^10.0.0",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^4.6.1",
|
|
49
|
+
"@typescript-eslint/parser": "^4.6.1",
|
|
50
|
+
"eslint": "^7.12.1",
|
|
51
|
+
"eslint-config-airbnb": "^18.2.0",
|
|
52
|
+
"eslint-config-prettier": "^6.15.0",
|
|
53
|
+
"eslint-import-resolver-typescript": "^2.3.0",
|
|
54
|
+
"eslint-plugin-import": "^2.22.1",
|
|
55
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
56
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
57
|
+
"eslint-plugin-react": "^7.21.5",
|
|
58
|
+
"eslint-plugin-react-hooks": "^4.2.0",
|
|
59
|
+
"prettier": "^2.1.2",
|
|
60
|
+
"react": "^17.0.1",
|
|
61
|
+
"react-native": "^0.62.2",
|
|
62
|
+
"react-native-windows": "0.63.6",
|
|
63
|
+
"rollup": "^2.33.1",
|
|
64
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
65
|
+
"rollup-plugin-typescript2": "^0.29.0",
|
|
66
|
+
"typescript": "^4.0.5",
|
|
67
|
+
"yalc": "^1.0.0-pre.45",
|
|
68
|
+
"react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = package['name']
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
|
|
11
|
+
s.authors = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = { :ios => "8.0" }
|
|
14
|
+
|
|
15
|
+
s.source = { :git => "https://github.com/mCodex/react-native-sensitive-info", :tag => "v#{s.version}" }
|
|
16
|
+
s.source_files = "ios/**/*.{h,m}"
|
|
17
|
+
|
|
18
|
+
s.dependency 'React-Core'
|
|
19
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
8
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
9
|
+
|
|
10
|
+
type RNSensitiveInfoBiometryType = 'Touch ID' | 'Face ID';
|
|
11
|
+
|
|
12
|
+
type RNSensitiveInfoAccessControlOptions =
|
|
13
|
+
| 'kSecAccessControlApplicationPassword'
|
|
14
|
+
| 'kSecAccessControlPrivateKeyUsage'
|
|
15
|
+
| 'kSecAccessControlDevicePasscode'
|
|
16
|
+
| 'kSecAccessControlTouchIDAny'
|
|
17
|
+
| 'kSecAccessControlTouchIDCurrentSet'
|
|
18
|
+
| 'kSecAccessControlUserPresence'
|
|
19
|
+
| 'kSecAccessControlBiometryAny'
|
|
20
|
+
| 'kSecAccessControlBiometryCurrentSet';
|
|
21
|
+
|
|
22
|
+
type RNSensitiveInfoAttrAccessibleOptions =
|
|
23
|
+
| 'kSecAttrAccessibleAfterFirstUnlock'
|
|
24
|
+
| 'kSecAttrAccessibleAlways'
|
|
25
|
+
| 'kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly'
|
|
26
|
+
| 'kSecAttrAccessibleWhenUnlockedThisDeviceOnly'
|
|
27
|
+
| 'kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly'
|
|
28
|
+
| 'kSecAttrAccessibleAlwaysThisDeviceOnly'
|
|
29
|
+
| 'kSecAttrAccessibleWhenUnlocked';
|
|
30
|
+
|
|
31
|
+
interface RNSensitiveInfoAndroidDialogStrings {
|
|
32
|
+
header?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
hint?: string;
|
|
35
|
+
success?: string;
|
|
36
|
+
notRecognized?: string;
|
|
37
|
+
cancel?: string;
|
|
38
|
+
cancelled?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface RNSensitiveInfoOptions {
|
|
41
|
+
kSecAccessControl?: RNSensitiveInfoAccessControlOptions;
|
|
42
|
+
kSecAttrAccessible?: RNSensitiveInfoAttrAccessibleOptions;
|
|
43
|
+
kSecAttrSynchronizable?: boolean;
|
|
44
|
+
keychainService?: string;
|
|
45
|
+
sharedPreferencesName?: string;
|
|
46
|
+
touchID?: boolean;
|
|
47
|
+
showModal?: boolean;
|
|
48
|
+
kSecUseOperationPrompt?: string;
|
|
49
|
+
kLocalizedFallbackTitle?: string;
|
|
50
|
+
strings?: RNSensitiveInfoAndroidDialogStrings;
|
|
51
|
+
}
|
|
52
|
+
interface SensitiveInfoEntry {
|
|
53
|
+
key: string;
|
|
54
|
+
value: string;
|
|
55
|
+
service: string;
|
|
56
|
+
}
|
|
57
|
+
export interface Spec extends TurboModule {
|
|
58
|
+
setItem: (key: string,
|
|
59
|
+
value: string,
|
|
60
|
+
options: RNSensitiveInfoOptions) => Promise<null>;
|
|
61
|
+
getItem: (key: string,
|
|
62
|
+
options: RNSensitiveInfoOptions) => Promise<string>;
|
|
63
|
+
hasItem(
|
|
64
|
+
key: string,
|
|
65
|
+
options: RNSensitiveInfoOptions,
|
|
66
|
+
): Promise<boolean>;
|
|
67
|
+
getAllItems(
|
|
68
|
+
options: RNSensitiveInfoOptions,
|
|
69
|
+
): Promise<[SensitiveInfoEntry[]]>;
|
|
70
|
+
deleteItem(
|
|
71
|
+
key: string,
|
|
72
|
+
options: RNSensitiveInfoOptions,
|
|
73
|
+
): Promise<null>;
|
|
74
|
+
isSensorAvailable(): Promise<
|
|
75
|
+
RNSensitiveInfoBiometryType | boolean
|
|
76
|
+
>;
|
|
77
|
+
hasEnrolledFingerprints(): Promise<boolean>;
|
|
78
|
+
cancelFingerprintAuth(): void;
|
|
79
|
+
setInvalidatedByBiometricEnrollment(set: boolean): void;
|
|
80
|
+
}
|
|
81
|
+
export default TurboModuleRegistry.get<Spec>('SensitiveInfoNativeModule') as Spec | null;
|