package com.jackwink.libsodium;

/**
 * Created by jackwink on 2/16/15.
 */
import com.jackwink.libsodium.jni.Sodium;

public class NaCl {
    private static NaCl instance = null;

    protected NaCl() {
        // Exists to defeat instantiation and force the first created instance to call sodium_init
        if (Sodium.sodium_init() == -1) {
            throw new RuntimeException("Sodium could not be initialized.");
        }
    }

    public static NaCl getInstance() {
        if(instance == null) {
            instance = new NaCl();
        }
        return instance;
    }

    public static String sodium_version_string() {
        return Sodium.sodium_version_string();
    }


    public int sodium_init() {
        return Sodium.sodium_init();
    }


    public static int crypto_sign_keypair(byte[] pk, byte[] sk) {
        return Sodium.crypto_sign_keypair(pk, sk);
    }

    static {
        System.loadLibrary("sodiumjni");
    }
}

@@ -132,16 +132,121 @@
  NaCl %7B%0A
+    public static String sodium_version_string() %7B%0A        return Sodium.sodium_version_string();%0A    %7D%0A%0A
     priv
@@ -698,197 +698,8 @@
 lic 
-static String sodium_version_string() %7B%0A        return Sodium.sodium_version_string();%0A    %7D%0A%0A%0A    public int sodium_init() %7B%0A        return Sodium.sodium_init();%0A    %7D%0A%0A%0A    public static 
 int 

make method non-static