-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add legacy credential type #425
Conversation
dev/gen_protos.sh
Outdated
@@ -6,7 +6,7 @@ if ! cargo install --list | grep "protoc-gen-prost-crate" > /dev/null; then | |||
fi | |||
fi | |||
|
|||
if ! buf generate https://github.com/xmtp/proto.git#branch=main,subdir=proto; then | |||
if ! buf generate https://github.com/xmtp/proto.git#branch=rich/legacy-keys-2,subdir=proto; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will switch back to main before merging
@@ -48,6 +48,7 @@ toml = "0.7.4" | |||
tracing = "0.1.37" | |||
xmtp_cryptography = { path = "../xmtp_cryptography" } | |||
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] } | |||
xmtp_v2 = { path = "../xmtp_v2" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think once we get to shaving fat off the WASM build we're going to want to extract the functions we need from this crate to avoid bloat. Or get really aggressive with features.
Problem for another day
pub(crate) account_address: Address, | ||
pub(crate) installation_public_key: Vec<u8>, | ||
pub(crate) created_ns: u64, | ||
iso8601_time: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need to store the iso8601 time on the struct. Seems like we can just generate it as-needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The act of getting the time from the created_ns
can produce an error, and it is better to validate the incoming data when creating the struct and allow callers to handle the error then and there, rather than when it is eventually used to produce text()
use xmtp_proto::xmtp::message_contents::SignedPublicKey as LegacySignedPublicKeyProto; | ||
|
||
#[tokio::test] | ||
async fn validate_good_key() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the hardcoded text fixtures. These are going to be helpful for catching regressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this is looking good
- 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
This adds the legacy credential type. Support for generating these credentials will be added in the next PR.
Because the protos have changed, some steps are required to avoid errors for those who already have libxmtp running:
./dev/down && ./dev/up
fromlibxmtp
. This rebuilds the validation service, and clears out any data stored on the server.