@ew-did-registry/did
Advanced tools
Comparing version 0.6.3-alpha.479.0 to 0.6.3-alpha.491.0
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var t={920:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Chain=e.Methods=e.DID=void 0;const o=r(622);Object.defineProperty(e,"Methods",{enumerable:!0,get:function(){return o.Methods}}),Object.defineProperty(e,"Chain",{enumerable:!0,get:function(){return o.Chain}}),e.DID=class{constructor(){this._dids=new Map}get(t){return this._dids.get(t)}set(t,e,r){return t.startsWith("did:")?this._setDid(t):void 0!==r?this._setDid(`did:${t}:${e}:${r}`):this._setDid(`did:${t}:${e}`)}_setDid(t){if(t.split(":").length>3){const[,e,r,n]=t.split(":");if(void 0===n)throw new Error("Identity cannot be undefined");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(`${e}:${r}`))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(void 0!==n&&!o.DID_SCHEME_PATTERNS.ID.test(n))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}{const[,e,r]=t.split(":");if(void 0===r)throw new Error("DID must consist of three parts separated by a colon");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(e))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(!o.DID_SCHEME_PATTERNS.ID.test(r))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}}},i(r(931),e),i(r(503),e)},622:(t,e)=>{var r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.DID_SCHEME_PATTERNS=e.Chain=e.Methods=void 0,(n=e.Methods||(e.Methods={})).Erc725="erc725",n.Erc1056="ethr",n.Jolocom="jolo",(r=e.Chain||(e.Chain={})).EWC="ewc",r.VOLTA="volta",e.DID_SCHEME_PATTERNS={NETWORK:/^[a-z0-9]+?(:)?[a-z0-9]+?$/,ID:/^[\w.-]*(:[\w.-]*)*$/}},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDIDChain=e.getDIDMethod=e.didPattern=void 0,e.didPattern="^did:[a-z0-9]+?:?[a-z0-9]+?:(0x[A-Fa-f0-9]{40})$",e.getDIDMethod=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");const[,r]=t.split(":");return r},e.getDIDChain=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");if(t.split(":").length>3){const[,,e]=t.split(":");return{foundChainInfo:!0,chainInfo:e}}return{foundChainInfo:!1,chainInfo:void 0}}},931:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isValidErc1056VOLTA=e.isValidErc1056EWC=e.isValidErc1056=e.DIDPatternVOLTA=e.DIDPatternEWC=e.DIDPattern=e.ethAddrPattern=void 0;const n=r(622);e.ethAddrPattern="0x[A-Fa-f0-9]{40}",e.DIDPattern=`^did:${n.Methods.Erc1056}:(${e.ethAddrPattern})$`,e.DIDPatternEWC=`^did:${n.Methods.Erc1056}:${n.Chain.EWC}:(${e.ethAddrPattern})$`,e.DIDPatternVOLTA=`^did:${n.Methods.Erc1056}:${n.Chain.VOLTA}:(${e.ethAddrPattern})$`,e.isValidErc1056=function(t){return new RegExp(e.DIDPattern).test(t)},e.isValidErc1056EWC=function(t){return new RegExp(e.DIDPatternEWC).test(t)},e.isValidErc1056VOLTA=function(t){return new RegExp(e.DIDPatternVOLTA).test(t)}}},e={},r=function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(920),n=exports;for(var i in r)n[i]=r[i];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})(); | ||
(()=>{"use strict";var t={920:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Chain=e.Methods=e.DID=void 0;const o=r(622);Object.defineProperty(e,"Methods",{enumerable:!0,get:function(){return o.Methods}}),Object.defineProperty(e,"Chain",{enumerable:!0,get:function(){return o.Chain}}),e.DID=class{constructor(){this._dids=new Map}get(t){return this._dids.get(t)}set(t,e,r){return t.startsWith("did:")?this._setDid(t):void 0!==r?this._setDid(`did:${t}:${e}:${r}`):this._setDid(`did:${t}:${e}`)}_setDid(t){if(t.split(":").length>3){const[,e,r,n]=t.split(":");if(void 0===n)throw new Error("Identity cannot be undefined");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(`${e}:${r}`))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(void 0!==n&&!o.DID_SCHEME_PATTERNS.ID.test(n))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}{const[,e,r]=t.split(":");if(void 0===r)throw new Error("DID must consist of three parts separated by a colon");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(e))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(!o.DID_SCHEME_PATTERNS.ID.test(r))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}}},i(r(931),e),i(r(503),e)},622:(t,e)=>{var r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.DID_SCHEME_PATTERNS=e.Chain=e.Methods=void 0,(n=e.Methods||(e.Methods={})).Erc725="erc725",n.Erc1056="ethr",n.Jolocom="jolo",(r=e.Chain||(e.Chain={})).EWC="ewc",r.VOLTA="volta",e.DID_SCHEME_PATTERNS={NETWORK:/^[a-z0-9]+?(:)?[a-z0-9]+?$/,ID:/^[\w.-]*(:[\w.-]*)*$/}},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDIDChain=e.getDIDMethod=e.didPattern=void 0,e.didPattern="^did:[a-z0-9]+?:?[a-z0-9]+?:(0x[A-Fa-f0-9]{40})$",e.getDIDMethod=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");const[,r]=t.split(":");return r},e.getDIDChain=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");if(t.split(":").length>3){const[,,e]=t.split(":");return{foundChainInfo:!0,chainInfo:e}}return{foundChainInfo:!1,chainInfo:void 0}}},931:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isValidErc1056VOLTA=e.isValidErc1056EWC=e.isValidErc1056Mainnet=e.isValidErc1056=e.DIDPatternVOLTA=e.DIDPatternEWC=e.DIDPatternMainnet=e.DIDPattern=e.ethAddrPattern=void 0;const n=r(622);e.ethAddrPattern="0x[A-Fa-f0-9]{40}",e.DIDPattern=`^did:${n.Methods.Erc1056}:([A-Za-z0-9]+:)?(${e.ethAddrPattern})$`,e.DIDPatternMainnet=`^did:${n.Methods.Erc1056}:(${e.ethAddrPattern})$`,e.DIDPatternEWC=`^did:${n.Methods.Erc1056}:${n.Chain.EWC}:(${e.ethAddrPattern})$`,e.DIDPatternVOLTA=`^did:${n.Methods.Erc1056}:${n.Chain.VOLTA}:(${e.ethAddrPattern})$`,e.isValidErc1056=function(t){return new RegExp(e.DIDPattern).test(t)},e.isValidErc1056Mainnet=function(t){return new RegExp(e.DIDPatternMainnet).test(t)},e.isValidErc1056EWC=function(t){return new RegExp(e.DIDPatternEWC).test(t)},e.isValidErc1056VOLTA=function(t){return new RegExp(e.DIDPatternVOLTA).test(t)}}},e={},r=function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(920),n=exports;for(var i in r)n[i]=r[i];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var t={920:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Chain=e.Methods=e.DID=void 0;const o=r(622);Object.defineProperty(e,"Methods",{enumerable:!0,get:function(){return o.Methods}}),Object.defineProperty(e,"Chain",{enumerable:!0,get:function(){return o.Chain}}),e.DID=class{constructor(){this._dids=new Map}get(t){return this._dids.get(t)}set(t,e,r){return t.startsWith("did:")?this._setDid(t):void 0!==r?this._setDid(`did:${t}:${e}:${r}`):this._setDid(`did:${t}:${e}`)}_setDid(t){if(t.split(":").length>3){const[,e,r,n]=t.split(":");if(void 0===n)throw new Error("Identity cannot be undefined");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(`${e}:${r}`))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(void 0!==n&&!o.DID_SCHEME_PATTERNS.ID.test(n))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}{const[,e,r]=t.split(":");if(void 0===r)throw new Error("DID must consist of three parts separated by a colon");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(e))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(!o.DID_SCHEME_PATTERNS.ID.test(r))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}}},i(r(931),e),i(r(503),e)},622:(t,e)=>{var r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.DID_SCHEME_PATTERNS=e.Chain=e.Methods=void 0,(n=e.Methods||(e.Methods={})).Erc725="erc725",n.Erc1056="ethr",n.Jolocom="jolo",(r=e.Chain||(e.Chain={})).EWC="ewc",r.VOLTA="volta",e.DID_SCHEME_PATTERNS={NETWORK:/^[a-z0-9]+?(:)?[a-z0-9]+?$/,ID:/^[\w.-]*(:[\w.-]*)*$/}},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDIDChain=e.getDIDMethod=e.didPattern=void 0,e.didPattern="^did:[a-z0-9]+?:?[a-z0-9]+?:(0x[A-Fa-f0-9]{40})$",e.getDIDMethod=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");const[,r]=t.split(":");return r},e.getDIDChain=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");if(t.split(":").length>3){const[,,e]=t.split(":");return{foundChainInfo:!0,chainInfo:e}}return{foundChainInfo:!1,chainInfo:void 0}}},931:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isValidErc1056VOLTA=e.isValidErc1056EWC=e.isValidErc1056=e.DIDPatternVOLTA=e.DIDPatternEWC=e.DIDPattern=e.ethAddrPattern=void 0;const n=r(622);e.ethAddrPattern="0x[A-Fa-f0-9]{40}",e.DIDPattern=`^did:${n.Methods.Erc1056}:(${e.ethAddrPattern})$`,e.DIDPatternEWC=`^did:${n.Methods.Erc1056}:${n.Chain.EWC}:(${e.ethAddrPattern})$`,e.DIDPatternVOLTA=`^did:${n.Methods.Erc1056}:${n.Chain.VOLTA}:(${e.ethAddrPattern})$`,e.isValidErc1056=function(t){return new RegExp(e.DIDPattern).test(t)},e.isValidErc1056EWC=function(t){return new RegExp(e.DIDPatternEWC).test(t)},e.isValidErc1056VOLTA=function(t){return new RegExp(e.DIDPatternVOLTA).test(t)}}},e={},r=function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(920),n=exports;for(var i in r)n[i]=r[i];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})(); | ||
(()=>{"use strict";var t={920:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Chain=e.Methods=e.DID=void 0;const o=r(622);Object.defineProperty(e,"Methods",{enumerable:!0,get:function(){return o.Methods}}),Object.defineProperty(e,"Chain",{enumerable:!0,get:function(){return o.Chain}}),e.DID=class{constructor(){this._dids=new Map}get(t){return this._dids.get(t)}set(t,e,r){return t.startsWith("did:")?this._setDid(t):void 0!==r?this._setDid(`did:${t}:${e}:${r}`):this._setDid(`did:${t}:${e}`)}_setDid(t){if(t.split(":").length>3){const[,e,r,n]=t.split(":");if(void 0===n)throw new Error("Identity cannot be undefined");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(`${e}:${r}`))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(void 0!==n&&!o.DID_SCHEME_PATTERNS.ID.test(n))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}{const[,e,r]=t.split(":");if(void 0===r)throw new Error("DID must consist of three parts separated by a colon");if(!o.DID_SCHEME_PATTERNS.NETWORK.test(e))throw new Error("Network must not be empty and consist only of lowcase alphanumerical characters");if(!o.DID_SCHEME_PATTERNS.ID.test(r))throw new Error("Id must consist only of alphanumerical characters, dots, minuses and underscores");return this._dids.set(e,t),this}}},i(r(931),e),i(r(503),e)},622:(t,e)=>{var r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.DID_SCHEME_PATTERNS=e.Chain=e.Methods=void 0,(n=e.Methods||(e.Methods={})).Erc725="erc725",n.Erc1056="ethr",n.Jolocom="jolo",(r=e.Chain||(e.Chain={})).EWC="ewc",r.VOLTA="volta",e.DID_SCHEME_PATTERNS={NETWORK:/^[a-z0-9]+?(:)?[a-z0-9]+?$/,ID:/^[\w.-]*(:[\w.-]*)*$/}},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDIDChain=e.getDIDMethod=e.didPattern=void 0,e.didPattern="^did:[a-z0-9]+?:?[a-z0-9]+?:(0x[A-Fa-f0-9]{40})$",e.getDIDMethod=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");const[,r]=t.split(":");return r},e.getDIDChain=function(t){if(!t.match(e.didPattern))throw new Error("Invalid DID");if(t.split(":").length>3){const[,,e]=t.split(":");return{foundChainInfo:!0,chainInfo:e}}return{foundChainInfo:!1,chainInfo:void 0}}},931:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isValidErc1056VOLTA=e.isValidErc1056EWC=e.isValidErc1056Mainnet=e.isValidErc1056=e.DIDPatternVOLTA=e.DIDPatternEWC=e.DIDPatternMainnet=e.DIDPattern=e.ethAddrPattern=void 0;const n=r(622);e.ethAddrPattern="0x[A-Fa-f0-9]{40}",e.DIDPattern=`^did:${n.Methods.Erc1056}:([A-Za-z0-9]+:)?(${e.ethAddrPattern})$`,e.DIDPatternMainnet=`^did:${n.Methods.Erc1056}:(${e.ethAddrPattern})$`,e.DIDPatternEWC=`^did:${n.Methods.Erc1056}:${n.Chain.EWC}:(${e.ethAddrPattern})$`,e.DIDPatternVOLTA=`^did:${n.Methods.Erc1056}:${n.Chain.VOLTA}:(${e.ethAddrPattern})$`,e.isValidErc1056=function(t){return new RegExp(e.DIDPattern).test(t)},e.isValidErc1056Mainnet=function(t){return new RegExp(e.DIDPatternMainnet).test(t)},e.isValidErc1056EWC=function(t){return new RegExp(e.DIDPatternEWC).test(t)},e.isValidErc1056VOLTA=function(t){return new RegExp(e.DIDPatternVOLTA).test(t)}}},e={},r=function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}(920),n=exports;for(var i in r)n[i]=r[i];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})(); |
export declare const ethAddrPattern = "0x[A-Fa-f0-9]{40}"; | ||
export declare const DIDPattern: string; | ||
export declare const DIDPatternMainnet: string; | ||
export declare const DIDPatternEWC: string; | ||
export declare const DIDPatternVOLTA: string; | ||
export declare function isValidErc1056(did: string): boolean; | ||
export declare function isValidErc1056Mainnet(did: string): boolean; | ||
export declare function isValidErc1056EWC(did: string): boolean; | ||
export declare function isValidErc1056VOLTA(did: string): boolean; |
{ | ||
"name": "@ew-did-registry/did", | ||
"version": "0.6.3-alpha.479.0", | ||
"version": "0.6.3-alpha.491.0", | ||
"publishConfig": { | ||
@@ -30,3 +30,3 @@ "access": "public", | ||
"devDependencies": { | ||
"@ew-did-registry/keys": "0.6.3-alpha.479.0", | ||
"@ew-did-registry/keys": "0.6.3-alpha.491.0", | ||
"node-polyfill-webpack-plugin": "^1.1.4", | ||
@@ -46,3 +46,3 @@ "ts-loader": "^9.2.6", | ||
}, | ||
"gitHead": "6799fe007c1dc9a1e0b43f973fb516938e545673" | ||
"gitHead": "27dde73ed75f9c9661fb55da323a494393ccd28a" | ||
} |
import { Methods, Chain } from '../models'; | ||
export const ethAddrPattern = '0x[A-Fa-f0-9]{40}'; | ||
export const DIDPattern = `^did:${Methods.Erc1056}:(${ethAddrPattern})$`; | ||
export const DIDPattern = `^did:${Methods.Erc1056}:([A-Za-z0-9]+:)?(${ethAddrPattern})$`; | ||
export const DIDPatternMainnet = `^did:${Methods.Erc1056}:(${ethAddrPattern})$`; | ||
export const DIDPatternEWC = `^did:${Methods.Erc1056}:${Chain.EWC}:(${ethAddrPattern})$`; | ||
@@ -12,2 +13,6 @@ export const DIDPatternVOLTA = `^did:${Methods.Erc1056}:${Chain.VOLTA}:(${ethAddrPattern})$`; | ||
export function isValidErc1056Mainnet(did: string): boolean { | ||
return new RegExp(DIDPatternMainnet).test(did); | ||
} | ||
export function isValidErc1056EWC(did: string): boolean { | ||
@@ -14,0 +19,0 @@ return new RegExp(DIDPatternEWC).test(did); |
@@ -6,2 +6,3 @@ import { expect } from 'chai'; | ||
isValidErc1056, | ||
isValidErc1056Mainnet, | ||
Chain, | ||
@@ -17,2 +18,3 @@ isValidErc1056EWC, | ||
expect(isValidErc1056(did)).true; | ||
expect(isValidErc1056Mainnet(did)).true; | ||
}); | ||
@@ -25,2 +27,3 @@ | ||
expect(isValidErc1056EWC(did)).true; | ||
expect(isValidErc1056(did)).true; | ||
}); | ||
@@ -27,0 +30,0 @@ |
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
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
63188
535