Skip to content

Resources

Jared Krajewski edited this page Oct 4, 2023 · 1 revision

Links to community forums or chat channels

  • Connect with the PASS team

    CODE PDX

    • Organization's main website

    Google Meet

    • Used for meetings

    Discord

    • Used for text and voice communication
      • Join our Discord link If you run into any issues, email our CodeForPDX brigade leader, Hugh: Hugh@codeforpdx.org or join the discord and drop a message in introductions or general-chat.
      • Post your GitHub name in the #github-access-request channel and we’ll add you to our GitHub. We keep track of technical and non-technical tasks in GitHub Projects.
      • Introduce yourself and post your email in the PASS channel so we can add you to our Google Drive. You can also request access privately from Flo -- florian@codeforpdx.org.
      • Pass is composed of three teams: UX/UI, Project Management, and Developers (back and front end). We are currently meeting in separate groups based on team member availability. The development team meets virtually every Tuesday at 7pm via Google Meet. Bi-weekly in person full group meetings are also back in session!!(details in discord).

    CODE PDX LinkedIn page

    • Used for main social media page

APIs and Libraries used by PASS

Inrupt Api's

ZXing Barcode Scanner

  • Background: PASS uses ZXing barcode scanner library to decode PDF417 barcodes from a drivers license along with inrupt functionally to obtain encoded data and parse it into a TTL file. This feature is not very robust and requires a clear and high quality barcode image.

  • Using barcode scanner feature: Within the PASS upload documents section under the input drop down menu, select the document type "Driver's License". Under file upload select a drivers license with a clearly visible barcode (at the state the image may require cropping) and click on the upload file button.

  • Viewing results: On the Solid Client Server, navigate below to the Search Document section. There you will find a form drop down titled Select Document Type. Select the Driver's License option and once selected, click on the Get Document button. A url should appear within this section of the page. Click on that link and a new tab will open which will present you with an interface for the Solid Pod. Here you will find icons that will navigate you to the scanned barcode image as well as the .ttl file containing the scanned data from the Driver's License barcode.

  • Location of code: found within the UploadDocumentModal.jsx component within the src/components directory:

src/components/Modals/UploadDocumentModal.jsx

the line specific to uploading files can be found within the handler function within the UploadDocumentModal component, where the entry point of what happens when the user clicks on the "Upload file", as this triggers the handleFormSubmission function. This function in turn calls the makeHandleFormSubmission function found within the utils directory, where the majority of the barcode scanner logic lives:

src/utils/frontend/FormSubmissionHelper.js

This function handles a good deal of logic for submitting a wide variety of forms to the Solid Server, including parsing the fileObject passed based off the event, and most importantly uploading the document, specifically by calling the uploadDocument() function defined in session-core. Going to the definition of this function leads us to:

src/utils/network/session-core.js

The uploadDocument() contains a great deal of logic specific to solid and we start to see a good deal of functions coming from the @inrupt/solid-client libraries. Of particular interest to the subject of this document is the createResourceTtlFile() function defined within:

src/utils/network/session-helper.js

There we see the logic specific to @inrupt/solid-client, which takes our fileObject and documentUrl and builds a generic .ttl file to be sent to the Solid server. Specific to the barcode scanner is the if statement which checks to see if the user has selected the "Driver's License" document from the "File to upload:" in the UploadDocumentModal.jsx component. Upon inspection of this if statement, we see that if the user has selected "Driver's License", the function returns the value of a separate helper function called createDriversLicenseTtlFile(). This lengthy function is very similar to the createResourceTtlFile() function, but starts itself with a helper function of its own called getDriversLicenseData, which takes the fileObject.file as an argument. This helper function is defined in:

src/utils/barcode/barcode-scan.js

Initially the readImageFile() function is called, which takes the file passed to it and returns the raw base64 image data within a JavaScript object. This image data is then decoded using the @zxing-browser library, specifically using their PDF417 reader to decode the barcode. The results are then returned in a simple csv style text format. For the purposes of easier parsing, this text data is then further processed by the csvToJson() function, which, as its name suggests, converts this textual data into JSON. This returned data is what is finally returned by the getDriversLicenseData() function in:

src/utils/network/session-helper.js

Returning to our createDriversLicenseTtlFile() function we see that the returned scanned data as JavaScript object is assigned the variable "dlData". This "dlData" object is then passed to the @inrupt/solid-client library's functions buildThing() and subsequently createThing(). It then utilizes PASS's RDF_PREDICATES object, which stores a series schema definitions specific to schema.org.

A side note is that the fields that call the .addDate() function utilize a helper function called formattedDate(), which is defined in src/utils/barcode/barcode-date-parser.js. This ensures that the dates returned from the Driver's License are in a format consistent with other dates parsed in PASS. Finally the @inrupt/solid-client library calls the build() function, finalizing the creation of our .ttl file which is passed back up the uploadDocument() function in session-core.js and sent off to the Solid Client for storage in the user's pod.


Authentication and authorization mechanisms

  • The OpenID Connect protocol, in abstract, follows the following steps.
  1. The RP (Client) sends a request to the OpenID Provider (OP).
  2. The OP authenticates the End-User and obtains authorization.
  3. The OP responds with an ID Token and usually an Access Token.
  4. The RP can send a request with the Access Token to the UserInfo Endpoint.
  5. The UserInfo Endpoint returns Claims about the End-User.

Top of page ⬆️

Clone this wiki locally