Create vp_token
it is a verifiable presentation signed by DidKit. In this presentation non ascii characters are escaped by a code (that's probably jsonencode).
The process is similar to existing _verifiablePresentationRequest function.
We use DIDKitProvider.instance.issuePresentation with:
selected credential,
user RSA key as key
options as defined below.
options = jsonEncode({
'verificationMethod': kid, // from RSA key
'proofPurpose': 'authentication',
'challenge': nonce // provided with claims
}),
create id_token
id_token is a signed Json Web Token (JWT).
header = {
"typ" :"JWT",
"kid": "did:web:ecole42.talao.co#key-1" //kid from wallet RSA key
}
payload = {
"exp": 1311281970, // current time + 1 minute
"iat": 1311280970, // current time
“i_am_siop” : true,
"sub": “did:web:ecole42.talao.co” // wallet DID,
"nonce": nonce, // nonce from selected instructions selected in QR code data
}
Create POST request
POST is sent to redirect_uri from instructions selected in QR code data.
Content-Type: application/x-www-form-urlencoded
data =
id_token=encoded_jwt&vp_token=verifiable_presentation
There is a stackoverflow question about How to post x-www-form-urlencoded in Flutter
complexity: 5
warning: We never used package https://pub.dev/packages/jose and some testing needs to be done.
Warning: crypto_keys package may be enough to do this job.
Create vp_token it is a verifiable presentation signed by DidKit. In this presentation non ascii characters are escaped by a code (that's probably jsonencode). The process is similar to existing _verifiablePresentationRequest function. We use DIDKitProvider.instance.issuePresentation with:
create id_token id_token is a signed Json Web Token (JWT). header = { "typ" :"JWT", "kid": "did:web:ecole42.talao.co#key-1" //kid from wallet RSA key } payload = { "exp": 1311281970, // current time + 1 minute "iat": 1311280970, // current time “i_am_siop” : true, "sub": “did:web:ecole42.talao.co” // wallet DID, "nonce": nonce, // nonce from selected instructions selected in QR code data }
Payload and header are signed with RSA key and following package: https://pub.dev/packages/jose
Create POST request POST is sent to redirect_uri from instructions selected in QR code data. Content-Type: application/x-www-form-urlencoded data = id_token=encoded_jwt&vp_token=verifiable_presentation There is a stackoverflow question about How to post x-www-form-urlencoded in Flutter