// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_HMAC_SHA512256 = "b2a31b8d4e01afcab2ee545b5caf4e3d212a99d7b3a116a97cec8e83c32e107d";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_KEY = "eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_MESSAGE = "8e993b9f48681273c29650ba32fc76ce48332ea7164d96a4476fb8c531a1186a" +
//         "c0dfc17c98dce87b4da7f011ec48c97271d2c20f9b928fe2270d6fb863d51738" +
//         "b48eeee314a7cc8ab932164548e526ae90224368517acfeabd6bb3732bc0e9da" +
//         "99832b61ca01b6de56244a9e88d5f9b37973f622a43d14a6599b1f654cb45a74" +
//         "e355a5";


import org.junit.Test;
import java.util.Arrays;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.abstractj.kalium.NaCl.Sodium.CRYPTO_AUTH_HMACSHA512256_KEYBYTES;
import static org.abstractj.kalium.encoders.Encoder.HEX;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_HMAC_SHA512256;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_KEY;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_MESSAGE;
import static org.junit.Assert.fail;
        byte[] key = new byte[CRYPTO_AUTH_HMACSHA512256_KEYBYTES + 1];
        new AuthenticationKey(key);
        fail("Should reject long keys");
    }

    @Test
    public void testSerializesToHex() throws Exception {
        try {
            AuthenticationKey key = new AuthenticationKey(AUTH_KEY, HEX);
            assertEquals("Correct auth key expected", AUTH_KEY, key.toString());
        } catch (Exception e) {
            fail("Should return a valid key size");
        }
    }

    @Test
    public void testSerializesToBytes() throws Exception {
        try {
            AuthenticationKey key = new AuthenticationKey(AUTH_KEY, HEX);
            assertTrue("Correct auth key expected", Arrays.equals(HEX.decode(AUTH_KEY), key.toBytes()));
        } catch (Exception e) {
            fail("Should return a valid key size");
        }
    }

    @Test
    public void testSignMessageAsBytes() throws Exception {
        byte[] rawKey = HEX.decode(AUTH_KEY);
        AuthenticationKey key = new AuthenticationKey(rawKey);
        byte[] mac = key.sign(HEX.decode(AUTH_MESSAGE));
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_HMAC_SHA512256 = "b2a31b8d4e01afcab2ee545b5caf4e3d212a99d7b3a116a97cec8e83c32e107d";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_KEY = "eea6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff880";
// 
// Path: src/test/java/org/abstractj/kalium/fixture/TestVectors.java
// public static final String AUTH_MESSAGE = "8e993b9f48681273c29650ba32fc76ce48332ea7164d96a4476fb8c531a1186a" +
//         "c0dfc17c98dce87b4da7f011ec48c97271d2c20f9b928fe2270d6fb863d51738" +
//         "b48eeee314a7cc8ab932164548e526ae90224368517acfeabd6bb3732bc0e9da" +
//         "99832b61ca01b6de56244a9e88d5f9b37973f622a43d14a6599b1f654cb45a74" +
//         "e355a5";


// Path: src/test/java/org/abstractj/kalium/keys/AuthenticationKeyTest.java
import org.junit.Test;
import java.util.Arrays;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.abstractj.kalium.NaCl.Sodium.CRYPTO_AUTH_HMACSHA512256_KEYBYTES;
import static org.abstractj.kalium.encoders.Encoder.HEX;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_HMAC_SHA512256;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_KEY;
import static org.abstractj.kalium.fixture.TestVectors.AUTH_MESSAGE;
import static org.junit.Assert.fail;

        byte[] key = new byte[CRYPTO_AUTH_HMACSHA512256_KEYBYTES + 1];
        new AuthenticationKey(key);
        fail("Should reject long keys");
    }

    @Test
    public void testSerializesToHex() throws Exception {
        try {
            AuthenticationKey key = new AuthenticationKey(AUTH_KEY, HEX);
            assertEquals("Correct auth key expected", AUTH_KEY, key.toString());
        } catch (Exception e) {
            fail("Should return a valid key size");
        }
    }

    @Test
    public void testSerializesToBytes() throws Exception {
        try {
            AuthenticationKey key = new AuthenticationKey(AUTH_KEY, HEX);
            assertTrue("Correct auth key expected", Arrays.equals(HEX.decode(AUTH_KEY), key.toBytes()));
        } catch (Exception e) {
            fail("Should return a valid key size");
        }
    }

    @Test
    public void testSignMessageAsBytes() throws Exception {
        byte[] rawKey = HEX.decode(AUTH_KEY);
        AuthenticationKey key = new AuthenticationKey(rawKey);
        byte[] mac = key.sign(HEX.decode(AUTH_MESSAGE));
        assertTrue("Message sign has failed", Arrays.equals(HEX.decode(AUTH_HMAC_SHA512256), mac));