test_class.file: kin-sdk/kin-base/src/test/java/kin/base/StrKeyTest.java
test_class.identifier: StrKeyTest
test_case.body: @Test()
      public void testDecodeInvalidVersionByte() {
          String address = "GCZHXL5HXQX5ABDM26LHYRCQZ5OJFHLOPLZX47WEBP3V2PF5AVFK2A5D";
          try {
              StrKey.decodeCheck(StrKey.VersionByte.SEED, address.toCharArray());
              fail();
          } catch (FormatException e) {
          }
      }
test_case.class_method_signature: StrKeyTest.testDecodeInvalidVersionByte()
test_case.full_signature: @Test() public void testDecodeInvalidVersionByte()
test_case.identifier: testDecodeInvalidVersionByte
test_case.invocations: decodeCheck toCharArray fail
test_case.modifiers: @Test() public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDecodeInvalidVersionByte()
focal_class.file: kin-sdk/kin-base/src/main/java/kin/base/StrKey.java
focal_class.identifier: StrKey
focal_class.class_method_signature: StrKey.encodeStellarAccountId(byte[] data)
focal_class.full_signature: public static String encodeStellarAccountId(byte[] data)
focal_class.identifier: encodeStellarAccountId
focal_class.modifiers: public static
focal_class.parameters: (byte[] data)
focal_class.return: String
focal_class.signature: String encodeStellarAccountId(byte[] data)
focal_class.class_method_signature: StrKey.decodeStellarAccountId(String data)
focal_class.full_signature: public static byte[] decodeStellarAccountId(String data)
focal_class.identifier: decodeStellarAccountId
focal_class.modifiers: public static
focal_class.parameters: (String data)
focal_class.return: byte[]
focal_class.signature: byte[] decodeStellarAccountId(String data)
focal_class.class_method_signature: StrKey.encodeStellarSecretSeed(byte[] data)
focal_class.full_signature: public static char[] encodeStellarSecretSeed(byte[] data)
focal_class.identifier: encodeStellarSecretSeed
focal_class.modifiers: public static
focal_class.parameters: (byte[] data)
focal_class.return: char[]
focal_class.signature: char[] encodeStellarSecretSeed(byte[] data)
focal_class.class_method_signature: StrKey.decodeStellarSecretSeed(char[] data)
focal_class.full_signature: public static byte[] decodeStellarSecretSeed(char[] data)
focal_class.identifier: decodeStellarSecretSeed
focal_class.modifiers: public static
focal_class.parameters: (char[] data)
focal_class.return: byte[]
focal_class.signature: byte[] decodeStellarSecretSeed(char[] data)
focal_class.class_method_signature: StrKey.encodePreAuthTx(byte[] data)
focal_class.full_signature: public static String encodePreAuthTx(byte[] data)
focal_class.identifier: encodePreAuthTx
focal_class.modifiers: public static
focal_class.parameters: (byte[] data)
focal_class.return: String
focal_class.signature: String encodePreAuthTx(byte[] data)
focal_class.class_method_signature: StrKey.decodePreAuthTx(String data)
focal_class.full_signature: public static byte[] decodePreAuthTx(String data)
focal_class.identifier: decodePreAuthTx
focal_class.modifiers: public static
focal_class.parameters: (String data)
focal_class.return: byte[]
focal_class.signature: byte[] decodePreAuthTx(String data)
focal_class.class_method_signature: StrKey.encodeSha256Hash(byte[] data)
focal_class.full_signature: public static String encodeSha256Hash(byte[] data)
focal_class.identifier: encodeSha256Hash
focal_class.modifiers: public static
focal_class.parameters: (byte[] data)
focal_class.return: String
focal_class.signature: String encodeSha256Hash(byte[] data)
focal_class.class_method_signature: StrKey.decodeSha256Hash(String data)
focal_class.full_signature: public static byte[] decodeSha256Hash(String data)
focal_class.identifier: decodeSha256Hash
focal_class.modifiers: public static
focal_class.parameters: (String data)
focal_class.return: byte[]
focal_class.signature: byte[] decodeSha256Hash(String data)
focal_class.class_method_signature: StrKey.encodeCheck(VersionByte versionByte, byte[] data)
focal_class.full_signature: protected static char[] encodeCheck(VersionByte versionByte, byte[] data)
focal_class.identifier: encodeCheck
focal_class.modifiers: protected static
focal_class.parameters: (VersionByte versionByte, byte[] data)
focal_class.return: char[]
focal_class.signature: char[] encodeCheck(VersionByte versionByte, byte[] data)
focal_class.class_method_signature: StrKey.decodeCheck(VersionByte versionByte, char[] encoded)
focal_class.full_signature: protected static byte[] decodeCheck(VersionByte versionByte, char[] encoded)
focal_class.identifier: decodeCheck
focal_class.modifiers: protected static
focal_class.parameters: (VersionByte versionByte, char[] encoded)
focal_class.return: byte[]
focal_class.signature: byte[] decodeCheck(VersionByte versionByte, char[] encoded)
focal_class.class_method_signature: StrKey.calculateChecksum(byte[] bytes)
focal_class.full_signature: protected static byte[] calculateChecksum(byte[] bytes)
focal_class.identifier: calculateChecksum
focal_class.modifiers: protected static
focal_class.parameters: (byte[] bytes)
focal_class.return: byte[]
focal_class.signature: byte[] calculateChecksum(byte[] bytes)
focal_method.body: protected static byte[] decodeCheck(VersionByte versionByte, char[] encoded) {
          byte[] bytes = new byte[encoded.length];
          for (int i = 0; i < encoded.length; i++) {
              if (encoded[i] > 127) {
                  throw new IllegalArgumentException("Illegal characters in encoded char array.");
              }
              bytes[i] = (byte) encoded[i];
          }
  
          Base32 base32Codec = new Base32();
          byte[] decoded = base32Codec.decode(bytes);
          byte decodedVersionByte = decoded[0];
          byte[] payload = Arrays.copyOfRange(decoded, 0, decoded.length - 2);
          byte[] data = Arrays.copyOfRange(payload, 1, payload.length);
          byte[] checksum = Arrays.copyOfRange(decoded, decoded.length - 2, decoded.length);
  
          if (decodedVersionByte != versionByte.getValue()) {
              throw new FormatException("Version byte is invalid");
          }
  
          byte[] expectedChecksum = StrKey.calculateChecksum(payload);
  
          if (!Arrays.equals(expectedChecksum, checksum)) {
              throw new FormatException("Checksum invalid");
          }
  
          if (VersionByte.SEED.getValue() == decodedVersionByte) {
              Arrays.fill(bytes, (byte) 0);
              Arrays.fill(decoded, (byte) 0);
              Arrays.fill(payload, (byte) 0);
          }
  
          return data;
      }
focal_method.class_method_signature: StrKey.decodeCheck(VersionByte versionByte, char[] encoded)
focal_method.full_signature: protected static byte[] decodeCheck(VersionByte versionByte, char[] encoded)
focal_method.identifier: decodeCheck
focal_method.invocations: decode copyOfRange copyOfRange copyOfRange getValue calculateChecksum equals getValue fill fill fill
focal_method.modifiers: protected static
focal_method.parameters: (VersionByte versionByte, char[] encoded)
focal_method.return: byte[]
focal_method.signature: byte[] decodeCheck(VersionByte versionByte, char[] encoded)