-
Notifications
You must be signed in to change notification settings - Fork 16
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
🎫 DSAT-123 Workaround for policy update issues #91
Conversation
8d04dc7
to
cac44a2
Compare
@@ -404,8 +408,23 @@ const actions = { | |||
return { alert: value }; | |||
}, | |||
setPolicyId: (state, value) => { |
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.
Not necessary to change now but I'm starting to regret using value
for all our actions - it would probably be easier to follow with params like newPolicyId
etc.
src/scenes/Document/Document.js
Outdated
@@ -65,13 +65,17 @@ function Document({ | |||
|
|||
const encrypt = async () => { | |||
setEncryptState(ENCRYPT_STATES.PROTECTING); | |||
const cleanPolicy = policy | |||
.builder() | |||
.withPolicyId(null) |
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.
damn this feels so wrong
According to @jherwitz the better way to fix this issue is to build encrypt params with an empty policy, add the users, and THEN grab the policy id. See example: https://github.com/virtru/virtru-tdf3-js-integration/blob/master/tests/multi-user.js#L63 |
Looking at it further, why not just generate our own uuid? All it is doing is calling uuid.v4() when there isn't a policyId present already - which why would there be if there isn't a copy constructor? I'll do that |
Also includes a workaround for the 'policy must have an id' bug
07de2e7
to
d62603e
Compare
Okay I'm generating a |
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.
Approved to unblock testing - let's circle back later today and make sure we're not using undocumented APIs to do this, though.
policy.builder()
fails whenpolicy.id
is undefined, so always set it.