Skip to content

Commit f983ea9

Browse files
committed
Repackage to client.impl
1 parent 4556341 commit f983ea9

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
id 'signing'
1212
}
1313

14-
def jarVersion = "1.1.1"
14+
def jarVersion = "1.5.0"
1515
group = 'io.nats'
1616

1717
def isMerge = System.getenv("BUILD_EVENT") == "push"

src/main/java/io/nats/nkeys/Common.java renamed to src/main/java/io/nats/client/impl/Common.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
package io.nats.nkeys;
14+
package io.nats.client.impl;
1515

1616
import net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec;
1717
import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;

src/main/java/io/nats/nkeys/DecodedSeed.java renamed to src/main/java/io/nats/client/impl/DecodedSeed.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
package io.nats.nkeys;
14+
package io.nats.client.impl;
1515

1616
class DecodedSeed {
1717
public final int prefix;

src/main/java/io/nats/nkeys/NKey.java renamed to src/main/java/io/nats/client/impl/NKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
package io.nats.nkeys;
14+
package io.nats.client.impl;
1515

1616
import net.i2p.crypto.eddsa.EdDSAEngine;
1717
import net.i2p.crypto.eddsa.EdDSAPrivateKey;

src/main/java/io/nats/nkeys/NKeyType.java renamed to src/main/java/io/nats/client/impl/NKeyType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
package io.nats.nkeys;
14+
package io.nats.client.impl;
1515

1616
/**
1717
* NKeys use a prefix byte to indicate their intended owner: 'N' = server, 'C' =

src/test/java/io/nats/nkeys/NKeyTests.java renamed to src/test/java/io/nats/client/impl/NKeyTests.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
package io.nats.nkeys;
14+
package io.nats.client.impl;
1515

1616
import io.ResourceUtils;
1717
import org.junit.jupiter.api.Test;
@@ -22,8 +22,6 @@
2222
import java.util.Base64;
2323
import java.util.List;
2424

25-
import static io.nats.nkeys.Common.*;
26-
import static io.nats.nkeys.NKey.removePaddingAndClear;
2725
import static org.junit.jupiter.api.Assertions.*;
2826

2927
public class NKeyTests {
@@ -61,7 +59,7 @@ public void testCRC16() {
6159
for (int i = 0; i < inputs.length; i++) {
6260
byte[] input = inputs[i];
6361
int crc = expected[i];
64-
int actual = crc16(input);
62+
int actual = Common.crc16(input);
6563
assertEquals(crc, actual, String.format("CRC for \"%s\", should be 0x%08X but was 0x%08X", Arrays.toString(input), crc, actual));
6664
}
6765
}
@@ -72,16 +70,16 @@ public void testBase32() {
7270

7371
for (String expected : inputs) {
7472
byte[] bytes = expected.getBytes(StandardCharsets.UTF_8);
75-
char[] encoded = base32Encode(bytes);
76-
byte[] decoded = base32Decode(encoded);
73+
char[] encoded = Common.base32Encode(bytes);
74+
byte[] decoded = Common.base32Decode(encoded);
7775
String test = new String(decoded, StandardCharsets.UTF_8);
7876
assertEquals(test, expected);
7977
}
8078

8179
// bad input for coverage
82-
byte[] decoded = base32Decode("/".toCharArray());
80+
byte[] decoded = Common.base32Decode("/".toCharArray());
8381
assertEquals(0, decoded.length);
84-
decoded = base32Decode(Character.toChars(512));
82+
decoded = Common.base32Decode(Character.toChars(512));
8583
assertEquals(0, decoded.length);
8684
}
8785

@@ -553,24 +551,24 @@ public void testInterop() throws Exception {
553551

554552
@Test
555553
public void testTypeEnum() {
556-
assertEquals(NKeyType.USER, NKeyType.fromPrefix(PREFIX_BYTE_USER));
557-
assertEquals(NKeyType.ACCOUNT, NKeyType.fromPrefix(PREFIX_BYTE_ACCOUNT));
558-
assertEquals(NKeyType.SERVER, NKeyType.fromPrefix(PREFIX_BYTE_SERVER));
559-
assertEquals(NKeyType.OPERATOR, NKeyType.fromPrefix(PREFIX_BYTE_OPERATOR));
560-
assertEquals(NKeyType.CLUSTER, NKeyType.fromPrefix(PREFIX_BYTE_CLUSTER));
561-
assertEquals(NKeyType.ACCOUNT, NKeyType.fromPrefix(PREFIX_BYTE_PRIVATE));
554+
assertEquals(NKeyType.USER, NKeyType.fromPrefix(Common.PREFIX_BYTE_USER));
555+
assertEquals(NKeyType.ACCOUNT, NKeyType.fromPrefix(Common.PREFIX_BYTE_ACCOUNT));
556+
assertEquals(NKeyType.SERVER, NKeyType.fromPrefix(Common.PREFIX_BYTE_SERVER));
557+
assertEquals(NKeyType.OPERATOR, NKeyType.fromPrefix(Common.PREFIX_BYTE_OPERATOR));
558+
assertEquals(NKeyType.CLUSTER, NKeyType.fromPrefix(Common.PREFIX_BYTE_CLUSTER));
559+
assertEquals(NKeyType.ACCOUNT, NKeyType.fromPrefix(Common.PREFIX_BYTE_PRIVATE));
562560
assertThrows(IllegalArgumentException.class, () -> { NKeyType ignored = NKeyType.fromPrefix(9999); });
563561
}
564562

565563
@Test
566564
public void testRemovePaddingAndClear() {
567565
char[] withPad = "!".toCharArray();
568-
char[] removed = removePaddingAndClear(withPad);
566+
char[] removed = NKey.removePaddingAndClear(withPad);
569567
assertEquals(withPad.length, removed.length);
570568
assertEquals('!', removed[0]);
571569

572570
withPad = "a=".toCharArray();
573-
removed = removePaddingAndClear(withPad);
571+
removed = NKey.removePaddingAndClear(withPad);
574572
assertEquals(1, removed.length);
575573
assertEquals('a', removed[0]);
576574
}

0 commit comments

Comments
 (0)