This repository has been archived by the owner on Feb 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
Add metadata_only flag to GET /v1/credentials/<ID> #274
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irhkang
commented
Mar 19, 2020
permissions['get'] = True | ||
include_credential_pairs = True | ||
|
||
if settings.ENABLE_SAVE_LAST_DECRYPTION_TIME: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this opt in - the setting defaults to false
irhkang
commented
Mar 19, 2020
@@ -184,11 +184,11 @@ def next_rotation_date(self): | |||
# If a credential has never been rotated or been decrypted, | |||
# immediately rotate | |||
if self.last_rotation_date is None: | |||
return datetime.utcnow() | |||
return datetime.now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now() has the timezone so we don't do subtraction between tz aware and tz unaware datetimes
skiptomyliu
previously approved these changes
Mar 19, 2020
skiptomyliu
reviewed
Mar 19, 2020
CHANGELOG.md
Outdated
`metadata_only` defaults to `false` so that it is backwards compatible. The purpose of this | ||
is to give users finer controls when deciding whether to send back `credential_pairs`. | ||
* Automatically update the `last_decrypted_date` on a credential when the `credential_pairs` are | ||
sent back to the client. Sending a credential_pair to the client implies that a credential has been |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit minor formatting: "credential pair" or credential_pair
skiptomyliu
approved these changes
Mar 19, 2020
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does 2 things.
Add a metadata_only flag to GET /v1/credentials/. This provides more granular controls for fetching a credential. One benefit this has is that it's very easy to tell when a credential_pair is sent in the response (when metadata_only=False). This gives us an easier way to see when a credential was last decrypted
Update the credential's last decrypted time if the credential_pairs was sent in the response. NOTE: this is opt in - there is a env variable that must be set for the save to occur. We make this opt in to not disturb existing users