Skip to content

Instantly share code, notes, and snippets.

@transducer
Created June 4, 2018 16:41
Show Gist options
  • Save transducer/0ddc1e126bc65b7f0f97bf9d50a93afa to your computer and use it in GitHub Desktop.
Save transducer/0ddc1e126bc65b7f0f97bf9d50a93afa to your computer and use it in GitHub Desktop.
Process an authorization revoked message
/**
* Process MAM message revoked: authorization
* @param message {Object} MAM message of type {@link AUTHORIZATION_REVOKED_TYPE}.
* @returns {undefined}
*/
processAuthorizationRevokedMessage(message) {
const newSideKey = DeviceClient.createSideKey();
this.authorizedServiceProviders.remove(message.policy.serviceProvider);
this.informUpdateSideKey(
this.authorizedServiceProviders.getAll(),
newSideKey,
)
.then(() => this.mam.changeSideKey(newSideKey))
.catch(err => logger.error(`processAuthorizationRevokedMessage failed: ${err}`));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment