Skip to content

Commit

Permalink
check credential offer for pre-authorized issuance; implement deferre…
Browse files Browse the repository at this point in the history
…d issuance; update docs
  • Loading branch information
vkanellopoulos committed Jun 28, 2024
1 parent 0f6b949 commit ebaa90d
Show file tree
Hide file tree
Showing 50 changed files with 1,067 additions and 362 deletions.
46 changes: 39 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The library provides the following functionality:
- [x] Support credential offer
- [x] Support for DPoP JWT in authorization
- [x] Support for JWT and CWT proof types
- [ ] Support for deferred issuing
- [x] Support for deferred issuing
- Proximity document presentation
- [x] Support for ISO-18013-5 device retrieval
- [x] QR device engagement
Expand Down Expand Up @@ -293,12 +293,12 @@ val attestationChallenge = byteArrayOf(
)
val result = EudiWallet.createDocument(docType, hardwareBacked, attestationChallenge)
when (result) {
is CreateIssuanceRequestResult.Failure -> {
is CreateDocumentResult.Failure -> {
val error = result.throwable
// handle error
}

is CreateIssuanceRequestResult.Success -> {
is CreateDocumentResult.Success -> {
val unsignedDocument = result.issuanceRequest
val docType = unsignedDocument.docType
// the device certificate that will be used in the signing of the document
Expand Down Expand Up @@ -341,11 +341,11 @@ when (result) {
val storeResult = EudiWallet.storeIssuedDocument(unsignedDocument, issuerData)

when (storeResult) {
is AddDocumentResult.Failure -> {
is StoreDocumentResult.Failure -> {
val error = storeResult.throwable
// handle error while adding document
}
is AddDocumentResult.Success -> {
is StoreDocumentResult.Success -> {
val documentId = storeResult.documentId
// the documentId of the newly added document
// use the documentId to retrieve the document
Expand Down Expand Up @@ -545,6 +545,14 @@ val onIssueEvent = OnIssueEvent { event ->
// or cancel the issuance process by calling
event.cancel()
}

is IssueEvent.DocumentDeferred -> {
// triggered when the document issuance is deferred
// and holds the documentId of the deferred document
val documentId: String = event.documentId
val documentName: String = event.name
val docType: String = event.docType
}
}
}

Expand Down Expand Up @@ -581,7 +589,7 @@ EudiWallet.issueDocumentByDocType(
}
```

##### Authorization code flow
#### Authorization code flow

For the authorization code flow to work, the application must handle the redirect URI. The redirect URI is the URI that
the Issuer will redirect the user to after the user has authenticated and authorized. The redirect URI must be handled
Expand Down Expand Up @@ -638,7 +646,7 @@ class SomeActivity : AppCompatActivity() {
}
```

##### Pre-Authorization code flow
#### Pre-Authorization code flow

When Issuer supports the pre-authorization code flow, the resolved offer will also contain the corresponding
information. Specifically, the `txCodeSpec` field in the `Offer` object will contain:
Expand All @@ -657,6 +665,30 @@ When the transaction code is provided, the issuance process can be resumed by ca

passing the transaction code as in the `txCode` parameter.

#### Deferred Issuance

When the document issuance is deferred, the `IssueEvent.DocumentDeferred` event is triggered. The deferred document can
be issued later by calling the `EudiWallet.issueDeferredDocument` method.

```kotlin
val documentId = "documentId"

EudiWallet.issueDeferredDocument(documentId) { result ->
when (result) {
is DeferredIssueResult.DocumentIssued -> {
// document issued
}
is DeferredIssueResult.DocumentFailed -> {
// error
val cause = result.throwable
}
is DeferredIssueResult.DocumentNotReady -> {
// document is not issued yet
}
}
}
```

### Transfer documents

The library supports the following 3 ways to transfer documents:
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.10.0-SNAPSHOT]

__27 Jun 2024__

- Bump eudi-lib-jvm-openid4vci-kt to v0.3.2
- Bump eudi-lib-android-wallet-document-manager to v0.4.0-SNAPSHOT
- Support for OpenId4VCI pre-authorization flow
- Support for OpenId4VCI deferred issuance
- Extensive logging for OpenId4VCI and OpenId4VP
- Allow overriding ktor client for OpenId4VCI and OpenId4VP
- Bug fixes in OpenId4VCI

## [0.9.5-SNAPSHOT]

__14 Jun 2024__
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentFailed](index.md)/[DocumentFailed](-document-failed.md)

# DocumentFailed

[androidJvm]\
constructor(documentId: DocumentId,
cause: [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html))
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentFailed](index.md)/[cause](cause.md)

# cause

[androidJvm]\
open override
val [cause](cause.md): [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentFailed](index.md)/[documentId](document-id.md)

# documentId

[androidJvm]\
val [documentId](document-id.md): DocumentId
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentFailed](index.md)

# DocumentFailed

[androidJvm]\
data class [DocumentFailed](index.md)(val documentId: DocumentId, val
cause: [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)) : [DeferredIssueResult](../index.md), [OpenId4VciResult.Erroneous](../../-open-id4-vci-result/-erroneous/index.md)

Document issuance failed.

## Constructors

| | |
|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| [DocumentFailed](-document-failed.md) | [androidJvm]<br>constructor(documentId: DocumentId, cause: [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)) |

## Properties

| Name | Summary |
|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [cause](cause.md) | [androidJvm]<br>open override val [cause](cause.md): [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)<br>the error that caused the failure |
| [documentId](document-id.md) | [androidJvm]<br>val [documentId](document-id.md): DocumentId |
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentIssued](index.md)/[DocumentIssued](-document-issued.md)

# DocumentIssued

[androidJvm]\
constructor(documentId: DocumentId,
name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),
docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html))
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentIssued](index.md)/[docType](doc-type.md)

