-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds verify data rpc method (#133)
* feat: add verifyData rpc method * feat: add testVC generation, fix verifyData tests * fix: update createTestVCs function * fix: update tests to use generated testVC * fix: move test constants for VC creation * chore: remove some // eslint-disable comments * fix: remove unnecessary meta field --------- Co-authored-by: martines3000 <domajnko.martin@gmail.com>
- Loading branch information
1 parent
8cd8a7a
commit 48b8a44
Showing
13 changed files
with
680 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { VerifyDataRequestParams } from '@blockchain-lab-um/ssi-snap-types'; | ||
import { IVerifyResult } from '@veramo/core'; | ||
|
||
import { ApiParams } from '../../interfaces'; | ||
import { veramoVerifyData } from '../../utils/veramoUtils'; | ||
|
||
export async function verifyData( | ||
params: ApiParams, | ||
args: VerifyDataRequestParams | ||
): Promise<boolean | IVerifyResult> { | ||
const { snap, ethereum } = params; | ||
const verbose = args.verbose || false; | ||
|
||
const res = await veramoVerifyData({ | ||
snap, | ||
ethereum, | ||
data: args, | ||
}); | ||
if (res.error) throw res.error as Error; | ||
return verbose ? res : res.verified; | ||
} |
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.