Skip to content

Add document escrow fields to Attempts API (LG-8057)#7381

Merged
matthinz merged 20 commits intomainfrom
matthinz/8057-attempts-api-uploads
Nov 25, 2022
Merged

Add document escrow fields to Attempts API (LG-8057)#7381
matthinz merged 20 commits intomainfrom
matthinz/8057-attempts-api-uploads

Conversation

@matthinz
Copy link
Contributor

@matthinz matthinz commented Nov 22, 2022

🎫 Ticket

LG-8057

🛠 Summary of changes

#7351 previously added encrypted document escrow support.

This PR updates the idv_document_upload_submitted event in the IRS attempts API to include the following keys (when document escrow is enabled):

Key Description
document_front_image_filename S3 filename (composed of a UUID + extension) for the image of the front of the document.
document_back_image_filename S3 filename (composed of a UUID + extension) for the image of the back of the document.
document_image_encryption_key Base64-encoded key used to encrypt the image data written to S3.

@matthinz matthinz requested a review from a team November 22, 2022 00:19
@zachmargolis zachmargolis requested a review from a team November 22, 2022 00:26
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@solipet solipet left a comment

Choose a reason for hiding this comment

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

A few comments to consider, but looks great!

matthinz and others added 11 commits November 22, 2022 11:09
changelog: Improvements, IRS Attempts API, Add document escrow fields to IRS attempts API
Write documents to encrypted storage and read them back
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Clarify that these args hold UUIDs identifying the front/back images
@matthinz matthinz force-pushed the matthinz/8057-attempts-api-uploads branch from d6bbdb7 to 0a544bd Compare November 22, 2022 19:21
@matthinz
Copy link
Contributor Author

@zachmargolis & @18F/identity-agnes: We had a late-breaking requirements change here, reducing the document escrow fields in the attempts API from 6 to 3. The big changes are:

  • content_type will now be inferred from the extension added to the S3 key for the image (e.g. ".jpeg" for `image/jpeg)
  • There's now only one encryption key field (we'd previously left the door open for using separate keys for front/back.

LMK if you need any more context!

@matthinz matthinz requested review from a team, solipet and zachmargolis November 23, 2022 19:02
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM!

end

context 'nonsense' do
let(:content_type) { 'yabba/dabbadoo' }
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@solipet solipet 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. One comment you can take or leave.


context 'jpeg' do
let(:content_type) { 'image/jpeg' }
it { should eql('.jpeg') }
Copy link
Contributor

Choose a reason for hiding this comment

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

These obviously work, but are written in the older "should" syntax. The more modern format used throughout login would be the "expect" syntax, e.g.,

it 'has the correct extension' do
  expect(subject).to eq('.jpeg')
end

matthinz and others added 2 commits November 25, 2022 09:53
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@matthinz matthinz merged commit 0e16a62 into main Nov 25, 2022
@matthinz matthinz deleted the matthinz/8057-attempts-api-uploads branch November 25, 2022 18:49
mdiarra3 pushed a commit that referenced this pull request Nov 28, 2022
* Add content_type to DataUrlImage

* First pass at wiring doc upload into attempts API

changelog: Improvements, IRS Attempts API, Add document escrow fields to IRS attempts API

* Additional tests

* WIP

* Update form test to roundtrip documents

Write documents to encrypted storage and read them back

* Use front_image & back_image lets for tests

* Update ImageUploadsController spec

* Test Attempts API includes images on  validation failure

* Update app/forms/idv/api_image_upload_form.rb

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

* Update app/services/encrypted_document_storage/local_storage.rb

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

* Update *_image -> *_image_uuid

Clarify that these args hold UUIDs identifying the front/back images

* Use let() for regexes in tests

avoid polluting global namespace

* Add doc escrow parameter descriptions

* Minimize unnecessary verbosity

* Lint issues

* Reduce number of document escrow fields

50% off!

* add "filename" to fields

try and make it clearer what these things are

* Remove empty test

whoops

* Update app/services/encrypted_document_storage/document_writer.rb

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

* Update spec from `should` to `is_expected.to`

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
This was referenced Nov 29, 2022
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.

3 participants