Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -159,6 +159,11 @@ java.hexDecodeToString(hex: String)
|
|||||||
utf8 编码为hexString
|
utf8 编码为hexString
|
||||||
java.hexEncodeToString(utf8: String)
|
java.hexEncodeToString(utf8: String)
|
||||||
```
|
```
|
||||||
|
* 标识id
|
||||||
|
```
|
||||||
|
java.randomUUID()
|
||||||
|
java.androidId()
|
||||||
|
```
|
||||||
* 文件
|
* 文件
|
||||||
> 所有对于文件的读写删操作都是相对路径,只能操作阅读缓存/android/data/{package}/cache/内的文件
|
> 所有对于文件的读写删操作都是相对路径,只能操作阅读缓存/android/data/{package}/cache/内的文件
|
||||||
```
|
```
|
||||||
@@ -206,11 +211,10 @@ cipher.encryptBase64(data)
|
|||||||
cipher.encryptHex(data)
|
cipher.encryptHex(data)
|
||||||
```
|
```
|
||||||
* 非对称加密 RSA/ECIES(不支持)
|
* 非对称加密 RSA/ECIES(不支持)
|
||||||
> algorithm: RSA, RSA/ECB/PKCS1Padding, RSA/ECB/NoPadding, RSA/None/NoPadding, RSA/None/NoPadding
|
|
||||||
> 输入参数密钥 支持ByteArray|**Utf8String**
|
> 输入参数密钥 支持ByteArray|**Utf8String**
|
||||||
```
|
```
|
||||||
//创建cipher
|
//创建cipher
|
||||||
java.createAsymmetricCrypto(algorithm, privateKey, publicKey)
|
java.createAsymmetricCrypto(transformation, privateKey, publicKey)
|
||||||
```
|
```
|
||||||
> 解密加密参数 data支持ByteArray|Base64String|HexString|InputStream
|
> 解密加密参数 data支持ByteArray|Base64String|HexString|InputStream
|
||||||
> keyType: 1 使用公钥 2 使用私钥
|
> keyType: 1 使用公钥 2 使用私钥
|
||||||
|
|||||||
@@ -71,20 +71,20 @@ interface JsEncodeUtils {
|
|||||||
|
|
||||||
/* keys都为null时使用随机密钥 */
|
/* keys都为null时使用随机密钥 */
|
||||||
fun createAsymmetricCrypto(
|
fun createAsymmetricCrypto(
|
||||||
algorithm: String,
|
transformation: String,
|
||||||
privateKey: ByteArray?,
|
privateKey: ByteArray?,
|
||||||
publicKey: ByteArray?
|
publicKey: ByteArray?
|
||||||
): AsymmetricCrypto {
|
): AsymmetricCrypto {
|
||||||
return AsymmetricCrypto(algorithm, privateKey, publicKey)
|
return AsymmetricCrypto(transformation, privateKey, publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createAsymmetricCrypto(
|
fun createAsymmetricCrypto(
|
||||||
algorithm: String,
|
transformation: String,
|
||||||
privateKey: String?,
|
privateKey: String?,
|
||||||
publicKey: String?
|
publicKey: String?
|
||||||
): AsymmetricCrypto {
|
): AsymmetricCrypto {
|
||||||
return createAsymmetricCrypto(
|
return createAsymmetricCrypto(
|
||||||
algorithm,
|
transformation,
|
||||||
privateKey?.encodeToByteArray(),
|
privateKey?.encodeToByteArray(),
|
||||||
publicKey?.encodeToByteArray()
|
publicKey?.encodeToByteArray()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -523,8 +523,9 @@ interface JsExtensions : JsEncodeUtils {
|
|||||||
fun unArchiveFile(zipPath: String): String {
|
fun unArchiveFile(zipPath: String): String {
|
||||||
if (zipPath.isEmpty()) return ""
|
if (zipPath.isEmpty()) return ""
|
||||||
val zipFile = getFile(zipPath)
|
val zipFile = getFile(zipPath)
|
||||||
return ArchiveUtils.deCompress(zipFile.absolutePath).toString()
|
return ArchiveUtils.deCompress(zipFile.absolutePath).let {
|
||||||
.substring(FileUtils.getCachePath().length)
|
ArchiveUtils.TEMP_FOLDER_NAME + File.separator + MD5Utils.md5Encode16(zipFile.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ class BookInfoActivity :
|
|||||||
onClick?.invoke(it)
|
onClick?.invoke(it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showDecompressFileImportAlert(files)
|
showDecompressFileImportAlert(files, onClick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ import java.io.File
|
|||||||
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||||
object ArchiveUtils {
|
object ArchiveUtils {
|
||||||
|
|
||||||
|
const val TEMP_FOLDER_NAME = "ArchiveTemp"
|
||||||
// 临时目录 下次启动自动删除
|
// 临时目录 下次启动自动删除
|
||||||
val TEMP_PATH: String by lazy {
|
val TEMP_PATH: String by lazy {
|
||||||
appCtx.externalCache.getFile("ArchiveTemp").createFolderReplace().absolutePath
|
appCtx.externalCache.getFile(TEMP_FOLDER_NAME).createFolderReplace().absolutePath
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deCompress(
|
fun deCompress(
|
||||||
|
|||||||
Reference in New Issue
Block a user