Skip to content

Commit 39f9ee6

Browse files
committed
Remove PinRequest redundant fields
1 parent 3ac0e88 commit 39f9ee6

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

library/src/main/kotlin/one/mixin/bot/vo/PinRequest.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ data class PinRequest(
66
val pin: String,
77
@SerializedName("old_pin")
88
val oldPin: String? = null,
9-
@SerializedName("salt_base64")
10-
var salt: String? = null,
11-
@SerializedName("old_salt_base64")
12-
var oldSalt: String? = null,
139
@SerializedName("timestamp")
1410
val timestamp: Long? = null,
1511
)

samples/src/main/java/jvmMain/java/SafeSample.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import kotlin.ExceptionsKt;
44
import kotlin.collections.CollectionsKt;
55
import one.mixin.bot.HttpClient;
6-
import one.mixin.bot.SessionKt;
76
import one.mixin.bot.api.MixinResponse;
87
import one.mixin.bot.extension.Base64ExtensionKt;
98
import one.mixin.bot.extension.ByteArrayExtensionKt;
@@ -77,7 +76,7 @@ private static void updateFromLegacyPin(HttpClient botClient) throws Exception {
7776

7877
// create user pin
7978
MixinResponse<User> response = userClient.getUserService().createPinCall(
80-
new PinRequest(encryptPin(userAesKey, userPin), null, null, null, null)
79+
new PinRequest(encryptPin(userAesKey, userPin), null, null)
8180
).execute().body();
8281
assert response != null;
8382
if (response.isSuccess()) {
@@ -87,7 +86,7 @@ private static void updateFromLegacyPin(HttpClient botClient) throws Exception {
8786
}
8887
// verify usr pin
8988
response = userClient.getUserService().pinVerifyCall(
90-
new PinRequest(encryptPin(userAesKey, userPin), null, null, null, null)
89+
new PinRequest(encryptPin(userAesKey, userPin), null, null)
9190
).execute().body();
9291
assert response != null;
9392
if (response.isSuccess()) {
@@ -103,7 +102,7 @@ private static void updateFromLegacyPin(HttpClient botClient) throws Exception {
103102
// verify tip pin
104103
long timestamp = TimeExtensionKt.nowInUtcNano();
105104
response = userClient.getUserService().pinVerifyCall(
106-
new PinRequest(encryptTipPin(userAesKey, TipBody.forVerify(timestamp), keyPair.getPrivateKey()), null, null, null, timestamp)
105+
new PinRequest(encryptTipPin(userAesKey, TipBody.forVerify(timestamp), keyPair.getPrivateKey()), null, timestamp)
107106
).execute().body();
108107
assert response != null;
109108
if (response.isSuccess()) {
@@ -141,7 +140,7 @@ private static Account createTipPin(HttpClient botClient) throws IOException, Ti
141140
MixinResponse<User> response = userClient.getUserService().createPinCall(
142141
new PinRequest(
143142
encryptPin(userAesKey, Bytes.concat(keyPair.getPublicKey(), ByteArrayUtilKt.toBeByteArray(1L))),
144-
null, null, null, null
143+
null, null
145144
)).execute().body();
146145
assert response != null;
147146
if (response.isSuccess()) {

samples/src/main/java/jvmMain/java/Sample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static String createAddress(HttpClient client, byte[] userAesKey) throws
126126
}
127127

128128
private static void pinVerifyCall(HttpClient client,byte[] userAesKey,String pin) throws IOException{
129-
MixinResponse<User> pinResponse = client.getUserService().pinVerifyCall(new PinRequest(Objects.requireNonNull(encryptPin(userAesKey, pin)), null, null, null, null)).execute().body();
129+
MixinResponse<User> pinResponse = client.getUserService().pinVerifyCall(new PinRequest(Objects.requireNonNull(encryptPin(userAesKey, pin)), null, null)).execute().body();
130130
if (pinResponse.isSuccess()) {
131131
System.out.printf("Pin verifyCall success %s%n", Objects.requireNonNull(pinResponse.getData()).getUserId());
132132
} else {
@@ -167,7 +167,7 @@ private static void searchUser(HttpClient client) throws IOException {
167167
}
168168

169169
static void createPin(HttpClient client, byte[] userAesKey) throws IOException {
170-
MixinResponse<User> pinResponse = client.getUserService().createPinCall(new PinRequest(Objects.requireNonNull(encryptPin(userAesKey, Sample.userPin)), null, null, null, null)).execute().body();
170+
MixinResponse<User> pinResponse = client.getUserService().createPinCall(new PinRequest(Objects.requireNonNull(encryptPin(userAesKey, Sample.userPin)), null, null)).execute().body();
171171
assert pinResponse != null;
172172
if (pinResponse.isSuccess()) {
173173
System.out.printf("Create pin success %s%n", Objects.requireNonNull(pinResponse.getData()).getUserId());

0 commit comments

Comments
 (0)