Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support revocation notification messages #579

Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4b9f0b3
Created message, events, handling, testing for revocation notification
TheTreek Dec 7, 2021
944278c
ran prettier
TheTreek Dec 7, 2021
2f192b9
Formatted revocation notification objects to comply with AFJ format, …
TheTreek Dec 7, 2021
92795d7
Added test expectation to start without revocationNotification
TheTreek Dec 9, 2021
2083656
Merge branch 'main' into feature/revocationNotification
TheTreek Dec 15, 2021
a70fed5
fixed issue from merge
TheTreek Dec 15, 2021
b07da51
formatting
TheTreek Feb 11, 2022
fb2ce15
formatting
TheTreek Feb 11, 2022
c6aaad8
merge conflicts
TheTreek Feb 11, 2022
95ffd04
Updated to use new threadId format
TheTreek Feb 11, 2022
16ab02f
Updated tests to use propper revocationNotification threadId
TheTreek Feb 11, 2022
10b1d02
formatted tests
TheTreek Feb 11, 2022
42f6af6
Test satisfaction
TheTreek Feb 11, 2022
8d47b26
revocation notification test sets listener before calling receive mes…
TheTreek Feb 12, 2022
c273882
Fixed unit tests and changed regex for revocation notification threadId
TheTreek Feb 15, 2022
4c9a099
formatting
TheTreek Feb 15, 2022
99c21f1
Added more unit tests, fixed regex parsing of revocation notification…
TheTreek Feb 15, 2022
b66dad1
Added support for RevocationNotificationV2
TheTreek Feb 28, 2022
8632e2c
Fixed scope issues
TheTreek Feb 28, 2022
21c7feb
Fixed handler registration
TheTreek Feb 28, 2022
0f47d0d
Added another unit test and added a required await in RevocationService
TheTreek Feb 28, 2022
e399e42
Fixed improper import and class/function names
TheTreek Mar 2, 2022
6e7f6b5
formatting
TheTreek Mar 2, 2022
2392503
updated types package and added revRegId/credRevId to metadata
TheTreek Apr 7, 2022
4915056
metadata changes and assert connection for revocationNotification
TheTreek Apr 15, 2022
ed58b26
formatting
TheTreek Apr 15, 2022
f8fcdf6
Fixed unit test and added test for connection assertion
TheTreek Apr 18, 2022
71db404
chore: added divergent changes language for revocation notification v1
JamesKEbert Apr 18, 2022
a7082b1
chore: prettier formatting
JamesKEbert Apr 19, 2022
88d548c
Update comments, update connection assertion in RevocationService.
TheTreek Apr 20, 2022
faa63fc
Changes for testing
TheTreek Apr 20, 2022
e5baf5c
formatting
TheTreek Apr 20, 2022
05cbff3
Fix broken tests
TheTreek Apr 20, 2022
3df712b
Changed name of revRegId in metadata
TheTreek Apr 20, 2022
1e2764c
Merge branch 'main' into feature/revocationNotification
TheTreek Apr 20, 2022
e09d99a
updated test snapshots
TheTreek Apr 21, 2022
669cee4
Regex for revocationRegistryId now matches aca-py's implementation
TheTreek Apr 21, 2022
b29efea
formatting
TheTreek Apr 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,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
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@multiformats/base-x": "^4.0.1",
"@stablelib/ed25519": "^1.0.2",
"@stablelib/sha256": "^1.0.1",
"@types/indy-sdk": "^1.16.12",
"@types/indy-sdk": "^1.16.16",
"@types/node-fetch": "^2.5.10",
"@types/ws": "^7.4.4",
"abort-controller": "^3.0.0",
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