# docType

[androidJvm]\
val [docType](doc-type.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentIssued](index.md)/[documentId](document-id.md)

# documentId

[androidJvm]\
val [documentId](document-id.md): DocumentId
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentIssued](index.md)

# DocumentIssued

data class [DocumentIssued](index.md)(val documentId: DocumentId, val
name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), val
docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) : [DeferredIssueResult](../index.md)

Document issued successfully.

#### See also

| | |
|------------|---------------------|
| DocumentId | for the document id |

## Constructors

| | |
|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DocumentIssued](-document-issued.md) | [androidJvm]<br>constructor(documentId: DocumentId, name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) |

## Properties

| Name | Summary |
|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| [docType](doc-type.md) | [androidJvm]<br>val [docType](doc-type.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>the document type |
| [documentId](document-id.md) | [androidJvm]<br>val [documentId](document-id.md): DocumentId<br>the id of the issued document |
| [name](name.md) | [androidJvm]<br>val [name](name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>the name of the document |
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentIssued](index.md)/[name](name.md)

# name

[androidJvm]\
val [name](name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentNotReady](index.md)/[DocumentNotReady](-document-not-ready.md)

# DocumentNotReady

[androidJvm]\
constructor(documentId: DocumentId,
name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),
docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html))
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentNotReady](index.md)/[docType](doc-type.md)

# docType

[androidJvm]\
val [docType](doc-type.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentNotReady](index.md)/[documentId](document-id.md)

# documentId

[androidJvm]\
val [documentId](document-id.md): DocumentId
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentNotReady](index.md)

# DocumentNotReady

[androidJvm]\
data class [DocumentNotReady](index.md)(val documentId: DocumentId, val
name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), val
docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) : [DeferredIssueResult](../index.md)

Document issuance deferred.

## Constructors

| | |
|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DocumentNotReady](-document-not-ready.md) | [androidJvm]<br>constructor(documentId: DocumentId, name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) |

## Properties

| Name | Summary |
|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| [docType](doc-type.md) | [androidJvm]<br>val [docType](doc-type.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>the document type |
| [documentId](document-id.md) | [androidJvm]<br>val [documentId](document-id.md): DocumentId<br>the id of the deferred document |
| [name](name.md) | [androidJvm]<br>val [name](name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>the name of the document |
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[wallet-core](../../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../../index.md)/[DeferredIssueResult](../index.md)/[DocumentNotReady](index.md)/[name](name.md)

# name

[androidJvm]\
val [name](name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//[wallet-core](../../../index.md)/[eu.europa.ec.eudi.wallet.issue.openid4vci](../index.md)/[DeferredIssueResult](index.md)

# DeferredIssueResult

interface [DeferredIssueResult](index.md) : [OpenId4VciResult](../-open-id4-vci-result/index.md)

#### Inheritors

| |
|--------------------------------------------------|
| [DocumentIssued](-document-issued/index.md) |
| [DocumentFailed](-document-failed/index.md) |
| [DocumentNotReady](-document-not-ready/index.md) |

## Types

| Name | Summary |
|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DocumentFailed](-document-failed/index.md) | [androidJvm]<br>data class [DocumentFailed](-document-failed/index.md)(val documentId: DocumentId, val cause: [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)) : [DeferredIssueResult](index.md), [OpenId4VciResult.Erroneous](../-open-id4-vci-result/-erroneous/index.md)<br>Document issuance failed. |
| [DocumentIssued](-document-issued/index.md) | [androidJvm]<br>data class [DocumentIssued](-document-issued/index.md)(val documentId: DocumentId, val name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), val docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) : [DeferredIssueResult](index.md)<br>Document issued successfully. |
| [DocumentNotReady](-document-not-ready/index.md) | [androidJvm]<br>data class [DocumentNotReady](-document-not-ready/index.md)(val documentId: DocumentId, val name: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html), val docType: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)) : [DeferredIssueResult](index.md)<br>Document issuance deferred. |
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# TxCodeSpec

[androidJvm]\
constructor(inputMode: [Offer.TxCodeSpec.InputMode](-input-mode/index.md) = InputMode.NUMERIC,
constructor(inputMode: [Offer.TxCodeSpec.InputMode](-input-mode/index.md) = NUMERIC,
length: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)?,
description: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? = null)
Loading

0 comments on commit ebaa90d

Please sign in to comment.