-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: refactor configuration options, add `chainID` * fix: improve `kid` stability during attribute changes * chore: cleanup in tests and local dependencies * test(coverage): improve test coverage * refactor(style): enable linting using `eslint` * refactor: isolate some of the type definitions * fix: test that checksum address resolves to identical DID document (#105) * fix: setAttribute with sigAuth adds key to authentication section (#95) * feat: enable base58 encoding for keys (#106)(#99) * refactor: group types, defaults, and helper methods * fix: add support for deactivated DIDs (#83)(#85) * fix(deps): bump did-resolver version * fix: update the default `@context` to be LD compatible (#99) * docs: update readme and spec to reflect reality and current DID spec compliance (#99) * fix: rename `publicKey` to `verificationMethod` (#99) * fix: rename `ethereumAddress` to `blockchainAccountId` (#99) * feat: no more errors thrown during resolution. fixes #83 closes #85 fixes #95 fixes #105 closes #106 fixes #99 BREAKING CHANGE: The return type is `DIDResolutionResult` which wraps a `DIDDocument`. BREAKING CHANGE: No errors are thrown during DID resolution. Please check `result.didResolutionMetadata.error` instead. BREAKING CHANGE: This DID core spec requirement will break for users expecting `publicKey`, `ethereumAddress`, `Secp256k1VerificationKey2018` entries in the DID document. They are replaced with `verificationMethod`, `blockchainAccountId` and `EcdsaSecp256k1VerificationKey2019` and `EcdsaSecp256k1RecoveryMethod2020` depending on the content.
- Loading branch information
Showing
10 changed files
with
104 additions
and
489 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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 @@ | ||
import { Resolver } from 'did-resolver' | ||
import { getResolver } from '../resolver' | ||
|
||
describe('error handling', () => { | ||
const didResolver = new Resolver( | ||
getResolver({ | ||
networks: [{ name: 'example', rpcUrl: 'example.com' }], | ||
}) | ||
) | ||
|
||
it('rejects invalid DID', async () => { | ||
expect.assertions(1) | ||
await expect(didResolver.resolve('did:ethr:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX')).resolves.toEqual({ | ||
didDocument: null, | ||
didDocumentMetadata: {}, | ||
didResolutionMetadata: { | ||
error: 'invalidDid', | ||
message: 'Not a valid did:ethr: 2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX', | ||
}, | ||
}) | ||
}) | ||
|
||
it('rejects resolution on unconfigured network', async () => { | ||
expect.assertions(1) | ||
await expect( | ||
didResolver.resolve('did:ethr:zrx:0x03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479') | ||
).resolves.toEqual({ | ||
didDocument: null, | ||
didDocumentMetadata: {}, | ||
didResolutionMetadata: { | ||
error: 'unknownNetwork', | ||
message: 'The DID resolver does not have a configuration for network: zrx', | ||
}, | ||
}) | ||
}) | ||
}) |
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