Rewrite in-app-payment flows to prepare for backups support.

This commit is contained in:
Alex Hart
2024-04-19 17:04:15 -03:00
committed by Cody Henthorne
parent b36b00a11c
commit d719edf104
123 changed files with 5429 additions and 1586 deletions

View File

@@ -4,6 +4,7 @@ package org.whispersystems.signalservice.api.subscriptions;
import org.signal.core.util.Base64;
import org.whispersystems.signalservice.api.util.Preconditions;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Arrays;
@@ -30,6 +31,12 @@ public final class SubscriberId {
return Base64.encodeUrlSafeWithPadding(bytes);
}
public static @NonNull SubscriberId deserialize(@NonNull String serialized) throws IOException {
byte[] bytes = Base64.decode(serialized);
return fromBytes(bytes);
}
public static SubscriberId fromBytes(byte[] bytes) {
Preconditions.checkArgument(bytes.length == SIZE);
return new SubscriberId(bytes);