Skip to content

Commit

Permalink
Merge pull request #131 from xmtp/rich/legacy-keys-2
Browse files Browse the repository at this point in the history
- Add LegacyCreateIdentityAssociation
- Split out GrantMessagingAccessAssociation and RevokeMessagingAccessAssociation from Eip191Association - not all EIP191 associations will have the same data, and this allows for stronger type-checking
- Change time format from ISO8601 string to nanoseconds since epoch - this creates consistency with the old SignedPublicKey type. The ISO8601 string can be constructed at the time of generating the signature text.

Will land xmtp/libxmtp#425 immediately after this PR lands
  • Loading branch information
richardhuaaa committed Feb 2, 2024
2 parents 3d021f7 + bee1448 commit 1304edd
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 26 deletions.
2 changes: 1 addition & 1 deletion go/keystore_api/v1/keystore.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_api/v1/authn.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_api/v1/message_api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_api/v1/message_api_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/ciphertext.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/composite.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/contact.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/content.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/conversation_reference.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/invitation.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/private_key.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/public_key.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/message_contents/signature.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/mls/api/v1/mls.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/mls/api/v1/mls_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/mls_validation/v1/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/mls_validation/v1/service_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 26 additions & 5 deletions proto/mls/message_contents/association.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ syntax = "proto3";

package xmtp.mls.message_contents;

import "message_contents/public_key.proto";

option go_package = "github.com/xmtp/proto/v3/go/mls/message_contents";
option java_package = "org.xmtp.proto.mls.message.contents";

Expand All @@ -13,17 +15,36 @@ enum AssociationTextVersion {
ASSOCIATION_TEXT_VERSION_1 = 1;
}

// EIP191Association is used for all EIP 191 compliant wallet signatures
message Eip191Association {
// Used for "Grant Messaging Access" associations
message GrantMessagingAccessAssociation {
AssociationTextVersion association_text_version = 1;
RecoverableEcdsaSignature signature = 2;
RecoverableEcdsaSignature signature = 2; // EIP-191 signature
string account_address = 3;
string iso8601_time = 4;
uint64 created_ns = 4;
}

// Used for "Revoke Messaging Access" associations
message RevokeMessagingAccessAssociation {
AssociationTextVersion association_text_version = 1;
RecoverableEcdsaSignature signature = 2; // EIP-191 signature
string account_address = 3;
uint64 created_ns = 4;
}

// LegacyCreateIdentityAssociation is used when a v3 installation key
// is signed by a v2 identity key, which in turn is signed via a
// 'CreateIdentity' wallet signature
message LegacyCreateIdentityAssociation {
// Signs SHA-256 hash of installation key
RecoverableEcdsaSignature signature = 1;
// created_ns is encoded inside serialized key, account_address is recoverable
// from the SignedPublicKey signature
xmtp.message_contents.SignedPublicKey signed_legacy_create_identity_key = 2;
}

// RecoverableEcdsaSignature
message RecoverableEcdsaSignature {
// Includes recovery id as the last byte
// 65-bytes [ R || S || V ], with recovery id as the last byte
bytes bytes = 1;
}

Expand Down
12 changes: 9 additions & 3 deletions proto/mls/message_contents/credential.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ option java_package = "org.xmtp.proto.mls.message.contents";
message MlsCredential {
bytes installation_public_key = 1;
oneof association {
Eip191Association eip_191 = 2;
GrantMessagingAccessAssociation messaging_access = 2;
LegacyCreateIdentityAssociation legacy_create_identity = 3;
}
}

// A declaration and proof that a credential is no longer valid
message CredentialRevocation {
bytes installation_public_key = 1;
oneof public_key {
// The 'installation_public_key' field of the MlsCredential proto
bytes installation_key = 1;
// The 'key_bytes' field of the legacy SignedPublicKey proto
bytes unsigned_legacy_create_identity_key = 2;
}
oneof association {
Eip191Association eip_191 = 2;
RevokeMessagingAccessAssociation messaging_access = 3;
}
}

0 comments on commit 1304edd

Please sign in to comment.