did-resolver
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -0,1 +1,8 @@ | ||
# [3.1.0](https://github.com/decentralized-identity/did-resolver/compare/3.0.2...3.1.0) (2021-03-26) | ||
### Features | ||
* export the Resolvable type definition ([ddc0ec2](https://github.com/decentralized-identity/did-resolver/commit/ddc0ec2d59e93769e0d523ced2e1c05f43712110)) | ||
## [3.0.2](https://github.com/decentralized-identity/did-resolver/compare/3.0.1...3.0.2) (2021-03-12) | ||
@@ -2,0 +9,0 @@ |
@@ -0,1 +1,2 @@ | ||
declare type Extensible = Record<string, any>; | ||
export interface DIDResolutionResult { | ||
@@ -6,12 +7,10 @@ didResolutionMetadata: DIDResolutionMetadata; | ||
} | ||
export interface DIDResolutionOptions { | ||
export interface DIDResolutionOptions extends Extensible { | ||
accept?: string; | ||
[x: string]: any; | ||
} | ||
export interface DIDResolutionMetadata { | ||
export interface DIDResolutionMetadata extends Extensible { | ||
contentType?: string; | ||
error?: 'invalidDid' | 'notFound' | 'representationNotSupported' | 'unsupportedDidMethod' | string; | ||
[x: string]: any; | ||
} | ||
export interface DIDDocumentMetadata { | ||
export interface DIDDocumentMetadata extends Extensible { | ||
created?: string; | ||
@@ -25,6 +24,5 @@ updated?: string; | ||
canonicalId?: string; | ||
[x: string]: any; | ||
} | ||
export interface DIDDocument { | ||
'@context'?: 'https://w3id.org/did/v1' | string | string[]; | ||
'@context'?: 'https://www.w3.org/ns/did/v1' | string | string[]; | ||
id: string; | ||
@@ -51,3 +49,3 @@ alsoKnownAs?: string[]; | ||
} | ||
interface JsonWebKey { | ||
interface JsonWebKey extends Extensible { | ||
alg?: string; | ||
@@ -64,3 +62,2 @@ crv?: string; | ||
y?: string; | ||
[x: string]: any; | ||
} | ||
@@ -108,3 +105,6 @@ export interface VerificationMethod { | ||
export declare function wrapLegacyResolver(resolve: LegacyDIDResolver): DIDResolver; | ||
export declare class Resolver { | ||
export declare type Resolvable = { | ||
resolve: (didUrl: string, options?: DIDResolutionOptions) => Promise<DIDResolutionResult>; | ||
}; | ||
export declare class Resolver implements Resolvable { | ||
private registry; | ||
@@ -111,0 +111,0 @@ private cache; |
@@ -1,2 +0,2 @@ | ||
function r(){return(r=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}).apply(this,arguments)}function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function t(){var r=new Map;return function(e,t){try{var n,o=function(o){if(n)return o;var i=r.get(e.didUrl);return void 0!==i?i:Promise.resolve(t()).then(function(t){var n;return"notFound"!==(null==(n=t.didResolutionMetadata)?void 0:n.error)&&r.set(e.didUrl,t),t})},i=function(){if(e.params&&"true"===e.params["no-cache"])return n=1,Promise.resolve(t())}();return Promise.resolve(i&&i.then?i.then(o):o(i))}catch(r){return Promise.reject(r)}}}function n(r,e){return e()}var o=new RegExp("^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$");function i(r){if(""===r||!r)return null;var t=r.match(o);if(t){var n={did:"did:"+t[1]+":"+t[2],method:t[1],id:t[2],didUrl:r};if(t[4]){var i=t[4].slice(1).split(";");n.params={};for(var a,u=function(r,t){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=r[Symbol.iterator]()).next.bind(n)}(i);!(a=u()).done;){var s=a.value.split("=");n.params[s[0]]=s[1]}}return t[6]&&(n.path=t[6]),t[7]&&(n.query=t[7].slice(1)),t[8]&&(n.fragment=t[8].slice(1)),n}return null}var a={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function u(e){return function(t,n,o,i){try{return Promise.resolve(function(i,u){try{var s=Promise.resolve(e(t,n,o)).then(function(e){return r({},a,{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:e})})}catch(r){return u(r)}return s&&s.then?s.then(void 0,u):s}(0,function(e){return r({},a,{didResolutionMetadata:{error:"notFound",message:e.toString()}})}))}catch(r){return Promise.reject(r)}}}exports.Resolver=function(){function e(r,e){var o=this;void 0===r&&(r={}),void 0===e&&(e={}),this.registry=r,this.cache=!0===e.cache?t():e.cache||n,e.legacyResolvers&&Object.keys(e.legacyResolvers).map(function(r){o.registry[r]||(o.registry[r]=u(e.legacyResolvers[r]))})}return e.prototype.resolve=function(e,t){void 0===t&&(t={});try{var n=this,o=i(e);if(null===o)return Promise.resolve(r({},a,{didResolutionMetadata:{error:"invalidDid"}}));var u=n.registry[o.method];return Promise.resolve(u?n.cache(o,function(){return u(o.did,o,n,t)}):r({},a,{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(r){return Promise.reject(r)}},e}(),exports.inMemoryCache=t,exports.noCache=n,exports.parse=i,exports.wrapLegacyResolver=u; | ||
function e(){const e=new Map;return function(t,r){try{let o;function n(n){if(o)return n;const i=e.get(t.didUrl);return void 0!==i?i:Promise.resolve(r()).then(function(r){var n;return"notFound"!==(null==(n=r.didResolutionMetadata)?void 0:n.error)&&e.set(t.didUrl,r),r})}const i=function(){if(t.params&&"true"===t.params["no-cache"])return o=1,Promise.resolve(r())}();return Promise.resolve(i&&i.then?i.then(n):n(i))}catch(e){return Promise.reject(e)}}}function t(e,t){return t()}const r=new RegExp("^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$");function n(e){if(""===e||!e)return null;const t=e.match(r);if(t){const r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){const e=t[4].slice(1).split(";");r.params={};for(const t of e){const e=t.split("=");r.params[e[0]]=e[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}const o={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function i(e){return function(t,r,n){try{return Promise.resolve(function(i,s){try{var c=Promise.resolve(e(t,r,n)).then(function(e){return{...o,didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:e}})}catch(e){return s(e)}return c&&c.then?c.then(void 0,s):c}(0,function(e){return{...o,didResolutionMetadata:{error:"notFound",message:e.toString()}}}))}catch(e){return Promise.reject(e)}}}exports.Resolver=class{constructor(r={},n={}){this.registry=r,this.cache=!0===n.cache?e():n.cache||t,n.legacyResolvers&&Object.keys(n.legacyResolvers).map(e=>{this.registry[e]||(this.registry[e]=i(n.legacyResolvers[e]))})}resolve(e,t={}){try{const r=this,i=n(e);if(null===i)return Promise.resolve({...o,didResolutionMetadata:{error:"invalidDid"}});const s=r.registry[i.method];return Promise.resolve(s?r.cache(i,()=>s(i.did,i,r,t)):{...o,didResolutionMetadata:{error:"unsupportedDidMethod"}})}catch(e){return Promise.reject(e)}}},exports.inMemoryCache=e,exports.noCache=t,exports.parse=n,exports.wrapLegacyResolver=i; | ||
//# sourceMappingURL=resolver.js.map |
@@ -1,2 +0,2 @@ | ||
function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(){const t=new Map;return async(e,r)=>{var n;if(e.params&&"true"===e.params["no-cache"])return await r();const a=t.get(e.didUrl);if(void 0!==a)return a;const i=await r();return"notFound"!==(null==(n=i.didResolutionMetadata)?void 0:n.error)&&t.set(e.didUrl,i),i}}function r(t,e){return e()}const n=new RegExp("^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$");function a(t){if(""===t||!t)return null;const e=t.match(n);if(e){const r={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:t};if(e[4]){const t=e[4].slice(1).split(";");r.params={};for(const e of t){const t=e.split("=");r.params[t[0]]=t[1]}}return e[6]&&(r.path=e[6]),e[7]&&(r.query=e[7].slice(1)),e[8]&&(r.fragment=e[8].slice(1)),r}return null}const i={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function o(e){return async(r,n,a,o)=>{try{const o=await e(r,n,a);return t({},i,{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:o})}catch(e){return t({},i,{didResolutionMetadata:{error:"notFound",message:e.toString()}})}}}class s{constructor(t={},n={}){this.registry=t,this.cache=!0===n.cache?e():n.cache||r,n.legacyResolvers&&Object.keys(n.legacyResolvers).map(t=>{this.registry[t]||(this.registry[t]=o(n.legacyResolvers[t]))})}async resolve(e,r={}){const n=a(e);if(null===n)return t({},i,{didResolutionMetadata:{error:"invalidDid"}});const o=this.registry[n.method];return o?this.cache(n,()=>o(n.did,n,this,r)):t({},i,{didResolutionMetadata:{error:"unsupportedDidMethod"}})}}export{s as Resolver,e as inMemoryCache,r as noCache,a as parse,o as wrapLegacyResolver}; | ||
function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(){const t=new Map;return async(e,r)=>{var n;if(e.params&&"true"===e.params["no-cache"])return await r();const a=t.get(e.didUrl);if(void 0!==a)return a;const i=await r();return"notFound"!==(null==(n=i.didResolutionMetadata)?void 0:n.error)&&t.set(e.didUrl,i),i}}function r(t,e){return e()}const n=new RegExp("^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$");function a(t){if(""===t||!t)return null;const e=t.match(n);if(e){const r={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:t};if(e[4]){const t=e[4].slice(1).split(";");r.params={};for(const e of t){const t=e.split("=");r.params[t[0]]=t[1]}}return e[6]&&(r.path=e[6]),e[7]&&(r.query=e[7].slice(1)),e[8]&&(r.fragment=e[8].slice(1)),r}return null}const i={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function o(e){return async(r,n,a)=>{try{const o=await e(r,n,a);return t({},i,{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:o})}catch(e){return t({},i,{didResolutionMetadata:{error:"notFound",message:e.toString()}})}}}class s{constructor(t={},n={}){this.registry=t,this.cache=!0===n.cache?e():n.cache||r,n.legacyResolvers&&Object.keys(n.legacyResolvers).map(t=>{this.registry[t]||(this.registry[t]=o(n.legacyResolvers[t]))})}async resolve(e,r={}){const n=a(e);if(null===n)return t({},i,{didResolutionMetadata:{error:"invalidDid"}});const o=this.registry[n.method];return o?this.cache(n,()=>o(n.did,n,this,r)):t({},i,{didResolutionMetadata:{error:"unsupportedDidMethod"}})}}export{s as Resolver,e as inMemoryCache,r as noCache,a as parse,o as wrapLegacyResolver}; | ||
//# sourceMappingURL=resolver.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e||self).didResolver={})}(this,function(e){function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function n(){var e=new Map;return function(r,t){try{var n,o=function(o){if(n)return o;var i=e.get(r.didUrl);return void 0!==i?i:Promise.resolve(t()).then(function(t){var n;return"notFound"!==(null==(n=t.didResolutionMetadata)?void 0:n.error)&&e.set(r.didUrl,t),t})},i=function(){if(r.params&&"true"===r.params["no-cache"])return n=1,Promise.resolve(t())}();return Promise.resolve(i&&i.then?i.then(o):o(i))}catch(e){return Promise.reject(e)}}}function o(e,r){return r()}var i=new RegExp("^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$");function a(e){if(""===e||!e)return null;var r=e.match(i);if(r){var n={did:"did:"+r[1]+":"+r[2],method:r[1],id:r[2],didUrl:e};if(r[4]){var o=r[4].slice(1).split(";");n.params={};for(var a,u=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(o);!(a=u()).done;){var d=a.value.split("=");n.params[d[0]]=d[1]}}return r[6]&&(n.path=r[6]),r[7]&&(n.query=r[7].slice(1)),r[8]&&(n.fragment=r[8].slice(1)),n}return null}var u={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function d(e){return function(t,n,o,i){try{return Promise.resolve(function(i,a){try{var d=Promise.resolve(e(t,n,o)).then(function(e){return r({},u,{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:e})})}catch(e){return a(e)}return d&&d.then?d.then(void 0,a):d}(0,function(e){return r({},u,{didResolutionMetadata:{error:"notFound",message:e.toString()}})}))}catch(e){return Promise.reject(e)}}}e.Resolver=function(){function e(e,r){var t=this;void 0===e&&(e={}),void 0===r&&(r={}),this.registry=e,this.cache=!0===r.cache?n():r.cache||o,r.legacyResolvers&&Object.keys(r.legacyResolvers).map(function(e){t.registry[e]||(t.registry[e]=d(r.legacyResolvers[e]))})}return e.prototype.resolve=function(e,t){void 0===t&&(t={});try{var n=this,o=a(e);if(null===o)return Promise.resolve(r({},u,{didResolutionMetadata:{error:"invalidDid"}}));var i=n.registry[o.method];return Promise.resolve(i?n.cache(o,function(){return i(o.did,o,n,t)}):r({},u,{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(e){return Promise.reject(e)}},e}(),e.inMemoryCache=n,e.noCache=o,e.parse=a,e.wrapLegacyResolver=d}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).didResolver={})}(this,function(e){function t(){const e=new Map;return function(t,r){try{let o;function n(n){if(o)return n;const i=e.get(t.didUrl);return void 0!==i?i:Promise.resolve(r()).then(function(r){var n;return"notFound"!==(null==(n=r.didResolutionMetadata)?void 0:n.error)&&e.set(t.didUrl,r),r})}const i=function(){if(t.params&&"true"===t.params["no-cache"])return o=1,Promise.resolve(r())}();return Promise.resolve(i&&i.then?i.then(n):n(i))}catch(e){return Promise.reject(e)}}}function r(e,t){return t()}const n="[a-zA-Z0-9_.%-]",o="[a-zA-Z0-9_.:%-]",i=new RegExp(`^did:([a-zA-Z0-9_]+):(${n}+(:${n}+)*)((;${o}+=${o}*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$`);function s(e){if(""===e||!e)return null;const t=e.match(i);if(t){const r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){const e=t[4].slice(1).split(";");r.params={};for(const t of e){const e=t.split("=");r.params[e[0]]=e[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}const c={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function d(e){return function(t,r,n){try{return Promise.resolve(function(o,i){try{var s=Promise.resolve(e(t,r,n)).then(function(e){return{...c,didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:e}})}catch(e){return i(e)}return s&&s.then?s.then(void 0,i):s}(0,function(e){return{...c,didResolutionMetadata:{error:"notFound",message:e.toString()}}}))}catch(e){return Promise.reject(e)}}}e.Resolver=class{constructor(e={},n={}){this.registry=e,this.cache=!0===n.cache?t():n.cache||r,n.legacyResolvers&&Object.keys(n.legacyResolvers).map(e=>{this.registry[e]||(this.registry[e]=d(n.legacyResolvers[e]))})}resolve(e,t={}){try{const r=this,n=s(e);if(null===n)return Promise.resolve({...c,didResolutionMetadata:{error:"invalidDid"}});const o=r.registry[n.method];return Promise.resolve(o?r.cache(n,()=>o(n.did,n,r,t)):{...c,didResolutionMetadata:{error:"unsupportedDidMethod"}})}catch(e){return Promise.reject(e)}}},e.inMemoryCache=t,e.noCache=r,e.parse=s,e.wrapLegacyResolver=d}); | ||
//# sourceMappingURL=resolver.umd.js.map |
{ | ||
"name": "did-resolver", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Resolve DID documents", | ||
"main": "lib/resolver.js", | ||
"main": "lib/resolver.umd.js", | ||
"source": "src/resolver.ts", | ||
"module": "lib/resolver.modern.js", | ||
"types": "lib/resolver.d.ts", | ||
"source": "src/resolver.ts", | ||
"module": "lib/resolver.esm.js", | ||
"sideEffects": false, | ||
@@ -15,3 +15,2 @@ "repository": { | ||
"files": [ | ||
"dist", | ||
"lib", | ||
@@ -21,2 +20,5 @@ "src" | ||
"author": "Pelle Braendgaard <pelle.braendgaard@consensys.net>", | ||
"contributors": [ | ||
"Mircea Nistor <mircea.nistor@mesh.xyz>" | ||
], | ||
"license": "Apache-2.0", | ||
@@ -26,4 +28,4 @@ "scripts": { | ||
"build:js": "microbundle", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"lint": "eslint \"src/**/*.[jt]s\"", | ||
"format": "prettier --write \"src/**/*.[jt]s\"", | ||
"prepare": "npm run build", | ||
@@ -36,39 +38,18 @@ "prepublishOnly": "npm test && npm run lint", | ||
"devDependencies": { | ||
"@commitlint/cli": "12.0.1", | ||
"@commitlint/config-conventional": "12.0.1", | ||
"@babel/preset-typescript": "7.13.0", | ||
"@semantic-release/changelog": "5.0.1", | ||
"@semantic-release/git": "9.0.0", | ||
"@types/jest": "26.0.20", | ||
"@types/node": "12.20.5", | ||
"@types/jest": "26.0.22", | ||
"@types/node": "14.14.36", | ||
"@typescript-eslint/eslint-plugin": "4.19.0", | ||
"@typescript-eslint/parser": "4.19.0", | ||
"codecov": "3.8.1", | ||
"eslint": "7.22.0", | ||
"eslint-config-prettier": "8.1.0", | ||
"jest": "26.6.3", | ||
"microbundle": "0.13.0", | ||
"prettier": "2.2.1", | ||
"regenerator-runtime": "0.13.7", | ||
"semantic-release": "17.4.2", | ||
"ts-jest": "26.5.3", | ||
"tslint": "6.1.3", | ||
"tslint-config-prettier": "1.18.0", | ||
"tslint-eslint-rules": "5.4.0", | ||
"typescript": "4.2.3" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json" | ||
], | ||
"coverageDirectory": "./coverage/", | ||
"collectCoverageFrom": [ | ||
"src/**/*.{ts,tsx}", | ||
"!src/**/*.d.ts", | ||
"!**/node_modules/**" | ||
] | ||
}, | ||
"resolutions": { | ||
@@ -75,0 +56,0 @@ "@babel/core": "7.13.10" |
@@ -1,2 +0,2 @@ | ||
// Copyright 2018 ConsenSys AG | ||
// Copyright 2018 Consensys AG | ||
@@ -15,2 +15,5 @@ // Licensed under the Apache License, Version 2.0(the "License"); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type Extensible = Record<string, any> | ||
export interface DIDResolutionResult { | ||
@@ -22,8 +25,7 @@ didResolutionMetadata: DIDResolutionMetadata | ||
export interface DIDResolutionOptions { | ||
export interface DIDResolutionOptions extends Extensible { | ||
accept?: string | ||
[x: string]: any | ||
} | ||
export interface DIDResolutionMetadata { | ||
export interface DIDResolutionMetadata extends Extensible { | ||
contentType?: string | ||
@@ -36,6 +38,5 @@ error?: | ||
| string | ||
[x: string]: any | ||
} | ||
export interface DIDDocumentMetadata { | ||
export interface DIDDocumentMetadata extends Extensible { | ||
created?: string | ||
@@ -49,7 +50,6 @@ updated?: string | ||
canonicalId?: string | ||
[x: string]: any | ||
} | ||
export interface DIDDocument { | ||
'@context'?: 'https://w3id.org/did/v1' | string | string[] | ||
'@context'?: 'https://www.w3.org/ns/did/v1' | string | string[] | ||
id: string | ||
@@ -78,3 +78,3 @@ alsoKnownAs?: string[] | ||
interface JsonWebKey { | ||
interface JsonWebKey extends Extensible { | ||
alg?: string | ||
@@ -91,3 +91,2 @@ crv?: string | ||
y?: string | ||
[x: string]: any | ||
} | ||
@@ -153,3 +152,3 @@ | ||
const cache: Map<string, DIDResolutionResult> = new Map() | ||
return async (parsed, resolve) => { | ||
return async (parsed: ParsedDID, resolve) => { | ||
if (parsed.params && parsed.params['no-cache'] === 'true') | ||
@@ -220,3 +219,3 @@ return await resolve() | ||
export function wrapLegacyResolver(resolve: LegacyDIDResolver): DIDResolver { | ||
return async (did, parsed, resolver, options) => { | ||
return async (did, parsed, resolver) => { | ||
try { | ||
@@ -241,3 +240,10 @@ const doc = await resolve(did, parsed, resolver) | ||
export class Resolver { | ||
export type Resolvable = { | ||
resolve: ( | ||
didUrl: string, | ||
options?: DIDResolutionOptions | ||
) => Promise<DIDResolutionResult> | ||
} | ||
export class Resolver implements Resolvable { | ||
private registry: ResolverRegistry | ||
@@ -254,2 +260,3 @@ private cache: DIDCache | ||
this.registry[methodName] = wrapLegacyResolver( | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
options.legacyResolvers![methodName] | ||
@@ -256,0 +263,0 @@ ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
15
3
847
85608
13
1