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

#37 Add ability to create users with needs rotation and rotate their key #39

Merged
merged 2 commits into from
Feb 25, 2020

Conversation

ernieturner
Copy link
Contributor

No description provided.

src/Constants.ts Outdated
@@ -39,6 +39,9 @@ export const ErrorCodes = {
USER_DEVICE_KEY_GENERATION_FAILURE: 207,
USER_DEVICE_LIST_REQUEST_FAILURE: 208,
USER_DEVICE_DELETE_REQUEST_FAILURE: 209,
USER_UPDATE_KEY_REQUEST_FAILURE: 210,
USER_PRIVATE_KEY_ROTATION_FAILURE: 211,
USER_CURRENT_GET_REQUEST_FAILURE: 212,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
USER_CURRENT_GET_REQUEST_FAILURE: 212,
USER_GET_CURRENT_REQUEST_FAILURE: 212,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually just removed this for now as we don't need it.

/**
* Augments the provided user private key and return both the augmented private key and the augmentation factor.
*/
const rotateUsersPrivateKey = (userPrivateKey: Buffer): Future<Error, {newPrivateKey: Buffer; augmentationFactor: Buffer}> => {
Copy link
Member

Choose a reason for hiding this comment

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

Should we export this too so they could use it without retry if desired?

Copy link
Member

Choose a reason for hiding this comment

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

I can't imagine a situation where you would never want to retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya, this method isn't exposed out to callers, it's all wrapped behind the key rotation call. Given the low likelihood of it actually failing I don't think it matters.

Copy link
Member

@coltfred coltfred left a comment

Choose a reason for hiding this comment

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

Looks good to me.

/**
* Augments the provided user private key and return both the augmented private key and the augmentation factor.
*/
const rotateUsersPrivateKey = (userPrivateKey: Buffer): Future<Error, {newPrivateKey: Buffer; augmentationFactor: Buffer}> => {
Copy link
Member

Choose a reason for hiding this comment

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

I can't imagine a situation where you would never want to retry.

@ernieturner ernieturner merged commit a2ee488 into keyRotation Feb 25, 2020
@ernieturner ernieturner deleted the userKeyRotation branch February 25, 2020 15:33
ernieturner pushed a commit that referenced this pull request Mar 4, 2020
* #37 Add ability to create users with needs rotation and rotate th… (#39)

* #37 Add ability to create users with needs rotation and rotate their key

* Remove unused error code

* #37 Add key rotation for groups and change init response to retur… (#40)

* #37 Add key rotation for groups and change init response to return info about current user for rotation purposes

* Expand details in comment

* Add missing test, bump up test coverage leniency for Recrypt tests
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

Successfully merging this pull request may close these issues.

None yet

3 participants