Skip to content

Commit

Permalink
feat: support revocation notification messages (#579)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Kenyon <[email protected]>

Co-authored-by: James Ebert <[email protected]>
  • Loading branch information
TheTreek and JamesKEbert authored Apr 22, 2022
1 parent c9bff93 commit 9f04375
Show file tree
Hide file tree
Showing 16 changed files with 570 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ Also check out [Aries Framework JavaScript Extensions](https://github.com/hyperl

Although Aries Framework JavaScript tries to follow the standards as described in the Aries RFCs as much as possible, some features in AFJ slightly diverge from the written spec. Below is an overview of the features that diverge from the spec, their impact and the reasons for diverging.

| Feature | Impact | Reason |
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Support for `imageUrl` attribute in connection invitation and connection request | Properties that are not recognized should be ignored, meaning this shouldn't limit interoperability between agents. As the image url is self-attested it could give a false sense of trust. Better, credential based, method for visually identifying an entity are not present yet. | Even though not documented, almost all agents support this feature. Not including this feature means AFJ is lacking in features in comparison to other implementations. |
| Feature | Impact | Reason |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Support for `imageUrl` attribute in connection invitation and connection request | Properties that are not recognized should be ignored, meaning this shouldn't limit interoperability between agents. As the image url is self-attested it could give a false sense of trust. Better, credential based, method for visually identifying an entity are not present yet. | Even though not documented, almost all agents support this feature. Not including this feature means AFJ is lacking in features in comparison to other implementations. |
| Revocation Notification v1 uses a different `thread_id` format ( `indy::<revocation_registry_id>::<credential_revocation_id>`) than specified in the Aries RFC | Any agents adhering to the [revocation notification v1 RFC](https://github.com/hyperledger/aries-rfcs/tree/main/features/0183-revocation-notification) will not be interoperable with Aries Framework Javascript. However, revocation notification is considered an optional portion of revocation, therefore this will not break core revocation behavior. Ideally agents should use and implement revocation notification v2. | Actual implementations (ACA-Py) of revocation notification v1 so far have implemented this different format, so this format change was made to remain interoperable. |

## Contributing

Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/modules/credentials/CredentialEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { CredentialRecord } from './repository/CredentialRecord'

export enum CredentialEventTypes {
CredentialStateChanged = 'CredentialStateChanged',
RevocationNotificationReceived = 'RevocationNotificationReceived',
}
export interface CredentialStateChangedEvent extends BaseEvent {
type: typeof CredentialEventTypes.CredentialStateChanged
Expand All @@ -12,3 +13,10 @@ export interface CredentialStateChangedEvent extends BaseEvent {
previousState: CredentialState | null
}
}

export interface RevocationNotificationReceivedEvent extends BaseEvent {
type: typeof CredentialEventTypes.RevocationNotificationReceived
payload: {
credentialRecord: CredentialRecord
}
}
11 changes: 9 additions & 2 deletions packages/core/src/modules/credentials/CredentialsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import {
OfferCredentialHandler,
ProposeCredentialHandler,
RequestCredentialHandler,
V1RevocationNotificationHandler,
V2RevocationNotificationHandler,
CredentialProblemReportHandler,
} from './handlers'
import { CredentialProblemReportMessage } from './messages'
import { CredentialService } from './services'
import { CredentialService, RevocationService } from './services'

@scoped(Lifecycle.ContainerScoped)
export class CredentialsModule {
Expand All @@ -36,6 +38,7 @@ export class CredentialsModule {
private agentConfig: AgentConfig
private credentialResponseCoordinator: CredentialResponseCoordinator
private mediationRecipientService: MediationRecipientService
private revocationService: RevocationService

public constructor(
dispatcher: Dispatcher,
Expand All @@ -44,14 +47,16 @@ export class CredentialsModule {
messageSender: MessageSender,
agentConfig: AgentConfig,
credentialResponseCoordinator: CredentialResponseCoordinator,
mediationRecipientService: MediationRecipientService
mediationRecipientService: MediationRecipientService,
revocationService: RevocationService
) {
this.connectionService = connectionService
this.credentialService = credentialService
this.messageSender = messageSender
this.agentConfig = agentConfig
this.credentialResponseCoordinator = credentialResponseCoordinator
this.mediationRecipientService = mediationRecipientService
this.revocationService = revocationService
this.registerHandlers(dispatcher)
}

Expand Down Expand Up @@ -530,6 +535,8 @@ export class CredentialsModule {
new IssueCredentialHandler(this.credentialService, this.agentConfig, this.credentialResponseCoordinator)
)
dispatcher.registerHandler(new CredentialAckHandler(this.credentialService))
dispatcher.registerHandler(new V1RevocationNotificationHandler(this.revocationService))
dispatcher.registerHandler(new V2RevocationNotificationHandler(this.revocationService))
dispatcher.registerHandler(new CredentialProblemReportHandler(this.credentialService))
}
}
Loading

0 comments on commit 9f04375

Please sign in to comment.