Java Code Examples for org.whispersystems.signalservice.api.util.UuidUtil#parse()

The following examples show how to use org.whispersystems.signalservice.api.util.UuidUtil#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PushServiceSocket.java    From libsignal-service-java with GNU General Public License v3.0 6 votes vote down vote up
public UUID verifyAccountCode(String verificationCode, String signalingKey, int registrationId, boolean fetchesMessages, String pin,
                              byte[] unidentifiedAccessKey, boolean unrestrictedUnidentifiedAccess)
    throws IOException
{
  AccountAttributes     signalingKeyEntity = new AccountAttributes(signalingKey, registrationId, fetchesMessages, pin, unidentifiedAccessKey, unrestrictedUnidentifiedAccess);
  String                requestBody        = JsonUtil.toJson(signalingKeyEntity);
  String                responseBody       = makeServiceRequest(String.format(VERIFY_ACCOUNT_CODE_PATH, verificationCode), "PUT", requestBody);
  VerifyAccountResponse response           = JsonUtil.fromJson(responseBody, VerifyAccountResponse.class);
  Optional<UUID>        uuid               = UuidUtil.parse(response.getUuid());

  if (uuid.isPresent()) {
    return uuid.get();
  } else {
    throw new IOException("Invalid UUID!");
  }
}
 
Example 2
Source File: PushServiceSocket.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public UUID getOwnUuid() throws IOException {
  String         body     = makeServiceRequest(WHO_AM_I, "GET", null);
  WhoAmIResponse response = JsonUtil.fromJson(body, WhoAmIResponse.class);
  Optional<UUID> uuid     = UuidUtil.parse(response.getUuid());

  if (uuid.isPresent()) {
    return uuid.get();
  } else {
    throw new IOException("Invalid UUID!");
  }
}
 
Example 3
Source File: PushServiceSocket.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
public UUID getOwnUuid() throws IOException {
  String         body     = makeServiceRequest(WHO_AM_I, "GET", null);
  WhoAmIResponse response = JsonUtil.fromJson(body, WhoAmIResponse.class);
  Optional<UUID> uuid     = UuidUtil.parse(response.getUuid());

  if (uuid.isPresent()) {
    return uuid.get();
  } else {
    throw new IOException("Invalid UUID!");
  }
}