From c46864a4559ea3096d080beed7315071e46875bc Mon Sep 17 00:00:00 2001 From: Martin Kobetic Date: Wed, 10 Aug 2022 15:56:14 -0400 Subject: [PATCH] fix: review --- go/message_api/v1/authn.pb.go | 212 +++++++++++++++---------------- proto/message_api/v1/authn.proto | 27 ++-- 2 files changed, 118 insertions(+), 121 deletions(-) diff --git a/go/message_api/v1/authn.pb.go b/go/message_api/v1/authn.pb.go index 56bc63da..6b862d63 100644 --- a/go/message_api/v1/authn.pb.go +++ b/go/message_api/v1/authn.pb.go @@ -97,7 +97,7 @@ type PublicKey struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CreatedNs uint64 `protobuf:"varint,1,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` + Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // signature is optional in the xmtp-js version // Types that are assignable to Union: // *PublicKey_Secp256K1Uncompressed @@ -136,9 +136,9 @@ func (*PublicKey) Descriptor() ([]byte, []int) { return file_message_api_v1_authn_proto_rawDescGZIP(), []int{1} } -func (x *PublicKey) GetCreatedNs() uint64 { +func (x *PublicKey) GetTimestamp() uint64 { if x != nil { - return x.CreatedNs + return x.Timestamp } return 0 } @@ -242,18 +242,24 @@ func (x *Token) GetAuthDataSignature() *Signature { return nil } -// ECDSA signature in its compact format -type Signature_ECDSACompact struct { +// AuthData carries token parameters that are authenticated +// by the identity key signature. +// It is embedded in the Token structure as bytes +// so that the bytes don't need to be reconstructed +// to verify the token signature. +type AuthData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` // compact representation [ R || S ], 64 bytes - Recovery uint32 `protobuf:"varint,2,opt,name=recovery,proto3" json:"recovery,omitempty"` // recovery bit + // address of the wallet + WalletAddr string `protobuf:"bytes,1,opt,name=wallet_addr,json=walletAddr,proto3" json:"wallet_addr,omitempty"` + // time when the token was generated/signed + CreatedNs uint64 `protobuf:"varint,2,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` } -func (x *Signature_ECDSACompact) Reset() { - *x = Signature_ECDSACompact{} +func (x *AuthData) Reset() { + *x = AuthData{} if protoimpl.UnsafeEnabled { mi := &file_message_api_v1_authn_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -261,13 +267,13 @@ func (x *Signature_ECDSACompact) Reset() { } } -func (x *Signature_ECDSACompact) String() string { +func (x *AuthData) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Signature_ECDSACompact) ProtoMessage() {} +func (*AuthData) ProtoMessage() {} -func (x *Signature_ECDSACompact) ProtoReflect() protoreflect.Message { +func (x *AuthData) ProtoReflect() protoreflect.Message { mi := &file_message_api_v1_authn_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -279,37 +285,37 @@ func (x *Signature_ECDSACompact) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Signature_ECDSACompact.ProtoReflect.Descriptor instead. -func (*Signature_ECDSACompact) Descriptor() ([]byte, []int) { - return file_message_api_v1_authn_proto_rawDescGZIP(), []int{0, 0} +// Deprecated: Use AuthData.ProtoReflect.Descriptor instead. +func (*AuthData) Descriptor() ([]byte, []int) { + return file_message_api_v1_authn_proto_rawDescGZIP(), []int{3} } -func (x *Signature_ECDSACompact) GetBytes() []byte { +func (x *AuthData) GetWalletAddr() string { if x != nil { - return x.Bytes + return x.WalletAddr } - return nil + return "" } -func (x *Signature_ECDSACompact) GetRecovery() uint32 { +func (x *AuthData) GetCreatedNs() uint64 { if x != nil { - return x.Recovery + return x.CreatedNs } return 0 } -// Secp256k1 public key in uncompressed point format. -type PublicKey_Secp256K1Uncompresed struct { +// ECDSA signature in its compact format +type Signature_ECDSACompact struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // uncompressed point with prefix (0x04) [ P || X || Y ], 65 bytes - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` + Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` // compact representation [ R || S ], 64 bytes + Recovery uint32 `protobuf:"varint,2,opt,name=recovery,proto3" json:"recovery,omitempty"` // recovery bit } -func (x *PublicKey_Secp256K1Uncompresed) Reset() { - *x = PublicKey_Secp256K1Uncompresed{} +func (x *Signature_ECDSACompact) Reset() { + *x = Signature_ECDSACompact{} if protoimpl.UnsafeEnabled { mi := &file_message_api_v1_authn_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -317,13 +323,13 @@ func (x *PublicKey_Secp256K1Uncompresed) Reset() { } } -func (x *PublicKey_Secp256K1Uncompresed) String() string { +func (x *Signature_ECDSACompact) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PublicKey_Secp256K1Uncompresed) ProtoMessage() {} +func (*Signature_ECDSACompact) ProtoMessage() {} -func (x *PublicKey_Secp256K1Uncompresed) ProtoReflect() protoreflect.Message { +func (x *Signature_ECDSACompact) ProtoReflect() protoreflect.Message { mi := &file_message_api_v1_authn_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -335,36 +341,37 @@ func (x *PublicKey_Secp256K1Uncompresed) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PublicKey_Secp256K1Uncompresed.ProtoReflect.Descriptor instead. -func (*PublicKey_Secp256K1Uncompresed) Descriptor() ([]byte, []int) { - return file_message_api_v1_authn_proto_rawDescGZIP(), []int{1, 0} +// Deprecated: Use Signature_ECDSACompact.ProtoReflect.Descriptor instead. +func (*Signature_ECDSACompact) Descriptor() ([]byte, []int) { + return file_message_api_v1_authn_proto_rawDescGZIP(), []int{0, 0} } -func (x *PublicKey_Secp256K1Uncompresed) GetBytes() []byte { +func (x *Signature_ECDSACompact) GetBytes() []byte { if x != nil { return x.Bytes } return nil } -// AuthData carries token parameters that are authenticated -// by the identity key signature. -// It is embedded in the Token structure as bytes -// so that the bytes don't need to be reconstructed -// to verify the token signature. -type Token_AuthData struct { +func (x *Signature_ECDSACompact) GetRecovery() uint32 { + if x != nil { + return x.Recovery + } + return 0 +} + +// Secp256k1 public key in uncompressed point format. +type PublicKey_Secp256K1Uncompresed struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // address of the wallet - WalletAddr string `protobuf:"bytes,1,opt,name=wallet_addr,json=walletAddr,proto3" json:"wallet_addr,omitempty"` - // time when the token was generated/signed - CreatedNs uint64 `protobuf:"varint,2,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` + // uncompressed point with prefix (0x04) [ P || X || Y ], 65 bytes + Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` } -func (x *Token_AuthData) Reset() { - *x = Token_AuthData{} +func (x *PublicKey_Secp256K1Uncompresed) Reset() { + *x = PublicKey_Secp256K1Uncompresed{} if protoimpl.UnsafeEnabled { mi := &file_message_api_v1_authn_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -372,13 +379,13 @@ func (x *Token_AuthData) Reset() { } } -func (x *Token_AuthData) String() string { +func (x *PublicKey_Secp256K1Uncompresed) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Token_AuthData) ProtoMessage() {} +func (*PublicKey_Secp256K1Uncompresed) ProtoMessage() {} -func (x *Token_AuthData) ProtoReflect() protoreflect.Message { +func (x *PublicKey_Secp256K1Uncompresed) ProtoReflect() protoreflect.Message { mi := &file_message_api_v1_authn_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -390,23 +397,16 @@ func (x *Token_AuthData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Token_AuthData.ProtoReflect.Descriptor instead. -func (*Token_AuthData) Descriptor() ([]byte, []int) { - return file_message_api_v1_authn_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *Token_AuthData) GetWalletAddr() string { - if x != nil { - return x.WalletAddr - } - return "" +// Deprecated: Use PublicKey_Secp256K1Uncompresed.ProtoReflect.Descriptor instead. +func (*PublicKey_Secp256K1Uncompresed) Descriptor() ([]byte, []int) { + return file_message_api_v1_authn_proto_rawDescGZIP(), []int{1, 0} } -func (x *Token_AuthData) GetCreatedNs() uint64 { +func (x *PublicKey_Secp256K1Uncompresed) GetBytes() []byte { if x != nil { - return x.CreatedNs + return x.Bytes } - return 0 + return nil } var File_message_api_v1_authn_proto protoreflect.FileDescriptor @@ -425,43 +425,43 @@ var file_message_api_v1_authn_proto_rawDesc = []byte{ 0x61, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x65, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x8d, - 0x02, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x6c, 0x0a, 0x16, 0x73, 0x65, 0x63, - 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0x5f, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x78, 0x6d, 0x74, 0x70, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, - 0x36, 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x64, 0x48, 0x00, - 0x52, 0x15, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x1a, 0x2c, 0x0a, 0x14, 0x53, 0x65, 0x63, 0x70, 0x32, - 0x35, 0x36, 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x62, 0x79, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x8e, - 0x02, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x41, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0b, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x61, - 0x75, 0x74, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x13, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x11, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x1f, 0x0a, 0x0b, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, - 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x42, - 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x76, 0x65, 0x72, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x8c, + 0x02, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x3c, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x6c, 0x0a, 0x16, 0x73, 0x65, 0x63, 0x70, + 0x32, 0x35, 0x36, 0x6b, 0x31, 0x5f, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, + 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x64, 0x48, 0x00, 0x52, + 0x15, 0x73, 0x65, 0x63, 0x70, 0x32, 0x35, 0x36, 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x1a, 0x2c, 0x0a, 0x14, 0x53, 0x65, 0x63, 0x70, 0x32, 0x35, + 0x36, 0x6b, 0x31, 0x55, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x65, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0xc2, 0x01, + 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x41, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x75, + 0x74, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x13, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x11, 0x61, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x22, 0x4a, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1f, + 0x0a, 0x0b, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x42, 0x12, + 0x5a, 0x10, 0x2e, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -481,14 +481,14 @@ var file_message_api_v1_authn_proto_goTypes = []interface{}{ (*Signature)(nil), // 0: xmtp.message_api.v1.Signature (*PublicKey)(nil), // 1: xmtp.message_api.v1.PublicKey (*Token)(nil), // 2: xmtp.message_api.v1.Token - (*Signature_ECDSACompact)(nil), // 3: xmtp.message_api.v1.Signature.ECDSACompact - (*PublicKey_Secp256K1Uncompresed)(nil), // 4: xmtp.message_api.v1.PublicKey.Secp256k1Uncompresed - (*Token_AuthData)(nil), // 5: xmtp.message_api.v1.Token.AuthData + (*AuthData)(nil), // 3: xmtp.message_api.v1.AuthData + (*Signature_ECDSACompact)(nil), // 4: xmtp.message_api.v1.Signature.ECDSACompact + (*PublicKey_Secp256K1Uncompresed)(nil), // 5: xmtp.message_api.v1.PublicKey.Secp256k1Uncompresed } var file_message_api_v1_authn_proto_depIdxs = []int32{ - 3, // 0: xmtp.message_api.v1.Signature.ecdsa_compact:type_name -> xmtp.message_api.v1.Signature.ECDSACompact + 4, // 0: xmtp.message_api.v1.Signature.ecdsa_compact:type_name -> xmtp.message_api.v1.Signature.ECDSACompact 0, // 1: xmtp.message_api.v1.PublicKey.signature:type_name -> xmtp.message_api.v1.Signature - 4, // 2: xmtp.message_api.v1.PublicKey.secp256k1_uncompressed:type_name -> xmtp.message_api.v1.PublicKey.Secp256k1Uncompresed + 5, // 2: xmtp.message_api.v1.PublicKey.secp256k1_uncompressed:type_name -> xmtp.message_api.v1.PublicKey.Secp256k1Uncompresed 1, // 3: xmtp.message_api.v1.Token.identity_key:type_name -> xmtp.message_api.v1.PublicKey 0, // 4: xmtp.message_api.v1.Token.auth_data_signature:type_name -> xmtp.message_api.v1.Signature 5, // [5:5] is the sub-list for method output_type @@ -541,7 +541,7 @@ func file_message_api_v1_authn_proto_init() { } } file_message_api_v1_authn_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Signature_ECDSACompact); i { + switch v := v.(*AuthData); i { case 0: return &v.state case 1: @@ -553,7 +553,7 @@ func file_message_api_v1_authn_proto_init() { } } file_message_api_v1_authn_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublicKey_Secp256K1Uncompresed); i { + switch v := v.(*Signature_ECDSACompact); i { case 0: return &v.state case 1: @@ -565,7 +565,7 @@ func file_message_api_v1_authn_proto_init() { } } file_message_api_v1_authn_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Token_AuthData); i { + switch v := v.(*PublicKey_Secp256K1Uncompresed); i { case 0: return &v.state case 1: diff --git a/proto/message_api/v1/authn.proto b/proto/message_api/v1/authn.proto index 07e62ba0..f0987fc2 100644 --- a/proto/message_api/v1/authn.proto +++ b/proto/message_api/v1/authn.proto @@ -27,7 +27,7 @@ message Signature { // PublicKey represents a generalized public key, // defined as a union to support cryptographic algorithm agility. message PublicKey { - uint64 created_ns = 1; + uint64 timestamp = 1; Signature signature = 2; // signature is optional in the xmtp-js version oneof union { Secp256k1Uncompresed secp256k1_uncompressed = 3; @@ -51,19 +51,16 @@ message Token { bytes auth_data_bytes = 2; // identity key signature of AuthData bytes Signature auth_data_signature = 3; - - // AuthData carries token parameters that are authenticated - // by the identity key signature. - // It is embedded in the Token structure as bytes - // so that the bytes don't need to be reconstructed - // to verify the token signature. - message AuthData { - // address of the wallet - string wallet_addr = 1; - // time when the token was generated/signed - uint64 created_ns = 2; - } } - - +// AuthData carries token parameters that are authenticated +// by the identity key signature. +// It is embedded in the Token structure as bytes +// so that the bytes don't need to be reconstructed +// to verify the token signature. +message AuthData { + // address of the wallet + string wallet_addr = 1; + // time when the token was generated/signed + uint64 created_ns = 2; +}