-
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.
* encodeDidUrl: the identifier as HexString, and prefix is `did:zk`. * encode did when calc digest hash
- Loading branch information
1 parent
e259185
commit 7a4b2e3
Showing
7 changed files
with
79 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@zcloak/vc': minor | ||
--- | ||
|
||
encode did when calc digest |
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,5 @@ | ||
--- | ||
'@zcloak/did': minor | ||
--- | ||
|
||
encodeDidUrl: the identifier as HexString, and prefix is `did:zk`. |
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,36 @@ | ||
// Copyright 2021-2023 zcloak authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { alice } from 'test-support'; | ||
|
||
import { initCrypto } from '@zcloak/crypto'; | ||
|
||
import { encodeDidUrl } from './utils'; | ||
|
||
describe('Did utils', (): void => { | ||
beforeAll(async () => { | ||
await initCrypto(); | ||
}); | ||
|
||
it('encode did url', () => { | ||
const encoded = encodeDidUrl(alice.id); | ||
|
||
expect(encoded).toEqual( | ||
new Uint8Array([ | ||
100, 105, 100, 58, 122, 107, 58, 17, 248, 183, 127, 52, 252, 241, 75, 112, 149, 191, 82, 40, | ||
172, 6, 6, 50, 78, 130, 209 | ||
]) | ||
); | ||
}); | ||
|
||
it('encode did has fragment', () => { | ||
const encoded = encodeDidUrl(alice.getKeyUrl('authentication')); | ||
|
||
expect(encoded).toEqual( | ||
new Uint8Array([ | ||
100, 105, 100, 58, 122, 107, 58, 17, 248, 183, 127, 52, 252, 241, 75, 112, 149, 191, 82, 40, | ||
172, 6, 6, 50, 78, 130, 209 | ||
]) | ||
); | ||
}); | ||
}); |
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