generated from digitalcredentials/isomorphic-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update libs for VC2 and add full test
- Loading branch information
1 parent
03ce9c5
commit 93ae3ab
Showing
7 changed files
with
103 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,6 @@ dist | |
.DS_Store | ||
|
||
# the keyv data store | ||
src/data | ||
src/data | ||
|
||
compose-test.yaml |
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,30 @@ | ||
#!/bin/sh | ||
if [ -z "$husky_skip_init" ]; then | ||
debug () { | ||
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" | ||
} | ||
|
||
readonly hook_name="$(basename "$0")" | ||
debug "starting $hook_name..." | ||
|
||
if [ "$HUSKY" = "0" ]; then | ||
debug "HUSKY env variable is set to 0, skipping hook" | ||
exit 0 | ||
fi | ||
|
||
if [ -f ~/.huskyrc ]; then | ||
debug "sourcing ~/.huskyrc" | ||
. ~/.huskyrc | ||
fi | ||
|
||
export readonly husky_skip_init=1 | ||
sh -e "$0" "$@" | ||
exitCode="$?" | ||
|
||
if [ $exitCode != 0 ]; then | ||
echo "husky - $hook_name hook exited with code $exitCode (error)" | ||
exit $exitCode | ||
fi | ||
|
||
exit 0 | ||
fi |
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 |
---|---|---|
@@ -1,12 +1,35 @@ | ||
import {verify} from '@digitalbazaar/vc'; | ||
import {verify,signPresentation, createPresentation} from '@digitalbazaar/vc'; | ||
import {Ed25519Signature2020} from '@digitalbazaar/ed25519-signature-2020'; | ||
import { securityLoader } from './securityLoader.js'; | ||
import { securityLoader } from '@digitalcredentials/security-document-loader'; | ||
import {Ed25519VerificationKey2020} from '@digitalbazaar/ed25519-verification-key-2020'; | ||
|
||
const documentLoader = securityLoader().build() | ||
const suite = new Ed25519Signature2020(); | ||
|
||
const key = await Ed25519VerificationKey2020.generate( | ||
{ | ||
seed: new Uint8Array ([ | ||
217, 87, 166, 30, 75, 106, 132, 55, | ||
32, 120, 171, 23, 116, 73, 254, 74, | ||
230, 16, 127, 91, 2, 252, 224, 96, | ||
184, 172, 245, 157, 58, 217, 91, 240 | ||
]), | ||
controller: "did:key:z6MkvL5yVCgPhYvQwSoSRQou6k6ZGfD5mNM57HKxufEXwfnP" | ||
} | ||
) | ||
|
||
const suite = new Ed25519Signature2020({key}); | ||
|
||
export const getSignedDIDAuth = async (holder = 'did:ex:12345', challenge) => { | ||
const presentation = createPresentation({holder}); | ||
return await signPresentation({ | ||
presentation, suite, challenge, documentLoader | ||
}); | ||
} | ||
|
||
const verificationSuite = new Ed25519Signature2020(); | ||
|
||
export const verifyDIDAuth = async ({presentation, challenge}) => { | ||
const result = await verify({presentation, challenge, suite, documentLoader}); | ||
const result = await verify({presentation, challenge, suite: verificationSuite, documentLoader}); | ||
return result.verified | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
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