-
Notifications
You must be signed in to change notification settings - Fork 5
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
Payer API Refactor #223
Merged
Merged
Payer API Refactor #223
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Message API for XMTP V4 | ||
syntax = "proto3"; | ||
|
||
package xmtp.xmtpv4.envelopes; | ||
|
||
import "identity/associations/association.proto"; | ||
import "identity/associations/signature.proto"; | ||
import "mls/api/v1/mls.proto"; | ||
|
||
option go_package = "github.com/xmtp/proto/v3/go/xmtpv4/envelopes"; | ||
|
||
// The last seen entry per originator. Originators that have not been seen are omitted. | ||
// Entries MUST be sorted in ascending order, so that smaller node ID's appear first. | ||
message VectorClock { | ||
map<uint32, uint64> node_id_to_sequence_id = 1; | ||
} | ||
|
||
// Data visible to the server that has been authenticated by the client. | ||
message AuthenticatedData { | ||
uint32 target_originator = 1; | ||
bytes target_topic = 2; | ||
VectorClock last_seen = 3; | ||
} | ||
|
||
message ClientEnvelope { | ||
AuthenticatedData aad = 1; | ||
|
||
oneof payload { | ||
xmtp.mls.api.v1.GroupMessageInput group_message = 2; | ||
xmtp.mls.api.v1.WelcomeMessageInput welcome_message = 3; | ||
xmtp.mls.api.v1.UploadKeyPackageRequest upload_key_package = 4; | ||
xmtp.identity.associations.IdentityUpdate identity_update = 5; | ||
} | ||
} | ||
|
||
// Wraps client envelope with payer signature | ||
message PayerEnvelope { | ||
bytes unsigned_client_envelope = 1; // Protobuf serialized | ||
xmtp.identity.associations.RecoverableEcdsaSignature payer_signature = 2; | ||
} | ||
|
||
// For blockchain envelopes, the originator_sid is set by the smart contract, | ||
// but the originator_ns is set by the publishing node | ||
message UnsignedOriginatorEnvelope { | ||
uint32 originator_node_id = 1; | ||
uint64 originator_sequence_id = 2; | ||
int64 originator_ns = 3; | ||
PayerEnvelope payer_envelope = 4; | ||
} | ||
|
||
// An alternative to a signature for blockchain payloads | ||
message BlockchainProof { | ||
uint64 block_number = 1; | ||
uint32 publisher_node_id = 2; | ||
} | ||
|
||
// Signed originator envelope | ||
message OriginatorEnvelope { | ||
bytes unsigned_originator_envelope = 1; // Protobuf serialized | ||
oneof proof { | ||
xmtp.identity.associations.RecoverableEcdsaSignature originator_signature = 2; | ||
BlockchainProof blockchain_proof = 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Payer API | ||
syntax = "proto3"; | ||
|
||
package xmtp.xmtpv4.payer_api; | ||
|
||
import "google/api/annotations.proto"; | ||
import "xmtpv4/envelopes/envelopes.proto"; | ||
|
||
option go_package = "github.com/xmtp/proto/v3/go/xmtpv4/payer_api"; | ||
|
||
message PublishUnpaidEnvelopesRequest { | ||
repeated xmtp.xmtpv4.envelopes.ClientEnvelope envelopes = 1; | ||
} | ||
|
||
message PublishUnpaidEnvelopesResponse { | ||
repeated xmtp.xmtpv4.envelopes.OriginatorEnvelope originator_envelopes = 1; | ||
} | ||
|
||
// A narrowly scoped API for publishing messages through a payer | ||
service PayerApi { | ||
// Publish envelope | ||
rpc PublishUnpaidEnvelopes(PublishUnpaidEnvelopesRequest) returns (PublishUnpaidEnvelopesResponse) { | ||
option (google.api.http) = { | ||
post: "/mls/v2/payer/publish-envelopes" | ||
neekolas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
body: "*" | ||
}; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 didn't want to have two APIs named
PublishEnvelopes
that expect different request/response types. That feels like a footgun.This is the best name I could come up with.
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'm wondering if
PublishPayerEnvelopes
andPublishClientEnvelopes
would be more consistent?