Commit 1723973d authored by ameba23's avatar ameba23
Browse files

allow either root id or secret owner pk in requests

parent fd1b53c7
......@@ -75,26 +75,39 @@ public final class RequestV1 {
com.google.protobuf.ByteString getRecipient();
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return Whether the root field is set.
*/
boolean hasRoot();
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return The root.
*/
com.google.protobuf.ByteString getRoot();
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes secretOwnerId = 6;</code>
* @return Whether the secretOwnerId field is set.
*/
boolean hasSecretOwnerId();
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return The secretOwnerId.
*/
com.google.protobuf.ByteString getSecretOwnerId();
/**
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return Whether the ephemeralPublicKey field is set.
*/
boolean hasEphemeralPublicKey();
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return The ephemeralPublicKey.
*/
com.google.protobuf.ByteString getEphemeralPublicKey();
public org.magmacollective.darkcrystal.keybackup.messageschemas.RequestV1.Request.SecretCase getSecretCase();
}
/**
* Protobuf type {@code org.magmacollective.darkcrystal.keybackup.messageschemas.Request}
......@@ -112,7 +125,6 @@ public final class RequestV1 {
type_ = "";
version_ = "";
recipient_ = com.google.protobuf.ByteString.EMPTY;
root_ = com.google.protobuf.ByteString.EMPTY;
ephemeralPublicKey_ = com.google.protobuf.ByteString.EMPTY;
}
......@@ -170,12 +182,17 @@ public final class RequestV1 {
break;
}
case 42: {
bitField0_ |= 0x00000010;
root_ = input.readBytes();
secretCase_ = 5;
secret_ = input.readBytes();
break;
}
case 50: {
bitField0_ |= 0x00000020;
secretCase_ = 6;
secret_ = input.readBytes();
break;
}
case 58: {
bitField0_ |= 0x00000040;
ephemeralPublicKey_ = input.readBytes();
break;
}
......@@ -212,6 +229,47 @@ public final class RequestV1 {
}
private int bitField0_;
private int secretCase_ = 0;
private java.lang.Object secret_;
public enum SecretCase
implements com.google.protobuf.Internal.EnumLite,
com.google.protobuf.AbstractMessage.InternalOneOfEnum {
ROOT(5),
SECRETOWNERID(6),
SECRET_NOT_SET(0);
private final int value;
private SecretCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static SecretCase valueOf(int value) {
return forNumber(value);
}
public static SecretCase forNumber(int value) {
switch (value) {
case 5: return ROOT;
case 6: return SECRETOWNERID;
case 0: return SECRET_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public SecretCase
getSecretCase() {
return SecretCase.forNumber(
secretCase_);
}
public static final int TYPE_FIELD_NUMBER = 1;
private volatile java.lang.Object type_;
/**
......@@ -337,33 +395,54 @@ public final class RequestV1 {
}
public static final int ROOT_FIELD_NUMBER = 5;
private com.google.protobuf.ByteString root_;
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return Whether the root field is set.
*/
public boolean hasRoot() {
return ((bitField0_ & 0x00000010) != 0);
return secretCase_ == 5;
}
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return The root.
*/
public com.google.protobuf.ByteString getRoot() {
return root_;
if (secretCase_ == 5) {
return (com.google.protobuf.ByteString) secret_;
}
return com.google.protobuf.ByteString.EMPTY;
}
public static final int SECRETOWNERID_FIELD_NUMBER = 6;
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return Whether the secretOwnerId field is set.
*/
public boolean hasSecretOwnerId() {
return secretCase_ == 6;
}
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return The secretOwnerId.
*/
public com.google.protobuf.ByteString getSecretOwnerId() {
if (secretCase_ == 6) {
return (com.google.protobuf.ByteString) secret_;
}
return com.google.protobuf.ByteString.EMPTY;
}
public static final int EPHEMERALPUBLICKEY_FIELD_NUMBER = 6;
public static final int EPHEMERALPUBLICKEY_FIELD_NUMBER = 7;
private com.google.protobuf.ByteString ephemeralPublicKey_;
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return Whether the ephemeralPublicKey field is set.
*/
public boolean hasEphemeralPublicKey() {
return ((bitField0_ & 0x00000020) != 0);
return ((bitField0_ & 0x00000040) != 0);
}
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return The ephemeralPublicKey.
*/
public com.google.protobuf.ByteString getEphemeralPublicKey() {
......@@ -393,10 +472,6 @@ public final class RequestV1 {
memoizedIsInitialized = 0;
return false;
}
if (!hasRoot()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
......@@ -416,11 +491,16 @@ public final class RequestV1 {
if (((bitField0_ & 0x00000008) != 0)) {
output.writeBytes(4, recipient_);
}
if (((bitField0_ & 0x00000010) != 0)) {
output.writeBytes(5, root_);
if (secretCase_ == 5) {
output.writeBytes(
5, (com.google.protobuf.ByteString) secret_);
}
if (secretCase_ == 6) {
output.writeBytes(
6, (com.google.protobuf.ByteString) secret_);
}
if (((bitField0_ & 0x00000020) != 0)) {
output.writeBytes(6, ephemeralPublicKey_);
if (((bitField0_ & 0x00000040) != 0)) {
output.writeBytes(7, ephemeralPublicKey_);
}
unknownFields.writeTo(output);
}
......@@ -445,13 +525,19 @@ public final class RequestV1 {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(4, recipient_);
}
if (((bitField0_ & 0x00000010) != 0)) {
if (secretCase_ == 5) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(
5, (com.google.protobuf.ByteString) secret_);
}
if (secretCase_ == 6) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(5, root_);
.computeBytesSize(
6, (com.google.protobuf.ByteString) secret_);
}
if (((bitField0_ & 0x00000020) != 0)) {
if (((bitField0_ & 0x00000040) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(6, ephemeralPublicKey_);
.computeBytesSize(7, ephemeralPublicKey_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
......@@ -488,16 +574,24 @@ public final class RequestV1 {
if (!getRecipient()
.equals(other.getRecipient())) return false;
}
if (hasRoot() != other.hasRoot()) return false;
if (hasRoot()) {
if (!getRoot()
.equals(other.getRoot())) return false;
}
if (hasEphemeralPublicKey() != other.hasEphemeralPublicKey()) return false;
if (hasEphemeralPublicKey()) {
if (!getEphemeralPublicKey()
.equals(other.getEphemeralPublicKey())) return false;
}
if (!getSecretCase().equals(other.getSecretCase())) return false;
switch (secretCase_) {
case 5:
if (!getRoot()
.equals(other.getRoot())) return false;
break;
case 6:
if (!getSecretOwnerId()
.equals(other.getSecretOwnerId())) return false;
break;
case 0:
default:
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
......@@ -526,14 +620,22 @@ public final class RequestV1 {
hash = (37 * hash) + RECIPIENT_FIELD_NUMBER;
hash = (53 * hash) + getRecipient().hashCode();
}
if (hasRoot()) {
hash = (37 * hash) + ROOT_FIELD_NUMBER;
hash = (53 * hash) + getRoot().hashCode();
}
if (hasEphemeralPublicKey()) {
hash = (37 * hash) + EPHEMERALPUBLICKEY_FIELD_NUMBER;
hash = (53 * hash) + getEphemeralPublicKey().hashCode();
}
switch (secretCase_) {
case 5:
hash = (37 * hash) + ROOT_FIELD_NUMBER;
hash = (53 * hash) + getRoot().hashCode();
break;
case 6:
hash = (37 * hash) + SECRETOWNERID_FIELD_NUMBER;
hash = (53 * hash) + getSecretOwnerId().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
......@@ -675,10 +777,10 @@ public final class RequestV1 {
bitField0_ = (bitField0_ & ~0x00000004);
recipient_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
root_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000010);
ephemeralPublicKey_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000020);
bitField0_ = (bitField0_ & ~0x00000040);
secretCase_ = 0;
secret_ = null;
return this;
}
......@@ -723,15 +825,18 @@ public final class RequestV1 {
to_bitField0_ |= 0x00000008;
}
result.recipient_ = recipient_;
if (((from_bitField0_ & 0x00000010) != 0)) {
to_bitField0_ |= 0x00000010;
if (secretCase_ == 5) {
result.secret_ = secret_;
}
if (secretCase_ == 6) {
result.secret_ = secret_;
}
result.root_ = root_;
if (((from_bitField0_ & 0x00000020) != 0)) {
to_bitField0_ |= 0x00000020;
if (((from_bitField0_ & 0x00000040) != 0)) {
to_bitField0_ |= 0x00000040;
}
result.ephemeralPublicKey_ = ephemeralPublicKey_;
result.bitField0_ = to_bitField0_;
result.secretCase_ = secretCase_;
onBuilt();
return result;
}
......@@ -796,12 +901,22 @@ public final class RequestV1 {
if (other.hasRecipient()) {
setRecipient(other.getRecipient());
}
if (other.hasRoot()) {
setRoot(other.getRoot());
}
if (other.hasEphemeralPublicKey()) {
setEphemeralPublicKey(other.getEphemeralPublicKey());
}
switch (other.getSecretCase()) {
case ROOT: {
setRoot(other.getRoot());
break;
}
case SECRETOWNERID: {
setSecretOwnerId(other.getSecretOwnerId());
break;
}
case SECRET_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
......@@ -821,9 +936,6 @@ public final class RequestV1 {
if (!hasRecipient()) {
return false;
}
if (!hasRoot()) {
return false;
}
return true;
}
......@@ -845,6 +957,21 @@ public final class RequestV1 {
}
return this;
}
private int secretCase_ = 0;
private java.lang.Object secret_;
public SecretCase
getSecretCase() {
return SecretCase.forNumber(
secretCase_);
}
public Builder clearSecret() {
secretCase_ = 0;
secret_ = null;
onChanged();
return this;
}
private int bitField0_;
private java.lang.Object type_ = "";
......@@ -1092,23 +1219,25 @@ public final class RequestV1 {
return this;
}
private com.google.protobuf.ByteString root_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return Whether the root field is set.
*/
public boolean hasRoot() {
return ((bitField0_ & 0x00000010) != 0);
return secretCase_ == 5;
}
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return The root.
*/
public com.google.protobuf.ByteString getRoot() {
return root_;
if (secretCase_ == 5) {
return (com.google.protobuf.ByteString) secret_;
}
return com.google.protobuf.ByteString.EMPTY;
}
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @param value The root to set.
* @return This builder for chaining.
*/
......@@ -1116,39 +1245,85 @@ public final class RequestV1 {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000010;
root_ = value;
secretCase_ = 5;
secret_ = value;
onChanged();
return this;
}
/**
* <code>required bytes root = 5;</code>
* <code>optional bytes root = 5;</code>
* @return This builder for chaining.
*/
public Builder clearRoot() {
bitField0_ = (bitField0_ & ~0x00000010);
root_ = getDefaultInstance().getRoot();
if (secretCase_ == 5) {
secretCase_ = 0;
secret_ = null;
onChanged();
}
return this;
}
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return Whether the secretOwnerId field is set.
*/
public boolean hasSecretOwnerId() {
return secretCase_ == 6;
}
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return The secretOwnerId.
*/
public com.google.protobuf.ByteString getSecretOwnerId() {
if (secretCase_ == 6) {
return (com.google.protobuf.ByteString) secret_;
}
return com.google.protobuf.ByteString.EMPTY;
}
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @param value The secretOwnerId to set.
* @return This builder for chaining.
*/
public Builder setSecretOwnerId(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
secretCase_ = 6;
secret_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes secretOwnerId = 6;</code>
* @return This builder for chaining.
*/
public Builder clearSecretOwnerId() {
if (secretCase_ == 6) {
secretCase_ = 0;
secret_ = null;
onChanged();
}
return this;
}
private com.google.protobuf.ByteString ephemeralPublicKey_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return Whether the ephemeralPublicKey field is set.
*/
public boolean hasEphemeralPublicKey() {
return ((bitField0_ & 0x00000020) != 0);
return ((bitField0_ & 0x00000040) != 0);
}
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return The ephemeralPublicKey.
*/
public com.google.protobuf.ByteString getEphemeralPublicKey() {
return ephemeralPublicKey_;
}
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @param value The ephemeralPublicKey to set.
* @return This builder for chaining.
*/
......@@ -1156,17 +1331,17 @@ public final class RequestV1 {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000020;
bitField0_ |= 0x00000040;
ephemeralPublicKey_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes ephemeralPublicKey = 6;</code>
* <code>optional bytes ephemeralPublicKey = 7;</code>
* @return This builder for chaining.
*/
public Builder clearEphemeralPublicKey() {
bitField0_ = (bitField0_ & ~0x00000020);
bitField0_ = (bitField0_ & ~0x00000040);
ephemeralPublicKey_ = getDefaultInstance().getEphemeralPublicKey();
onChanged();
return this;
......@@ -1239,10 +1414,11 @@ public final class RequestV1 {
static {
java.lang.String[] descriptorData = {
"\n\017requestV1.proto\0228org.magmacollective.d" +
"arkcrystal.keybackup.messageschemas\"x\n\007R" +
"equest\022\014\n\004type\030\001 \002(\t\022\017\n\007version\030\002 \002(\t\022\021\n" +
"\ttimestamp\030\003 \002(\006\022\021\n\trecipient\030\004 \002(\014\022\014\n\004r" +
"oot\030\005 \002(\014\022\032\n\022ephemeralPublicKey\030\006 \001(\014"
"arkcrystal.keybackup.messageschemas\"\235\001\n\007" +
"Request\022\014\n\004type\030\001 \002(\t\022\017\n\007version\030\002 \002(\t\022\021" +
"\n\ttimestamp\030\003 \002(\006\022\021\n\trecipient\030\004 \002(\014\022\016\n\004" +
"root\030\005 \001(\014H\000\022\027\n\rsecretOwnerId\030\006 \001(\014H\000\022\032\n" +
"\022ephemeralPublicKey\030\007 \001(\014B\010\n\006secret"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
......@@ -1253,7 +1429,7 @@ public final class RequestV1 {
internal_static_org_magmacollective_darkcrystal_keybackup_messageschemas_Request_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_org_magmacollective_darkcrystal_keybackup_messageschemas_Request_descriptor,
new java.lang.String[] { "Type", "Version", "Timestamp", "Recipient", "Root", "EphemeralPublicKey", });
new java.lang.String[] { "Type", "Version", "Timestamp", "Recipient", "Root", "SecretOwnerId", "EphemeralPublicKey", "Secret", });
}
// @@protoc_insertion_point(outer_class_scope)
......
......@@ -6,6 +6,9 @@ message Request {
required string version = 2;
required fixed64 timestamp = 3;
required bytes recipient = 4;
required bytes root = 5;
optional bytes ephemeralPublicKey = 6;
oneof secret {
bytes root = 5;
bytes secretOwnerId = 6;
}
optional bytes ephemeralPublicKey = 7;
}