token-import: add entrypoint for blank token setup flow
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.sufficientlysecure.keychain.securitytoken;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
@@ -12,6 +14,8 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
|
||||
@AutoValue
|
||||
public abstract class SecurityTokenInfo implements Parcelable {
|
||||
private static final byte[] EMPTY_ARRAY = new byte[20];
|
||||
|
||||
@Nullable
|
||||
public abstract byte[] getFingerprintSign();
|
||||
@Nullable
|
||||
@@ -36,7 +40,8 @@ public abstract class SecurityTokenInfo implements Parcelable {
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getFingerprintSign() == null && getFingerprintDecrypt() == null && getFingerprintAuth() == null;
|
||||
return Arrays.equals(EMPTY_ARRAY, getFingerprintSign()) && Arrays.equals(EMPTY_ARRAY, getFingerprintDecrypt()) &&
|
||||
Arrays.equals(EMPTY_ARRAY, getFingerprintAuth());
|
||||
}
|
||||
|
||||
public static SecurityTokenInfo create(byte[] fpSign, byte[] fpDecrypt, byte[] fpAuth,
|
||||
@@ -45,10 +50,6 @@ public abstract class SecurityTokenInfo implements Parcelable {
|
||||
userId, url, verifyRetries, verifyAdminRetries);
|
||||
}
|
||||
|
||||
public static SecurityTokenInfo createBlank(byte[] aid) {
|
||||
return new AutoValue_SecurityTokenInfo(null, null, null, aid, null, null, 0, 0);
|
||||
}
|
||||
|
||||
public static SecurityTokenInfo newInstanceDebugKeyserver() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
throw new UnsupportedOperationException("This operation is only available in debug builds!");
|
||||
|
||||
Reference in New Issue
Block a user