packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FastRsaExample
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 10.0.2.2
5 | localhost
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/fastrsaexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.fastrsaexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 21
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 | kotlinVersion = '1.7.0'
10 |
11 |
12 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
13 | ndkVersion = "23.1.7779620"
14 | }
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | dependencies {
20 | classpath("com.android.tools.build:gradle")
21 | classpath("com.facebook.react:react-native-gradle-plugin")
22 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
23 | }
24 | }
25 |
26 | allprojects {
27 | repositories {
28 | google()
29 | maven {
30 | url("$rootDir/../node_modules/detox/Detox-android")
31 | }
32 | maven { url 'https://www.jitpack.io' }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.182.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Mar 16 21:42:37 PET 2025
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
5 | networkTimeout=10000
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
9 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'FastRsaExample'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/@react-native/gradle-plugin')
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "FastRsaExample",
3 | "displayName": "FastRsaExample"
4 | }
5 |
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | presets: ['module:metro-react-native-babel-preset'],
6 | plugins: [
7 | [
8 | 'module-resolver',
9 | {
10 | extensions: ['.tsx', '.ts', '.js', '.json'],
11 | alias: {
12 | [pak.name]: path.join(__dirname, '..', pak.source),
13 | },
14 | },
15 | ],
16 | ],
17 | };
18 |
--------------------------------------------------------------------------------
/example/e2e/jest.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('@jest/types').Config.InitialOptions} */
2 | module.exports = {
3 | rootDir: '..',
4 | testMatch: ['/e2e/**/*.test.js'],
5 | testTimeout: 120000,
6 | maxWorkers: 1,
7 | globalSetup: 'detox/runners/jest/globalSetup',
8 | globalTeardown: 'detox/runners/jest/globalTeardown',
9 | reporters: ['detox/runners/jest/reporter'],
10 | testEnvironment: 'detox/runners/jest/testEnvironment',
11 | verbose: true,
12 | };
13 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 | import App from './src/App';
3 | import { name as appName } from './app.json';
4 |
5 | AppRegistry.registerComponent(appName, () => App);
6 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | Pods/
2 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : RCTAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"FastRsaExample";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | FastRsaExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExample/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExampleTests/FastRsaExampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface FastRsaExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation FastRsaExampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/ios/FastRsaExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/File.swift:
--------------------------------------------------------------------------------
1 | //
2 | // File.swift
3 | // FastRsaExample
4 | //
5 |
6 | import Foundation
7 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Resolve react_native_pods.rb with node to allow for hoisting
2 | require Pod::Executable.execute_command('node', ['-p',
3 | 'require.resolve(
4 | "react-native/scripts/react_native_pods.rb",
5 | {paths: [process.argv[1]]},
6 | )', __dir__]).strip
7 |
8 | platform :ios, min_ios_version_supported
9 | prepare_react_native_project!
10 |
11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
13 | #
14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
15 | # ```js
16 | # module.exports = {
17 | # dependencies: {
18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
19 | # ```
20 | flipper_config = FlipperConfiguration.disabled
21 |
22 | linkage = ENV['USE_FRAMEWORKS']
23 | if linkage != nil
24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
25 | use_frameworks! :linkage => linkage.to_sym
26 | end
27 |
28 | target 'FastRsaExample' do
29 | config = use_native_modules!
30 |
31 | # Flags change depending on the env values.
32 | flags = get_default_flags()
33 |
34 | use_react_native!(
35 | :path => config[:reactNativePath],
36 | # Hermes is now enabled by default. Disable by setting this flag to false.
37 | :hermes_enabled => flags[:hermes_enabled],
38 | :fabric_enabled => flags[:fabric_enabled],
39 | # Enables Flipper.
40 | #
41 | # Note that if you have use_frameworks! enabled, Flipper will not work and
42 | # you should disable the next line.
43 | :flipper_configuration => flipper_config,
44 | # An absolute path to your application root.
45 | :app_path => "#{Pod::Config.instance.installation_root}/.."
46 | )
47 |
48 | target 'FastRsaExampleTests' do
49 | inherit! :complete
50 | # Pods for testing
51 | end
52 |
53 | post_install do |installer|
54 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
55 | react_native_post_install(
56 | installer,
57 | config[:reactNativePath],
58 | :mac_catalyst_enabled => false
59 | )
60 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/example/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | };
4 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2 | const path = require('path');
3 | const escape = require('escape-string-regexp');
4 | const exclusionList = require('metro-config/src/defaults/exclusionList');
5 | const pak = require('../package.json');
6 |
7 | const root = path.resolve(__dirname, '..');
8 | const modules = Object.keys({ ...pak.peerDependencies });
9 |
10 | /**
11 | * Metro configuration
12 | * https://facebook.github.io/metro/docs/configuration
13 | *
14 | * @type {import('metro-config').MetroConfig}
15 | */
16 | const config = {
17 | watchFolders: [root],
18 |
19 | // We need to make sure that only one version is loaded for peerDependencies
20 | // So we block them at the root, and alias them to the versions in example's node_modules
21 | resolver: {
22 | blacklistRE: exclusionList(
23 | modules.map(
24 | (m) =>
25 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
26 | )
27 | ),
28 |
29 | extraNodeModules: modules.reduce((acc, name) => {
30 | acc[name] = path.join(__dirname, 'node_modules', name);
31 | return acc;
32 | }, {}),
33 | },
34 |
35 | transformer: {
36 | getTransformOptions: async () => ({
37 | transform: {
38 | experimentalImportSupport: false,
39 | inlineRequires: true,
40 | },
41 | }),
42 | },
43 | };
44 |
45 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
46 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-fast-rsa-example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "test:android": "detox test --configuration android.att.debug",
10 | "build:android": "detox build --configuration android.att.debug",
11 | "test:ios": "detox test --configuration ios.sim.debug",
12 | "build:ios": "detox build --configuration ios.sim.debug",
13 | "build:android:debug": "cd android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
14 | "build:ios:debug": "cd ios && xcodebuild -workspace FastRsaExample.xcworkspace -scheme FastRsaExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
15 | },
16 | "dependencies": {
17 | "react": "18.2.0",
18 | "react-native": "0.72.6"
19 | },
20 | "devDependencies": {
21 | "@babel/core": "^7.20.0",
22 | "@babel/preset-env": "^7.20.0",
23 | "@babel/runtime": "^7.20.0",
24 | "@react-native/metro-config": "^0.72.11",
25 | "babel-plugin-module-resolver": "^5.0.0",
26 | "detox": "^20.13.1",
27 | "jest": "^29",
28 | "metro-react-native-babel-preset": "0.76.8",
29 | "pod-install": "^0.1.0"
30 | },
31 | "engines": {
32 | "node": ">=16"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/example/react-native.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | dependencies: {
6 | [pak.name]: {
7 | root: path.join(__dirname, '..'),
8 | },
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/example/src/components/Container.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {StyleSheet, View} from "react-native";
3 |
4 | interface Props {
5 | children: React.ReactNode[] | React.ReactNode
6 | testID: string
7 | }
8 |
9 | export default function ({testID,children}: Props) {
10 | return {children};
11 | }
12 |
13 | const styles = StyleSheet.create({
14 | container: {
15 | backgroundColor: '#f1f0f0',
16 | borderRadius: 10,
17 | padding: 5,
18 | margin: 5,
19 | marginBottom:10,
20 | },
21 | });
22 |
--------------------------------------------------------------------------------
/example/src/components/SectionContainer.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {StyleSheet, View} from "react-native";
3 |
4 | interface Props {
5 | children: React.ReactNode[]
6 | testID: string
7 | }
8 |
9 | export default function ({testID,children}: Props) {
10 | return {children};
11 | }
12 |
13 | const styles = StyleSheet.create({
14 | sectionContainer: {
15 | backgroundColor: '#f9f9f9',
16 | borderRadius: 10,
17 | padding: 10,
18 | paddingHorizontal: 20,
19 | margin: 10,
20 | },
21 | });
22 |
--------------------------------------------------------------------------------
/example/src/components/SectionResult.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import {Colors} from "react-native/Libraries/NewAppScreen";
4 | import {StyleSheet, Text} from "react-native";
5 |
6 | interface Props {
7 | children: React.ReactNode
8 | testID: string
9 | }
10 |
11 | export default function ({children, testID}: Props) {
12 | return {children};
13 | }
14 | const styles = StyleSheet.create({
15 | sectionDescription: {
16 | marginTop: 8,
17 | fontSize: 14,
18 | fontWeight: '400',
19 | color: Colors.dark,
20 | },
21 | });
22 |
--------------------------------------------------------------------------------
/example/src/components/SectionTitle.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import {Colors} from "react-native/Libraries/NewAppScreen";
4 | import {StyleSheet, Text} from "react-native";
5 |
6 | interface Props {
7 | children: String
8 | }
9 |
10 | export default function ({children}: Props) {
11 | return {children};
12 | }
13 | const styles = StyleSheet.create({
14 | sectionTitle: {
15 | fontSize: 24,
16 | fontWeight: '600',
17 | color: Colors.black,
18 | },
19 | });
20 |
--------------------------------------------------------------------------------
/example/src/modules/Base64.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [result, setResult] = useState('');
20 |
21 | return
22 |
23 | Base64
24 | {
28 | setInput(text);
29 | }}
30 | style={{backgroundColor: Colors.white, borderRadius: 4}}
31 | placeholder={"insert message here"}
32 | />
33 |
45 | ;
46 | }
--------------------------------------------------------------------------------
/example/src/modules/ConvertJWT.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from 'react-native';
2 | import React, { useState } from 'react';
3 | import RSA from 'react-native-fast-rsa';
4 | import SectionContainer from '../components/SectionContainer';
5 | import SectionTitle from '../components/SectionTitle';
6 | import SectionResult from '../components/SectionResult';
7 | import Container from '../components/Container';
8 |
9 | interface Props {
10 | publicKey: string;
11 | privateKey: string;
12 | passphrase: string;
13 | }
14 |
15 | export default function ({ publicKey, privateKey }: Props) {
16 | const [privateResult, setPrivate] = useState('');
17 | const [publicResult, setPublic] = useState('');
18 |
19 | return (
20 |
21 |
22 | Convert JWT
23 |
54 |
55 | );
56 | }
57 |
--------------------------------------------------------------------------------
/example/src/modules/ConvertKeyPair.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from 'react-native';
2 | import React, { useState } from 'react';
3 | import RSA from 'react-native-fast-rsa';
4 | import SectionContainer from '../components/SectionContainer';
5 | import SectionTitle from '../components/SectionTitle';
6 | import SectionResult from '../components/SectionResult';
7 | import Container from '../components/Container';
8 |
9 | interface Props {
10 | publicKey: string;
11 | privateKey: string;
12 | passphrase: string;
13 | }
14 |
15 | export default function ({ passphrase, privateKey }: Props) {
16 | const [privateResult, setPrivate] = useState('');
17 |
18 | return (
19 |
20 |
21 | Convert KeyPair
22 | {
26 | const output = await RSA.convertKeyPairToPKCS12(
27 | privateKey,
28 | '',
29 | passphrase
30 | );
31 | setPrivate(output);
32 | }}
33 | />
34 | {!!privateResult && (
35 | {privateResult}
36 | )}
37 |
38 |
39 | );
40 | }
41 |
--------------------------------------------------------------------------------
/example/src/modules/ConvertPrivate.tsx:
--------------------------------------------------------------------------------
1 | import {Button} from "react-native";
2 | import React, {useState} from "react";
3 | import RSA from 'react-native-fast-rsa';
4 | import SectionContainer from "../components/SectionContainer";
5 | import SectionTitle from "../components/SectionTitle";
6 | import SectionResult from "../components/SectionResult";
7 | import Container from "../components/Container";
8 |
9 | interface Props {
10 | publicKey: string,
11 | privateKey: string,
12 | passphrase: string
13 | }
14 |
15 | export default function ({privateKey}: Props) {
16 |
17 | const [jwt, setJWT] = useState('');
18 | const [pkcs1, setPKCS1] = useState('');
19 | const [pkcs8, setPKCS8] = useState('');
20 | const [publicKey, setPublicKey] = useState('');
21 |
22 | return
23 |
24 | Convert PrivateKey
25 | {
29 | const output = await RSA.convertPrivateKeyToJWK(
30 | privateKey
31 | );
32 | setJWT(JSON.stringify(output));
33 | }}
34 | />
35 | {!!jwt && {jwt}}
36 | {
40 | const output = await RSA.convertPrivateKeyToPKCS1(
41 | privateKey
42 | );
43 | setPKCS1(output);
44 | }}
45 | />
46 | {!!jwt && {pkcs1}}
47 | {
51 | const output = await RSA.convertPrivateKeyToPKCS8(
52 | privateKey
53 | );
54 | setPKCS8(output);
55 | }}
56 | />
57 | {!!jwt && {pkcs8}}
58 | {
62 | const output = await RSA.convertPrivateKeyToPublicKey(
63 | privateKey
64 | );
65 | setPublicKey(output);
66 | }}
67 | />
68 | {!!jwt && {publicKey}}
69 |
70 | ;
71 | }
--------------------------------------------------------------------------------
/example/src/modules/ConvertPublic.tsx:
--------------------------------------------------------------------------------
1 | import {Button} from "react-native";
2 | import React, {useState} from "react";
3 | import RSA from 'react-native-fast-rsa';
4 | import SectionContainer from "../components/SectionContainer";
5 | import SectionTitle from "../components/SectionTitle";
6 | import SectionResult from "../components/SectionResult";
7 | import Container from "../components/Container";
8 |
9 | interface Props {
10 | publicKey: string,
11 | privateKey: string,
12 | passphrase: string
13 | }
14 |
15 | export default function ({publicKey}: Props) {
16 |
17 | const [jwt, setJWT] = useState('');
18 | const [pkcs1, setPKCS1] = useState('');
19 | const [pkix, setPKIX] = useState('');
20 |
21 | return
22 |
23 | Convert PublicKey
24 | {
28 | const output = await RSA.convertPublicKeyToJWK(
29 | publicKey
30 | );
31 | setJWT(JSON.stringify(output));
32 | }}
33 | />
34 | {!!jwt && {jwt}}
35 | {
39 | const output = await RSA.convertPublicKeyToPKCS1(
40 | publicKey
41 | );
42 | setPKCS1(output);
43 | }}
44 | />
45 | {!!jwt && {pkcs1}}
46 | {
50 | const output = await RSA.convertPublicKeyToPKIX(
51 | publicKey
52 | );
53 | setPKIX(output);
54 | }}
55 | />
56 | {!!jwt && {pkix}}
57 |
58 | ;
59 | }
--------------------------------------------------------------------------------
/example/src/modules/EncryptDecryptOAEP.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA, { Hash } from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({publicKey, privateKey}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [encrypted, setEncrypted] = useState('');
20 | const [decrypted, setDecrypted] = useState('');
21 |
22 | return
23 |
24 | Encrypt OAEP
25 | {
29 | setInput(text);
30 | }}
31 | style={{backgroundColor: Colors.white, borderRadius: 4}}
32 | placeholder={"insert message here"}
33 | />
34 | {
38 | const output = await RSA.encryptOAEP(input,"sample",Hash.SHA256, publicKey);
39 | setEncrypted(output);
40 | }}
41 | />
42 | {!!encrypted && {encrypted}}
43 |
44 | {!!encrypted && (
45 |
46 | Decrypt OAEP
47 | {
51 | const output = await RSA.decryptOAEP(
52 | encrypted,
53 | "sample",
54 | Hash.SHA256,
55 | privateKey
56 | );
57 | setDecrypted(output);
58 | }}
59 | />
60 | {!!decrypted && (
61 |
62 | {decrypted}
63 |
64 | )}
65 |
66 | )}
67 | ;
68 | }
69 |
--------------------------------------------------------------------------------
/example/src/modules/EncryptDecryptOAEPBytes.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA, { Hash } from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 | import { base64Encode, uint8ArrayToString } from "../utils/codecs";
10 |
11 | interface Props {
12 | publicKey: string,
13 | privateKey: string,
14 | passphrase: string
15 | }
16 |
17 | export default function ({publicKey, privateKey}: Props) {
18 |
19 | const [input, setInput] = useState();
20 | const [encrypted, setEncrypted] = useState();
21 | const [decrypted, setDecrypted] = useState();
22 |
23 | return
24 |
25 | Encrypt OAEP Bytes
26 | {
29 | const encoded = new global.TextEncoder().encode(text);
30 | setInput(encoded);
31 | }}
32 | style={{backgroundColor: Colors.white, borderRadius: 4}}
33 | placeholder={"insert message here"}
34 | />
35 | {
39 | if (!input) {
40 | return;
41 | }
42 | const output = await RSA.encryptOAEPBytes(input,"sample",Hash.SHA256, publicKey);
43 | setEncrypted(output);
44 | }}
45 | />
46 | {!!encrypted && (
47 |
48 | bytes: {encrypted.join(", ")}
49 |
50 | )}
51 | {!!encrypted && (
52 |
53 | base64: {base64Encode(encrypted)}
54 |
55 | )}
56 |
57 | {!!encrypted && (
58 |
59 | Decrypt OAEP Bytes
60 | {
64 | const output = await RSA.decryptOAEPBytes(
65 | encrypted,
66 | "sample",
67 | Hash.SHA256,
68 | privateKey
69 | );
70 | setDecrypted(output);
71 | }}
72 | />
73 | {!!decrypted && (
74 |
75 | bytes: {decrypted.join(", ")}
76 |
77 | )}
78 | {!!decrypted && (
79 |
80 | decoded: {uint8ArrayToString(decrypted)}
81 |
82 | )}
83 |
84 | )}
85 | ;
86 | }
87 |
--------------------------------------------------------------------------------
/example/src/modules/EncryptDecryptPKCS.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({publicKey, privateKey}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [encrypted, setEncrypted] = useState('');
20 | const [decrypted, setDecrypted] = useState('');
21 |
22 | return
23 |
24 | Encrypt PKCS1v15
25 | {
29 | setInput(text);
30 | }}
31 | style={{backgroundColor: Colors.white, borderRadius: 4}}
32 | placeholder={"insert message here"}
33 | />
34 | {
38 | const output = await RSA.encryptPKCS1v15(input, publicKey);
39 | setEncrypted(output);
40 | }}
41 | />
42 | {!!encrypted && {encrypted}}
43 |
44 | {!!encrypted && (
45 |
46 | Decrypt PKCS1v15
47 | {
51 | const output = await RSA.decryptPKCS1v15(
52 | encrypted,
53 | privateKey
54 | );
55 | setDecrypted(output);
56 | }}
57 | />
58 | {!!decrypted && (
59 |
60 | {decrypted}
61 |
62 | )}
63 |
64 | )}
65 | ;
66 | }
67 |
--------------------------------------------------------------------------------
/example/src/modules/Generate.tsx:
--------------------------------------------------------------------------------
1 | import {Button} from "react-native";
2 | import React, {useState} from "react";
3 | import RSA from 'react-native-fast-rsa';
4 | import SectionContainer from "../components/SectionContainer";
5 | import SectionTitle from "../components/SectionTitle";
6 | import SectionResult from "../components/SectionResult";
7 | import Container from "../components/Container";
8 |
9 | interface Props {
10 | publicKey: string,
11 | privateKey: string,
12 | passphrase: string
13 | }
14 |
15 | export default function ({}: Props) {
16 |
17 | const [keyPair, setKeyPair] = useState({publicKey: '', privateKey: ''});
18 |
19 | return
20 |
21 | Generate
22 |
23 | {
27 | const output = await RSA.generate(4096);
28 | setKeyPair(output);
29 | }}
30 | />
31 | {!!keyPair && !!keyPair.publicKey && {keyPair.publicKey}}
32 | {!!keyPair && !!keyPair.privateKey && {keyPair.privateKey}}
33 |
34 |
35 | ;
36 | }
37 |
--------------------------------------------------------------------------------
/example/src/modules/HashExample.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA, { Hash } from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [result, setResult] = useState('');
20 |
21 | return
22 |
23 | Hash
24 | {
28 | setInput(text);
29 | }}
30 | style={{backgroundColor: Colors.white, borderRadius: 4}}
31 | placeholder={"insert message here"}
32 | />
33 | {
37 | const output = await RSA.hash(
38 | input,
39 | Hash.SHA512
40 | );
41 | setResult(output);
42 | }}
43 | />
44 | {!!result && {result}}
45 |
46 | ;
47 | }
--------------------------------------------------------------------------------
/example/src/modules/SignVerifyPKCS.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA, { Hash } from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({publicKey, privateKey}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [signed, setSigned] = useState('');
20 | const [verified, setVerified] = useState(false);
21 |
22 | return
23 |
24 | Sign PKCS1v15
25 | {
29 | setInput(text);
30 | }}
31 | style={{backgroundColor: Colors.white, borderRadius: 4}}
32 | placeholder={"insert message here"}
33 | />
34 | {
38 | const output = await RSA.signPKCS1v15(
39 | input,
40 | Hash.SHA224,
41 | privateKey
42 | );
43 | setSigned(output);
44 | }}
45 | />
46 | {!!signed && {signed}}
47 |
48 | {!!signed && (
49 |
50 | Verify PKCS1v15
51 | {
55 | const output = await RSA.verifyPKCS1v15(
56 | signed,
57 | input,
58 | Hash.SHA224,
59 | publicKey
60 | );
61 |
62 | setVerified(output);
63 | }}
64 | />
65 | {typeof verified !== 'undefined' && (
66 |
67 | {verified ? 'valid' : 'invalid'}
68 |
69 | )}
70 |
71 | )}
72 | ;
73 | }
--------------------------------------------------------------------------------
/example/src/modules/SignVerifyPSS.tsx:
--------------------------------------------------------------------------------
1 | import {Colors} from "react-native/Libraries/NewAppScreen";
2 | import {Button, TextInput} from "react-native";
3 | import React, {useState} from "react";
4 | import RSA, { Hash, SaltLength } from 'react-native-fast-rsa';
5 | import SectionContainer from "../components/SectionContainer";
6 | import SectionTitle from "../components/SectionTitle";
7 | import SectionResult from "../components/SectionResult";
8 | import Container from "../components/Container";
9 |
10 | interface Props {
11 | publicKey: string,
12 | privateKey: string,
13 | passphrase: string
14 | }
15 |
16 | export default function ({publicKey, privateKey}: Props) {
17 |
18 | const [input, setInput] = useState('');
19 | const [signed, setSigned] = useState('');
20 | const [verified, setVerified] = useState(false);
21 |
22 | return
23 |
24 | Sign PSS
25 | {
29 | setInput(text);
30 | }}
31 | style={{backgroundColor: Colors.white, borderRadius: 4}}
32 | placeholder={"insert message here"}
33 | />
34 | {
38 | const output = await RSA.signPSS(
39 | input,
40 | Hash.SHA224,
41 | SaltLength.AUTO,
42 | privateKey
43 | );
44 | setSigned(output);
45 | }}
46 | />
47 | {!!signed && {signed}}
48 |
49 | {!!signed && (
50 |
51 | Verify PSS
52 | {
56 | const output = await RSA.verifyPSS(
57 | signed,
58 | input,
59 | Hash.SHA224,
60 | SaltLength.AUTO,
61 | publicKey
62 | );
63 |
64 | setVerified(output);
65 | }}
66 | />
67 | {typeof verified !== 'undefined' && (
68 |
69 | {verified ? 'valid' : 'invalid'}
70 |
71 | )}
72 |
73 | )}
74 | ;
75 | }
--------------------------------------------------------------------------------
/example/src/utils/base64.ts:
--------------------------------------------------------------------------------
1 | const keyStr: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
2 |
3 | export default {
4 | encode: function (input: string): string {
5 | const output: string[] = [];
6 | let chr1: number, chr2: number, chr3: number;
7 | let enc1: number, enc2: number, enc3: number, enc4: number;
8 | let i = 0;
9 |
10 | do {
11 | chr1 = input.charCodeAt(i++);
12 | chr2 = input.charCodeAt(i++);
13 | chr3 = input.charCodeAt(i++);
14 |
15 | enc1 = chr1 >> 2;
16 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
17 | enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
18 | enc4 = chr3 & 63;
19 |
20 | if (isNaN(chr2)) {
21 | enc3 = enc4 = 64;
22 | } else if (isNaN(chr3)) {
23 | enc4 = 64;
24 | }
25 |
26 | output.push(
27 | keyStr.charAt(enc1) +
28 | keyStr.charAt(enc2) +
29 | keyStr.charAt(enc3) +
30 | keyStr.charAt(enc4)
31 | );
32 | } while (i < input.length);
33 |
34 | return output.join('');
35 | },
36 |
37 | encodeFromByteArray: function (input: Uint8Array): string {
38 | const output: string[] = [];
39 | let chr1: any, chr2: any, chr3: any;
40 | let enc1: number, enc2: number, enc3: number, enc4: number;
41 | let i = 0;
42 |
43 | do {
44 | chr1 = input[i++];
45 | chr2 = input[i++];
46 | chr3 = input[i++];
47 |
48 | enc1 = chr1 >> 2;
49 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
50 | enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
51 | enc4 = chr3 & 63;
52 |
53 | if (isNaN(chr2)) {
54 | enc3 = enc4 = 64;
55 | } else if (isNaN(chr3)) {
56 | enc4 = 64;
57 | }
58 |
59 | output.push(
60 | keyStr.charAt(enc1) +
61 | keyStr.charAt(enc2) +
62 | keyStr.charAt(enc3) +
63 | keyStr.charAt(enc4)
64 | );
65 | } while (i < input.length);
66 |
67 | return output.join('');
68 | },
69 |
70 | decode: function (input: string): string {
71 | let output = "";
72 | let chr1: number, chr2: number, chr3: number;
73 | let enc1: number, enc2: number, enc3: number, enc4: number;
74 | let i = 0;
75 |
76 | const base64test = /[^A-Za-z0-9\+\/\=]/g;
77 | if (base64test.exec(input)) {
78 | throw new Error("Invalid base64 characters in input text.");
79 | }
80 | input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
81 |
82 | do {
83 | enc1 = keyStr.indexOf(input.charAt(i++));
84 | enc2 = keyStr.indexOf(input.charAt(i++));
85 | enc3 = keyStr.indexOf(input.charAt(i++));
86 | enc4 = keyStr.indexOf(input.charAt(i++));
87 |
88 | chr1 = (enc1 << 2) | (enc2 >> 4);
89 | chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
90 | chr3 = ((enc3 & 3) << 6) | enc4;
91 |
92 | output += String.fromCharCode(chr1);
93 |
94 | if (enc3 !== 64) {
95 | output += String.fromCharCode(chr2);
96 | }
97 | if (enc4 !== 64) {
98 | output += String.fromCharCode(chr3);
99 | }
100 | } while (i < input.length);
101 |
102 | return output;
103 | }
104 | };
105 |
--------------------------------------------------------------------------------
/example/src/utils/codecs.ts:
--------------------------------------------------------------------------------
1 | import base64 from "./base64";
2 |
3 | export function base64Encode(uint8Array:Uint8Array) {
4 | let binary = '';
5 | uint8Array.forEach(byte => {
6 | binary += String.fromCharCode(byte);
7 | });
8 | return base64.encode(binary);
9 | }
10 |
11 | export function stringToUint8Array(str:string) {
12 | return new global.TextEncoder().encode(str);
13 | }
14 |
15 | export function uint8ArrayToString(str:Uint8Array) {
16 | return new global.TextDecoder().decode(str);
17 | }
18 |
--------------------------------------------------------------------------------
/ios/FastRsa.h:
--------------------------------------------------------------------------------
1 | #ifdef __cplusplus
2 | #import "react-native-fast-rsa.h"
3 | #endif
4 |
5 | #import
6 |
7 | @interface FastRsa : NSObject
8 | @property (nonatomic, assign) BOOL setBridgeOnMainQueue;
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AvailableLibraries
6 |
7 |
8 | BinaryPath
9 | RSABridge.framework/RSABridge
10 | LibraryIdentifier
11 | ios-arm64_x86_64-simulator
12 | LibraryPath
13 | RSABridge.framework
14 | SupportedArchitectures
15 |
16 | arm64
17 | x86_64
18 |
19 | SupportedPlatform
20 | ios
21 | SupportedPlatformVariant
22 | simulator
23 |
24 |
25 | BinaryPath
26 | RSABridge.framework/RSABridge
27 | LibraryIdentifier
28 | ios-arm64
29 | LibraryPath
30 | RSABridge.framework
31 | SupportedArchitectures
32 |
33 | arm64
34 |
35 | SupportedPlatform
36 | ios
37 |
38 |
39 | BinaryPath
40 | RSABridge.framework/RSABridge
41 | LibraryIdentifier
42 | ios-arm64_x86_64-maccatalyst
43 | LibraryPath
44 | RSABridge.framework
45 | SupportedArchitectures
46 |
47 | arm64
48 | x86_64
49 |
50 | SupportedPlatform
51 | ios
52 | SupportedPlatformVariant
53 | maccatalyst
54 |
55 |
56 | CFBundlePackageType
57 | XFWK
58 | XCFrameworkFormatVersion
59 | 1.0
60 |
61 |
62 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64/RSABridge.framework/Headers/librsa_bridge.h:
--------------------------------------------------------------------------------
1 | /* Code generated by cmd/cgo; DO NOT EDIT. */
2 |
3 | /* package command-line-arguments */
4 |
5 |
6 | #line 1 "cgo-builtin-export-prolog"
7 |
8 | #include
9 |
10 | #ifndef GO_CGO_EXPORT_PROLOGUE_H
11 | #define GO_CGO_EXPORT_PROLOGUE_H
12 |
13 | #ifndef GO_CGO_GOSTRING_TYPEDEF
14 | typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15 | #endif
16 |
17 | #endif
18 |
19 | /* Start of preamble from import "C" comments. */
20 |
21 |
22 | #line 3 "main.go"
23 | #include
24 | #include
25 | typedef struct { void* message; int size; char* error; } BytesReturn;
26 |
27 | #line 1 "cgo-generated-wrapper"
28 |
29 |
30 | /* End of preamble from import "C" comments. */
31 |
32 |
33 | /* Start of boilerplate cgo prologue. */
34 | #line 1 "cgo-gcc-export-header-prolog"
35 |
36 | #ifndef GO_CGO_PROLOGUE_H
37 | #define GO_CGO_PROLOGUE_H
38 |
39 | typedef signed char GoInt8;
40 | typedef unsigned char GoUint8;
41 | typedef short GoInt16;
42 | typedef unsigned short GoUint16;
43 | typedef int GoInt32;
44 | typedef unsigned int GoUint32;
45 | typedef long long GoInt64;
46 | typedef unsigned long long GoUint64;
47 | typedef GoInt64 GoInt;
48 | typedef GoUint64 GoUint;
49 | typedef size_t GoUintptr;
50 | typedef float GoFloat32;
51 | typedef double GoFloat64;
52 | #ifdef _MSC_VER
53 | #include
54 | typedef _Fcomplex GoComplex64;
55 | typedef _Dcomplex GoComplex128;
56 | #else
57 | typedef float _Complex GoComplex64;
58 | typedef double _Complex GoComplex128;
59 | #endif
60 |
61 | /*
62 | static assertion to make sure the file is being used on architecture
63 | at least with matching size of GoInt.
64 | */
65 | typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
66 |
67 | #ifndef GO_CGO_GOSTRING_TYPEDEF
68 | typedef _GoString_ GoString;
69 | #endif
70 | typedef void *GoMap;
71 | typedef void *GoChan;
72 | typedef struct { void *t; void *v; } GoInterface;
73 | typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
74 |
75 | #endif
76 |
77 | /* End of boilerplate cgo prologue. */
78 |
79 | #ifdef __cplusplus
80 | extern "C" {
81 | #endif
82 |
83 | extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize);
84 | extern BytesReturn* RSAEncodeText(char* input, char* encoding);
85 | extern char* RSADecodeText(void* input, int size, char* encoding, int fatal, int ignoreBOM, int stream);
86 |
87 | #ifdef __cplusplus
88 | }
89 | #endif
90 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64/RSABridge.framework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleExecutable
6 | RSABridge
7 | CFBundleIdentifier
8 | RSABridge
9 | MinimumOSVersion
10 | 100.0
11 | CFBundleShortVersionString
12 | 1.7.0
13 | CFBundleVersion
14 | 1.7.0.1745445032
15 | CFBundlePackageType
16 | FMWK
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64/RSABridge.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module "RSABridge" {
2 | header "librsa_bridge.h"
3 | export *
4 | }
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64/RSABridge.framework/RSABridge:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/ios/RSABridge.xcframework/ios-arm64/RSABridge.framework/RSABridge
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-maccatalyst/RSABridge.framework/Headers/librsa_bridge.h:
--------------------------------------------------------------------------------
1 | /* Code generated by cmd/cgo; DO NOT EDIT. */
2 |
3 | /* package command-line-arguments */
4 |
5 |
6 | #line 1 "cgo-builtin-export-prolog"
7 |
8 | #include
9 |
10 | #ifndef GO_CGO_EXPORT_PROLOGUE_H
11 | #define GO_CGO_EXPORT_PROLOGUE_H
12 |
13 | #ifndef GO_CGO_GOSTRING_TYPEDEF
14 | typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15 | #endif
16 |
17 | #endif
18 |
19 | /* Start of preamble from import "C" comments. */
20 |
21 |
22 | #line 3 "main.go"
23 | #include
24 | #include
25 | typedef struct { void* message; int size; char* error; } BytesReturn;
26 |
27 | #line 1 "cgo-generated-wrapper"
28 |
29 |
30 | /* End of preamble from import "C" comments. */
31 |
32 |
33 | /* Start of boilerplate cgo prologue. */
34 | #line 1 "cgo-gcc-export-header-prolog"
35 |
36 | #ifndef GO_CGO_PROLOGUE_H
37 | #define GO_CGO_PROLOGUE_H
38 |
39 | typedef signed char GoInt8;
40 | typedef unsigned char GoUint8;
41 | typedef short GoInt16;
42 | typedef unsigned short GoUint16;
43 | typedef int GoInt32;
44 | typedef unsigned int GoUint32;
45 | typedef long long GoInt64;
46 | typedef unsigned long long GoUint64;
47 | typedef GoInt64 GoInt;
48 | typedef GoUint64 GoUint;
49 | typedef size_t GoUintptr;
50 | typedef float GoFloat32;
51 | typedef double GoFloat64;
52 | #ifdef _MSC_VER
53 | #include
54 | typedef _Fcomplex GoComplex64;
55 | typedef _Dcomplex GoComplex128;
56 | #else
57 | typedef float _Complex GoComplex64;
58 | typedef double _Complex GoComplex128;
59 | #endif
60 |
61 | /*
62 | static assertion to make sure the file is being used on architecture
63 | at least with matching size of GoInt.
64 | */
65 | typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
66 |
67 | #ifndef GO_CGO_GOSTRING_TYPEDEF
68 | typedef _GoString_ GoString;
69 | #endif
70 | typedef void *GoMap;
71 | typedef void *GoChan;
72 | typedef struct { void *t; void *v; } GoInterface;
73 | typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
74 |
75 | #endif
76 |
77 | /* End of boilerplate cgo prologue. */
78 |
79 | #ifdef __cplusplus
80 | extern "C" {
81 | #endif
82 |
83 | extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize);
84 | extern BytesReturn* RSAEncodeText(char* input, char* encoding);
85 | extern char* RSADecodeText(void* input, int size, char* encoding, int fatal, int ignoreBOM, int stream);
86 |
87 | #ifdef __cplusplus
88 | }
89 | #endif
90 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-maccatalyst/RSABridge.framework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleExecutable
6 | RSABridge
7 | CFBundleIdentifier
8 | RSABridge
9 | MinimumOSVersion
10 | 100.0
11 | CFBundleShortVersionString
12 | 1.7.0
13 | CFBundleVersion
14 | 1.7.0.1745445032
15 | CFBundlePackageType
16 | FMWK
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-maccatalyst/RSABridge.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module "RSABridge" {
2 | header "librsa_bridge.h"
3 | export *
4 | }
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-maccatalyst/RSABridge.framework/RSABridge:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/ios/RSABridge.xcframework/ios-arm64_x86_64-maccatalyst/RSABridge.framework/RSABridge
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-simulator/RSABridge.framework/Headers/librsa_bridge.h:
--------------------------------------------------------------------------------
1 | /* Code generated by cmd/cgo; DO NOT EDIT. */
2 |
3 | /* package command-line-arguments */
4 |
5 |
6 | #line 1 "cgo-builtin-export-prolog"
7 |
8 | #include
9 |
10 | #ifndef GO_CGO_EXPORT_PROLOGUE_H
11 | #define GO_CGO_EXPORT_PROLOGUE_H
12 |
13 | #ifndef GO_CGO_GOSTRING_TYPEDEF
14 | typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15 | #endif
16 |
17 | #endif
18 |
19 | /* Start of preamble from import "C" comments. */
20 |
21 |
22 | #line 3 "main.go"
23 | #include
24 | #include
25 | typedef struct { void* message; int size; char* error; } BytesReturn;
26 |
27 | #line 1 "cgo-generated-wrapper"
28 |
29 |
30 | /* End of preamble from import "C" comments. */
31 |
32 |
33 | /* Start of boilerplate cgo prologue. */
34 | #line 1 "cgo-gcc-export-header-prolog"
35 |
36 | #ifndef GO_CGO_PROLOGUE_H
37 | #define GO_CGO_PROLOGUE_H
38 |
39 | typedef signed char GoInt8;
40 | typedef unsigned char GoUint8;
41 | typedef short GoInt16;
42 | typedef unsigned short GoUint16;
43 | typedef int GoInt32;
44 | typedef unsigned int GoUint32;
45 | typedef long long GoInt64;
46 | typedef unsigned long long GoUint64;
47 | typedef GoInt64 GoInt;
48 | typedef GoUint64 GoUint;
49 | typedef size_t GoUintptr;
50 | typedef float GoFloat32;
51 | typedef double GoFloat64;
52 | #ifdef _MSC_VER
53 | #include
54 | typedef _Fcomplex GoComplex64;
55 | typedef _Dcomplex GoComplex128;
56 | #else
57 | typedef float _Complex GoComplex64;
58 | typedef double _Complex GoComplex128;
59 | #endif
60 |
61 | /*
62 | static assertion to make sure the file is being used on architecture
63 | at least with matching size of GoInt.
64 | */
65 | typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
66 |
67 | #ifndef GO_CGO_GOSTRING_TYPEDEF
68 | typedef _GoString_ GoString;
69 | #endif
70 | typedef void *GoMap;
71 | typedef void *GoChan;
72 | typedef struct { void *t; void *v; } GoInterface;
73 | typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
74 |
75 | #endif
76 |
77 | /* End of boilerplate cgo prologue. */
78 |
79 | #ifdef __cplusplus
80 | extern "C" {
81 | #endif
82 |
83 | extern BytesReturn* RSABridgeCall(char* name, void* payload, int payloadSize);
84 | extern BytesReturn* RSAEncodeText(char* input, char* encoding);
85 | extern char* RSADecodeText(void* input, int size, char* encoding, int fatal, int ignoreBOM, int stream);
86 |
87 | #ifdef __cplusplus
88 | }
89 | #endif
90 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-simulator/RSABridge.framework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleExecutable
6 | RSABridge
7 | CFBundleIdentifier
8 | RSABridge
9 | MinimumOSVersion
10 | 100.0
11 | CFBundleShortVersionString
12 | 1.7.0
13 | CFBundleVersion
14 | 1.7.0.1745445032
15 | CFBundlePackageType
16 | FMWK
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-simulator/RSABridge.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module "RSABridge" {
2 | header "librsa_bridge.h"
3 | export *
4 | }
--------------------------------------------------------------------------------
/ios/RSABridge.xcframework/ios-arm64_x86_64-simulator/RSABridge.framework/RSABridge:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jerson/react-native-fast-rsa/0813c4938362fbbf15c3c7a8448ce8f8f8eb65ac/ios/RSABridge.xcframework/ios-arm64_x86_64-simulator/RSABridge.framework/RSABridge
--------------------------------------------------------------------------------
/lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | parallel: true
3 | commands:
4 | lint:
5 | files: git diff --name-only @{push}
6 | glob: "*.{js,ts,jsx,tsx}"
7 | run: npx eslint {files}
8 | types:
9 | files: git diff --name-only @{push}
10 | glob: "*.{js,ts, jsx, tsx}"
11 | run: npx tsc --noEmit
12 | commit-msg:
13 | parallel: true
14 | commands:
15 | commitlint:
16 | run: npx commitlint --edit
17 |
--------------------------------------------------------------------------------
/react-native-fast-rsa.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5 |
6 | Pod::Spec.new do |s|
7 | s.name = package["name"]
8 | s.version = package["version"]
9 | s.summary = package["description"]
10 | s.homepage = package["homepage"]
11 | s.license = package["license"]
12 | s.authors = package["author"]
13 |
14 | s.platforms = { :ios => "11.0" }
15 | s.source = { :git => "https://github.com/jerson/react-native-fast-rsa.git", :tag => "#{s.version}" }
16 |
17 | s.source_files = "ios/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"
18 | s.vendored_framework = 'ios/RSABridge.xcframework'
19 | s.static_framework = true
20 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
21 |
22 | # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23 | # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
24 | if respond_to?(:install_modules_dependencies, true)
25 | install_modules_dependencies(s)
26 | else
27 | s.dependency "React-Core"
28 |
29 | # Don't install the dependencies when we run `pod install` in the old architecture.
30 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
31 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
32 | s.pod_target_xcconfig = {
33 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
34 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
35 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
36 | }
37 | s.dependency "React-Codegen"
38 | s.dependency "RCT-Folly"
39 | s.dependency "RCTRequired"
40 | s.dependency "RCTTypeSafety"
41 | s.dependency "ReactCommon/turbomodule/core"
42 | end
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/scripts/pod-install.cjs:
--------------------------------------------------------------------------------
1 | const child_process = require('child_process');
2 |
3 | module.exports = {
4 | name: 'pod-install',
5 | factory() {
6 | return {
7 | hooks: {
8 | afterAllInstalled(project, options) {
9 | if (process.env.POD_INSTALL === '0') {
10 | return;
11 | }
12 |
13 | if (
14 | options &&
15 | (options.mode === 'update-lockfile' ||
16 | options.mode === 'skip-build')
17 | ) {
18 | return;
19 | }
20 |
21 | const result = child_process.spawnSync(
22 | 'yarn',
23 | ['pod-install', 'example/ios'],
24 | {
25 | cwd: project.cwd,
26 | env: process.env,
27 | stdio: 'inherit',
28 | encoding: 'utf-8',
29 | shell: true,
30 | }
31 | );
32 |
33 | if (result.status !== 0) {
34 | throw new Error('Failed to run pod-install');
35 | }
36 | },
37 | },
38 | };
39 | },
40 | };
41 |
--------------------------------------------------------------------------------
/scripts/upgrade_bridge_flatbuffers.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #######################################################
3 | # Usage: #
4 | # ./upgrade_bridge_flatbuffers.sh #
5 | # #
6 | # or custom version: #
7 | # VERSION=v0.1.1 ./upgrade_bridge_flatbuffers.sh #
8 | #######################################################
9 |
10 | REPO="jerson/rsa-mobile"
11 | NAME="flatbuffers_librsa_bridge_ts"
12 | OUTPUT_DIR="src"
13 |
14 | #######################################################
15 | # you shouldn't edit below this line #
16 | #######################################################
17 |
18 | echo "Get latest release"
19 | RELEASE_PAYLOAD=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest")
20 |
21 | get_version() {
22 | echo "$RELEASE_PAYLOAD" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
23 | }
24 |
25 | LATEST_VERSION=$(get_version $REPO)
26 | VERSION=${VERSION:-$LATEST_VERSION}
27 | TMP_DIR=$(dirname $(mktemp -u))
28 |
29 | echo "Using: $VERSION"
30 | echo "--------------------------------------------"
31 |
32 | FILE_NAME="${NAME}_${VERSION}.tar.gz"
33 | TMP_FILE="$TMP_DIR/$FILE_NAME"
34 | FILE_URL="https://github.com/${REPO}/releases/download/${VERSION}/${FILE_NAME}"
35 |
36 | echo "Downloading: $FILE_URL to $TMP_FILE"
37 | curl -L -o $TMP_FILE "$FILE_URL"
38 |
39 | echo "Extracting: $TMP_FILE to $OUTPUT_DIR"
40 | mkdir -p $OUTPUT_DIR
41 | tar -xz --strip-components=1 --directory=$OUTPUT_DIR --file=$TMP_FILE
42 |
43 | echo "All updated"
44 |
45 |
--------------------------------------------------------------------------------
/scripts/upgrade_bridge_libs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #######################################################
3 | # Usage: #
4 | # ./upgrade_bridge_libs.sh #
5 | # #
6 | # or custom version: #
7 | # VERSION=v0.1.1 ./upgrade_bridge_libs.sh #
8 | #######################################################
9 |
10 | REPO="jerson/rsa-mobile"
11 | NAME="librsa_bridge"
12 | PLATFORMS=("android" "ios_xcframework" )
13 | OUTPUT_DIRS=("android/src/main" "ios")
14 | OUTPUT_SUB_DIRS=("" "")
15 | OUTPUT_STRIP_DIRS=(1 1)
16 |
17 | #######################################################
18 | # you shouldn't edit below this line #
19 | #######################################################
20 |
21 | echo "Get latest release"
22 | RELEASE_PAYLOAD=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest")
23 |
24 | get_version() {
25 | echo "$RELEASE_PAYLOAD" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
26 | }
27 |
28 | LATEST_VERSION=$(get_version $REPO)
29 | VERSION=${VERSION:-$LATEST_VERSION}
30 |
31 | echo "Using: $VERSION"
32 | echo "--------------------------------------------"
33 |
34 | INDEX=0
35 | TMP_DIR=$(dirname $(mktemp -u))
36 | for PLATFORM in "${PLATFORMS[@]}"
37 | do
38 | :
39 |
40 | OUTPUT_DIR=${OUTPUT_DIRS[$INDEX]}
41 | OUTPUT_SUB_DIR=${OUTPUT_SUB_DIRS[$INDEX]}
42 | OUTPUT_STRIP_DIR=${OUTPUT_STRIP_DIRS[$INDEX]}
43 |
44 | FILE_NAME="${NAME}_${PLATFORM}_${VERSION}.tar.gz"
45 | TMP_FILE="$TMP_DIR/$FILE_NAME"
46 | FILE_URL="https://github.com/${REPO}/releases/download/${VERSION}/${FILE_NAME}"
47 |
48 | echo "Platform: $PLATFORM"
49 | echo "Downloading: $FILE_URL to $TMP_FILE"
50 | curl -L -o $TMP_FILE "$FILE_URL"
51 |
52 | echo "Extracting: $TMP_FILE to $OUTPUT_DIR"
53 | mkdir -p $OUTPUT_DIR
54 | tar -xz --strip-components=$OUTPUT_STRIP_DIR --directory=$OUTPUT_DIR --file=$TMP_FILE $OUTPUT_SUB_DIR
55 |
56 | INDEX=${INDEX}+1
57 |
58 | echo "Updated"
59 | echo "--------------------------------------------"
60 | done
61 | #
62 | echo "All updated"
63 |
--------------------------------------------------------------------------------
/src/__tests__/index.test.tsx:
--------------------------------------------------------------------------------
1 | it.todo('write a test');
2 |
--------------------------------------------------------------------------------
/src/bridge.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | export * as model from './model';
4 |
--------------------------------------------------------------------------------
/src/model.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | export { Base64Request } from './model/base64-request';
4 | export { BoolResponse } from './model/bool-response';
5 | export { BytesResponse } from './model/bytes-response';
6 | export { ConvertJWTRequest } from './model/convert-jwtrequest';
7 | export { ConvertKeyPairRequest } from './model/convert-key-pair-request';
8 | export { ConvertPKCS12Request } from './model/convert-pkcs12-request';
9 | export { ConvertPrivateKeyRequest } from './model/convert-private-key-request';
10 | export { ConvertPublicKeyRequest } from './model/convert-public-key-request';
11 | export { DecryptOAEPBytesRequest } from './model/decrypt-oaepbytes-request';
12 | export { DecryptOAEPRequest } from './model/decrypt-oaeprequest';
13 | export { DecryptPKCS1v15BytesRequest } from './model/decrypt-pkcs1v15-bytes-request';
14 | export { DecryptPKCS1v15Request } from './model/decrypt-pkcs1v15-request';
15 | export { DecryptPrivateKeyRequest } from './model/decrypt-private-key-request';
16 | export { EncryptOAEPBytesRequest } from './model/encrypt-oaepbytes-request';
17 | export { EncryptOAEPRequest } from './model/encrypt-oaeprequest';
18 | export { EncryptPKCS1v15BytesRequest } from './model/encrypt-pkcs1v15-bytes-request';
19 | export { EncryptPKCS1v15Request } from './model/encrypt-pkcs1v15-request';
20 | export { EncryptPrivateKeyRequest } from './model/encrypt-private-key-request';
21 | export { GenerateRequest } from './model/generate-request';
22 | export { Hash } from './model/hash';
23 | export { HashRequest } from './model/hash-request';
24 | export { KeyPair } from './model/key-pair';
25 | export { KeyPairResponse } from './model/key-pair-response';
26 | export { MetadataPrivateKeyRequest } from './model/metadata-private-key-request';
27 | export { MetadataPublicKeyRequest } from './model/metadata-public-key-request';
28 | export { PEMCipher } from './model/pemcipher';
29 | export { PKCS12KeyPair } from './model/pkcs12-key-pair';
30 | export { PKCS12KeyPairResponse } from './model/pkcs12-key-pair-response';
31 | export { PrivateKeyInfo } from './model/private-key-info';
32 | export { PrivateKeyInfoResponse } from './model/private-key-info-response';
33 | export { PublicKeyInfo } from './model/public-key-info';
34 | export { PublicKeyInfoResponse } from './model/public-key-info-response';
35 | export { SaltLength } from './model/salt-length';
36 | export { SignPKCS1v15BytesRequest } from './model/sign-pkcs1v15-bytes-request';
37 | export { SignPKCS1v15Request } from './model/sign-pkcs1v15-request';
38 | export { SignPSSBytesRequest } from './model/sign-pssbytes-request';
39 | export { SignPSSRequest } from './model/sign-pssrequest';
40 | export { StringResponse } from './model/string-response';
41 | export { VerifyPKCS1v15BytesRequest } from './model/verify-pkcs1v15-bytes-request';
42 | export { VerifyPKCS1v15Request } from './model/verify-pkcs1v15-request';
43 | export { VerifyPSSBytesRequest } from './model/verify-pssbytes-request';
44 | export { VerifyPSSRequest } from './model/verify-pssrequest';
45 |
--------------------------------------------------------------------------------
/src/model/base64-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class Base64Request {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):Base64Request {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsBase64Request(bb:flatbuffers.ByteBuffer, obj?:Base64Request):Base64Request {
17 | return (obj || new Base64Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsBase64Request(bb:flatbuffers.ByteBuffer, obj?:Base64Request):Base64Request {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new Base64Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | message():string|null
26 | message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | message(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | static startBase64Request(builder:flatbuffers.Builder) {
33 | builder.startObject(1);
34 | }
35 |
36 | static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
37 | builder.addFieldOffset(0, messageOffset, 0);
38 | }
39 |
40 | static endBase64Request(builder:flatbuffers.Builder):flatbuffers.Offset {
41 | const offset = builder.endObject();
42 | return offset;
43 | }
44 |
45 | static createBase64Request(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset):flatbuffers.Offset {
46 | Base64Request.startBase64Request(builder);
47 | Base64Request.addMessage(builder, messageOffset);
48 | return Base64Request.endBase64Request(builder);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/model/bool-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class BoolResponse {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):BoolResponse {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsBoolResponse(bb:flatbuffers.ByteBuffer, obj?:BoolResponse):BoolResponse {
17 | return (obj || new BoolResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsBoolResponse(bb:flatbuffers.ByteBuffer, obj?:BoolResponse):BoolResponse {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new BoolResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | output():boolean {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
28 | }
29 |
30 | mutate_output(value:boolean):boolean {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 |
33 | if (offset === 0) {
34 | return false;
35 | }
36 |
37 | this.bb!.writeInt8(this.bb_pos + offset, +value);
38 | return true;
39 | }
40 |
41 | error():string|null
42 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
43 | error(optionalEncoding?:any):string|Uint8Array|null {
44 | const offset = this.bb!.__offset(this.bb_pos, 6);
45 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
46 | }
47 |
48 | static startBoolResponse(builder:flatbuffers.Builder) {
49 | builder.startObject(2);
50 | }
51 |
52 | static addOutput(builder:flatbuffers.Builder, output:boolean) {
53 | builder.addFieldInt8(0, +output, +false);
54 | }
55 |
56 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
57 | builder.addFieldOffset(1, errorOffset, 0);
58 | }
59 |
60 | static endBoolResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
61 | const offset = builder.endObject();
62 | return offset;
63 | }
64 |
65 | static createBoolResponse(builder:flatbuffers.Builder, output:boolean, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
66 | BoolResponse.startBoolResponse(builder);
67 | BoolResponse.addOutput(builder, output);
68 | BoolResponse.addError(builder, errorOffset);
69 | return BoolResponse.endBoolResponse(builder);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/model/bytes-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class BytesResponse {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):BytesResponse {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsBytesResponse(bb:flatbuffers.ByteBuffer, obj?:BytesResponse):BytesResponse {
17 | return (obj || new BytesResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsBytesResponse(bb:flatbuffers.ByteBuffer, obj?:BytesResponse):BytesResponse {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new BytesResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | output(index: number):number|null {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
28 | }
29 |
30 | outputLength():number {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
33 | }
34 |
35 | outputArray():Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 4);
37 | return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
38 | }
39 |
40 | error():string|null
41 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
42 | error(optionalEncoding?:any):string|Uint8Array|null {
43 | const offset = this.bb!.__offset(this.bb_pos, 6);
44 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
45 | }
46 |
47 | static startBytesResponse(builder:flatbuffers.Builder) {
48 | builder.startObject(2);
49 | }
50 |
51 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
52 | builder.addFieldOffset(0, outputOffset, 0);
53 | }
54 |
55 | static createOutputVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
56 | builder.startVector(1, data.length, 1);
57 | for (let i = data.length - 1; i >= 0; i--) {
58 | builder.addInt8(data[i]!);
59 | }
60 | return builder.endVector();
61 | }
62 |
63 | static startOutputVector(builder:flatbuffers.Builder, numElems:number) {
64 | builder.startVector(1, numElems, 1);
65 | }
66 |
67 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
68 | builder.addFieldOffset(1, errorOffset, 0);
69 | }
70 |
71 | static endBytesResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
72 | const offset = builder.endObject();
73 | return offset;
74 | }
75 |
76 | static createBytesResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
77 | BytesResponse.startBytesResponse(builder);
78 | BytesResponse.addOutput(builder, outputOffset);
79 | BytesResponse.addError(builder, errorOffset);
80 | return BytesResponse.endBytesResponse(builder);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/model/convert-jwtrequest.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class ConvertJWTRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):ConvertJWTRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsConvertJWTRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertJWTRequest):ConvertJWTRequest {
17 | return (obj || new ConvertJWTRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsConvertJWTRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertJWTRequest):ConvertJWTRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new ConvertJWTRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | data():string|null
26 | data(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | data(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | keyId():string|null
33 | keyId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | keyId(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startConvertJWTRequest(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, dataOffset, 0);
45 | }
46 |
47 | static addKeyId(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, keyIdOffset, 0);
49 | }
50 |
51 | static endConvertJWTRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createConvertJWTRequest(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset, keyIdOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | ConvertJWTRequest.startConvertJWTRequest(builder);
58 | ConvertJWTRequest.addData(builder, dataOffset);
59 | ConvertJWTRequest.addKeyId(builder, keyIdOffset);
60 | return ConvertJWTRequest.endConvertJWTRequest(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/convert-key-pair-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class ConvertKeyPairRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):ConvertKeyPairRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsConvertKeyPairRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertKeyPairRequest):ConvertKeyPairRequest {
17 | return (obj || new ConvertKeyPairRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsConvertKeyPairRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertKeyPairRequest):ConvertKeyPairRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new ConvertKeyPairRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKey():string|null
26 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | certificate():string|null
33 | certificate(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | certificate(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | password():string|null
40 | password(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
41 | password(optionalEncoding?:any):string|Uint8Array|null {
42 | const offset = this.bb!.__offset(this.bb_pos, 8);
43 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
44 | }
45 |
46 | static startConvertKeyPairRequest(builder:flatbuffers.Builder) {
47 | builder.startObject(3);
48 | }
49 |
50 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
51 | builder.addFieldOffset(0, privateKeyOffset, 0);
52 | }
53 |
54 | static addCertificate(builder:flatbuffers.Builder, certificateOffset:flatbuffers.Offset) {
55 | builder.addFieldOffset(1, certificateOffset, 0);
56 | }
57 |
58 | static addPassword(builder:flatbuffers.Builder, passwordOffset:flatbuffers.Offset) {
59 | builder.addFieldOffset(2, passwordOffset, 0);
60 | }
61 |
62 | static endConvertKeyPairRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
63 | const offset = builder.endObject();
64 | return offset;
65 | }
66 |
67 | static createConvertKeyPairRequest(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset, certificateOffset:flatbuffers.Offset, passwordOffset:flatbuffers.Offset):flatbuffers.Offset {
68 | ConvertKeyPairRequest.startConvertKeyPairRequest(builder);
69 | ConvertKeyPairRequest.addPrivateKey(builder, privateKeyOffset);
70 | ConvertKeyPairRequest.addCertificate(builder, certificateOffset);
71 | ConvertKeyPairRequest.addPassword(builder, passwordOffset);
72 | return ConvertKeyPairRequest.endConvertKeyPairRequest(builder);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/model/convert-pkcs12-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class ConvertPKCS12Request {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):ConvertPKCS12Request {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsConvertPKCS12Request(bb:flatbuffers.ByteBuffer, obj?:ConvertPKCS12Request):ConvertPKCS12Request {
17 | return (obj || new ConvertPKCS12Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsConvertPKCS12Request(bb:flatbuffers.ByteBuffer, obj?:ConvertPKCS12Request):ConvertPKCS12Request {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new ConvertPKCS12Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | pkcs12():string|null
26 | pkcs12(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | pkcs12(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | password():string|null
33 | password(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | password(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startConvertPKCS12Request(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addPkcs12(builder:flatbuffers.Builder, pkcs12Offset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, pkcs12Offset, 0);
45 | }
46 |
47 | static addPassword(builder:flatbuffers.Builder, passwordOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, passwordOffset, 0);
49 | }
50 |
51 | static endConvertPKCS12Request(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createConvertPKCS12Request(builder:flatbuffers.Builder, pkcs12Offset:flatbuffers.Offset, passwordOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | ConvertPKCS12Request.startConvertPKCS12Request(builder);
58 | ConvertPKCS12Request.addPkcs12(builder, pkcs12Offset);
59 | ConvertPKCS12Request.addPassword(builder, passwordOffset);
60 | return ConvertPKCS12Request.endConvertPKCS12Request(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/convert-private-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class ConvertPrivateKeyRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):ConvertPrivateKeyRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsConvertPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertPrivateKeyRequest):ConvertPrivateKeyRequest {
17 | return (obj || new ConvertPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsConvertPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertPrivateKeyRequest):ConvertPrivateKeyRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new ConvertPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKey():string|null
26 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | static startConvertPrivateKeyRequest(builder:flatbuffers.Builder) {
33 | builder.startObject(1);
34 | }
35 |
36 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
37 | builder.addFieldOffset(0, privateKeyOffset, 0);
38 | }
39 |
40 | static endConvertPrivateKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
41 | const offset = builder.endObject();
42 | return offset;
43 | }
44 |
45 | static createConvertPrivateKeyRequest(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
46 | ConvertPrivateKeyRequest.startConvertPrivateKeyRequest(builder);
47 | ConvertPrivateKeyRequest.addPrivateKey(builder, privateKeyOffset);
48 | return ConvertPrivateKeyRequest.endConvertPrivateKeyRequest(builder);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/model/convert-public-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class ConvertPublicKeyRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):ConvertPublicKeyRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsConvertPublicKeyRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertPublicKeyRequest):ConvertPublicKeyRequest {
17 | return (obj || new ConvertPublicKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsConvertPublicKeyRequest(bb:flatbuffers.ByteBuffer, obj?:ConvertPublicKeyRequest):ConvertPublicKeyRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new ConvertPublicKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | publicKey():string|null
26 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | static startConvertPublicKeyRequest(builder:flatbuffers.Builder) {
33 | builder.startObject(1);
34 | }
35 |
36 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
37 | builder.addFieldOffset(0, publicKeyOffset, 0);
38 | }
39 |
40 | static endConvertPublicKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
41 | const offset = builder.endObject();
42 | return offset;
43 | }
44 |
45 | static createConvertPublicKeyRequest(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
46 | ConvertPublicKeyRequest.startConvertPublicKeyRequest(builder);
47 | ConvertPublicKeyRequest.addPublicKey(builder, publicKeyOffset);
48 | return ConvertPublicKeyRequest.endConvertPublicKeyRequest(builder);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/model/decrypt-pkcs1v15-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class DecryptPKCS1v15Request {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):DecryptPKCS1v15Request {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsDecryptPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:DecryptPKCS1v15Request):DecryptPKCS1v15Request {
17 | return (obj || new DecryptPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsDecryptPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:DecryptPKCS1v15Request):DecryptPKCS1v15Request {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new DecryptPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | ciphertext():string|null
26 | ciphertext(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | ciphertext(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | privateKey():string|null
33 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startDecryptPKCS1v15Request(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addCiphertext(builder:flatbuffers.Builder, ciphertextOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, ciphertextOffset, 0);
45 | }
46 |
47 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, privateKeyOffset, 0);
49 | }
50 |
51 | static endDecryptPKCS1v15Request(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createDecryptPKCS1v15Request(builder:flatbuffers.Builder, ciphertextOffset:flatbuffers.Offset, privateKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | DecryptPKCS1v15Request.startDecryptPKCS1v15Request(builder);
58 | DecryptPKCS1v15Request.addCiphertext(builder, ciphertextOffset);
59 | DecryptPKCS1v15Request.addPrivateKey(builder, privateKeyOffset);
60 | return DecryptPKCS1v15Request.endDecryptPKCS1v15Request(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/decrypt-private-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class DecryptPrivateKeyRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):DecryptPrivateKeyRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsDecryptPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:DecryptPrivateKeyRequest):DecryptPrivateKeyRequest {
17 | return (obj || new DecryptPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsDecryptPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:DecryptPrivateKeyRequest):DecryptPrivateKeyRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new DecryptPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKeyEncrypted():string|null
26 | privateKeyEncrypted(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKeyEncrypted(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | password():string|null
33 | password(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | password(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startDecryptPrivateKeyRequest(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addPrivateKeyEncrypted(builder:flatbuffers.Builder, privateKeyEncryptedOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, privateKeyEncryptedOffset, 0);
45 | }
46 |
47 | static addPassword(builder:flatbuffers.Builder, passwordOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, passwordOffset, 0);
49 | }
50 |
51 | static endDecryptPrivateKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createDecryptPrivateKeyRequest(builder:flatbuffers.Builder, privateKeyEncryptedOffset:flatbuffers.Offset, passwordOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | DecryptPrivateKeyRequest.startDecryptPrivateKeyRequest(builder);
58 | DecryptPrivateKeyRequest.addPrivateKeyEncrypted(builder, privateKeyEncryptedOffset);
59 | DecryptPrivateKeyRequest.addPassword(builder, passwordOffset);
60 | return DecryptPrivateKeyRequest.endDecryptPrivateKeyRequest(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/encrypt-pkcs1v15-bytes-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class EncryptPKCS1v15BytesRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):EncryptPKCS1v15BytesRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsEncryptPKCS1v15BytesRequest(bb:flatbuffers.ByteBuffer, obj?:EncryptPKCS1v15BytesRequest):EncryptPKCS1v15BytesRequest {
17 | return (obj || new EncryptPKCS1v15BytesRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsEncryptPKCS1v15BytesRequest(bb:flatbuffers.ByteBuffer, obj?:EncryptPKCS1v15BytesRequest):EncryptPKCS1v15BytesRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new EncryptPKCS1v15BytesRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | message(index: number):number|null {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
28 | }
29 |
30 | messageLength():number {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
33 | }
34 |
35 | messageArray():Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 4);
37 | return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
38 | }
39 |
40 | publicKey():string|null
41 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
42 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
43 | const offset = this.bb!.__offset(this.bb_pos, 6);
44 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
45 | }
46 |
47 | static startEncryptPKCS1v15BytesRequest(builder:flatbuffers.Builder) {
48 | builder.startObject(2);
49 | }
50 |
51 | static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
52 | builder.addFieldOffset(0, messageOffset, 0);
53 | }
54 |
55 | static createMessageVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
56 | builder.startVector(1, data.length, 1);
57 | for (let i = data.length - 1; i >= 0; i--) {
58 | builder.addInt8(data[i]!);
59 | }
60 | return builder.endVector();
61 | }
62 |
63 | static startMessageVector(builder:flatbuffers.Builder, numElems:number) {
64 | builder.startVector(1, numElems, 1);
65 | }
66 |
67 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
68 | builder.addFieldOffset(1, publicKeyOffset, 0);
69 | }
70 |
71 | static endEncryptPKCS1v15BytesRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
72 | const offset = builder.endObject();
73 | return offset;
74 | }
75 |
76 | static createEncryptPKCS1v15BytesRequest(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset, publicKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
77 | EncryptPKCS1v15BytesRequest.startEncryptPKCS1v15BytesRequest(builder);
78 | EncryptPKCS1v15BytesRequest.addMessage(builder, messageOffset);
79 | EncryptPKCS1v15BytesRequest.addPublicKey(builder, publicKeyOffset);
80 | return EncryptPKCS1v15BytesRequest.endEncryptPKCS1v15BytesRequest(builder);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/model/encrypt-pkcs1v15-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class EncryptPKCS1v15Request {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):EncryptPKCS1v15Request {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsEncryptPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:EncryptPKCS1v15Request):EncryptPKCS1v15Request {
17 | return (obj || new EncryptPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsEncryptPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:EncryptPKCS1v15Request):EncryptPKCS1v15Request {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new EncryptPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | message():string|null
26 | message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | message(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | publicKey():string|null
33 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startEncryptPKCS1v15Request(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, messageOffset, 0);
45 | }
46 |
47 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, publicKeyOffset, 0);
49 | }
50 |
51 | static endEncryptPKCS1v15Request(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createEncryptPKCS1v15Request(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset, publicKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | EncryptPKCS1v15Request.startEncryptPKCS1v15Request(builder);
58 | EncryptPKCS1v15Request.addMessage(builder, messageOffset);
59 | EncryptPKCS1v15Request.addPublicKey(builder, publicKeyOffset);
60 | return EncryptPKCS1v15Request.endEncryptPKCS1v15Request(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/encrypt-private-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { PEMCipher } from '../model/pemcipher';
8 |
9 |
10 | export class EncryptPrivateKeyRequest {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):EncryptPrivateKeyRequest {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsEncryptPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:EncryptPrivateKeyRequest):EncryptPrivateKeyRequest {
20 | return (obj || new EncryptPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsEncryptPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:EncryptPrivateKeyRequest):EncryptPrivateKeyRequest {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new EncryptPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | privateKey():string|null
29 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
30 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
33 | }
34 |
35 | password():string|null
36 | password(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
37 | password(optionalEncoding?:any):string|Uint8Array|null {
38 | const offset = this.bb!.__offset(this.bb_pos, 6);
39 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
40 | }
41 |
42 | cipher():PEMCipher {
43 | const offset = this.bb!.__offset(this.bb_pos, 8);
44 | return offset ? this.bb!.readInt32(this.bb_pos + offset) : PEMCipher.DES;
45 | }
46 |
47 | mutate_cipher(value:PEMCipher):boolean {
48 | const offset = this.bb!.__offset(this.bb_pos, 8);
49 |
50 | if (offset === 0) {
51 | return false;
52 | }
53 |
54 | this.bb!.writeInt32(this.bb_pos + offset, value);
55 | return true;
56 | }
57 |
58 | static startEncryptPrivateKeyRequest(builder:flatbuffers.Builder) {
59 | builder.startObject(3);
60 | }
61 |
62 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
63 | builder.addFieldOffset(0, privateKeyOffset, 0);
64 | }
65 |
66 | static addPassword(builder:flatbuffers.Builder, passwordOffset:flatbuffers.Offset) {
67 | builder.addFieldOffset(1, passwordOffset, 0);
68 | }
69 |
70 | static addCipher(builder:flatbuffers.Builder, cipher:PEMCipher) {
71 | builder.addFieldInt32(2, cipher, PEMCipher.DES);
72 | }
73 |
74 | static endEncryptPrivateKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
75 | const offset = builder.endObject();
76 | return offset;
77 | }
78 |
79 | static createEncryptPrivateKeyRequest(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset, passwordOffset:flatbuffers.Offset, cipher:PEMCipher):flatbuffers.Offset {
80 | EncryptPrivateKeyRequest.startEncryptPrivateKeyRequest(builder);
81 | EncryptPrivateKeyRequest.addPrivateKey(builder, privateKeyOffset);
82 | EncryptPrivateKeyRequest.addPassword(builder, passwordOffset);
83 | EncryptPrivateKeyRequest.addCipher(builder, cipher);
84 | return EncryptPrivateKeyRequest.endEncryptPrivateKeyRequest(builder);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/model/generate-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class GenerateRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):GenerateRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsGenerateRequest(bb:flatbuffers.ByteBuffer, obj?:GenerateRequest):GenerateRequest {
17 | return (obj || new GenerateRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsGenerateRequest(bb:flatbuffers.ByteBuffer, obj?:GenerateRequest):GenerateRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new GenerateRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | nBits():number {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
28 | }
29 |
30 | mutate_n_bits(value:number):boolean {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 |
33 | if (offset === 0) {
34 | return false;
35 | }
36 |
37 | this.bb!.writeInt32(this.bb_pos + offset, value);
38 | return true;
39 | }
40 |
41 | static startGenerateRequest(builder:flatbuffers.Builder) {
42 | builder.startObject(1);
43 | }
44 |
45 | static addNBits(builder:flatbuffers.Builder, nBits:number) {
46 | builder.addFieldInt32(0, nBits, 0);
47 | }
48 |
49 | static endGenerateRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
50 | const offset = builder.endObject();
51 | return offset;
52 | }
53 |
54 | static createGenerateRequest(builder:flatbuffers.Builder, nBits:number):flatbuffers.Offset {
55 | GenerateRequest.startGenerateRequest(builder);
56 | GenerateRequest.addNBits(builder, nBits);
57 | return GenerateRequest.endGenerateRequest(builder);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/model/hash-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { Hash } from '../model/hash';
8 |
9 |
10 | export class HashRequest {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):HashRequest {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsHashRequest(bb:flatbuffers.ByteBuffer, obj?:HashRequest):HashRequest {
20 | return (obj || new HashRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsHashRequest(bb:flatbuffers.ByteBuffer, obj?:HashRequest):HashRequest {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new HashRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | message():string|null
29 | message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
30 | message(optionalEncoding?:any):string|Uint8Array|null {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
33 | }
34 |
35 | hash():Hash {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.readInt32(this.bb_pos + offset) : Hash.MD5;
38 | }
39 |
40 | mutate_hash(value:Hash):boolean {
41 | const offset = this.bb!.__offset(this.bb_pos, 6);
42 |
43 | if (offset === 0) {
44 | return false;
45 | }
46 |
47 | this.bb!.writeInt32(this.bb_pos + offset, value);
48 | return true;
49 | }
50 |
51 | static startHashRequest(builder:flatbuffers.Builder) {
52 | builder.startObject(2);
53 | }
54 |
55 | static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
56 | builder.addFieldOffset(0, messageOffset, 0);
57 | }
58 |
59 | static addHash(builder:flatbuffers.Builder, hash:Hash) {
60 | builder.addFieldInt32(1, hash, Hash.MD5);
61 | }
62 |
63 | static endHashRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
64 | const offset = builder.endObject();
65 | return offset;
66 | }
67 |
68 | static createHashRequest(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset, hash:Hash):flatbuffers.Offset {
69 | HashRequest.startHashRequest(builder);
70 | HashRequest.addMessage(builder, messageOffset);
71 | HashRequest.addHash(builder, hash);
72 | return HashRequest.endHashRequest(builder);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/model/hash.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | export enum Hash {
6 | MD5 = 0,
7 | SHA1 = 1,
8 | SHA224 = 2,
9 | SHA256 = 3,
10 | SHA384 = 4,
11 | SHA512 = 5
12 | }
13 |
--------------------------------------------------------------------------------
/src/model/key-pair-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { KeyPair } from '../model/key-pair';
8 |
9 |
10 | export class KeyPairResponse {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):KeyPairResponse {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsKeyPairResponse(bb:flatbuffers.ByteBuffer, obj?:KeyPairResponse):KeyPairResponse {
20 | return (obj || new KeyPairResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsKeyPairResponse(bb:flatbuffers.ByteBuffer, obj?:KeyPairResponse):KeyPairResponse {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new KeyPairResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | output(obj?:KeyPair):KeyPair|null {
29 | const offset = this.bb!.__offset(this.bb_pos, 4);
30 | return offset ? (obj || new KeyPair()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
31 | }
32 |
33 | error():string|null
34 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
35 | error(optionalEncoding?:any):string|Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
38 | }
39 |
40 | static startKeyPairResponse(builder:flatbuffers.Builder) {
41 | builder.startObject(2);
42 | }
43 |
44 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
45 | builder.addFieldOffset(0, outputOffset, 0);
46 | }
47 |
48 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
49 | builder.addFieldOffset(1, errorOffset, 0);
50 | }
51 |
52 | static endKeyPairResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
53 | const offset = builder.endObject();
54 | return offset;
55 | }
56 |
57 | static createKeyPairResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
58 | KeyPairResponse.startKeyPairResponse(builder);
59 | KeyPairResponse.addOutput(builder, outputOffset);
60 | KeyPairResponse.addError(builder, errorOffset);
61 | return KeyPairResponse.endKeyPairResponse(builder);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/model/key-pair.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class KeyPair {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):KeyPair {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsKeyPair(bb:flatbuffers.ByteBuffer, obj?:KeyPair):KeyPair {
17 | return (obj || new KeyPair()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsKeyPair(bb:flatbuffers.ByteBuffer, obj?:KeyPair):KeyPair {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new KeyPair()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKey():string|null
26 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | publicKey():string|null
33 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startKeyPair(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, privateKeyOffset, 0);
45 | }
46 |
47 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, publicKeyOffset, 0);
49 | }
50 |
51 | static endKeyPair(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createKeyPair(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset, publicKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | KeyPair.startKeyPair(builder);
58 | KeyPair.addPrivateKey(builder, privateKeyOffset);
59 | KeyPair.addPublicKey(builder, publicKeyOffset);
60 | return KeyPair.endKeyPair(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/model/metadata-private-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class MetadataPrivateKeyRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):MetadataPrivateKeyRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsMetadataPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:MetadataPrivateKeyRequest):MetadataPrivateKeyRequest {
17 | return (obj || new MetadataPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsMetadataPrivateKeyRequest(bb:flatbuffers.ByteBuffer, obj?:MetadataPrivateKeyRequest):MetadataPrivateKeyRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new MetadataPrivateKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKey():string|null
26 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | static startMetadataPrivateKeyRequest(builder:flatbuffers.Builder) {
33 | builder.startObject(1);
34 | }
35 |
36 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
37 | builder.addFieldOffset(0, privateKeyOffset, 0);
38 | }
39 |
40 | static endMetadataPrivateKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
41 | const offset = builder.endObject();
42 | return offset;
43 | }
44 |
45 | static createMetadataPrivateKeyRequest(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
46 | MetadataPrivateKeyRequest.startMetadataPrivateKeyRequest(builder);
47 | MetadataPrivateKeyRequest.addPrivateKey(builder, privateKeyOffset);
48 | return MetadataPrivateKeyRequest.endMetadataPrivateKeyRequest(builder);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/model/metadata-public-key-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class MetadataPublicKeyRequest {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):MetadataPublicKeyRequest {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsMetadataPublicKeyRequest(bb:flatbuffers.ByteBuffer, obj?:MetadataPublicKeyRequest):MetadataPublicKeyRequest {
17 | return (obj || new MetadataPublicKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsMetadataPublicKeyRequest(bb:flatbuffers.ByteBuffer, obj?:MetadataPublicKeyRequest):MetadataPublicKeyRequest {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new MetadataPublicKeyRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | publicKey():string|null
26 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | static startMetadataPublicKeyRequest(builder:flatbuffers.Builder) {
33 | builder.startObject(1);
34 | }
35 |
36 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
37 | builder.addFieldOffset(0, publicKeyOffset, 0);
38 | }
39 |
40 | static endMetadataPublicKeyRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
41 | const offset = builder.endObject();
42 | return offset;
43 | }
44 |
45 | static createMetadataPublicKeyRequest(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
46 | MetadataPublicKeyRequest.startMetadataPublicKeyRequest(builder);
47 | MetadataPublicKeyRequest.addPublicKey(builder, publicKeyOffset);
48 | return MetadataPublicKeyRequest.endMetadataPublicKeyRequest(builder);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/model/pemcipher.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | export enum PEMCipher {
6 | DES = 0,
7 | D3DES = 1,
8 | AES128 = 2,
9 | AES192 = 3,
10 | AES256 = 4
11 | }
12 |
--------------------------------------------------------------------------------
/src/model/pkcs12-key-pair-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { PKCS12KeyPair } from '../model/pkcs12-key-pair';
8 |
9 |
10 | export class PKCS12KeyPairResponse {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):PKCS12KeyPairResponse {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsPKCS12KeyPairResponse(bb:flatbuffers.ByteBuffer, obj?:PKCS12KeyPairResponse):PKCS12KeyPairResponse {
20 | return (obj || new PKCS12KeyPairResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsPKCS12KeyPairResponse(bb:flatbuffers.ByteBuffer, obj?:PKCS12KeyPairResponse):PKCS12KeyPairResponse {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new PKCS12KeyPairResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | output(obj?:PKCS12KeyPair):PKCS12KeyPair|null {
29 | const offset = this.bb!.__offset(this.bb_pos, 4);
30 | return offset ? (obj || new PKCS12KeyPair()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
31 | }
32 |
33 | error():string|null
34 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
35 | error(optionalEncoding?:any):string|Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
38 | }
39 |
40 | static startPKCS12KeyPairResponse(builder:flatbuffers.Builder) {
41 | builder.startObject(2);
42 | }
43 |
44 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
45 | builder.addFieldOffset(0, outputOffset, 0);
46 | }
47 |
48 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
49 | builder.addFieldOffset(1, errorOffset, 0);
50 | }
51 |
52 | static endPKCS12KeyPairResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
53 | const offset = builder.endObject();
54 | return offset;
55 | }
56 |
57 | static createPKCS12KeyPairResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
58 | PKCS12KeyPairResponse.startPKCS12KeyPairResponse(builder);
59 | PKCS12KeyPairResponse.addOutput(builder, outputOffset);
60 | PKCS12KeyPairResponse.addError(builder, errorOffset);
61 | return PKCS12KeyPairResponse.endPKCS12KeyPairResponse(builder);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/model/pkcs12-key-pair.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class PKCS12KeyPair {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):PKCS12KeyPair {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsPKCS12KeyPair(bb:flatbuffers.ByteBuffer, obj?:PKCS12KeyPair):PKCS12KeyPair {
17 | return (obj || new PKCS12KeyPair()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsPKCS12KeyPair(bb:flatbuffers.ByteBuffer, obj?:PKCS12KeyPair):PKCS12KeyPair {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new PKCS12KeyPair()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | privateKey():string|null
26 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | publicKey():string|null
33 | publicKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | publicKey(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | certificate():string|null
40 | certificate(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
41 | certificate(optionalEncoding?:any):string|Uint8Array|null {
42 | const offset = this.bb!.__offset(this.bb_pos, 8);
43 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
44 | }
45 |
46 | static startPKCS12KeyPair(builder:flatbuffers.Builder) {
47 | builder.startObject(3);
48 | }
49 |
50 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
51 | builder.addFieldOffset(0, privateKeyOffset, 0);
52 | }
53 |
54 | static addPublicKey(builder:flatbuffers.Builder, publicKeyOffset:flatbuffers.Offset) {
55 | builder.addFieldOffset(1, publicKeyOffset, 0);
56 | }
57 |
58 | static addCertificate(builder:flatbuffers.Builder, certificateOffset:flatbuffers.Offset) {
59 | builder.addFieldOffset(2, certificateOffset, 0);
60 | }
61 |
62 | static endPKCS12KeyPair(builder:flatbuffers.Builder):flatbuffers.Offset {
63 | const offset = builder.endObject();
64 | return offset;
65 | }
66 |
67 | static createPKCS12KeyPair(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset, publicKeyOffset:flatbuffers.Offset, certificateOffset:flatbuffers.Offset):flatbuffers.Offset {
68 | PKCS12KeyPair.startPKCS12KeyPair(builder);
69 | PKCS12KeyPair.addPrivateKey(builder, privateKeyOffset);
70 | PKCS12KeyPair.addPublicKey(builder, publicKeyOffset);
71 | PKCS12KeyPair.addCertificate(builder, certificateOffset);
72 | return PKCS12KeyPair.endPKCS12KeyPair(builder);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/model/private-key-info-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { PrivateKeyInfo } from '../model/private-key-info';
8 |
9 |
10 | export class PrivateKeyInfoResponse {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):PrivateKeyInfoResponse {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsPrivateKeyInfoResponse(bb:flatbuffers.ByteBuffer, obj?:PrivateKeyInfoResponse):PrivateKeyInfoResponse {
20 | return (obj || new PrivateKeyInfoResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsPrivateKeyInfoResponse(bb:flatbuffers.ByteBuffer, obj?:PrivateKeyInfoResponse):PrivateKeyInfoResponse {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new PrivateKeyInfoResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | output(obj?:PrivateKeyInfo):PrivateKeyInfo|null {
29 | const offset = this.bb!.__offset(this.bb_pos, 4);
30 | return offset ? (obj || new PrivateKeyInfo()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
31 | }
32 |
33 | error():string|null
34 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
35 | error(optionalEncoding?:any):string|Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
38 | }
39 |
40 | static startPrivateKeyInfoResponse(builder:flatbuffers.Builder) {
41 | builder.startObject(2);
42 | }
43 |
44 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
45 | builder.addFieldOffset(0, outputOffset, 0);
46 | }
47 |
48 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
49 | builder.addFieldOffset(1, errorOffset, 0);
50 | }
51 |
52 | static endPrivateKeyInfoResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
53 | const offset = builder.endObject();
54 | return offset;
55 | }
56 |
57 | static createPrivateKeyInfoResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
58 | PrivateKeyInfoResponse.startPrivateKeyInfoResponse(builder);
59 | PrivateKeyInfoResponse.addOutput(builder, outputOffset);
60 | PrivateKeyInfoResponse.addError(builder, errorOffset);
61 | return PrivateKeyInfoResponse.endPrivateKeyInfoResponse(builder);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/model/private-key-info.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class PrivateKeyInfo {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):PrivateKeyInfo {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsPrivateKeyInfo(bb:flatbuffers.ByteBuffer, obj?:PrivateKeyInfo):PrivateKeyInfo {
17 | return (obj || new PrivateKeyInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsPrivateKeyInfo(bb:flatbuffers.ByteBuffer, obj?:PrivateKeyInfo):PrivateKeyInfo {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new PrivateKeyInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | bitLen():bigint {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
28 | }
29 |
30 | mutate_bit_len(value:bigint):boolean {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 |
33 | if (offset === 0) {
34 | return false;
35 | }
36 |
37 | this.bb!.writeInt64(this.bb_pos + offset, value);
38 | return true;
39 | }
40 |
41 | size():bigint {
42 | const offset = this.bb!.__offset(this.bb_pos, 6);
43 | return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
44 | }
45 |
46 | mutate_size(value:bigint):boolean {
47 | const offset = this.bb!.__offset(this.bb_pos, 6);
48 |
49 | if (offset === 0) {
50 | return false;
51 | }
52 |
53 | this.bb!.writeInt64(this.bb_pos + offset, value);
54 | return true;
55 | }
56 |
57 | error():string|null
58 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
59 | error(optionalEncoding?:any):string|Uint8Array|null {
60 | const offset = this.bb!.__offset(this.bb_pos, 8);
61 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
62 | }
63 |
64 | static startPrivateKeyInfo(builder:flatbuffers.Builder) {
65 | builder.startObject(3);
66 | }
67 |
68 | static addBitLen(builder:flatbuffers.Builder, bitLen:bigint) {
69 | builder.addFieldInt64(0, bitLen, BigInt('0'));
70 | }
71 |
72 | static addSize(builder:flatbuffers.Builder, size:bigint) {
73 | builder.addFieldInt64(1, size, BigInt('0'));
74 | }
75 |
76 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
77 | builder.addFieldOffset(2, errorOffset, 0);
78 | }
79 |
80 | static endPrivateKeyInfo(builder:flatbuffers.Builder):flatbuffers.Offset {
81 | const offset = builder.endObject();
82 | return offset;
83 | }
84 |
85 | static createPrivateKeyInfo(builder:flatbuffers.Builder, bitLen:bigint, size:bigint, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
86 | PrivateKeyInfo.startPrivateKeyInfo(builder);
87 | PrivateKeyInfo.addBitLen(builder, bitLen);
88 | PrivateKeyInfo.addSize(builder, size);
89 | PrivateKeyInfo.addError(builder, errorOffset);
90 | return PrivateKeyInfo.endPrivateKeyInfo(builder);
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/model/public-key-info-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { PublicKeyInfo } from '../model/public-key-info';
8 |
9 |
10 | export class PublicKeyInfoResponse {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):PublicKeyInfoResponse {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsPublicKeyInfoResponse(bb:flatbuffers.ByteBuffer, obj?:PublicKeyInfoResponse):PublicKeyInfoResponse {
20 | return (obj || new PublicKeyInfoResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsPublicKeyInfoResponse(bb:flatbuffers.ByteBuffer, obj?:PublicKeyInfoResponse):PublicKeyInfoResponse {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new PublicKeyInfoResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | output(obj?:PublicKeyInfo):PublicKeyInfo|null {
29 | const offset = this.bb!.__offset(this.bb_pos, 4);
30 | return offset ? (obj || new PublicKeyInfo()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
31 | }
32 |
33 | error():string|null
34 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
35 | error(optionalEncoding?:any):string|Uint8Array|null {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
38 | }
39 |
40 | static startPublicKeyInfoResponse(builder:flatbuffers.Builder) {
41 | builder.startObject(2);
42 | }
43 |
44 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
45 | builder.addFieldOffset(0, outputOffset, 0);
46 | }
47 |
48 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
49 | builder.addFieldOffset(1, errorOffset, 0);
50 | }
51 |
52 | static endPublicKeyInfoResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
53 | const offset = builder.endObject();
54 | return offset;
55 | }
56 |
57 | static createPublicKeyInfoResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
58 | PublicKeyInfoResponse.startPublicKeyInfoResponse(builder);
59 | PublicKeyInfoResponse.addOutput(builder, outputOffset);
60 | PublicKeyInfoResponse.addError(builder, errorOffset);
61 | return PublicKeyInfoResponse.endPublicKeyInfoResponse(builder);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/model/public-key-info.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class PublicKeyInfo {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):PublicKeyInfo {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsPublicKeyInfo(bb:flatbuffers.ByteBuffer, obj?:PublicKeyInfo):PublicKeyInfo {
17 | return (obj || new PublicKeyInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsPublicKeyInfo(bb:flatbuffers.ByteBuffer, obj?:PublicKeyInfo):PublicKeyInfo {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new PublicKeyInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | bitLen():bigint {
26 | const offset = this.bb!.__offset(this.bb_pos, 4);
27 | return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
28 | }
29 |
30 | mutate_bit_len(value:bigint):boolean {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 |
33 | if (offset === 0) {
34 | return false;
35 | }
36 |
37 | this.bb!.writeInt64(this.bb_pos + offset, value);
38 | return true;
39 | }
40 |
41 | size():bigint {
42 | const offset = this.bb!.__offset(this.bb_pos, 6);
43 | return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
44 | }
45 |
46 | mutate_size(value:bigint):boolean {
47 | const offset = this.bb!.__offset(this.bb_pos, 6);
48 |
49 | if (offset === 0) {
50 | return false;
51 | }
52 |
53 | this.bb!.writeInt64(this.bb_pos + offset, value);
54 | return true;
55 | }
56 |
57 | e():bigint {
58 | const offset = this.bb!.__offset(this.bb_pos, 8);
59 | return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
60 | }
61 |
62 | mutate_e(value:bigint):boolean {
63 | const offset = this.bb!.__offset(this.bb_pos, 8);
64 |
65 | if (offset === 0) {
66 | return false;
67 | }
68 |
69 | this.bb!.writeInt64(this.bb_pos + offset, value);
70 | return true;
71 | }
72 |
73 | static startPublicKeyInfo(builder:flatbuffers.Builder) {
74 | builder.startObject(3);
75 | }
76 |
77 | static addBitLen(builder:flatbuffers.Builder, bitLen:bigint) {
78 | builder.addFieldInt64(0, bitLen, BigInt('0'));
79 | }
80 |
81 | static addSize(builder:flatbuffers.Builder, size:bigint) {
82 | builder.addFieldInt64(1, size, BigInt('0'));
83 | }
84 |
85 | static addE(builder:flatbuffers.Builder, e:bigint) {
86 | builder.addFieldInt64(2, e, BigInt('0'));
87 | }
88 |
89 | static endPublicKeyInfo(builder:flatbuffers.Builder):flatbuffers.Offset {
90 | const offset = builder.endObject();
91 | return offset;
92 | }
93 |
94 | static createPublicKeyInfo(builder:flatbuffers.Builder, bitLen:bigint, size:bigint, e:bigint):flatbuffers.Offset {
95 | PublicKeyInfo.startPublicKeyInfo(builder);
96 | PublicKeyInfo.addBitLen(builder, bitLen);
97 | PublicKeyInfo.addSize(builder, size);
98 | PublicKeyInfo.addE(builder, e);
99 | return PublicKeyInfo.endPublicKeyInfo(builder);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/model/salt-length.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | export enum SaltLength {
6 | AUTO = 0,
7 | EQUALS_HASH = 1
8 | }
9 |
--------------------------------------------------------------------------------
/src/model/sign-pkcs1v15-request.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | import { Hash } from '../model/hash';
8 |
9 |
10 | export class SignPKCS1v15Request {
11 | bb: flatbuffers.ByteBuffer|null = null;
12 | bb_pos = 0;
13 | __init(i:number, bb:flatbuffers.ByteBuffer):SignPKCS1v15Request {
14 | this.bb_pos = i;
15 | this.bb = bb;
16 | return this;
17 | }
18 |
19 | static getRootAsSignPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:SignPKCS1v15Request):SignPKCS1v15Request {
20 | return (obj || new SignPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 | }
22 |
23 | static getSizePrefixedRootAsSignPKCS1v15Request(bb:flatbuffers.ByteBuffer, obj?:SignPKCS1v15Request):SignPKCS1v15Request {
24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 | return (obj || new SignPKCS1v15Request()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 | }
27 |
28 | message():string|null
29 | message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
30 | message(optionalEncoding?:any):string|Uint8Array|null {
31 | const offset = this.bb!.__offset(this.bb_pos, 4);
32 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
33 | }
34 |
35 | hash():Hash {
36 | const offset = this.bb!.__offset(this.bb_pos, 6);
37 | return offset ? this.bb!.readInt32(this.bb_pos + offset) : Hash.MD5;
38 | }
39 |
40 | mutate_hash(value:Hash):boolean {
41 | const offset = this.bb!.__offset(this.bb_pos, 6);
42 |
43 | if (offset === 0) {
44 | return false;
45 | }
46 |
47 | this.bb!.writeInt32(this.bb_pos + offset, value);
48 | return true;
49 | }
50 |
51 | privateKey():string|null
52 | privateKey(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
53 | privateKey(optionalEncoding?:any):string|Uint8Array|null {
54 | const offset = this.bb!.__offset(this.bb_pos, 8);
55 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
56 | }
57 |
58 | static startSignPKCS1v15Request(builder:flatbuffers.Builder) {
59 | builder.startObject(3);
60 | }
61 |
62 | static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
63 | builder.addFieldOffset(0, messageOffset, 0);
64 | }
65 |
66 | static addHash(builder:flatbuffers.Builder, hash:Hash) {
67 | builder.addFieldInt32(1, hash, Hash.MD5);
68 | }
69 |
70 | static addPrivateKey(builder:flatbuffers.Builder, privateKeyOffset:flatbuffers.Offset) {
71 | builder.addFieldOffset(2, privateKeyOffset, 0);
72 | }
73 |
74 | static endSignPKCS1v15Request(builder:flatbuffers.Builder):flatbuffers.Offset {
75 | const offset = builder.endObject();
76 | return offset;
77 | }
78 |
79 | static createSignPKCS1v15Request(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset, hash:Hash, privateKeyOffset:flatbuffers.Offset):flatbuffers.Offset {
80 | SignPKCS1v15Request.startSignPKCS1v15Request(builder);
81 | SignPKCS1v15Request.addMessage(builder, messageOffset);
82 | SignPKCS1v15Request.addHash(builder, hash);
83 | SignPKCS1v15Request.addPrivateKey(builder, privateKeyOffset);
84 | return SignPKCS1v15Request.endSignPKCS1v15Request(builder);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/model/string-response.ts:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4 |
5 | import * as flatbuffers from 'flatbuffers';
6 |
7 | export class StringResponse {
8 | bb: flatbuffers.ByteBuffer|null = null;
9 | bb_pos = 0;
10 | __init(i:number, bb:flatbuffers.ByteBuffer):StringResponse {
11 | this.bb_pos = i;
12 | this.bb = bb;
13 | return this;
14 | }
15 |
16 | static getRootAsStringResponse(bb:flatbuffers.ByteBuffer, obj?:StringResponse):StringResponse {
17 | return (obj || new StringResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 | }
19 |
20 | static getSizePrefixedRootAsStringResponse(bb:flatbuffers.ByteBuffer, obj?:StringResponse):StringResponse {
21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 | return (obj || new StringResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 | }
24 |
25 | output():string|null
26 | output(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 | output(optionalEncoding?:any):string|Uint8Array|null {
28 | const offset = this.bb!.__offset(this.bb_pos, 4);
29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 | }
31 |
32 | error():string|null
33 | error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
34 | error(optionalEncoding?:any):string|Uint8Array|null {
35 | const offset = this.bb!.__offset(this.bb_pos, 6);
36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
37 | }
38 |
39 | static startStringResponse(builder:flatbuffers.Builder) {
40 | builder.startObject(2);
41 | }
42 |
43 | static addOutput(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset) {
44 | builder.addFieldOffset(0, outputOffset, 0);
45 | }
46 |
47 | static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
48 | builder.addFieldOffset(1, errorOffset, 0);
49 | }
50 |
51 | static endStringResponse(builder:flatbuffers.Builder):flatbuffers.Offset {
52 | const offset = builder.endObject();
53 | return offset;
54 | }
55 |
56 | static createStringResponse(builder:flatbuffers.Builder, outputOffset:flatbuffers.Offset, errorOffset:flatbuffers.Offset):flatbuffers.Offset {
57 | StringResponse.startStringResponse(builder);
58 | StringResponse.addOutput(builder, outputOffset);
59 | StringResponse.addError(builder, errorOffset);
60 | return StringResponse.endStringResponse(builder);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/shim.ts:
--------------------------------------------------------------------------------
1 | if (typeof global.BigInt === 'undefined') {
2 | const BigInt = require('./utils/big-int').default;
3 | global.BigInt = BigInt;
4 | }
5 |
6 | if (typeof global.TextDecoder === 'undefined') {
7 | const TextDecoder = require('./utils/text-decoder').default;
8 | global.TextDecoder = TextDecoder;
9 | }
10 |
11 | if (typeof global.TextEncoder === 'undefined') {
12 | const TextEncoder = require('./utils/text-encoder').default;
13 | global.TextEncoder = TextEncoder;
14 | }
15 |
--------------------------------------------------------------------------------
/src/types.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains all method available inside of `NativeModules`
3 | */
4 | interface FastRSANativeModules {
5 | /**
6 | * this method use `NativeModules` in a more traditional way
7 | * using `JNI` on android in order to call shared a library.
8 | */
9 | call(name: string, payload: number[]): Promise;
10 |
11 | encodeText(input: string, encoding: string): number[];
12 | decodeText(
13 | input: number[],
14 | encoding: string,
15 | fatal: boolean,
16 | ignoreBOM: boolean,
17 | stream: boolean
18 | ): string;
19 | /**
20 | * this method will install JSI definitions
21 | */
22 | install(): boolean;
23 | }
24 |
25 | interface NativeModulesDef {
26 | FastRsa: FastRSANativeModules;
27 | }
28 |
29 | interface Global {
30 | BigInt: any;
31 | TextEncoder: any;
32 | TextDecoder: any;
33 | // for now we are not going to use this way because of hermes on release mode only
34 | // FastRSA:FastRSAJSI
35 | /**
36 | * this method use `JSI`, but will return a `Promise` in order to use an async way,
37 | * at this moment is no real Async but in the future will be.
38 | * TODO: implement real promise here
39 | */
40 | FastRSACallPromise(
41 | name: string,
42 | payload: ArrayBuffer | SharedArrayBuffer
43 | ): Promise;
44 | /**
45 | * this method use `JSI`, and will use in a Sync way,
46 | * be careful if the method that you are using is a complex one like generate a new Key
47 | */
48 | FastRSACallSync(
49 | name: string,
50 | payload: ArrayBuffer | SharedArrayBuffer
51 | ): ArrayBuffer;
52 |
53 | FastRSAEncodeText(input: string, encoding: string): Uint8Array;
54 | FastRSADecodeText(
55 | input: Uint8Array,
56 | encoding: string,
57 | fatal: boolean,
58 | ignoreBOM: boolean,
59 | stream: boolean
60 | ): string;
61 | }
62 |
63 | declare const global: Global;
64 | declare const module: any;
65 | declare const atob: any;
66 |
--------------------------------------------------------------------------------
/src/utils/big-int.ts:
--------------------------------------------------------------------------------
1 | const BigInt = require('big-integer');
2 | BigInt.asUintN = function (bits: any, bigint: any) {
3 | bigint = BigInt(bigint);
4 | if (typeof bigint.value === 'bigint') {
5 | return BigInt(BigInt.asUintN(bits, bigint.value));
6 | }
7 | const p2bits = BigInt(1).shiftLeft(bits);
8 | const mod = bigint.and(p2bits.subtract(1));
9 | return mod;
10 | };
11 | BigInt.asIntN = function (bits: any, bigint: any) {
12 | bigint = BigInt(bigint);
13 | if (typeof bigint.value === 'bigint') {
14 | return BigInt(BigInt.asIntN(bits, bigint.value));
15 | }
16 | const p2bits = BigInt(1).shiftLeft(bits);
17 | const mod = bigint.and(p2bits.subtract(1));
18 | return mod.greaterOrEquals(p2bits.subtract(mod)) ? mod.subtract(p2bits) : mod;
19 | };
20 |
21 | export default BigInt;
22 |
--------------------------------------------------------------------------------
/src/utils/text-decoder.ts:
--------------------------------------------------------------------------------
1 | import { NativeModules } from 'react-native';
2 |
3 | const FastRSANativeModules = (NativeModules as NativeModulesDef).FastRsa;
4 | const isDebuggingEnabled =
5 | typeof atob !== 'undefined' && typeof HermesInternal === 'undefined';
6 |
7 | typeof global.FastRSADecodeText === 'undefined' &&
8 | !isDebuggingEnabled &&
9 | FastRSANativeModules.install();
10 |
11 | interface TextDecoderOptions {
12 | fatal?: boolean;
13 | ignoreBOM?: boolean;
14 | }
15 |
16 | interface TextDecodeOptions {
17 | stream?: boolean;
18 | }
19 |
20 | export default class TextDecoder {
21 | private encoding: string;
22 | private fatal: boolean;
23 | private ignoreBOM: boolean;
24 |
25 | constructor(label: string = 'utf-8', options: TextDecoderOptions = {}) {
26 | this.encoding = label.toLowerCase();
27 | this.fatal = options.fatal ?? false;
28 | this.ignoreBOM = options.ignoreBOM ?? false;
29 | }
30 |
31 | decode(input?: Uint8Array, options: TextDecodeOptions = {}): string {
32 | if (!input) {
33 | return '';
34 | }
35 |
36 | if (typeof global.FastRSADecodeText === 'function') {
37 | const ress = global.FastRSADecodeText(
38 | input,
39 | this.encoding,
40 | this.fatal,
41 | this.ignoreBOM,
42 | options.stream ?? false
43 | );
44 | return ress;
45 | }
46 | return FastRSANativeModules.decodeText(
47 | Array.from(input),
48 | this.encoding,
49 | this.fatal,
50 | this.ignoreBOM,
51 | options.stream ?? false
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/utils/text-encoder.ts:
--------------------------------------------------------------------------------
1 | import { NativeModules } from 'react-native';
2 |
3 | const FastRSANativeModules = (NativeModules as NativeModulesDef).FastRsa;
4 | const isDebuggingEnabled =
5 | typeof atob !== 'undefined' && typeof HermesInternal === 'undefined';
6 |
7 | typeof global.FastRSAEncodeText === 'undefined' &&
8 | !isDebuggingEnabled &&
9 | FastRSANativeModules.install();
10 |
11 | export default class TextEncoder {
12 | get encoding(): string {
13 | return 'utf-8';
14 | }
15 |
16 | encode(input: string = ''): Uint8Array {
17 | if (typeof global.FastRSAEncodeText === 'function') {
18 | const result = global.FastRSAEncodeText(input, 'utf-8');
19 | return new Uint8Array(result);
20 | }
21 | const result = FastRSANativeModules.encodeText(input, 'utf-8');
22 | return new Uint8Array(result);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "extends": "./tsconfig",
4 | "exclude": ["example"]
5 | }
6 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "rootDir": ".",
4 | "paths": {
5 | "react-native-fast-rsa": ["./src/index"]
6 | },
7 | "allowUnreachableCode": false,
8 | "allowUnusedLabels": false,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "jsx": "react",
12 | "lib": ["esnext"],
13 | "module": "esnext",
14 | "moduleResolution": "node",
15 | "noFallthroughCasesInSwitch": true,
16 | "noImplicitReturns": true,
17 | "noImplicitUseStrict": false,
18 | "noStrictGenericChecks": false,
19 | "noUncheckedIndexedAccess": true,
20 | "noUnusedLocals": true,
21 | "noUnusedParameters": true,
22 | "resolveJsonModule": true,
23 | "skipLibCheck": true,
24 | "strict": true,
25 | "target": "esnext",
26 | "verbatimModuleSyntax": true
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "pipeline": {
4 | "build:android": {
5 | "inputs": [
6 | "package.json",
7 | "android",
8 | "!android/build",
9 | "src/*.ts",
10 | "src/*.tsx",
11 | "example/package.json",
12 | "example/android",
13 | "!example/android/.gradle",
14 | "!example/android/build",
15 | "!example/android/app/build"
16 | ],
17 | "outputs": []
18 | },
19 | "build:ios": {
20 | "inputs": [
21 | "package.json",
22 | "*.podspec",
23 | "ios",
24 | "src/*.ts",
25 | "src/*.tsx",
26 | "example/package.json",
27 | "example/ios",
28 | "!example/ios/build",
29 | "!example/ios/Pods"
30 | ],
31 | "outputs": []
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------