expo-crypto 10.2.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/crypto/CryptoModule.kt +15 -28
- package/android/src/main/java/expo/modules/crypto/DigestAlgorithm.kt +11 -0
- package/android/src/main/java/expo/modules/crypto/DigestOptions.kt +15 -0
- package/expo-module.config.json +4 -0
- package/ios/CryptoModule.swift +3 -4
- package/ios/ExpoCrypto.podspec +1 -1
- package/package.json +3 -3
- package/tsconfig.json +1 -1
- package/android/src/main/java/expo/modules/crypto/CryptoPackage.kt +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 12.0.0 — 2022-10-25
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
19
|
+
## 11.0.0 — 2022-07-07
|
|
20
|
+
|
|
21
|
+
### 🎉 New features
|
|
22
|
+
|
|
23
|
+
- The module on Android now uses JSI host object instead of the bridge module for communication between JavaScript and native code. ([#17614](https://github.com/expo/expo/pull/17614) by [@lukmccall](https://github.com/lukmccall))
|
|
24
|
+
|
|
25
|
+
### 💡 Others
|
|
26
|
+
|
|
27
|
+
- Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
|
|
28
|
+
|
|
13
29
|
## 10.2.0 — 2022-04-18
|
|
14
30
|
|
|
15
31
|
### 🎉 New features
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '
|
|
6
|
+
version = '12.0.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -74,7 +74,7 @@ android {
|
|
|
74
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
75
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
76
76
|
versionCode 25
|
|
77
|
-
versionName "
|
|
77
|
+
versionName "12.0.0"
|
|
78
78
|
}
|
|
79
79
|
lintOptions {
|
|
80
80
|
abortOnError false
|
|
@@ -1,45 +1,32 @@
|
|
|
1
1
|
package expo.modules.crypto
|
|
2
2
|
|
|
3
|
-
import android.content.Context
|
|
4
3
|
import android.util.Base64
|
|
5
|
-
|
|
6
|
-
import expo.modules.
|
|
7
|
-
import expo.modules.core.Promise
|
|
8
|
-
import expo.modules.core.interfaces.ExpoMethod
|
|
9
|
-
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
10
6
|
import java.security.MessageDigest
|
|
11
|
-
import java.security.NoSuchAlgorithmException
|
|
12
7
|
|
|
13
|
-
class CryptoModule
|
|
14
|
-
override fun
|
|
8
|
+
class CryptoModule : Module() {
|
|
9
|
+
override fun definition() = ModuleDefinition {
|
|
10
|
+
Name("ExpoCrypto")
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
Function("digestString", this@CryptoModule::digestString)
|
|
13
|
+
AsyncFunction("digestStringAsync", this@CryptoModule::digestString)
|
|
14
|
+
}
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} catch (e: NoSuchAlgorithmException) {
|
|
23
|
-
promise.reject("ERR_CRYPTO_DIGEST", e)
|
|
24
|
-
return
|
|
25
|
-
}
|
|
16
|
+
private fun digestString(algorithm: DigestAlgorithm, data: String, options: DigestOptions): String {
|
|
17
|
+
val messageDigest = MessageDigest.getInstance(algorithm.value).apply { update(data.toByteArray()) }
|
|
26
18
|
|
|
27
19
|
val digest: ByteArray = messageDigest.digest()
|
|
28
|
-
when (encoding) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
promise.resolve(output)
|
|
20
|
+
return when (options.encoding) {
|
|
21
|
+
DigestOptions.Encoding.BASE64 -> {
|
|
22
|
+
Base64.encodeToString(digest, Base64.NO_WRAP)
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
DigestOptions.Encoding.HEX -> {
|
|
25
|
+
digest.joinToString(separator = "") { byte ->
|
|
35
26
|
((byte.toInt() and 0xff) + 0x100)
|
|
36
27
|
.toString(radix = 16)
|
|
37
28
|
.substring(startIndex = 1)
|
|
38
29
|
}
|
|
39
|
-
promise.resolve(output)
|
|
40
|
-
}
|
|
41
|
-
else -> {
|
|
42
|
-
promise.reject("ERR_CRYPTO_DIGEST", "Invalid encoding type provided.")
|
|
43
30
|
}
|
|
44
31
|
}
|
|
45
32
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package expo.modules.crypto
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.records.Field
|
|
4
|
+
import expo.modules.kotlin.records.Record
|
|
5
|
+
import expo.modules.kotlin.types.Enumerable
|
|
6
|
+
|
|
7
|
+
class DigestOptions : Record {
|
|
8
|
+
@Field
|
|
9
|
+
var encoding: Encoding = Encoding.HEX
|
|
10
|
+
|
|
11
|
+
enum class Encoding(val value: String) : Enumerable {
|
|
12
|
+
HEX("hex"),
|
|
13
|
+
BASE64("base64")
|
|
14
|
+
}
|
|
15
|
+
}
|
package/expo-module.config.json
CHANGED
package/ios/CryptoModule.swift
CHANGED
|
@@ -5,12 +5,11 @@ import ExpoModulesCore
|
|
|
5
5
|
|
|
6
6
|
public class CryptoModule: Module {
|
|
7
7
|
public func definition() -> ModuleDefinition {
|
|
8
|
-
|
|
8
|
+
Name("ExpoCrypto")
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
AsyncFunction("digestStringAsync", digestString)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
.runSynchronously()
|
|
12
|
+
Function("digestString", digestString)
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
|
package/ios/ExpoCrypto.podspec
CHANGED
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.platform = :ios, '
|
|
13
|
+
s.platform = :ios, '13.0'
|
|
14
14
|
s.swift_version = '5.4'
|
|
15
15
|
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
16
16
|
s.static_framework = true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-crypto",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Expo universal module for crypto",
|
|
5
5
|
"main": "build/Crypto.js",
|
|
6
6
|
"types": "build/Crypto.d.ts",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"expo-module-scripts": "^
|
|
43
|
+
"expo-module-scripts": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"expo": "*"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
|
|
49
49
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package expo.modules.crypto
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import expo.modules.core.BasePackage
|
|
5
|
-
import expo.modules.core.ExportedModule
|
|
6
|
-
|
|
7
|
-
class CryptoPackage : BasePackage() {
|
|
8
|
-
override fun createExportedModules(context: Context): List<ExportedModule> = listOf(CryptoModule(context))
|
|
9
|
-
}
|