@pmishra0/react-native-aes-gcm 0.1.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/AesGcm.podspec +34 -0
- package/LICENSE +20 -0
- package/README.md +33 -0
- package/android/build.gradle +100 -0
- package/android/generated/java/com/aesgcm/NativeAesGcmSpec.java +42 -0
- package/android/generated/jni/CMakeLists.txt +28 -0
- package/android/generated/jni/RNAesGcmSpec-generated.cpp +38 -0
- package/android/generated/jni/RNAesGcmSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNAesGcmSpec/RNAesGcmSpecJSI.h +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/aesgcm/AesGcmModule.kt +116 -0
- package/android/src/main/java/com/aesgcm/AesGcmPackage.kt +33 -0
- package/ios/AesGcm.h +6 -0
- package/ios/AesGcm.mm +66 -0
- package/ios/EncryptionManager.swift +138 -0
- package/ios/generated/Package.swift +59 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
- package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
- package/ios/generated/ReactCodegen/RNAesGcmSpec/RNAesGcmSpec-generated.mm +46 -0
- package/ios/generated/ReactCodegen/RNAesGcmSpec/RNAesGcmSpec.h +71 -0
- package/ios/generated/ReactCodegen/RNAesGcmSpecJSI.h +51 -0
- package/ios/generated/ReactCodegen/ReactCodegen.podspec +110 -0
- package/lib/module/NativeAesGcm.ts +17 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeAesGcm.d.ts +8 -0
- package/lib/typescript/src/NativeAesGcm.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +171 -0
- package/react-native.config.js +12 -0
- package/src/NativeAesGcm.ts +17 -0
- package/src/index.tsx +17 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
template <typename T>
|
|
19
|
+
class JSI_EXPORT NativeAesGcmCxxSpec : public TurboModule {
|
|
20
|
+
public:
|
|
21
|
+
static constexpr std::string_view kModuleName = "AesGcm";
|
|
22
|
+
|
|
23
|
+
protected:
|
|
24
|
+
NativeAesGcmCxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{NativeAesGcmCxxSpec::kModuleName}, jsInvoker) {
|
|
25
|
+
methodMap_["encrypt"] = MethodMetadata {.argCount = 3, .invoker = __encrypt};
|
|
26
|
+
methodMap_["decrypt"] = MethodMetadata {.argCount = 3, .invoker = __decrypt};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
static jsi::Value __encrypt(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
31
|
+
static_assert(
|
|
32
|
+
bridging::getParameterCount(&T::encrypt) == 4,
|
|
33
|
+
"Expected encrypt(...) to have 4 parameters");
|
|
34
|
+
return bridging::callFromJs<jsi::Value>(rt, &T::encrypt, static_cast<NativeAesGcmCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
|
|
35
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
36
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
37
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asNumber());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static jsi::Value __decrypt(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
41
|
+
static_assert(
|
|
42
|
+
bridging::getParameterCount(&T::decrypt) == 4,
|
|
43
|
+
"Expected decrypt(...) to have 4 parameters");
|
|
44
|
+
return bridging::callFromJs<jsi::Value>(rt, &T::decrypt, static_cast<NativeAesGcmCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
|
|
45
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
46
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
47
|
+
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asNumber());
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
version = "0.84.0"
|
|
7
|
+
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
+
if version == '1000.0.0'
|
|
9
|
+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
+
else
|
|
12
|
+
source[:tag] = "v#{version}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
use_frameworks = ENV['USE_FRAMEWORKS'] != nil
|
|
16
|
+
folly_compiler_flags = Helpers::Constants.folly_config[:compiler_flags]
|
|
17
|
+
boost_compiler_flags = Helpers::Constants.boost_config[:compiler_flags]
|
|
18
|
+
|
|
19
|
+
header_search_paths = []
|
|
20
|
+
framework_search_paths = []
|
|
21
|
+
|
|
22
|
+
header_search_paths = [
|
|
23
|
+
"\"$(PODS_ROOT)/ReactNativeDependencies\"",
|
|
24
|
+
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
|
|
25
|
+
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
|
|
26
|
+
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
|
|
27
|
+
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
|
|
28
|
+
"\"$(PODS_TARGET_SRCROOT)\"",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
if use_frameworks
|
|
32
|
+
ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
|
|
33
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", []))
|
|
34
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"]))
|
|
35
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"]))
|
|
36
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-runtimeexecutor", "React_runtimeexecutor", ["platform/ios"]))
|
|
37
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", []))
|
|
38
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", []))
|
|
39
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", []))
|
|
40
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", []))
|
|
41
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", []))
|
|
42
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", []))
|
|
43
|
+
.each { |search_path|
|
|
44
|
+
header_search_paths << "\"#{search_path}\""
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Pod::Spec.new do |s|
|
|
49
|
+
s.name = "ReactCodegen"
|
|
50
|
+
s.version = version
|
|
51
|
+
s.summary = 'Temp pod for generated files for React Native'
|
|
52
|
+
s.homepage = 'https://facebook.com/'
|
|
53
|
+
s.license = 'Unlicense'
|
|
54
|
+
s.authors = 'Facebook'
|
|
55
|
+
s.compiler_flags = "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20"
|
|
56
|
+
s.source = { :git => '' }
|
|
57
|
+
s.header_mappings_dir = './'
|
|
58
|
+
s.platforms = min_supported_versions
|
|
59
|
+
s.source_files = "**/*.{h,mm,cpp}"
|
|
60
|
+
s.exclude_files = "RCTAppDependencyProvider.{h,mm}" # these files are generated in the same codegen path but needs to belong to a different pod
|
|
61
|
+
s.pod_target_xcconfig = {
|
|
62
|
+
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
|
|
63
|
+
"FRAMEWORK_SEARCH_PATHS" => framework_search_paths,
|
|
64
|
+
"OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
s.dependency "React-jsiexecutor"
|
|
68
|
+
s.dependency "RCTRequired"
|
|
69
|
+
s.dependency "RCTTypeSafety"
|
|
70
|
+
s.dependency "React-Core"
|
|
71
|
+
s.dependency "React-jsi"
|
|
72
|
+
s.dependency "ReactCommon/turbomodule/bridging"
|
|
73
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
74
|
+
s.dependency "React-NativeModulesApple"
|
|
75
|
+
s.dependency 'React-graphics'
|
|
76
|
+
s.dependency 'React-rendererdebug'
|
|
77
|
+
s.dependency 'React-Fabric'
|
|
78
|
+
s.dependency 'React-FabricImage'
|
|
79
|
+
s.dependency 'React-debug'
|
|
80
|
+
s.dependency 'React-utils'
|
|
81
|
+
s.dependency 'React-featureflags'
|
|
82
|
+
s.dependency 'React-RCTAppDelegate'
|
|
83
|
+
|
|
84
|
+
depend_on_js_engine(s)
|
|
85
|
+
add_rn_third_party_dependencies(s)
|
|
86
|
+
add_rncore_dependency(s)
|
|
87
|
+
|
|
88
|
+
s.script_phases = {
|
|
89
|
+
'name' => 'Generate Specs',
|
|
90
|
+
'execution_position' => :before_compile,
|
|
91
|
+
'input_files' => ["${PODS_ROOT}/../../../src/NativeAesGcm.ts"],
|
|
92
|
+
'show_env_vars_in_log' => true,
|
|
93
|
+
'output_files' => ["${DERIVED_FILE_DIR}/react-codegen.log"],
|
|
94
|
+
'script': <<-SCRIPT
|
|
95
|
+
pushd "$PODS_ROOT/../" > /dev/null
|
|
96
|
+
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
|
|
97
|
+
popd >/dev/null
|
|
98
|
+
|
|
99
|
+
export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../../node_modules/react-native"
|
|
100
|
+
export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../.."
|
|
101
|
+
export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT"
|
|
102
|
+
export RCT_SCRIPT_TYPE="withCodegenDiscovery"
|
|
103
|
+
|
|
104
|
+
export SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
|
|
105
|
+
export WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
|
|
106
|
+
/bin/sh -c '"$WITH_ENVIRONMENT" "$SCRIPT_PHASES_SCRIPT"'
|
|
107
|
+
SCRIPT
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
encrypt(
|
|
6
|
+
plainText: string,
|
|
7
|
+
key: string,
|
|
8
|
+
iterationCount: number
|
|
9
|
+
): Promise<string>;
|
|
10
|
+
decrypt(
|
|
11
|
+
encryptedText: string,
|
|
12
|
+
key: string,
|
|
13
|
+
iterationCount: number
|
|
14
|
+
): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('AesGcm');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import AesGcm from './NativeAesGcm';
|
|
4
|
+
export function encrypt(plainText, key, iterationCount) {
|
|
5
|
+
return AesGcm.encrypt(plainText, key, iterationCount);
|
|
6
|
+
}
|
|
7
|
+
export function decrypt(encryptedText, key, iterationCount) {
|
|
8
|
+
return AesGcm.decrypt(encryptedText, key, iterationCount);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AesGcm","encrypt","plainText","key","iterationCount","decrypt","encryptedText"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,MAAM,MAAM,gBAAgB;AAEnC,OAAO,SAASC,OAAOA,CACrBC,SAAiB,EACjBC,GAAW,EACXC,cAAsB,EACL;EACjB,OAAOJ,MAAM,CAACC,OAAO,CAACC,SAAS,EAAEC,GAAG,EAAEC,cAAc,CAAC;AACvD;AAEA,OAAO,SAASC,OAAOA,CACrBC,aAAqB,EACrBH,GAAW,EACXC,cAAsB,EACL;EACjB,OAAOJ,MAAM,CAACK,OAAO,CAACC,aAAa,EAAEH,GAAG,EAAEC,cAAc,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
encrypt(plainText: string, key: string, iterationCount: number): Promise<string>;
|
|
4
|
+
decrypt(encryptedText: string, key: string, iterationCount: number): Promise<string>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: Spec;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=NativeAesGcm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeAesGcm.d.ts","sourceRoot":"","sources":["../../../src/NativeAesGcm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,OAAO,CACL,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;;AAED,wBAAgE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,OAAO,CACrB,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pmishra0/react-native-aes-gcm",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AES-GCM encryption/decryption for React Native",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
10
|
+
"default": "./lib/module/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"lib",
|
|
17
|
+
"android",
|
|
18
|
+
"ios",
|
|
19
|
+
"cpp",
|
|
20
|
+
"*.podspec",
|
|
21
|
+
"react-native.config.js",
|
|
22
|
+
"!ios/build",
|
|
23
|
+
"!android/build",
|
|
24
|
+
"!android/gradle",
|
|
25
|
+
"!android/gradlew",
|
|
26
|
+
"!android/gradlew.bat",
|
|
27
|
+
"!android/local.properties",
|
|
28
|
+
"!**/__tests__",
|
|
29
|
+
"!**/__fixtures__",
|
|
30
|
+
"!**/__mocks__",
|
|
31
|
+
"!**/.*"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"example": "yarn workspace react-native-aes-gcm-example",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"typecheck": "tsc",
|
|
37
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
38
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
39
|
+
"prepare": "bob build",
|
|
40
|
+
"release": "release-it"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react-native",
|
|
44
|
+
"ios",
|
|
45
|
+
"android"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/prashantkmishra/rn-aes-gcm-crypto.git.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Prashant Mishra <p_mishra@live.com> (https://www.npmjs.com/~pmishra0)",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/prashantkmishra/rn-aes-gcm-crypto.git/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/prashantkmishra/rn-aes-gcm-crypto.git#readme",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"registry": "https://registry.npmjs.org/"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
62
|
+
"@eslint/compat": "^1.2.7",
|
|
63
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
64
|
+
"@eslint/js": "^9.22.0",
|
|
65
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
66
|
+
"@react-native-community/cli": "20.1.0",
|
|
67
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
68
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
69
|
+
"@types/jest": "^29.5.5",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"commitlint": "^19.6.1",
|
|
72
|
+
"del-cli": "^5.1.0",
|
|
73
|
+
"eslint": "^9.22.0",
|
|
74
|
+
"eslint-config-prettier": "^10.1.1",
|
|
75
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"prettier": "^3.0.3",
|
|
78
|
+
"react": "19.2.3",
|
|
79
|
+
"react-native": "0.84.0",
|
|
80
|
+
"react-native-builder-bob": "^0.38.3",
|
|
81
|
+
"release-it": "^17.10.0",
|
|
82
|
+
"turbo": "^1.10.7",
|
|
83
|
+
"typescript": "^5.2.2"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"react": "*",
|
|
87
|
+
"react-native": "*"
|
|
88
|
+
},
|
|
89
|
+
"workspaces": [
|
|
90
|
+
"example"
|
|
91
|
+
],
|
|
92
|
+
"packageManager": "yarn@3.6.1",
|
|
93
|
+
"jest": {
|
|
94
|
+
"preset": "react-native",
|
|
95
|
+
"modulePathIgnorePatterns": [
|
|
96
|
+
"<rootDir>/example/node_modules",
|
|
97
|
+
"<rootDir>/lib/"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"commitlint": {
|
|
101
|
+
"extends": [
|
|
102
|
+
"@commitlint/config-conventional"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"release-it": {
|
|
106
|
+
"git": {
|
|
107
|
+
"commitMessage": "chore: release ${version}",
|
|
108
|
+
"tagName": "v${version}"
|
|
109
|
+
},
|
|
110
|
+
"npm": {
|
|
111
|
+
"publish": true
|
|
112
|
+
},
|
|
113
|
+
"github": {
|
|
114
|
+
"release": true
|
|
115
|
+
},
|
|
116
|
+
"plugins": {
|
|
117
|
+
"@release-it/conventional-changelog": {
|
|
118
|
+
"preset": {
|
|
119
|
+
"name": "angular"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"prettier": {
|
|
125
|
+
"quoteProps": "consistent",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"tabWidth": 2,
|
|
128
|
+
"trailingComma": "es5",
|
|
129
|
+
"useTabs": false
|
|
130
|
+
},
|
|
131
|
+
"react-native-builder-bob": {
|
|
132
|
+
"source": "src",
|
|
133
|
+
"output": "lib",
|
|
134
|
+
"targets": [
|
|
135
|
+
"codegen",
|
|
136
|
+
[
|
|
137
|
+
"module",
|
|
138
|
+
{
|
|
139
|
+
"esm": true
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
"typescript",
|
|
144
|
+
{
|
|
145
|
+
"project": "tsconfig.build.json"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"codegenConfig": {
|
|
151
|
+
"name": "RNAesGcmSpec",
|
|
152
|
+
"type": "modules",
|
|
153
|
+
"jsSrcsDir": "src",
|
|
154
|
+
"outputDir": {
|
|
155
|
+
"ios": "ios/generated",
|
|
156
|
+
"android": "android/generated"
|
|
157
|
+
},
|
|
158
|
+
"android": {
|
|
159
|
+
"javaPackageName": "com.aesgcm"
|
|
160
|
+
},
|
|
161
|
+
"includesGeneratedCode": true
|
|
162
|
+
},
|
|
163
|
+
"create-react-native-library": {
|
|
164
|
+
"type": "turbo-module",
|
|
165
|
+
"languages": "kotlin-objc",
|
|
166
|
+
"version": "0.49.2"
|
|
167
|
+
},
|
|
168
|
+
"dependencies": {
|
|
169
|
+
"react-native-safe-area-context": "^5.6.2"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
encrypt(
|
|
6
|
+
plainText: string,
|
|
7
|
+
key: string,
|
|
8
|
+
iterationCount: number
|
|
9
|
+
): Promise<string>;
|
|
10
|
+
decrypt(
|
|
11
|
+
encryptedText: string,
|
|
12
|
+
key: string,
|
|
13
|
+
iterationCount: number
|
|
14
|
+
): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('AesGcm');
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import AesGcm from './NativeAesGcm';
|
|
2
|
+
|
|
3
|
+
export function encrypt(
|
|
4
|
+
plainText: string,
|
|
5
|
+
key: string,
|
|
6
|
+
iterationCount: number
|
|
7
|
+
): Promise<string> {
|
|
8
|
+
return AesGcm.encrypt(plainText, key, iterationCount);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function decrypt(
|
|
12
|
+
encryptedText: string,
|
|
13
|
+
key: string,
|
|
14
|
+
iterationCount: number
|
|
15
|
+
): Promise<string> {
|
|
16
|
+
return AesGcm.decrypt(encryptedText, key, iterationCount);
|
|
17
|
+
}
|