Page MenuHomePhabricator

D7002.id23852.diff
No OneTemporary

D7002.id23852.diff

diff --git a/.dockerignore b/.dockerignore
--- a/.dockerignore
+++ b/.dockerignore
@@ -19,6 +19,7 @@
!native/ios/pod-patch
!native/cpp/CommonCpp/grpc
!native/expo-modules/android-lifecycle/package.json
+!native/expo-modules/aes-crypto/package.json
web/node_modules
web/dist
diff --git a/keyserver/Dockerfile b/keyserver/Dockerfile
--- a/keyserver/Dockerfile
+++ b/keyserver/Dockerfile
@@ -122,6 +122,8 @@
keyserver/addons/rust-node-addon/
COPY --chown=comm native/expo-modules/android-lifecycle/package.json \
native/expo-modules/android-lifecycle/
+COPY --chown=comm native/expo-modules/aes-crypto/package.json \
+ native/expo-modules/aes-crypto/
COPY --chown=comm services/electron-update-server/package.json \
services/electron-update-server/
diff --git a/native/expo-modules/aes-crypto/android/build.gradle b/native/expo-modules/aes-crypto/android/build.gradle
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/android/build.gradle
@@ -0,0 +1,91 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'maven-publish'
+
+group = 'app.comm.android.aescrypto'
+version = '0.1.0'
+
+buildscript {
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
+ if (expoModulesCorePlugin.exists()) {
+ apply from: expoModulesCorePlugin
+ applyKotlinExpoModulesCorePlugin()
+ }
+
+ // Simple helper that allows the root project to override versions declared by this library.
+ ext.safeExtGet = { prop, fallback ->
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
+ }
+
+ // Ensures backward compatibility
+ ext.getKotlinVersion = {
+ if (ext.has("kotlinVersion")) {
+ ext.kotlinVersion()
+ } else {
+ ext.safeExtGet("kotlinVersion", "1.6.10")
+ }
+ }
+
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
+ }
+}
+
+// Creating sources with comments
+task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.srcDirs
+}
+
+afterEvaluate {
+ publishing {
+ publications {
+ release(MavenPublication) {
+ from components.release
+ // Add additional sourcesJar to artifacts
+ artifact(androidSourcesJar)
+ }
+ }
+ repositories {
+ maven {
+ url = mavenLocal().url
+ }
+ }
+ }
+}
+
+android {
+ compileSdkVersion safeExtGet("compileSdkVersion", 31)
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_11.majorVersion
+ }
+
+ defaultConfig {
+ minSdkVersion safeExtGet("minSdkVersion", 21)
+ targetSdkVersion safeExtGet("targetSdkVersion", 31)
+ versionCode 1
+ versionName "0.1.0"
+ }
+ lintOptions {
+ abortOnError false
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation project(':expo-modules-core')
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
+}
diff --git a/native/expo-modules/aes-crypto/android/src/main/AndroidManifest.xml b/native/expo-modules/aes-crypto/android/src/main/AndroidManifest.xml
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/android/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+<manifest package="app.comm.android.aescrypto">
+</manifest>
diff --git a/native/expo-modules/aes-crypto/android/src/main/java/app/comm/android/aescrypto/AESCryptoModule.kt b/native/expo-modules/aes-crypto/android/src/main/java/app/comm/android/aescrypto/AESCryptoModule.kt
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/android/src/main/java/app/comm/android/aescrypto/AESCryptoModule.kt
@@ -0,0 +1,14 @@
+package app.comm.android.aescrypto
+
+import expo.modules.kotlin.modules.Module
+import expo.modules.kotlin.modules.ModuleDefinition
+
+class AESCryptoModule : Module() {
+ override fun definition() = ModuleDefinition {
+ Name("AESCrypto")
+
+ Function("hello") {
+ return@Function "Hello world! 👋"
+ }
+ }
+}
diff --git a/native/expo-modules/aes-crypto/expo-module.config.json b/native/expo-modules/aes-crypto/expo-module.config.json
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/expo-module.config.json
@@ -0,0 +1,9 @@
+{
+ "platforms": ["ios", "android"],
+ "ios": {
+ "modules": ["AESCryptoModule"]
+ },
+ "android": {
+ "modules": ["app.comm.android.aescrypto.AESCryptoModule"]
+ }
+}
diff --git a/native/expo-modules/aes-crypto/ios/AESCrypto.podspec b/native/expo-modules/aes-crypto/ios/AESCrypto.podspec
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/ios/AESCrypto.podspec
@@ -0,0 +1,27 @@
+require 'json'
+
+package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
+
+Pod::Spec.new do |s|
+ s.name = 'AESCrypto'
+ s.version = package['version']
+ s.summary = package['description']
+ s.description = package['description']
+ s.license = package['license']
+ s.author = 'Comm'
+ s.homepage = 'https://comm.app'
+ s.platform = :ios, '13.0'
+ s.swift_version = '5.4'
+ s.source = { git: 'https://github.com/CommE2E/comm' }
+ s.static_framework = true
+
+ s.dependency 'ExpoModulesCore'
+
+ # Swift/Objective-C compatibility
+ s.pod_target_xcconfig = {
+ 'DEFINES_MODULE' => 'YES',
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule'
+ }
+
+ s.source_files = "**/*.{h,m,swift}"
+end
diff --git a/native/expo-modules/aes-crypto/ios/AESCryptoModule.swift b/native/expo-modules/aes-crypto/ios/AESCryptoModule.swift
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/ios/AESCryptoModule.swift
@@ -0,0 +1,11 @@
+import ExpoModulesCore
+
+public class AESCryptoModule: Module {
+ public func definition() -> ModuleDefinition {
+ Name("AESCrypto")
+
+ Function("hello") { () -> String in
+ return "Hello world! 👋"
+ }
+ }
+}
diff --git a/native/expo-modules/aes-crypto/package.json b/native/expo-modules/aes-crypto/package.json
new file mode 100644
--- /dev/null
+++ b/native/expo-modules/aes-crypto/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@commapp/aes-crypto",
+ "version": "0.0.1",
+ "private": true,
+ "license": "BSD-3-Clause",
+ "description": "AES GCM encryption and decryption",
+ "dependencies": {},
+ "devDependencies": {
+ "expo-module-scripts": "^3.0.3",
+ "expo-modules-core": "^1.0.3"
+ },
+ "peerDependencies": {
+ "expo": "*",
+ "react": "*",
+ "react-native": "*"
+ }
+}
diff --git a/native/ios/Podfile.lock b/native/ios/Podfile.lock
--- a/native/ios/Podfile.lock
+++ b/native/ios/Podfile.lock
@@ -1,4 +1,6 @@
PODS:
+ - AESCrypto (0.0.1):
+ - ExpoModulesCore
- boost (1.76.0)
- DoubleConversion (1.1.6)
- DVAssetLoaderDelegate (0.3.3)
@@ -546,6 +548,7 @@
- Yoga (1.14.0)
DEPENDENCIES:
+ - AESCrypto (from `../expo-modules/aes-crypto/ios`)
- boost (from `../../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXApplication (from `../../node_modules/expo-application/ios`)
@@ -645,6 +648,8 @@
- SPTPersistentCache
EXTERNAL SOURCES:
+ AESCrypto:
+ :path: "../expo-modules/aes-crypto/ios"
boost:
:podspec: "../../node_modules/react-native/third-party-podspecs/boost.podspec"
DoubleConversion:
@@ -811,6 +816,7 @@
:path: "../../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
+ AESCrypto: 3f397599b6b8e66c3b8a16e09bed17e6ad03482d
boost: a7c83b31436843459a1961bfd74b96033dc77234
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DVAssetLoaderDelegate: 0caec20e4e08b8560b691131539e9180024d4bce
diff --git a/native/package.json b/native/package.json
--- a/native/package.json
+++ b/native/package.json
@@ -50,6 +50,7 @@
},
"dependencies": {
"@commapp/android-lifecycle": "0.0.1",
+ "@commapp/aes-crypto": "0.0.1",
"@commapp/sqlcipher-amalgamation": "^4.4.3-a",
"@ethersproject/shims": "^5.7.0",
"@expo/react-native-action-sheet": "^3.14.0",
diff --git a/native/utils/aes-crypto-module.js b/native/utils/aes-crypto-module.js
new file mode 100644
--- /dev/null
+++ b/native/utils/aes-crypto-module.js
@@ -0,0 +1,11 @@
+// @flow
+
+import { requireNativeModule } from 'expo-modules-core';
+
+const AESCryptoModule: {
+ +hello: () => string,
+} = requireNativeModule('AESCrypto');
+
+export function hello(): string {
+ return AESCryptoModule.hello();
+}
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"desktop",
"keyserver/addons/rust-node-addon",
"native/expo-modules/android-lifecycle",
+ "native/expo-modules/aes-crypto",
"services/electron-update-server"
],
"scripts": {

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 1:43 PM (20 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2571028
Default Alt Text
D7002.id23852.diff (8 KB)

Event Timeline