org.whispersystems.signalservice.api.util.ExpiringProfileCredentialUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java, unofficial fork
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;
}
}