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

In Push Component, return scope as part of the decrypt() JSON response #2045

Closed
jrconlin opened this issue Oct 25, 2019 · 6 comments
Closed

Comments

@jrconlin
Copy link
Contributor

jrconlin commented Oct 25, 2019

According to
Screen Shot 2019-10-25 at 1 19 27 PM

It's my understanding that since Scope is an identifier for service worker, (and since Push Component is not doing Delivery), decrypt should include the previously registered scope string as part of the response JSON. (Scope is a parameter of subscribe.

@jonalmeida can provide additional details if needed.

┆Issue is synchronized with this Jira Story

@jonalmeida
Copy link
Collaborator

Since scope is an identifier, we can be putting in multiple subscriptions with the same chid but different scopes, expecting separate subscriptions for each scope.

What I'm unsure about right now is if we should be using one chid for all GeckoView and multiple scopes, or just hashing the scope and using that as the chid? If the latter, then I guess we don't need scopes in the PushManager?

@jrconlin
Copy link
Contributor Author

A CHID is basically how to determine the recipient of a push message on a given device. If you're fine with one recipient for all GeckoView push messages and use some other mechanism (e.g. an identifier in the body of the push message) then you shouldn't need scopes. Complicating things is that "scope" isn't contained in the received Push Message, since it's not provided to the Push server and encoded into the endpoint, nor is the endpoint provided to the decrypt function.

So possible solutions might include:

  1. GeckoView creating a new subscription (new channelid + scope) per scope, in which case scope can be returned as part of the decrypt (this bug would cover a future PR to return a scope associated with a ChannelID as part of the decrypt response, who's return would also change.

  2. GeckoView providing scope as part of the subscription info block to the subscription provider which would encode scope in the push message content

  3. scope is incorporated into the endpoint information which may violate some privacy considerations and require work on the autopush server and push component.

@jonalmeida
Copy link
Collaborator

jonalmeida commented Oct 30, 2019

We spoke offline and reduced to a few points:

  • There's not much difference between calling subscribe(hash_of_scope_to_uuid) and subscribe(hash_of_scope_to_uuid, scope). The scope is just stored in the database and not retrieved.
  • What we can do as a client, is call subscribe(hash_of_scope_to_uuid, scope) and when we decrypt the message, return the SubscriptionResponse ([push] SubscriptionResponse needed when decrypting message #2047) and the scope together so that it can be passed on to GeckoView (which doesn't hold on the subscription info state).
  • The GeckoView API for delivering a message is here1.

@jrconlin
Copy link
Contributor Author

Digging around the code for PushManager, I found PushManager.dispatchInfoForChid which returns DispatchInfo{ uaid: String, scope: String}

This might be what you're looking for.

@rfk rfk added the 📣 Push label Oct 31, 2019
@data-sync-user
Copy link
Collaborator

➤ Janet Dragojevic commented:

endofyear cleanup: is this still an issue that needs to be addressed?

@jonalmeida
Copy link
Collaborator

No, I think we have what we need. Thanks Janet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants