-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
174 additions
and
5 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
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
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,21 @@ | ||
import type { DidCommMrtdService } from '../DidCommMrtdService' | ||
import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core' | ||
|
||
import { EMrtdDataMessage } from '../messages' | ||
|
||
/** | ||
* Handler for incoming mrtd-data messages | ||
*/ | ||
export class EMrtdDataHandler implements MessageHandler { | ||
public supportedMessages = [EMrtdDataMessage] | ||
|
||
private mrtdService: DidCommMrtdService | ||
|
||
public constructor(mrtdService: DidCommMrtdService) { | ||
this.mrtdService = mrtdService | ||
} | ||
|
||
public async handle(inboundMessage: MessageHandlerInboundMessage<EMrtdDataHandler>) { | ||
await this.mrtdService.processEMrtdData(inboundMessage) | ||
} | ||
} |
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,21 @@ | ||
import type { DidCommMrtdService } from '../DidCommMrtdService' | ||
import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core' | ||
|
||
import { MrzDataRequestMessage } from '../messages' | ||
|
||
/** | ||
* Handler for incoming emrtd-data-request messages | ||
*/ | ||
export class EMrtdDataRequestHandler implements MessageHandler { | ||
public supportedMessages = [MrzDataRequestMessage] | ||
|
||
private mrtdService: DidCommMrtdService | ||
|
||
public constructor(mrtdService: DidCommMrtdService) { | ||
this.mrtdService = mrtdService | ||
} | ||
|
||
public async handle(inboundMessage: MessageHandlerInboundMessage<EMrtdDataRequestHandler>) { | ||
await this.mrtdService.processEMrtdDataRequest(inboundMessage) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { EMrtdDataHandler } from './EMrtdDataHandler' | ||
export { EMrtdDataRequestHandler } from './EMrtdDataRequestHandler' | ||
export { MrzDataHandler } from './MrzDataHandler' | ||
export { MrzDataRequestHandler } from './MrzDataRequestHandler' |
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,25 @@ | ||
import { AgentMessage, IsValidMessageType, parseMessageType } from '@credo-ts/core' | ||
|
||
interface EMrtdDataMessageOptions { | ||
id?: string | ||
threadId?: string | ||
dataGroups: Record<string, string> | ||
} | ||
|
||
export class EMrtdDataMessage extends AgentMessage { | ||
public constructor(options: EMrtdDataMessageOptions) { | ||
super() | ||
|
||
if (options) { | ||
this.id = options.id ?? this.generateId() | ||
this.dataGroups = options.dataGroups | ||
this.setThread({ threadId: options.threadId }) | ||
} | ||
} | ||
|
||
public dataGroups!: Record<string, string> | ||
|
||
@IsValidMessageType(EMrtdDataMessage.type) | ||
public static readonly type = parseMessageType('https://didcomm.org/mrtd/1.0/emrtd-data') | ||
public readonly type = EMrtdDataMessage.type.messageTypeUri | ||
} |
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,23 @@ | ||
import { AgentMessage, IsValidMessageType, parseMessageType } from '@credo-ts/core' | ||
|
||
interface EMrtdDataRequestOptions { | ||
id?: string | ||
parentThreadId?: string | ||
} | ||
|
||
export class EMrtdDataRequestMessage extends AgentMessage { | ||
public constructor(options: EMrtdDataRequestOptions) { | ||
super() | ||
|
||
if (options) { | ||
this.id = options.id ?? this.generateId() | ||
if (options.parentThreadId) { | ||
this.setThread({ parentThreadId: options.parentThreadId }) | ||
} | ||
} | ||
} | ||
|
||
@IsValidMessageType(EMrtdDataRequestMessage.type) | ||
public static readonly type = parseMessageType('https://didcomm.org/mrtd/1.0/emrtd-data-request') | ||
public readonly type = EMrtdDataRequestMessage.type.messageTypeUri | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { MrzDataMessage } from './MrzDataMessage' | ||
export { MrzDataRequestMessage } from './MrzDataRequestMessage' | ||
export { EMrtdDataMessage } from './EMrtdDataMessage' | ||
export { EMrtdDataRequestMessage } from './EmrtdDataRequestMessage' |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export enum DidCommMrtdRole { | ||
MrzRequester = 'mrz-requester', | ||
MrzResponder = 'mrz-responder', | ||
EMrtdDataRequester = 'emrtd-data-requester', | ||
EMrtdDataResponder = 'emrtd-data-responder', | ||
} |