Skip to content

Define behaviour when device secret is lost#1062

Merged
tbedford merged 3 commits into
mainfrom
update-device-id
Apr 12, 2021
Merged

Define behaviour when device secret is lost#1062
tbedford merged 3 commits into
mainfrom
update-device-id

Conversation

@cruickshankpg
Copy link
Copy Markdown
Contributor

@cruickshankpg cruickshankpg commented Mar 23, 2021

I've tried to tighten up the language around the device ID and secret to make it clear they are a pair.

@cruickshankpg cruickshankpg changed the title behaviour when device secret is lost Define behaviour when device secret is lost Mar 23, 2021
@mattheworiordan mattheworiordan temporarily deployed to ably-docs-pr-1062 March 23, 2021 18:07 Inactive
Copy link
Copy Markdown
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

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

See comment

***** @(RSH3a2a3)@ Otherwise, makes an asynchronous HTTP PUT request to @/push/deviceRegistrations/:deviceId@ using the local @DeviceDetails@ with the push details as body. When the registration validation request is complete, a @RegistrationSynced@ or @SyncRegistrationFailed@ event should be fired.
***** @(RSH3a2a4)@ Transitions to @WaitingForRegistrationSync@.
**** @(RSH3a2b)@ If the local device does not have @id@ and @deviceSecret@, both are generated locally. The @id@ must be a "ulid":https://github.com/ulid/spec or similar globally-unique identifier. The @deviceSecret@ must be created using secure random data with sufficient entropy to generate a digest of at least 32 bytes (eg using sha256) and encoding that digest with base64. The local @DeviceDetails@ is updated with the resulting @deviceId@ and @deviceSecret@.
**** @(RSH3a2b)@ If the local device does not have @id@ or @deviceSecret@, both are generated locally. The @id@ must be a "ulid":https://github.com/ulid/spec or similar globally-unique identifier. The @deviceSecret@ must be created using secure random data with sufficient entropy to generate a digest of at least 32 bytes (eg using sha256) and encoding that digest with base64. The local @DeviceDetails@ is updated with the resulting @deviceId@ and @deviceSecret@. If either the @id@ or the @deviceSecret@ is lost then a new pair must be created.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there needs to be an explicit statement in RSH8a, or in RSH8 as a separate requirement, stating that if during initialisation of the activation state machine the retrieval of existing LocalDevice details fails, then the machine should transition to NotActivated (which will result in new local device details being created on the next activation event).

@cruickshankpg cruickshankpg requested a review from paddybyers April 7, 2021 13:02
** @(RSH8g)@ Whenever any change arises of the push transport details for local device (eg an FCM registration token update triggered by the platform), a @GotPushDeviceDetails@ event is sent to "the state machine":#RSH3.
** @(RSH8h)@ If an attempt to obtain the push transport details for local device (eg an FCM registration token) fails, a @GettingPushDeviceDetailsFailed@ event containing the indicated error is sent to "the state machine":#RSH3.
** @(RSH8i)@ Each time the library is instanced, if the LocalDevice has push device details (eg an APNS deviceToken), and if the platform supports it, it must verify the validity of those details (eg by requesting a token from the platform and comparing that with the already-known token). If as a result there are updated details, then an update to the Ably server is triggered by sending a @GotPushDeviceDetails@ event to "the state machine":#RSH3.
** @(RSH8j)@ If during library initialisation the @LocalDevice@ @id@ or @deviceSecret@ attributes are not able to be loaded then the ActivationStateMachine machine should transition to the @NotActivated@ state. New @LocalDevice@ @id@ and @deviceSecret@ attributes should be generated on the next activation event.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

.... are not able to be loaded then those LocalDevice details must be discarded and the ...

Copy link
Copy Markdown
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

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

ok if you make the suggested change, thanks

@mattheworiordan mattheworiordan temporarily deployed to ably-docs-pr-1062 April 12, 2021 10:06 Inactive
@tbedford tbedford merged commit 81a24a2 into main Apr 12, 2021
@tbedford tbedford deleted the update-device-id branch April 12, 2021 13:23
lawrence-forooghian added a commit to ably/specification that referenced this pull request May 20, 2026
I didn't even know that this statement existed. Paul added it to RSH3a2b
in a6e9e18 but then added RSH8j in 17d4a2a a couple of weeks later, both
in the same PR [1]; the former seems to be a vaguer version of the
latter.

[1] ably/docs#1062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants