-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add revocation for JWT credentials (#934)
Signed-off-by: Shota Jolbordi <[email protected]>
- Loading branch information
shotexa
authored
Mar 19, 2024
1 parent
a699628
commit 88b7fa5
Showing
77 changed files
with
2,976 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,9 @@ on: | |
|
||
env: | ||
BENCHMARKING_DIR: "tests/performance-tests/atala-performance-tests-k6" | ||
NODE_AUTH_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_ACTOR: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
run-e2e-tests: | ||
|
@@ -35,19 +37,17 @@ jobs: | |
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
password: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
username: ${{ env.GITHUB_ACTOR }} | ||
password: ${{ env.GITHUB_TOKEN }} | ||
|
||
- uses: KengoTODA/actions-setup-docker-compose@v1 | ||
name: Install `docker-compose` | ||
with: | ||
version: '2.14.2' | ||
version: "2.14.2" | ||
|
||
- name: Build local version of PRISM Agent | ||
env: | ||
ENV_FILE: "infrastructure/local/.env" | ||
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
run: | | ||
sbt docker:publishLocal | ||
PRISM_AGENT_VERSION=$(cut version.sbt -d '=' -f2 | tr -d '" ') | ||
|
@@ -113,7 +113,7 @@ jobs: | |
with: | ||
node-version: 16.x | ||
registry-url: "https://npm.pkg.github.com" | ||
scope: 'input-output-hk' | ||
scope: "input-output-hk" | ||
|
||
- name: Install dependencies | ||
uses: borales/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ry-library/protocol-revocation-notification/Revocation-notification-protocol.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Revocation notification protocol | ||
|
||
This Protocol for an Isuser to notify the revocation of a credential to the holder. | ||
|
||
|
||
|
||
## PIURI | ||
|
||
Version 1.0: <https://atalaprism.io/revocation_notification/1.0/revoke> | ||
|
||
### Roles | ||
|
||
- Issuer | ||
- Will create the message and send it to the holder via previously established connection | ||
- Holder | ||
- Will process the message as they see fit, protocol does not require any actions from the holder | ||
|
||
|
||
### Revocation notification DIDcomV2 message as JSON | ||
|
||
```json | ||
|
||
{ | ||
"from": "fromDID_value", | ||
"to": "toDID_value", | ||
"piuri":"https://atalaprism.io/revocation_notification/1.0/revoke", | ||
"body": { | ||
"issueCredentialProtocolThreadId": "issueCredentialProtocolThreadId_value", | ||
"comment": "Thread Id used to issue this credential withing issue credential protocol" | ||
} | ||
} | ||
|
||
``` |
77 changes: 77 additions & 0 deletions
77
.../scala/io/iohk/atala/mercury/protocol/revocationnotificaiton/RevocationNotification.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package io.iohk.atala.mercury.protocol.revocationnotificaiton | ||
|
||
import io.circe._ | ||
import io.circe.generic.semiauto._ | ||
import io.circe.syntax._ | ||
|
||
import io.iohk.atala.mercury.model._ | ||
|
||
final case class RevocationNotification( | ||
id: String = java.util.UUID.randomUUID.toString(), | ||
`type`: PIURI = RevocationNotification.`type`, | ||
body: RevocationNotification.Body, | ||
thid: Option[String] = None, | ||
from: DidId, | ||
to: DidId, | ||
) { | ||
assert(`type` == RevocationNotification.`type`) | ||
|
||
def makeMessage: Message = Message( | ||
id = this.id, | ||
`type` = this.`type`, | ||
from = Some(this.from), | ||
to = Seq(this.to), | ||
thid = this.thid, | ||
body = this.body.asJson.asObject.get, | ||
) | ||
} | ||
object RevocationNotification { | ||
|
||
given Encoder[RevocationNotification] = deriveEncoder[RevocationNotification] | ||
given Decoder[RevocationNotification] = deriveDecoder[RevocationNotification] | ||
|
||
def `type`: PIURI = "https://atalaprism.io/revocation_notification/1.0/revoke" | ||
|
||
def build( | ||
fromDID: DidId, | ||
toDID: DidId, | ||
thid: Option[String] = None, | ||
issueCredentialProtocolThreadId: String | ||
): RevocationNotification = { | ||
RevocationNotification( | ||
thid = thid, | ||
from = fromDID, | ||
to = toDID, | ||
body = Body( | ||
issueCredentialProtocolThreadId = issueCredentialProtocolThreadId, | ||
comment = Some("Thread Id used to issue this credential withing issue credential protocol") | ||
), | ||
) | ||
} | ||
|
||
final case class Body( | ||
issueCredentialProtocolThreadId: String, | ||
comment: Option[String] = None, | ||
) | ||
|
||
object Body { | ||
given Encoder[Body] = deriveEncoder[Body] | ||
given Decoder[Body] = deriveDecoder[Body] | ||
} | ||
|
||
def readFromMessage(message: Message): RevocationNotification = | ||
val body = message.body.asJson.as[RevocationNotification.Body].toOption.get | ||
|
||
RevocationNotification( | ||
id = message.id, | ||
`type` = message.piuri, | ||
body = body, | ||
thid = message.thid, | ||
from = message.from.get, // TODO get | ||
to = { | ||
assert(message.to.length == 1, "The recipient is ambiguous. Need to have only 1 recipient") | ||
message.to.head | ||
}, | ||
) | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
pollux/lib/core/src/main/scala/io/iohk/atala/pollux/core/model/CredentialStatusList.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.iohk.atala.pollux.core.model | ||
|
||
import io.iohk.atala.castor.core.model.did.CanonicalPrismDID | ||
import io.iohk.atala.pollux.vc.jwt.StatusPurpose | ||
import io.iohk.atala.shared.models.WalletId | ||
import java.time.Instant | ||
import java.util.UUID | ||
|
||
final case class CredentialStatusList( | ||
id: UUID, | ||
walletId: WalletId, | ||
issuer: CanonicalPrismDID, | ||
issued: Instant, | ||
purpose: StatusPurpose, | ||
statusListCredential: String, | ||
size: Int, | ||
lastUsedIndex: Int, | ||
createdAt: Instant, | ||
updatedAt: Option[Instant] | ||
) | ||
|
||
case class CredInStatusList( | ||
id: UUID, | ||
issueCredentialRecordId: DidCommID, | ||
statusListIndex: Int, | ||
isCanceled: Boolean, | ||
isProcessed: Boolean, | ||
) | ||
|
||
case class CredentialStatusListWithCred( | ||
credentialStatusListId: UUID, | ||
issuer: CanonicalPrismDID, | ||
issued: Instant, | ||
purpose: StatusPurpose, | ||
walletId: WalletId, | ||
statusListCredential: String, | ||
size: Int, | ||
lastUsedIndex: Int, | ||
credentialInStatusListId: UUID, | ||
issueCredentialRecordId: DidCommID, | ||
statusListIndex: Int, | ||
isCanceled: Boolean, | ||
isProcessed: Boolean, | ||
) | ||
|
||
case class CredentialStatusListWithCreds( | ||
id: UUID, | ||
walletId: WalletId, | ||
issuer: CanonicalPrismDID, | ||
issued: Instant, | ||
purpose: StatusPurpose, | ||
statusListCredential: String, | ||
size: Int, | ||
lastUsedIndex: Int, | ||
credentials: Seq[CredInStatusList] | ||
) |
Oops, something went wrong.