PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/expo-random/android/src/main/java/expo/modules/random

Просмотр файла: RandomModule.kt

package expo.modules.random

import android.util.Base64
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import java.security.SecureRandom

class RandomModule : Module() {
  private val secureRandom by lazy { SecureRandom() }

  override fun definition() = ModuleDefinition {
    Name("ExpoRandom")

    Function("getRandomBase64String", this@RandomModule::getRandomBase64String)
    AsyncFunction("getRandomBase64StringAsync", this@RandomModule::getRandomBase64String)
  }

  private fun getRandomBase64String(randomByteCount: Int): String {
    val output = ByteArray(randomByteCount)
    secureRandom.nextBytes(output)
    return Base64.encodeToString(output, Base64.NO_WRAP)
  }
}

Выполнить команду


Для локальной разработки. Не используйте в интернете!