Package org.ngengine.platform
Class NGEPlatform
java.lang.Object
org.ngengine.platform.NGEPlatform
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract byte[]
aes256cbc
(byte[] key, byte[] iv, byte[] data, boolean forEncryption) Encrypts or decrypts data using AES-256 in CBC mode with PKCS7 padding.awaitAllSettled
(List<AsyncTask<T>> promises) abstract byte[]
base64decode
(String data) abstract String
base64encode
(byte[] data) abstract byte[]
chacha20
(byte[] key, byte[] nonce, byte[] data, boolean forEncryption) abstract <T> T
abstract byte[]
abstract byte[]
genPubKey
(byte[] secKey) static NGEPlatform
get()
static BrowserInterceptor
abstract VStore
getCacheStore
(String appName, String cacheName) abstract String
abstract VStore
getDataStore
(String appName, String storeName) static VStoreInterceptor
abstract long
abstract byte[]
hkdf_expand
(byte[] prk, byte[] info, int length) abstract byte[]
hkdf_extract
(byte[] salt, byte[] ikm) abstract byte[]
hmac
(byte[] key, byte[] data1, byte[] data2) abstract AsyncTask
<byte[]> boolean
isLoopbackAddress
(URI uri) Checks if the given URI is a loopback address.final AsyncExecutor
abstract AsyncExecutor
newAsyncExecutor
(Object hint) abstract <T> Queue
<T> newConcurrentQueue
(Class<T> claz) final AsyncExecutor
Deprecated.final AsyncExecutor
Deprecated.usenewAsyncExecutor(Object)
insteadabstract RTCTransport
newRTCTransport
(RTCSettings settings, String connId, Collection<String> stunServers) final AsyncExecutor
Deprecated.usenewAsyncExecutor(Object)
insteadfinal AsyncExecutor
Deprecated.usenewAsyncExecutor(Object)
insteadabstract WebsocketTransport
abstract String
abstract void
openInWebBrowser
(String url) abstract InputStream
openResource
(String resourceName) abstract <T> AsyncTask
<T> promisify
(BiConsumer<Consumer<T>, Consumer<Throwable>> func, AsyncExecutor executor) abstract byte[]
randomBytes
(int n) abstract Runnable
registerFinalizer
(Object obj, Runnable finalizer) abstract byte[]
scrypt
(byte[] P, byte[] S, int N, int r, int p, int dkLen) abstract byte[]
secp256k1SharedSecret
(byte[] privKey, byte[] pubKey) static void
set
(NGEPlatform platform) static void
setBrowserInterceptor
(BrowserInterceptor interceptor) abstract void
setClipboardContent
(String data) static void
setStoreInterceptor
(VStoreInterceptor interceptor) abstract byte[]
sha256
(byte[] data) abstract String
abstract String
abstract String
toJSON
(Collection obj) abstract String
abstract boolean
verifyAsync
(String data, String sign, byte[] pubKey) abstract <T> AsyncTask
<T> wrapPromise
(BiConsumer<Consumer<T>, Consumer<Throwable>> func) abstract byte[]
xchacha20poly1305
(byte[] key, byte[] nonce, byte[] data, byte[] associatedData, boolean forEncryption)
-
Constructor Details
-
NGEPlatform
public NGEPlatform()
-
-
Method Details
-
set
-
get
-
setBrowserInterceptor
-
getBrowserInterceptor
-
setStoreInterceptor
-
getStoreInterceptor
-
generatePrivateKey
public abstract byte[] generatePrivateKey() -
genPubKey
public abstract byte[] genPubKey(byte[] secKey) -
toJSON
-
toJSON
-
fromJSON
-
hmac
public abstract byte[] hmac(byte[] key, byte[] data1, byte[] data2) -
hkdf_extract
public abstract byte[] hkdf_extract(byte[] salt, byte[] ikm) -
hkdf_expand
public abstract byte[] hkdf_expand(byte[] prk, byte[] info, int length) -
base64encode
-
base64decode
-
chacha20
public abstract byte[] chacha20(byte[] key, byte[] nonce, byte[] data, boolean forEncryption) -
newTransport
-
newRTCTransport
public abstract RTCTransport newRTCTransport(RTCSettings settings, String connId, Collection<String> stunServers) -
sha256
-
sha256
public abstract byte[] sha256(byte[] data) -
sign
- Throws:
FailedToSignException
-
verify
-
signAsync
-
verifyAsync
-
randomBytes
public abstract byte[] randomBytes(int n) -
newAsyncExecutor
-
newAsyncExecutor
-
newRelayExecutor
Deprecated.usenewAsyncExecutor(Object)
instead -
newSubscriptionExecutor
Deprecated.usenewAsyncExecutor(Object)
instead -
newSignerExecutor
Deprecated.usenewAsyncExecutor(Object)
instead -
newPoolExecutor
Deprecated.usenewAsyncExecutor(Object)
instead -
promisify
public abstract <T> AsyncTask<T> promisify(BiConsumer<Consumer<T>, Consumer<Throwable>> func, AsyncExecutor executor) -
wrapPromise
-
awaitAll
-
awaitAllSettled
-
getTimestampSeconds
public abstract long getTimestampSeconds() -
newConcurrentQueue
-
httpGet
-
httpGetBytes
-
setClipboardContent
-
getClipboardContent
-
openInWebBrowser
-
scrypt
public abstract byte[] scrypt(byte[] P, byte[] S, int N, int r, int p, int dkLen) -
xchacha20poly1305
public abstract byte[] xchacha20poly1305(byte[] key, byte[] nonce, byte[] data, byte[] associatedData, boolean forEncryption) -
nfkc
-
getDataStore
-
getCacheStore
-
registerFinalizer
-
isLoopbackAddress
Checks if the given URI is a loopback address. Polyfill for non jcl compliant platforms. This method should be overriden by a platform specific implementation- Parameters:
uri
- the URI to check- Returns:
- true if the URI is a loopback address, false otherwise
-
openResource
- Throws:
IOException
-
aes256cbc
public abstract byte[] aes256cbc(byte[] key, byte[] iv, byte[] data, boolean forEncryption) Encrypts or decrypts data using AES-256 in CBC mode with PKCS7 padding.- Parameters:
key
- A 32-byte key for AES-256iv
- A 16-byte initialization vectordata
- The data to encrypt or decryptforEncryption
- True for encryption, false for decryption- Returns:
- The encrypted or decrypted data
-
newAsyncExecutor(Object)
instead