All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.api.util.ExpiringProfileCredentialUtil Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
package org.whispersystems.signalservice.api.util;

import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredential;

import java.time.temporal.ChronoField;
import java.util.concurrent.TimeUnit;

public final class ExpiringProfileCredentialUtil {

  private ExpiringProfileCredentialUtil() {}

  public static boolean isValid(ExpiringProfileKeyCredential credential) {
    if (credential == null) {
      return false;
    }

    long now = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
    long expires = credential.getExpirationTime().getLong(ChronoField.INSTANT_SECONDS);
    return now < expires;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy