-
Notifications
You must be signed in to change notification settings - Fork 1
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
[TECH-676] Use properly LatestConfig to encrypt affidavit #217
[TECH-676] Use properly LatestConfig to encrypt affidavit #217
Conversation
@@ -272,7 +272,6 @@ export interface LatestConfig { | |||
items: LatestConfigItems | |||
receipt?: string | |||
affidavit?: AffidavitConfig | |||
castRequestItemAttachmentEncryptionKey?: string |
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.
This element is not available on the root object.
@@ -396,9 +396,9 @@ export class AVClient implements IAVClient { | |||
|
|||
let encryptedAffidavit; | |||
|
|||
if (affidavit && this.latestConfig && this.latestConfig.castRequestItemAttachmentEncryptionKey) { | |||
if (affidavit && this?.latestConfig?.items?.electionConfig?.content?.castRequestItemAttachmentEncryptionKey) { |
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.
Given we're using TypeScript, can we make these null
assertions at the Type level? (i.e., fail when parsing the API response)
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.
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.
Are you referring to add union types with null
possibility to these @av-lukas or you have something else in mind?
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.
I'm not sure how union types would be used here, but I'm referring to the fact that at this point in the lifecycle of the av_client, if the affidavit is present, then it also means that the client has been told to ask for one, via the configuration object. So, in that case, the castRequestItemAttachmentEncryptionKey
should always be present, and the null checks shouldn't be necessary. The class that wraps it should enforce it to be present when parsing the request.
No description provided.