@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,138 @@
|
|
|
1
|
+
//
|
|
2
|
+
// EncryptionManager.swift
|
|
3
|
+
// AesGcm
|
|
4
|
+
//
|
|
5
|
+
// Created by Prashant Mishra on 18/02/26.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import CryptoSwift
|
|
9
|
+
import CryptoKit
|
|
10
|
+
import Foundation
|
|
11
|
+
|
|
12
|
+
@objc(EncryptionManager)
|
|
13
|
+
public class EncryptionManager: NSObject {
|
|
14
|
+
let SALT_LENGTH = 16
|
|
15
|
+
let IV_LENGTH = 12
|
|
16
|
+
let encriptedPos = 28
|
|
17
|
+
let remainingLengh = 0
|
|
18
|
+
|
|
19
|
+
func getRandomNonce(length: Int) throws -> [UInt8] {
|
|
20
|
+
var nonce = [UInt8](repeating: 0, count: length)
|
|
21
|
+
let result = SecRandomCopyBytes(kSecRandomDefault, length, &nonce)
|
|
22
|
+
guard result == errSecSuccess else {
|
|
23
|
+
throw NSError(domain: "com.example", code: Int(result), userInfo: nil)
|
|
24
|
+
}
|
|
25
|
+
return nonce
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
func generateRandomSalt(length: Int) -> [UInt8] {
|
|
29
|
+
var salt = [UInt8](repeating: 0, count: length)
|
|
30
|
+
_ = SecRandomCopyBytes(kSecRandomDefault, length, &salt)
|
|
31
|
+
return salt
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@objc(decrypt:key:iterationCount:error:)
|
|
35
|
+
public func decrypt(_ encryptedText: String,
|
|
36
|
+
key: String,
|
|
37
|
+
iterationCount: NSNumber,
|
|
38
|
+
error: NSErrorPointer) -> String? {
|
|
39
|
+
|
|
40
|
+
do {
|
|
41
|
+
let trimmedText = encryptedText.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
42
|
+
|
|
43
|
+
guard let encryptedData = Data(base64Encoded: trimmedText) else {
|
|
44
|
+
throw NSError(domain: "Decryption",
|
|
45
|
+
code: -1,
|
|
46
|
+
userInfo: [NSLocalizedDescriptionKey: "Invalid Base64 input"])
|
|
47
|
+
}
|
|
48
|
+
guard encryptedData.count > (SALT_LENGTH + IV_LENGTH) else {
|
|
49
|
+
throw NSError(domain: "Decryption",
|
|
50
|
+
code: -2,
|
|
51
|
+
userInfo: [NSLocalizedDescriptionKey: "Encrypted data too short"])
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Extract salt, IV, ciphertext(+tag if combined)
|
|
55
|
+
let salt = encryptedData[..<SALT_LENGTH]
|
|
56
|
+
let iv = encryptedData[SALT_LENGTH..<(SALT_LENGTH + IV_LENGTH)]
|
|
57
|
+
let encrypted = encryptedData[(SALT_LENGTH + IV_LENGTH)...]
|
|
58
|
+
|
|
59
|
+
let saltData: [UInt8] = Array(salt)
|
|
60
|
+
let password: [UInt8] = Array(key.utf8)
|
|
61
|
+
let encryptedArray: [UInt8] = Array(encrypted)
|
|
62
|
+
let ivArray: [UInt8] = Array(iv)
|
|
63
|
+
|
|
64
|
+
guard let secretKey = try? PKCS5.PBKDF2(
|
|
65
|
+
password: password,
|
|
66
|
+
salt: saltData,
|
|
67
|
+
iterations: iterationCount.intValue,
|
|
68
|
+
keyLength: 32,
|
|
69
|
+
variant: .sha2(.sha512)
|
|
70
|
+
).calculate() else {
|
|
71
|
+
throw NSError(domain: "Decryption",
|
|
72
|
+
code: -3,
|
|
73
|
+
userInfo: [NSLocalizedDescriptionKey: "Key derivation failed"])
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let gcm = GCM(iv: ivArray, mode: .combined)
|
|
77
|
+
let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
|
|
78
|
+
|
|
79
|
+
let decryptedBytes = try aes.decrypt(encryptedArray)
|
|
80
|
+
|
|
81
|
+
let decryptedData = Data(decryptedBytes)
|
|
82
|
+
|
|
83
|
+
guard let decryptedString = String(data: decryptedData, encoding: .utf8) else {
|
|
84
|
+
throw NSError(domain: "Decryption",
|
|
85
|
+
code: -4,
|
|
86
|
+
userInfo: [NSLocalizedDescriptionKey: "UTF8 decoding failed"])
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return decryptedString
|
|
90
|
+
|
|
91
|
+
} catch let err {
|
|
92
|
+
error?.pointee = err as NSError
|
|
93
|
+
return nil
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@objc(encrypt:key:iterationCount:error:)
|
|
98
|
+
public func encrypt(_ plainText: String,
|
|
99
|
+
key: String,
|
|
100
|
+
iterationCount: NSNumber,
|
|
101
|
+
error: NSErrorPointer) -> String? {
|
|
102
|
+
|
|
103
|
+
do {
|
|
104
|
+
print("encryptTextAesGcm JSON : \(plainText)")
|
|
105
|
+
print("encryptTextAesGcm Key : \(key)")
|
|
106
|
+
|
|
107
|
+
let salt = generateRandomSalt(length: SALT_LENGTH)
|
|
108
|
+
let iv = try getRandomNonce(length: IV_LENGTH)
|
|
109
|
+
|
|
110
|
+
let password: [UInt8] = Array(key.utf8)
|
|
111
|
+
let plainTextArray: [UInt8] = Array(plainText.utf8)
|
|
112
|
+
|
|
113
|
+
guard let secretKey = try? PKCS5.PBKDF2(
|
|
114
|
+
password: password,
|
|
115
|
+
salt: salt,
|
|
116
|
+
iterations: iterationCount.intValue,
|
|
117
|
+
keyLength: 32,
|
|
118
|
+
variant: .sha2(.sha512)
|
|
119
|
+
).calculate() else {
|
|
120
|
+
throw NSError(domain: "Encryption", code: -1,
|
|
121
|
+
userInfo: [NSLocalizedDescriptionKey: "Key derivation failed"])
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
let gcm = GCM(iv: iv, mode: .combined)
|
|
125
|
+
let aes = try AES(key: secretKey, blockMode: gcm, padding: .noPadding)
|
|
126
|
+
|
|
127
|
+
let encrypted = try aes.encrypt(plainTextArray)
|
|
128
|
+
|
|
129
|
+
let cipherData = Data(salt + iv + encrypted)
|
|
130
|
+
return cipherData.base64EncodedString()
|
|
131
|
+
|
|
132
|
+
} catch let err {
|
|
133
|
+
error?.pointee = err as NSError
|
|
134
|
+
return nil
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// swift-tools-version: 6.1
|
|
2
|
+
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
|
3
|
+
|
|
4
|
+
import PackageDescription
|
|
5
|
+
|
|
6
|
+
let package = Package(
|
|
7
|
+
name: "React-GeneratedCode",
|
|
8
|
+
platforms: [.iOS(.v15), .macCatalyst(SupportedPlatform.MacCatalystVersion.v13)],
|
|
9
|
+
products: [
|
|
10
|
+
// Products define the executables and libraries a package produces, making them visible to other packages.
|
|
11
|
+
.library(
|
|
12
|
+
name: "ReactCodegen",
|
|
13
|
+
targets: ["ReactCodegen"]),
|
|
14
|
+
.library(
|
|
15
|
+
name: "ReactAppDependencyProvider",
|
|
16
|
+
targets: ["ReactAppDependencyProvider"]),
|
|
17
|
+
],
|
|
18
|
+
dependencies: [
|
|
19
|
+
.package(name: "React", path: "../../../../../../../../node_modules/react-native")
|
|
20
|
+
],
|
|
21
|
+
targets: [
|
|
22
|
+
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
|
23
|
+
// Targets can depend on other targets in this package and products from dependencies.
|
|
24
|
+
.target(
|
|
25
|
+
name: "ReactCodegen",
|
|
26
|
+
dependencies: ["React"],
|
|
27
|
+
path: "ReactCodegen",
|
|
28
|
+
exclude: ["ReactCodegen.podspec"],
|
|
29
|
+
publicHeadersPath: ".",
|
|
30
|
+
cSettings: [
|
|
31
|
+
.headerSearchPath("headers")
|
|
32
|
+
],
|
|
33
|
+
cxxSettings: [
|
|
34
|
+
.headerSearchPath("headers"),
|
|
35
|
+
.unsafeFlags(["-std=c++20"]),
|
|
36
|
+
],
|
|
37
|
+
linkerSettings: [
|
|
38
|
+
.linkedFramework("Foundation")
|
|
39
|
+
]
|
|
40
|
+
),
|
|
41
|
+
.target(
|
|
42
|
+
name: "ReactAppDependencyProvider",
|
|
43
|
+
dependencies: ["ReactCodegen"],
|
|
44
|
+
path: "ReactAppDependencyProvider",
|
|
45
|
+
exclude: ["ReactAppDependencyProvider.podspec"],
|
|
46
|
+
publicHeadersPath: ".",
|
|
47
|
+
cSettings: [
|
|
48
|
+
.headerSearchPath("headers"),
|
|
49
|
+
],
|
|
50
|
+
cxxSettings: [
|
|
51
|
+
.headerSearchPath("headers"),
|
|
52
|
+
.unsafeFlags(["-std=c++20"]),
|
|
53
|
+
],
|
|
54
|
+
linkerSettings: [
|
|
55
|
+
.linkedFramework("Foundation")
|
|
56
|
+
]
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
|
|
12
|
+
#import <React-RCTAppDelegate/RCTDependencyProvider.h>
|
|
13
|
+
#elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
|
|
14
|
+
#import <React_RCTAppDelegate/RCTDependencyProvider.h>
|
|
15
|
+
#else
|
|
16
|
+
#import "RCTDependencyProvider.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
20
|
+
|
|
21
|
+
@interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
|
|
22
|
+
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTAppDependencyProvider.h"
|
|
9
|
+
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
|
|
10
|
+
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
|
|
11
|
+
#import <ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h>
|
|
12
|
+
#import <ReactCodegen/RCTModuleProviders.h>
|
|
13
|
+
|
|
14
|
+
@implementation RCTAppDependencyProvider
|
|
15
|
+
|
|
16
|
+
- (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
|
|
17
|
+
return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
|
|
21
|
+
return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
|
|
25
|
+
return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (nonnull NSArray<NSString *> *)unstableModulesRequiringMainQueueSetup {
|
|
29
|
+
return RCTUnstableModulesRequiringMainQueueSetupProvider.modules;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
|
|
33
|
+
return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (nonnull NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders {
|
|
37
|
+
return RCTModuleProviders.moduleProviders;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@end
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
Pod::Spec.new do |s|
|
|
16
|
+
s.name = "ReactAppDependencyProvider"
|
|
17
|
+
s.version = version
|
|
18
|
+
s.summary = "The third party dependency provider for the app"
|
|
19
|
+
s.homepage = "https://reactnative.dev/"
|
|
20
|
+
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
+
s.license = "MIT"
|
|
22
|
+
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
+
s.platforms = min_supported_versions
|
|
24
|
+
s.source = source
|
|
25
|
+
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
+
"DEFINES_MODULE" => "YES"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
s.dependency "ReactCodegen"
|
|
34
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@protocol RCTModuleProvider;
|
|
11
|
+
|
|
12
|
+
@interface RCTModuleProviders: NSObject
|
|
13
|
+
|
|
14
|
+
+ (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders;
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
#import "RCTModuleProviders.h"
|
|
11
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
12
|
+
#import <React/RCTLog.h>
|
|
13
|
+
|
|
14
|
+
@implementation RCTModuleProviders
|
|
15
|
+
|
|
16
|
+
+ (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders
|
|
17
|
+
{
|
|
18
|
+
static NSDictionary<NSString *, id<RCTModuleProvider>> *providers = nil;
|
|
19
|
+
static dispatch_once_t onceToken;
|
|
20
|
+
|
|
21
|
+
dispatch_once(&onceToken, ^{
|
|
22
|
+
NSDictionary<NSString *, NSString *> * moduleMapping = @{
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count];
|
|
27
|
+
|
|
28
|
+
for (NSString *key in moduleMapping) {
|
|
29
|
+
NSString * moduleProviderName = moduleMapping[key];
|
|
30
|
+
Class klass = NSClassFromString(moduleProviderName);
|
|
31
|
+
if (!klass) {
|
|
32
|
+
RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
id instance = [klass new];
|
|
37
|
+
if (![instance respondsToSelector:@selector(getTurboModule:)]) {
|
|
38
|
+
RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[dict setObject:instance forKey:key];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
providers = dict;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return providers;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@interface RCTModulesConformingToProtocolsProvider: NSObject
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)imageURLLoaderClassNames;
|
|
13
|
+
|
|
14
|
+
+(NSArray<NSString *> *)imageDataDecoderClassNames;
|
|
15
|
+
|
|
16
|
+
+(NSArray<NSString *> *)URLRequestHandlerClassNames;
|
|
17
|
+
|
|
18
|
+
@end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTModulesConformingToProtocolsProvider.h"
|
|
9
|
+
|
|
10
|
+
@implementation RCTModulesConformingToProtocolsProvider
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)imageURLLoaderClassNames
|
|
13
|
+
{
|
|
14
|
+
static NSArray<NSString *> *classNames = nil;
|
|
15
|
+
static dispatch_once_t onceToken;
|
|
16
|
+
|
|
17
|
+
dispatch_once(&onceToken, ^{
|
|
18
|
+
classNames = @[
|
|
19
|
+
|
|
20
|
+
];
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return classNames;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
+(NSArray<NSString *> *)imageDataDecoderClassNames
|
|
27
|
+
{
|
|
28
|
+
static NSArray<NSString *> *classNames = nil;
|
|
29
|
+
static dispatch_once_t onceToken;
|
|
30
|
+
|
|
31
|
+
dispatch_once(&onceToken, ^{
|
|
32
|
+
classNames = @[
|
|
33
|
+
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return classNames;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+(NSArray<NSString *> *)URLRequestHandlerClassNames
|
|
41
|
+
{
|
|
42
|
+
static NSArray<NSString *> *classNames = nil;
|
|
43
|
+
static dispatch_once_t onceToken;
|
|
44
|
+
|
|
45
|
+
dispatch_once(&onceToken, ^{
|
|
46
|
+
classNames = @[
|
|
47
|
+
|
|
48
|
+
];
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return classNames;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@protocol RCTComponentViewProtocol;
|
|
11
|
+
|
|
12
|
+
@interface RCTThirdPartyComponentsProvider: NSObject
|
|
13
|
+
|
|
14
|
+
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTThirdPartyComponentsProvider.h"
|
|
12
|
+
#import <React/RCTComponentViewProtocol.h>
|
|
13
|
+
|
|
14
|
+
@implementation RCTThirdPartyComponentsProvider
|
|
15
|
+
|
|
16
|
+
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
17
|
+
{
|
|
18
|
+
static NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *thirdPartyComponents = nil;
|
|
19
|
+
static dispatch_once_t nativeComponentsToken;
|
|
20
|
+
|
|
21
|
+
dispatch_once(&nativeComponentsToken, ^{
|
|
22
|
+
thirdPartyComponents = @{
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return thirdPartyComponents;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)modules;
|
|
13
|
+
|
|
14
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTUnstableModulesRequiringMainQueueSetupProvider.h"
|
|
9
|
+
|
|
10
|
+
@implementation RCTUnstableModulesRequiringMainQueueSetupProvider
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)modules
|
|
13
|
+
{
|
|
14
|
+
return @[
|
|
15
|
+
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@end
|
|
@@ -0,0 +1,46 @@
|
|
|
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: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "RNAesGcmSpec.h"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@implementation NativeAesGcmSpecBase
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
21
|
+
{
|
|
22
|
+
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
|
|
23
|
+
}
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
namespace facebook::react {
|
|
28
|
+
|
|
29
|
+
static facebook::jsi::Value __hostFunction_NativeAesGcmSpecJSI_encrypt(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
30
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "encrypt", @selector(encrypt:key:iterationCount:resolve:reject:), args, count);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static facebook::jsi::Value __hostFunction_NativeAesGcmSpecJSI_decrypt(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
34
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "decrypt", @selector(decrypt:key:iterationCount:resolve:reject:), args, count);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
NativeAesGcmSpecJSI::NativeAesGcmSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
38
|
+
: ObjCTurboModule(params) {
|
|
39
|
+
|
|
40
|
+
methodMap_["encrypt"] = MethodMetadata {3, __hostFunction_NativeAesGcmSpecJSI_encrypt};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
methodMap_["decrypt"] = MethodMetadata {3, __hostFunction_NativeAesGcmSpecJSI_decrypt};
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,71 @@
|
|
|
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: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of RNAesGcmSpec symbols
|
|
19
|
+
#ifndef RNAesGcmSpec_H
|
|
20
|
+
#define RNAesGcmSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
35
|
+
|
|
36
|
+
@protocol NativeAesGcmSpec <RCTBridgeModule, RCTTurboModule>
|
|
37
|
+
|
|
38
|
+
- (void)encrypt:(NSString *)plainText
|
|
39
|
+
key:(NSString *)key
|
|
40
|
+
iterationCount:(double)iterationCount
|
|
41
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
42
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
43
|
+
- (void)decrypt:(NSString *)encryptedText
|
|
44
|
+
key:(NSString *)key
|
|
45
|
+
iterationCount:(double)iterationCount
|
|
46
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
47
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
48
|
+
|
|
49
|
+
@end
|
|
50
|
+
|
|
51
|
+
@interface NativeAesGcmSpecBase : NSObject {
|
|
52
|
+
@protected
|
|
53
|
+
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
54
|
+
}
|
|
55
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
namespace facebook::react {
|
|
61
|
+
/**
|
|
62
|
+
* ObjC++ class for module 'NativeAesGcm'
|
|
63
|
+
*/
|
|
64
|
+
class JSI_EXPORT NativeAesGcmSpecJSI : public ObjCTurboModule {
|
|
65
|
+
public:
|
|
66
|
+
NativeAesGcmSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
67
|
+
};
|
|
68
|
+
} // namespace facebook::react
|
|
69
|
+
|
|
70
|
+
NS_ASSUME_NONNULL_END
|
|
71
|
+
#endif // RNAesGcmSpec_H
|