Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit c4fde73

Browse files
committed
Remove some unnecessary lines
1 parent 69eb01d commit c4fde73

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

blockstack-sdk/src/androidTest/java/org/blockstack/android/sdk/EncryptionColendiLibTest.kt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.json.JSONObject
1616
import org.junit.Rule
1717
import org.junit.Test
1818
import org.junit.runner.RunWith
19-
import org.komputing.khex.extensions.hexToByteArray
2019
import java.security.MessageDigest
2120

2221
private val PRIVATE_KEY = "a5c61c6ca7b3e7e55edee68566aeab22e4da26baa285c7bd10e8d2218aa3b229"
@@ -32,16 +31,13 @@ class EncryptionColendiLibTest {
3231
fun testEncryptDecryptWorks() {
3332
val encryption = Encryption()
3433

35-
val privateKey = "a5c61c6ca7b3e7e55edee68566aeab22e4da26baa285c7bd10e8d2218aa3b229"
36-
val publicKey = "027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69"
3734
val message = "Colendi"
3835

39-
40-
val encryptedResult = encryption.encryptWithPublicKey(message.toByteArray(), publicKey)
36+
val encryptedResult = encryption.encryptWithPublicKey(message.toByteArray(), PUBLIC_KEY)
4137

4238
val formData = EncryptedResultForm()
4339

44-
formData.privateKey = privateKey
40+
formData.privateKey = PRIVATE_KEY
4541
formData.ciphertext = encryptedResult.ciphertext
4642
formData.ephemPublicKey = encryptedResult.ephemPublicKey
4743
formData.iv = encryptedResult.iv
@@ -55,16 +51,13 @@ class EncryptionColendiLibTest {
5551
fun testEncryptColendiDescryptBlockstackJS() {
5652
val encryption = Encryption()
5753

58-
val privateKey = "a5c61c6ca7b3e7e55edee68566aeab22e4da26baa285c7bd10e8d2218aa3b229"
59-
val publicKey = "027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69"
6054
val message = "Colendi"
6155

62-
63-
val encryptedResult = encryption.encryptWithPublicKey(message.toByteArray(), publicKey)
56+
val encryptedResult = encryption.encryptWithPublicKey(message.toByteArray(), PUBLIC_KEY)
6457

6558
val result = Blockstack()
6659
.decryptContent(CipherObject(encryptedResult.iv, encryptedResult.ephemPublicKey, encryptedResult.ciphertext, encryptedResult.mac, true).json.toString(), false,
67-
CryptoOptions(publicKey, privateKey))
60+
CryptoOptions(PUBLIC_KEY, PRIVATE_KEY))
6861
assertThat(result.value as String, `is`(message))
6962

7063
}
@@ -74,11 +67,8 @@ class EncryptionColendiLibTest {
7467
fun testEncryptBlockstackJSDescryptColendi() {
7568
val encryption = Encryption()
7669

77-
val privateKey = "a5c61c6ca7b3e7e55edee68566aeab22e4da26baa285c7bd10e8d2218aa3b229"
78-
val publicKey = "027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69"
7970
val message = "all work and no play makes jack a dull boy"
8071

81-
8272
val cipherObject = JSONObject("{cipherText : \"c77fded9b2013ed08409b5f6a69f53e78d4ef0ec1cca6380d6b0aa8bd927c454135dd1a5c54adc0f3e0aa9748fec3fb5\",\n" +
8373
" ephemeralPK: \"02df2bc402b134631b2afaa31316392e3ded63728cd588e4f8bc152b39f8a6deb4\",\n" +
8474
" iv: \"f0f56df1978d5c5d65e8e5b3ff8ad1fc\",\n" +
@@ -88,18 +78,16 @@ class EncryptionColendiLibTest {
8878

8979
val encryptedResult = CipherObject(cipherObject)
9080

91-
val result = encryption.decryptWithPrivateKey(EncryptedResultForm(encryptedResult.ephemeralPK, encryptedResult.iv, encryptedResult.mac, encryptedResult.cipherText, privateKey))
81+
val result = encryption.decryptWithPrivateKey(EncryptedResultForm(encryptedResult.ephemeralPK, encryptedResult.iv, encryptedResult.mac, encryptedResult.cipherText, PRIVATE_KEY))
9282

9383
assertThat(String(result), `is`(message))
9484

9585
}
9686

9787
@Test
9888
fun testDecryptAes256CDReturnsCorrectValue() {
99-
val publicKey = "027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69"
100-
10189
val cipher = "c5a777b2daac1c7f50f2007af02f517d"
102-
val plainText = Encryption.decryptAES256CBC(cipher.hexToByteArray(), publicKey.slice(0..63), byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6))
90+
val plainText = Encryption.decryptAES256CBC(cipher.hexToByteArray(), PUBLIC_KEY.slice(0..63), byteArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6))
10391
assertThat(String(plainText), `is`("abc"))
10492

10593
}
@@ -125,6 +113,6 @@ class EncryptionColendiLibTest {
125113
}
126114

127115
companion object {
128-
val TAG = EncryptionColendiLibTest.javaClass.simpleName
116+
val TAG = EncryptionColendiLibTest::class.simpleName
129117
}
130118
}

blockstack-sdk/src/main/res/values/dimens.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)