Skip to content
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

feat: add SubscribeAssociationChanges #238

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions proto/identity/api/v1/identity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ service IdentityApi {
body: "*"
};
}

// Subscribe to a stream of addresses associated and revoked from all inboxes on the network
rpc SubscribeAssociationChanges(SubscribeAssociationChangesRequest) returns (stream SubscribeAssociationChangesResponse) {
option (google.api.http) = {
post: "/identity/v1/subscribe-association-changes"
body: "*"
};
}
}

message VerifySmartContractWalletSignaturesRequest {
Expand Down Expand Up @@ -137,3 +145,27 @@ message GetInboxIdsResponse {

repeated Response responses = 1;
}

// Request to subscribe to association changes, triggered by Identity Updates
message SubscribeAssociationChangesRequest {}

message SubscribeAssociationChangesResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any world where this can just be a stream of identity updates, with the parsing of the stream done client-side? Would be simpler/more compatible with decentralization/requiring less server trust

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping in a decentralized world we can create a subgraph that does that aggregation by reading events from the blockchain and running our code. Then we can slice and dice the data any way we want.

But for now, it's a big ask for clients to run libxmtp from whatever language/framework they are using and correctly store previous association states and apply updates.

// A change in account_address -> inbox_id association
message AccountAddressAssociation {
string account_address = 1;
string inbox_id = 2;
}

// A revocation of an account_address -> inbox_id association
message AccountAddressRevocation {
string account_address = 1;
string inbox_id = 2;
}

uint64 timestamp_ns = 1;

oneof change {
AccountAddressAssociation account_address_association = 2;
AccountAddressRevocation account_address_revocation = 3;
}
}
Loading