Class NGEPlatform

java.lang.Object
org.ngengine.platform.NGEPlatform

public abstract class NGEPlatform extends Object
  • Constructor Details

    • NGEPlatform

      public NGEPlatform()
  • Method Details

    • set

      public static void set(NGEPlatform platform)
    • get

      public static NGEPlatform get()
    • setBrowserInterceptor

      public static void setBrowserInterceptor(BrowserInterceptor interceptor)
    • getBrowserInterceptor

      public static BrowserInterceptor getBrowserInterceptor()
    • setStoreInterceptor

      public static void setStoreInterceptor(VStoreInterceptor interceptor)
    • getStoreInterceptor

      public static VStoreInterceptor getStoreInterceptor()
    • generatePrivateKey

      public abstract byte[] generatePrivateKey()
    • genPubKey

      public abstract byte[] genPubKey(byte[] secKey)
    • toJSON

      public abstract String toJSON(Collection obj)
    • toJSON

      public abstract String toJSON(Map obj)
    • fromJSON

      public abstract <T> T fromJSON(String json, Class<T> claz)
    • secp256k1SharedSecret

      public abstract byte[] secp256k1SharedSecret(byte[] privKey, byte[] pubKey)
    • 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

      public abstract String base64encode(byte[] data)
    • base64decode

      public abstract byte[] base64decode(String data)
    • chacha20

      public abstract byte[] chacha20(byte[] key, byte[] nonce, byte[] data, boolean forEncryption)
    • newTransport

      public abstract WebsocketTransport newTransport()
    • newRTCTransport

      public abstract RTCTransport newRTCTransport(RTCSettings settings, String connId, Collection<String> stunServers)
    • sha256

      public abstract String sha256(String data)
    • sha256

      public abstract byte[] sha256(byte[] data)
    • sign

      public abstract String sign(String data, byte[] privKey) throws FailedToSignException
      Throws:
      FailedToSignException
    • verify

      public abstract boolean verify(String data, String sign, byte[] pubKey)
    • signAsync

      public abstract AsyncTask<String> signAsync(String data, byte[] privKey)
    • verifyAsync

      public abstract AsyncTask<Boolean> verifyAsync(String data, String sign, byte[] pubKey)
    • randomBytes

      public abstract byte[] randomBytes(int n)
    • newAsyncExecutor

      public final AsyncExecutor newAsyncExecutor()
    • newAsyncExecutor

      public abstract AsyncExecutor newAsyncExecutor(Object hint)
    • newRelayExecutor

      @Deprecated public final AsyncExecutor newRelayExecutor()
      Deprecated.
    • newSubscriptionExecutor

      @Deprecated public final AsyncExecutor newSubscriptionExecutor()
      Deprecated.
    • newSignerExecutor

      @Deprecated public final AsyncExecutor newSignerExecutor()
      Deprecated.
    • newPoolExecutor

      @Deprecated public final AsyncExecutor newPoolExecutor()
      Deprecated.
    • promisify

      public abstract <T> AsyncTask<T> promisify(BiConsumer<Consumer<T>,Consumer<Throwable>> func, AsyncExecutor executor)
    • wrapPromise

      public abstract <T> AsyncTask<T> wrapPromise(BiConsumer<Consumer<T>,Consumer<Throwable>> func)
    • awaitAll

      public abstract <T> AsyncTask<List<T>> awaitAll(List<AsyncTask<T>> promises)
    • awaitAllSettled

      public abstract <T> AsyncTask<List<AsyncTask<T>>> awaitAllSettled(List<AsyncTask<T>> promises)
    • getTimestampSeconds

      public abstract long getTimestampSeconds()
    • newConcurrentQueue

      public abstract <T> Queue<T> newConcurrentQueue(Class<T> claz)
    • httpGet

      public abstract AsyncTask<String> httpGet(String url, Duration timeout, Map<String,String> headers)
    • httpGetBytes

      public abstract AsyncTask<byte[]> httpGetBytes(String url, Duration timeout, Map<String,String> headers)
    • setClipboardContent

      public abstract void setClipboardContent(String data)
    • getClipboardContent

      public abstract String getClipboardContent()
    • openInWebBrowser

      public abstract void openInWebBrowser(String url)
    • 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

      public abstract String nfkc(String str)
    • getDataStore

      public abstract VStore getDataStore(String appName, String storeName)
    • getCacheStore

      public abstract VStore getCacheStore(String appName, String cacheName)
    • registerFinalizer

      public abstract Runnable registerFinalizer(Object obj, Runnable finalizer)
    • isLoopbackAddress

      public boolean isLoopbackAddress(URI uri)
      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

      public abstract InputStream openResource(String resourceName) throws IOException
      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-256
      iv - A 16-byte initialization vector
      data - The data to encrypt or decrypt
      forEncryption - True for encryption, false for decryption
      Returns:
      The encrypted or decrypted data