-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an API class to the `W3cCredentialsModule` that allows for CRUD operations for W3C credentials.
- Loading branch information
1 parent
c46a6b8
commit c888736
Showing
17 changed files
with
222 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { W3cVerifiableCredential, StoreCredentialOptions } from './models' | ||
import type { W3cCredentialRecord } from './repository' | ||
import type { Query } from '../../storage/StorageService' | ||
|
||
import { AgentContext } from '../../agent' | ||
import { injectable } from '../../plugins' | ||
|
||
import { W3cCredentialService } from './W3cCredentialService' | ||
|
||
/** | ||
* @public | ||
*/ | ||
@injectable() | ||
export class W3cCredentialsApi { | ||
private agentContext: AgentContext | ||
private w3cCredentialService: W3cCredentialService | ||
|
||
public constructor(agentContext: AgentContext, w3cCredentialService: W3cCredentialService) { | ||
this.agentContext = agentContext | ||
this.w3cCredentialService = w3cCredentialService | ||
} | ||
|
||
public async storeCredential(options: StoreCredentialOptions): Promise<W3cCredentialRecord> { | ||
return this.w3cCredentialService.storeCredential(this.agentContext, options) | ||
} | ||
|
||
public async removeCredentialRecord(id: string) { | ||
return this.w3cCredentialService.removeCredentialRecord(this.agentContext, id) | ||
} | ||
|
||
public async getAllCredentialRecords(): Promise<W3cCredentialRecord[]> { | ||
return this.w3cCredentialService.getAllCredentialRecords(this.agentContext) | ||
} | ||
|
||
public async getCredentialRecordById(id: string): Promise<W3cCredentialRecord> { | ||
return this.w3cCredentialService.getCredentialRecordById(this.agentContext, id) | ||
} | ||
|
||
public async findCredentialRecordsByQuery(query: Query<W3cCredentialRecord>): Promise<W3cVerifiableCredential[]> { | ||
return this.w3cCredentialService.findCredentialsByQuery(this.agentContext, query) | ||
} | ||
} |
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.