Add a gRPC service for working with pre-keys

This commit is contained in:
Jon Chambers
2023-07-20 11:10:26 -04:00
committed by GitHub
parent 0188d314ce
commit 5627209fdd
24 changed files with 2112 additions and 23 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.util;
/**
* An abstract base class for runtime exceptions that do not include a stack trace. Stackless exceptions are generally
* intended for internal error-handling cases where the error will never be logged or otherwise reported.
*/
public abstract class NoStackTraceRuntimeException extends RuntimeException {
public NoStackTraceRuntimeException() {
super(null, null, true, false);
}
public NoStackTraceRuntimeException(final String message) {
super(message, null, true, false);
}
public NoStackTraceRuntimeException(final String message, final Throwable cause) {
super(message, cause, true, false);
}
public NoStackTraceRuntimeException(final Throwable cause) {
super(null, cause, true, false);
}
}

View File

@@ -5,6 +5,7 @@
package org.whispersystems.textsecuregcm.util;
import com.google.protobuf.ByteString;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.Optional;
@@ -27,6 +28,14 @@ public final class UUIDUtil {
return byteBuffer.flip();
}
public static ByteString toByteString(final UUID uuid) {
return ByteString.copyFrom(toByteBuffer(uuid));
}
public static UUID fromByteString(final ByteString byteString) {
return fromBytes(byteString.toByteArray());
}
public static UUID fromBytes(final byte[] bytes) {
return fromByteBuffer(ByteBuffer.wrap(bytes));
}