Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private UserKeys recoverUserKeys(final Host bookmark, final UserDto me, final De
// Setup existing device with account key
final DeviceSetupCallback.AccountKeyAndDeviceName input = prompt.askForAccountKeyAndDeviceName(bookmark);
try {
final UserKeys userKeys = UserKeys.recoverWithAccountKey(me.getPrivateKey(), input.accountKey(),
final UserKeys userKeys = UserKeys.recoverWithAccountKey(me.getPrivateKeys(), input.accountKey(),
me.getEcdhPublicKey(), me.getEcdsaPublicKey());
this.uploadDeviceKeys(input.deviceName(), userKeys, deviceKeyPair);
return userKeys;
Expand Down Expand Up @@ -127,7 +127,7 @@ private void uploadDeviceKeys(final String deviceName, final UserKeys userKeys,
}

private static boolean validate(final UserDto me) {
return me.getEcdhPublicKey() != null && me.getPrivateKey() != null;
return me.getEcdhPublicKey() != null && me.getPrivateKeys() != null;
}

public static UserDto withCountsToUserDto(WithCounts withCounts) {
Expand Down
4 changes: 2 additions & 2 deletions hub/src/test/java/cloud/katta/core/UserKeysRecoveryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ void testFirstLoginAndUserKeyRecovery(final HubTestConfig hubTestConfig) throws
final UsersResourceApi usersApi = new UsersResourceApi(hubSession.getClient());
final UserDto me = usersApi.apiUsersMeGet(true, false);

final SecurityFailure exception = assertThrows(SecurityFailure.class, () -> UserKeys.recoverWithAccountKey(me.getPrivateKey(), new AlphanumericRandomStringService().random(), me.getEcdhPublicKey(), me.getEcdsaPublicKey()
final SecurityFailure exception = assertThrows(SecurityFailure.class, () -> UserKeys.recoverWithAccountKey(me.getPrivateKeys(), new AlphanumericRandomStringService().random(), me.getEcdhPublicKey(), me.getEcdsaPublicKey()
));
assertInstanceOf(JOSEException.class, exception.getCause());
assertInstanceOf(InvalidKeyException.class, exception.getCause().getCause());
assertNotNull(UserKeys.recoverWithAccountKey(me.getPrivateKey(), hubTestConfig.setup.userConfig.setupCode, me.getEcdhPublicKey(), me.getEcdsaPublicKey()
assertNotNull(UserKeys.recoverWithAccountKey(me.getPrivateKeys(), hubTestConfig.setup.userConfig.setupCode, me.getEcdhPublicKey(), me.getEcdsaPublicKey()
));
}
}
Loading