forked from Mozartted/ethr-did-resolver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade to latest did core spec (decentralized-identity#99) (de…
…centralized-identity#109) (decentralized-identity#111) * 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 (decentralized-identity#105) * fix: setAttribute with sigAuth adds key to authentication section (decentralized-identity#95) * feat: enable base58 encoding for keys (decentralized-identity#106)(decentralized-identity#99) * refactor: group types, defaults, and helper methods * fix: add support for deactivated DIDs (decentralized-identity#83)(decentralized-identity#85) * fix(deps): bump did-resolver version * fix: update the default `@context` to be LD compatible (decentralized-identity#99) * docs: update readme and spec to reflect reality and current DID spec compliance (decentralized-identity#99) * fix: rename `publicKey` to `verificationMethod` (decentralized-identity#99) * fix: rename `ethereumAddress` to `blockchainAccountId` (decentralized-identity#99) * feat: no more errors thrown during resolution. fixes decentralized-identity#83 closes decentralized-identity#85 fixes decentralized-identity#95 fixes decentralized-identity#105 closes decentralized-identity#106 fixes decentralized-identity#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