@Override
  public Mono<SetRegistrationRecoveryPasswordResponse> setRegistrationRecoveryPassword(final SetRegistrationRecoveryPasswordRequest request) {
    final AuthenticatedDevice authenticatedDevice = AuthenticationUtil.requireAuthenticatedDevice();

    if (request.getRegistrationRecoveryPassword().isEmpty()) {
      throw Status.INVALID_ARGUMENT
          .withDescription("Registration recovery password must not be empty")
          .asRuntimeException();
    }

    return Mono.fromFuture(() -> accountsManager.getByAccountIdentifierAsync(authenticatedDevice.accountIdentifier()))
        .map(maybeAccount -> maybeAccount.orElseThrow(Status.UNAUTHENTICATED::asRuntimeException))
        .flatMap(account -> Mono.fromFuture(() -> registrationRecoveryPasswordsManager.storeForCurrentNumber(account.getNumber(), request.getRegistrationRecoveryPassword().toByteArray())))
        .thenReturn(SetRegistrationRecoveryPasswordResponse.newBuilder().build());
  }
@Test
  void setRegistrationRecoveryPasswordMissingPassword() {
    //noinspection ResultOfMethodCallIgnored
    GrpcTestUtils.assertStatusException(Status.INVALID_ARGUMENT,
        () -> authenticatedServiceStub().setRegistrationRecoveryPassword(
            SetRegistrationRecoveryPasswordRequest.newBuilder().build()));
  }