forked from openwallet-foundation/credo-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support newer did-communication service type (openwallet-founda…
…tion#233) Signed-off-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
100d0ab
commit b0b89de
Showing
13 changed files
with
183 additions
and
28 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
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
38 changes: 38 additions & 0 deletions
38
src/modules/connections/models/did/service/DidCommService.ts
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,38 @@ | ||
import { ArrayNotEmpty, IsOptional, IsString } from 'class-validator' | ||
import { Service } from './Service' | ||
|
||
export class DidCommService extends Service { | ||
public constructor(options: { | ||
id: string | ||
serviceEndpoint: string | ||
recipientKeys: string[] | ||
routingKeys?: string[] | ||
accept?: string[] | ||
priority?: number | ||
}) { | ||
super({ ...options, type: DidCommService.type }) | ||
|
||
if (options) { | ||
this.recipientKeys = options.recipientKeys | ||
this.routingKeys = options.routingKeys | ||
this.accept = options.accept | ||
if (options.priority) this.priority = options.priority | ||
} | ||
} | ||
|
||
public static type = 'did-communication' | ||
|
||
@ArrayNotEmpty() | ||
@IsString({ each: true }) | ||
public recipientKeys!: string[] | ||
|
||
@IsString({ each: true }) | ||
@IsOptional() | ||
public routingKeys?: string[] | ||
|
||
@IsString({ each: true }) | ||
@IsOptional() | ||
public accept?: string[] | ||
|
||
public priority = 0 | ||
} |
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
Oops, something went wrong.