impierce / openid4vc

Rust implementation of the OpenID4VC standards. The library will offer implementations for SIOPv2, OpenID4VP and OpenID4VCI.
https://www.impierce.com
Apache License 2.0
28 stars 3 forks source link

feat: Add initial Implicit Flow implementation #1

Closed nanderstabel closed 1 year ago

nanderstabel commented 1 year ago

Description of change

This PR includes a first version of the Implicit Flow. The addition consists of four major parts:

  1. A Provider that can accept a SiopRequest and generate a SiopResponse by creating an IdToken; adding its key identifier to the header of the id_token, signing the id_token and wrap it into a SiopResponse. Secondly, it can send the SiopResponse using the redirect_uri parameter.
  2. A RelyingParty struct which can validate a SiopResponse by validating its IdToken using a key identifier (which is extracted from the id_token) and its public key.
  3. The Subject trait can be implemented on a custom struct representing the signing logic of a DID method. A Provider can ingest an object that implemented the Subject trait so that during generation of a SiopResponse the DID method syntax, key identifier and signing method of the specific Subject can be used.
  4. The Validator trait can be implemented on a custom struct representing the validating logic of a DID method. The sole responsibility is that (when ingested by a RelyingParty) it can resolve the public key that is needed for validating an IdToken.

Links to any relevant issues

Fixes #5

How the change has been tested

Three unit tests are provided:

Definition of Done checklist

Add an x to the boxes that are relevant to your changes.