Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ethr-did-resolver

Package Overview
Dependencies
Maintainers
0
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethr-did-resolver - npm Package Compare versions

Comparing version 10.1.10 to 11.0.0-alpha.2

lib/config/EthereumDIDRegistry.d.ts

2

lib/configuration.d.ts
import { Contract, Provider } from 'ethers';
import { EthrDidRegistryDeployment } from './config/deployments';
import { EthrDidRegistryDeployment } from './config/deployments.js';
/**

@@ -4,0 +4,0 @@ * A configuration entry for an ethereum network

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -9,5 +6,5 @@ exports.getContractForNetwork = getContractForNetwork;

const ethers_1 = require("ethers");
const helpers_1 = require("./helpers");
const deployments_1 = require("./config/deployments");
const EthereumDIDRegistry_json_1 = __importDefault(require("./config/EthereumDIDRegistry.json"));
const helpers_js_1 = require("./helpers.js");
const deployments_js_1 = require("./config/deployments.js");
const EthereumDIDRegistry_js_1 = require("./config/EthereumDIDRegistry.js");
const infuraNames = {

@@ -26,3 +23,3 @@ polygon: 'matic',

.map((n) => {
const existingDeployment = deployments_1.deployments.find((d) => d.name === n);
const existingDeployment = deployments_js_1.deployments.find((d) => d.name === n);
if (existingDeployment && existingDeployment.name) {

@@ -41,3 +38,3 @@ const infuraName = infuraNames[existingDeployment.name] || existingDeployment.name;

if (conf.rpcUrl) {
const chainIdRaw = conf.chainId ? conf.chainId : deployments_1.deployments.find((d) => d.name === conf.name)?.chainId;
const chainIdRaw = conf.chainId ? conf.chainId : deployments_js_1.deployments.find((d) => d.name === conf.name)?.chainId;
const chainId = chainIdRaw ? BigInt(chainIdRaw) : chainIdRaw;

@@ -50,4 +47,4 @@ provider = new ethers_1.JsonRpcProvider(conf.rpcUrl, chainId || 'any');

}
const contract = ethers_1.ContractFactory.fromSolidity(EthereumDIDRegistry_json_1.default)
.attach(conf.registry || helpers_1.DEFAULT_REGISTRY_ADDRESS)
const contract = ethers_1.ContractFactory.fromSolidity(EthereumDIDRegistry_js_1.EthereumDIDRegistry)
.attach(conf.registry || helpers_js_1.DEFAULT_REGISTRY_ADDRESS)
.connect(provider);

@@ -58,3 +55,3 @@ return contract;

const networks = {};
const chainId = net.chainId || deployments_1.deployments.find((d) => net.name && (d.name === net.name || d.description === net.name))?.chainId;
const chainId = net.chainId || deployments_js_1.deployments.find((d) => net.name && (d.name === net.name || d.description === net.name))?.chainId;
if (chainId) {

@@ -61,0 +58,0 @@ if (net.name) {

import { AddressLike, BlockTag, Contract, Overrides, Provider, Signer, TransactionReceipt } from 'ethers';
import { address, MetaSignature } from './helpers';
import { address, MetaSignature } from './helpers.js';
/**

@@ -4,0 +4,0 @@ * A class that can be used to interact with the ERC1056 contract on behalf of a local controller key-pair

@@ -5,4 +5,4 @@ "use strict";

const ethers_1 = require("ethers");
const configuration_1 = require("./configuration");
const helpers_1 = require("./helpers");
const configuration_js_1 = require("./configuration.js");
const helpers_js_1 = require("./helpers.js");
/**

@@ -29,6 +29,6 @@ * A class that can be used to interact with the ERC1056 contract on behalf of a local controller key-pair

*/
constructor(identifier, contract, signer, chainNameOrId = 'mainnet', provider, rpcUrl, registry = helpers_1.DEFAULT_REGISTRY_ADDRESS, legacyNonce = true) {
constructor(identifier, contract, signer, chainNameOrId = 'mainnet', provider, rpcUrl, registry = helpers_js_1.DEFAULT_REGISTRY_ADDRESS, legacyNonce = true) {
this.legacyNonce = legacyNonce;
// initialize identifier
const { address, publicKey, network } = (0, helpers_1.interpretIdentifier)(identifier);
const { address, publicKey, network } = (0, helpers_js_1.interpretIdentifier)(identifier);
const net = network || chainNameOrId;

@@ -41,3 +41,3 @@ // initialize contract connection

const prov = provider || signer?.provider;
this.contract = (0, configuration_1.getContractForNetwork)({ name: net, provider: prov, registry, rpcUrl });
this.contract = (0, configuration_js_1.getContractForNetwork)({ name: net, provider: prov, registry, rpcUrl });
}

@@ -100,3 +100,3 @@ else {

const dataToHash = (0, ethers_1.concat)([
helpers_1.MESSAGE_PREFIX,
helpers_js_1.MESSAGE_PREFIX,
await this.contract.getAddress(),

@@ -126,3 +126,3 @@ paddedNonce,

delete overrides.from;
const delegateTypeBytes = (0, helpers_1.stringToBytes32)(delegateType);
const delegateTypeBytes = (0, helpers_js_1.stringToBytes32)(delegateType);
const addDelegateTx = await contract.addDelegate(this.address, delegateTypeBytes, delegateAddress, exp, overrides);

@@ -134,3 +134,3 @@ return await addDelegateTx.wait();

const dataToHash = (0, ethers_1.concat)([
helpers_1.MESSAGE_PREFIX,
helpers_js_1.MESSAGE_PREFIX,
await this.contract.getAddress(),

@@ -155,3 +155,3 @@ paddedNonce,

delete overrides.from;
const delegateTypeBytes = (0, helpers_1.stringToBytes32)(delegateType);
const delegateTypeBytes = (0, helpers_js_1.stringToBytes32)(delegateType);
const addDelegateTx = await contract.addDelegateSigned(this.address, metaSignature.sigV, metaSignature.sigR, metaSignature.sigS, delegateTypeBytes, delegateAddress, exp, overrides);

@@ -165,3 +165,3 @@ return await addDelegateTx.wait();

};
delegateType = delegateType.startsWith('0x') ? delegateType : (0, helpers_1.stringToBytes32)(delegateType);
delegateType = delegateType.startsWith('0x') ? delegateType : (0, helpers_js_1.stringToBytes32)(delegateType);
const contract = await this.attachContract(overrides.from ?? undefined);

@@ -175,3 +175,3 @@ delete overrides.from;

const dataToHash = (0, ethers_1.concat)([
helpers_1.MESSAGE_PREFIX,
helpers_js_1.MESSAGE_PREFIX,
await this.contract.getAddress(),

@@ -189,3 +189,3 @@ paddedNonce,

};
delegateType = delegateType.startsWith('0x') ? delegateType : (0, helpers_1.stringToBytes32)(delegateType);
delegateType = delegateType.startsWith('0x') ? delegateType : (0, helpers_js_1.stringToBytes32)(delegateType);
const contract = await this.attachContract(overrides.from ?? undefined);

@@ -202,3 +202,3 @@ delete overrides.from;

};
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_1.stringToBytes32)(attrName);
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_js_1.stringToBytes32)(attrName);
attrValue = attrValue.startsWith('0x') ? attrValue : (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(attrValue));

@@ -214,3 +214,3 @@ const contract = await this.attachContract(overrides.from ?? undefined);

const dataToHash = (0, ethers_1.concat)([
helpers_1.MESSAGE_PREFIX,
helpers_js_1.MESSAGE_PREFIX,
await this.contract.getAddress(),

@@ -234,3 +234,3 @@ paddedNonce,

};
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_1.stringToBytes32)(attrName);
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_js_1.stringToBytes32)(attrName);
attrValue = attrValue.startsWith('0x') ? attrValue : (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(attrValue));

@@ -248,3 +248,3 @@ const contract = await this.attachContract(overrides.from ?? undefined);

};
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_1.stringToBytes32)(attrName);
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_js_1.stringToBytes32)(attrName);
attrValue = attrValue.startsWith('0x') ? attrValue : (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(attrValue));

@@ -260,3 +260,3 @@ const contract = await this.attachContract(overrides.from ?? undefined);

const dataToHash = (0, ethers_1.concat)([
helpers_1.MESSAGE_PREFIX,
helpers_js_1.MESSAGE_PREFIX,
await this.contract.getAddress(),

@@ -292,3 +292,3 @@ paddedNonce,

};
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_1.stringToBytes32)(attrName);
attrName = attrName.startsWith('0x') ? attrName : (0, helpers_js_1.stringToBytes32)(attrName);
attrValue = attrValue.startsWith('0x') ? attrValue : (0, ethers_1.hexlify)((0, ethers_1.toUtf8Bytes)(attrValue));

@@ -295,0 +295,0 @@ const contract = await this.attachContract(overrides.from ?? undefined);

@@ -1,5 +0,6 @@

import { getResolver } from './resolver';
import { EthrDidController } from './controller';
import { bytes32toString, DEFAULT_REGISTRY_ADDRESS, Errors, identifierMatcher, interpretIdentifier, legacyAlgoMap, legacyAttrTypes, stringToBytes32, verificationMethodTypes, MetaSignature } from './helpers';
import { default as EthereumDIDRegistry } from './config/EthereumDIDRegistry.json';
import { getResolver } from './resolver.js';
import { EthrDidController } from './controller.js';
import { bytes32toString, DEFAULT_REGISTRY_ADDRESS, Errors, identifierMatcher, interpretIdentifier, legacyAlgoMap, legacyAttrTypes, stringToBytes32, verificationMethodTypes, MetaSignature } from './helpers.js';
import { EthereumDIDRegistry } from './config/EthereumDIDRegistry.js';
import { deployments, EthrDidRegistryDeployment } from './config/deployments.js';
export { DEFAULT_REGISTRY_ADDRESS as REGISTRY, getResolver, bytes32toString, stringToBytes32, EthrDidController,

@@ -9,4 +10,53 @@ /**@deprecated */

/**@deprecated */
legacyAttrTypes as attrTypes, verificationMethodTypes, identifierMatcher, interpretIdentifier, Errors, EthereumDIDRegistry, MetaSignature, };
export { deployments, EthrDidRegistryDeployment } from './config/deployments';
legacyAttrTypes as attrTypes, verificationMethodTypes, identifierMatcher, interpretIdentifier, Errors, EthereumDIDRegistry, MetaSignature, deployments, EthrDidRegistryDeployment, };
declare const _default: {
REGISTRY: string;
getResolver: typeof getResolver;
bytes32toString: typeof bytes32toString;
stringToBytes32: typeof stringToBytes32;
EthrDidController: typeof EthrDidController;
verificationMethodTypes: typeof verificationMethodTypes;
identifierMatcher: RegExp;
interpretIdentifier: typeof interpretIdentifier;
Errors: typeof Errors;
EthereumDIDRegistry: {
_format: string;
contractName: string;
sourceName: string;
abi: ({
anonymous: boolean;
inputs: {
indexed: boolean;
internalType: string;
name: string;
type: string;
}[];
name: string;
type: string;
outputs?: undefined;
stateMutability?: undefined;
} | {
inputs: {
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: {
internalType: string;
name: string;
type: string;
}[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
bytecode: string;
deployedBytecode: string;
linkReferences: {};
deployedLinkReferences: {};
};
deployments: EthrDidRegistryDeployment[];
};
export default _default;
//# sourceMappingURL=index.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.deployments = exports.EthereumDIDRegistry = exports.Errors = exports.interpretIdentifier = exports.identifierMatcher = exports.verificationMethodTypes = exports.attrTypes = exports.delegateTypes = exports.EthrDidController = exports.stringToBytes32 = exports.bytes32toString = exports.getResolver = exports.REGISTRY = void 0;
const resolver_1 = require("./resolver");
Object.defineProperty(exports, "getResolver", { enumerable: true, get: function () { return resolver_1.getResolver; } });
const controller_1 = require("./controller");
Object.defineProperty(exports, "EthrDidController", { enumerable: true, get: function () { return controller_1.EthrDidController; } });
const helpers_1 = require("./helpers");
Object.defineProperty(exports, "bytes32toString", { enumerable: true, get: function () { return helpers_1.bytes32toString; } });
Object.defineProperty(exports, "REGISTRY", { enumerable: true, get: function () { return helpers_1.DEFAULT_REGISTRY_ADDRESS; } });
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return helpers_1.Errors; } });
Object.defineProperty(exports, "identifierMatcher", { enumerable: true, get: function () { return helpers_1.identifierMatcher; } });
Object.defineProperty(exports, "interpretIdentifier", { enumerable: true, get: function () { return helpers_1.interpretIdentifier; } });
Object.defineProperty(exports, "delegateTypes", { enumerable: true, get: function () { return helpers_1.legacyAlgoMap; } });
Object.defineProperty(exports, "attrTypes", { enumerable: true, get: function () { return helpers_1.legacyAttrTypes; } });
Object.defineProperty(exports, "stringToBytes32", { enumerable: true, get: function () { return helpers_1.stringToBytes32; } });
Object.defineProperty(exports, "verificationMethodTypes", { enumerable: true, get: function () { return helpers_1.verificationMethodTypes; } });
const EthereumDIDRegistry_json_1 = __importDefault(require("./config/EthereumDIDRegistry.json"));
Object.defineProperty(exports, "EthereumDIDRegistry", { enumerable: true, get: function () { return EthereumDIDRegistry_json_1.default; } });
var deployments_1 = require("./config/deployments");
Object.defineProperty(exports, "deployments", { enumerable: true, get: function () { return deployments_1.deployments; } });
const resolver_js_1 = require("./resolver.js");
Object.defineProperty(exports, "getResolver", { enumerable: true, get: function () { return resolver_js_1.getResolver; } });
const controller_js_1 = require("./controller.js");
Object.defineProperty(exports, "EthrDidController", { enumerable: true, get: function () { return controller_js_1.EthrDidController; } });
const helpers_js_1 = require("./helpers.js");
Object.defineProperty(exports, "bytes32toString", { enumerable: true, get: function () { return helpers_js_1.bytes32toString; } });
Object.defineProperty(exports, "REGISTRY", { enumerable: true, get: function () { return helpers_js_1.DEFAULT_REGISTRY_ADDRESS; } });
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return helpers_js_1.Errors; } });
Object.defineProperty(exports, "identifierMatcher", { enumerable: true, get: function () { return helpers_js_1.identifierMatcher; } });
Object.defineProperty(exports, "interpretIdentifier", { enumerable: true, get: function () { return helpers_js_1.interpretIdentifier; } });
Object.defineProperty(exports, "delegateTypes", { enumerable: true, get: function () { return helpers_js_1.legacyAlgoMap; } });
Object.defineProperty(exports, "attrTypes", { enumerable: true, get: function () { return helpers_js_1.legacyAttrTypes; } });
Object.defineProperty(exports, "stringToBytes32", { enumerable: true, get: function () { return helpers_js_1.stringToBytes32; } });
Object.defineProperty(exports, "verificationMethodTypes", { enumerable: true, get: function () { return helpers_js_1.verificationMethodTypes; } });
const EthereumDIDRegistry_js_1 = require("./config/EthereumDIDRegistry.js");
Object.defineProperty(exports, "EthereumDIDRegistry", { enumerable: true, get: function () { return EthereumDIDRegistry_js_1.EthereumDIDRegistry; } });
const deployments_js_1 = require("./config/deployments.js");
Object.defineProperty(exports, "deployments", { enumerable: true, get: function () { return deployments_js_1.deployments; } });
// workaround for esbuild/vite/hermes issues
// This should not be needed once we move to ESM only build outputs.
// This library now builds as a CommonJS library, with a small ESM wrapper on top.
// This pattern seems to confuse some bundlers, causing errors like `Cannot read 'getResolver' of undefined`
// see https://github.com/decentralized-identity/ethr-did-resolver/issues/186
exports.default = {
REGISTRY: helpers_js_1.DEFAULT_REGISTRY_ADDRESS,
getResolver: resolver_js_1.getResolver,
bytes32toString: helpers_js_1.bytes32toString,
stringToBytes32: helpers_js_1.stringToBytes32,
EthrDidController: controller_js_1.EthrDidController,
verificationMethodTypes: helpers_js_1.verificationMethodTypes,
identifierMatcher: helpers_js_1.identifierMatcher,
interpretIdentifier: helpers_js_1.interpretIdentifier,
Errors: helpers_js_1.Errors,
EthereumDIDRegistry: EthereumDIDRegistry_js_1.EthereumDIDRegistry,
deployments: deployments_js_1.deployments,
};
//# sourceMappingURL=index.js.map
import { Contract, Log } from 'ethers';
import { ERC1056Event } from './helpers';
import { ERC1056Event } from './helpers.js';
export declare function logDecoder(contract: Contract, logs: Log[]): ERC1056Event[];
//# sourceMappingURL=logParser.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logDecoder = logDecoder;
const helpers_1 = require("./helpers");
const helpers_js_1 = require("./helpers.js");
function populateEventMetaClass(logResult, blockNumber) {

@@ -17,3 +17,3 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

if (input.type === 'bytes32') {
val = (0, helpers_1.bytes32toString)(val);
val = (0, helpers_js_1.bytes32toString)(val);
}

@@ -34,4 +34,4 @@ result[input.name] = val;

})
.filter(helpers_1.isDefined);
.filter(helpers_js_1.isDefined);
}
//# sourceMappingURL=logParser.js.map
import { BlockTag } from 'ethers';
import { ConfigurationOptions } from './configuration';
import { ConfigurationOptions } from './configuration.js';
import { DIDDocument, DIDResolutionOptions, DIDResolutionResult, DIDResolver, ParsedDID, Resolvable } from 'did-resolver';
import { ERC1056Event } from './helpers';
import { ERC1056Event } from './helpers.js';
export declare function getResolver(options: ConfigurationOptions): Record<string, DIDResolver>;

@@ -6,0 +6,0 @@ export declare class EthrDidResolver {

@@ -6,5 +6,5 @@ "use strict";

const ethers_1 = require("ethers");
const configuration_1 = require("./configuration");
const helpers_1 = require("./helpers");
const logParser_1 = require("./logParser");
const configuration_js_1 = require("./configuration.js");
const helpers_js_1 = require("./helpers.js");
const logParser_js_1 = require("./logParser.js");
function getResolver(options) {

@@ -15,3 +15,3 @@ return new EthrDidResolver(options).build();

constructor(options) {
this.contracts = (0, configuration_1.configureResolverWithNetworks)(options);
this.contracts = (0, configuration_js_1.configureResolverWithNetworks)(options);
}

@@ -57,3 +57,3 @@ /**

const history = [];
const { address, publicKey } = (0, helpers_1.interpretIdentifier)(identity);
const { address, publicKey } = (0, helpers_js_1.interpretIdentifier)(identity);
const controllerKey = publicKey;

@@ -70,3 +70,3 @@ let previousChange = await this.previousChange(address, networkId, blockTag);

});
const events = (0, logParser_1.logDecoder)(contract, logs);
const events = (0, logParser_js_1.logDecoder)(contract, logs);
events.reverse();

@@ -123,3 +123,3 @@ previousChange = null;

if (validTo && validTo >= now) {
if (event._eventName === helpers_1.eventNames.DIDDelegateChanged) {
if (event._eventName === helpers_js_1.eventNames.DIDDelegateChanged) {
const currentEvent = event;

@@ -136,3 +136,3 @@ delegateCount++;

id: `${did}#delegate-${delegateCount}`,
type: helpers_1.verificationMethodTypes.EcdsaSecp256k1RecoveryMethod2020,
type: helpers_js_1.verificationMethodTypes.EcdsaSecp256k1RecoveryMethod2020,
controller: did,

@@ -145,3 +145,3 @@ blockchainAccountId: `eip155:${chainId}:${currentEvent.delegate}`,

}
else if (event._eventName === helpers_1.eventNames.DIDAttributeChanged) {
else if (event._eventName === helpers_js_1.eventNames.DIDAttributeChanged) {
const currentEvent = event;

@@ -153,3 +153,3 @@ const name = currentEvent.name; //conversion from bytes32 is done in logParser

const algorithm = match[2];
const type = helpers_1.legacyAttrTypes[match[4]] || match[4];
const type = helpers_js_1.legacyAttrTypes[match[4]] || match[4];
const encoding = match[6];

@@ -164,3 +164,3 @@ switch (section) {

};
pk.type = helpers_1.legacyAlgoMap[pk.type] || algorithm;
pk.type = helpers_js_1.legacyAlgoMap[pk.type] || algorithm;
switch (encoding) {

@@ -170,3 +170,3 @@ case null:

case 'hex':
pk.publicKeyHex = (0, helpers_1.strip0x)(currentEvent.value);
pk.publicKeyHex = (0, helpers_js_1.strip0x)(currentEvent.value);
break;

@@ -183,3 +183,3 @@ case 'base64':

default:
pk.value = (0, helpers_1.strip0x)(currentEvent.value);
pk.value = (0, helpers_js_1.strip0x)(currentEvent.value);
}

@@ -219,6 +219,6 @@ pks[eventIndex] = pk;

}
else if (event._eventName === helpers_1.eventNames.DIDOwnerChanged) {
else if (event._eventName === helpers_js_1.eventNames.DIDOwnerChanged) {
const currentEvent = event;
controller = currentEvent.owner;
if (currentEvent.owner === helpers_1.nullAddress) {
if (currentEvent.owner === helpers_js_1.nullAddress) {
deactivated = true;

@@ -229,8 +229,8 @@ break;

else {
if (event._eventName === helpers_1.eventNames.DIDDelegateChanged ||
(event._eventName === helpers_1.eventNames.DIDAttributeChanged &&
if (event._eventName === helpers_js_1.eventNames.DIDDelegateChanged ||
(event._eventName === helpers_js_1.eventNames.DIDAttributeChanged &&
event.name.match(/^did\/pub\//))) {
delegateCount++;
}
else if (event._eventName === helpers_1.eventNames.DIDAttributeChanged &&
else if (event._eventName === helpers_js_1.eventNames.DIDAttributeChanged &&
event.name.match(/^did\/svc\//)) {

@@ -248,3 +248,3 @@ serviceCount++;

id: `${did}#controller`,
type: helpers_1.verificationMethodTypes.EcdsaSecp256k1RecoveryMethod2020,
type: helpers_js_1.verificationMethodTypes.EcdsaSecp256k1RecoveryMethod2020,
controller: did,

@@ -257,5 +257,5 @@ blockchainAccountId: `eip155:${chainId}:${controller}`,

id: `${did}#controllerKey`,
type: helpers_1.verificationMethodTypes.EcdsaSecp256k1VerificationKey2019,
type: helpers_js_1.verificationMethodTypes.EcdsaSecp256k1VerificationKey2019,
controller: did,
publicKeyHex: (0, helpers_1.strip0x)(controllerKey),
publicKeyHex: (0, helpers_js_1.strip0x)(controllerKey),
});

@@ -307,3 +307,3 @@ authentication.push(`${did}#controllerKey`);

didResolutionMetadata: {
error: helpers_1.Errors.unsupportedFormat,
error: helpers_js_1.Errors.unsupportedFormat,
message: `The DID resolver does not support the requested 'accept' format: ${options.accept}`,

@@ -315,7 +315,7 @@ },

}
const fullId = parsed.id.match(helpers_1.identifierMatcher);
const fullId = parsed.id.match(helpers_js_1.identifierMatcher);
if (!fullId) {
return {
didResolutionMetadata: {
error: helpers_1.Errors.invalidDid,
error: helpers_js_1.Errors.invalidDid,
message: `Not a valid did:ethr: ${parsed.id}`,

@@ -344,3 +344,3 @@ },

didResolutionMetadata: {
error: helpers_1.Errors.unknownNetwork,
error: helpers_js_1.Errors.unknownNetwork,
message: `The DID resolver does not have a configuration for network: ${networkId}`,

@@ -393,3 +393,3 @@ },

didResolutionMetadata: {
error: helpers_1.Errors.notFound,
error: helpers_js_1.Errors.notFound,
message: e.toString(), // This is not in spec, nut may be helpful

@@ -396,0 +396,0 @@ },

{
"name": "ethr-did-resolver",
"version": "10.1.10",
"version": "11.0.0-alpha.2",
"description": "Resolve DID documents for ethereum addresses and public keys",

@@ -17,12 +17,2 @@ "type": "commonjs",

},
"typesVersions": {
"*": {
"lib/index.d.ts": [
"lib/index.d.ts"
],
"*": [
"./lib/index.d.js"
]
}
},
"repository": {

@@ -40,3 +30,3 @@ "type": "git",

"contributors": [
"Mircea Nistor <mircea.nistor@mesh.xyz>"
"Mircea Nistor"
],

@@ -71,19 +61,8 @@ "license": "Apache-2.0",

},
"jest": {
"clearMocks": true,
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"!src/**/*.d.ts",
"!**/node_modules/**",
"!**/__tests__/**"
],
"testEnvironment": "node",
"testMatch": [
"**/__tests__/**/*.test.[jt]s"
]
},
"devDependencies": {
"@babel/core": "7.24.9",
"@babel/preset-env": "7.24.8",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/preset-typescript": "7.24.7",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@ethers-ext/provider-ganache": "6.0.0-beta.2",

@@ -93,14 +72,14 @@ "@semantic-release/changelog": "6.0.3",

"@types/jest": "29.5.12",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"babel-jest": "29.7.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "27.9.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prettier": "5.2.1",
"jest": "29.7.0",
"microbundle": "0.15.1",
"prettier": "3.3.3",
"semantic-release": "22.0.12",
"typescript": "5.5.3"
"ts-jest": "^29.2.5",
"typescript": "5.5.4"
},

@@ -110,3 +89,4 @@ "dependencies": {

"ethers": "^6.8.1"
}
},
"packageManager": "yarn@1.22.22"
}

@@ -41,29 +41,2 @@ import { Resolver } from 'did-resolver'

it('resolves on linea:goerli when configured', async () => {
const did = 'did:ethr:linea:goerli:' + addr
const ethr = getResolver({
infuraProjectId: '6b734e0b04454df8a6ce234023c04f26',
})
const resolver = new Resolver(ethr)
const result = await resolver.resolve(did)
expect(result).toEqual({
didDocumentMetadata: {},
didResolutionMetadata: { contentType: 'application/did+ld+json' },
didDocument: {
'@context': expect.anything(),
id: did,
verificationMethod: [
{
id: `${did}#controller`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:59140:${checksumAddr}`,
},
],
authentication: [`${did}#controller`],
assertionMethod: [`${did}#controller`],
},
})
})
it('resolves on sepolia when configured', async () => {

@@ -70,0 +43,0 @@ const did = 'did:ethr:sepolia:' + addr

@@ -5,3 +5,3 @@ import { Contract, ContractFactory, ethers, SigningKey, Wallet } from 'ethers'

import { getResolver } from '../resolver'
import { default as EthereumDIDRegistry } from '../config/EthereumDIDRegistry.json'
import { EthereumDIDRegistry } from '../config/EthereumDIDRegistry'

@@ -8,0 +8,0 @@ export async function deployRegistry(): Promise<{

import { Contract, ContractFactory, JsonRpcProvider, Provider } from 'ethers'
import { DEFAULT_REGISTRY_ADDRESS } from './helpers'
import { deployments, EthrDidRegistryDeployment } from './config/deployments'
import { default as EthereumDIDRegistry } from './config/EthereumDIDRegistry.json'
import { DEFAULT_REGISTRY_ADDRESS } from './helpers.js'
import { deployments, EthrDidRegistryDeployment } from './config/deployments.js'
import { EthereumDIDRegistry } from './config/EthereumDIDRegistry.js'

@@ -6,0 +6,0 @@ const infuraNames: Record<string, string> = {

@@ -21,3 +21,3 @@ import {

} from 'ethers'
import { getContractForNetwork } from './configuration'
import { getContractForNetwork } from './configuration.js'
import {

@@ -30,3 +30,3 @@ address,

stringToBytes32,
} from './helpers'
} from './helpers.js'

@@ -33,0 +33,0 @@ /**

@@ -1,3 +0,3 @@

import { getResolver } from './resolver'
import { EthrDidController } from './controller'
import { getResolver } from './resolver.js'
import { EthrDidController } from './controller.js'
import {

@@ -14,5 +14,6 @@ bytes32toString,

MetaSignature,
} from './helpers'
} from './helpers.js'
import { default as EthereumDIDRegistry } from './config/EthereumDIDRegistry.json'
import { EthereumDIDRegistry } from './config/EthereumDIDRegistry.js'
import { deployments, EthrDidRegistryDeployment } from './config/deployments.js'

@@ -35,4 +36,23 @@ export {

MetaSignature,
deployments,
EthrDidRegistryDeployment,
}
export { deployments, EthrDidRegistryDeployment } from './config/deployments'
// workaround for esbuild/vite/hermes issues
// This should not be needed once we move to ESM only build outputs.
// This library now builds as a CommonJS library, with a small ESM wrapper on top.
// This pattern seems to confuse some bundlers, causing errors like `Cannot read 'getResolver' of undefined`
// see https://github.com/decentralized-identity/ethr-did-resolver/issues/186
export default {
REGISTRY: DEFAULT_REGISTRY_ADDRESS,
getResolver,
bytes32toString,
stringToBytes32,
EthrDidController,
verificationMethodTypes,
identifierMatcher,
interpretIdentifier,
Errors,
EthereumDIDRegistry,
deployments,
}
import { Contract, Log, LogDescription } from 'ethers'
import { bytes32toString, ERC1056Event, isDefined } from './helpers'
import { bytes32toString, ERC1056Event, isDefined } from './helpers.js'

@@ -4,0 +4,0 @@ function populateEventMetaClass(logResult: LogDescription, blockNumber: number): ERC1056Event {

import { BlockTag, encodeBase58, encodeBase64, toUtf8String } from 'ethers'
import { ConfigurationOptions, ConfiguredNetworks, configureResolverWithNetworks } from './configuration'
import { ConfigurationOptions, ConfiguredNetworks, configureResolverWithNetworks } from './configuration.js'
import {

@@ -28,4 +28,4 @@ DIDDocument,

verificationMethodTypes,
} from './helpers'
import { logDecoder } from './logParser'
} from './helpers.js'
import { logDecoder } from './logParser.js'

@@ -157,7 +157,7 @@ export function getResolver(options: ConfigurationOptions): Record<string, DIDResolver> {

const eventIndex = `${event._eventName}-${
(<DIDDelegateChanged>event).delegateType || (<DIDAttributeChanged>event).name
}-${(<DIDDelegateChanged>event).delegate || (<DIDAttributeChanged>event).value}`
(event as DIDDelegateChanged).delegateType || (event as DIDAttributeChanged).name
}-${(event as DIDDelegateChanged).delegate || (event as DIDAttributeChanged).value}`
if (validTo && validTo >= now) {
if (event._eventName === eventNames.DIDDelegateChanged) {
const currentEvent = <DIDDelegateChanged>event
const currentEvent = event as DIDDelegateChanged
delegateCount++

@@ -181,3 +181,3 @@ const delegateType = currentEvent.delegateType //conversion from bytes32 is done in logParser

} else if (event._eventName === eventNames.DIDAttributeChanged) {
const currentEvent = <DIDAttributeChanged>event
const currentEvent = event as DIDAttributeChanged
const name = currentEvent.name //conversion from bytes32 is done in logParser

@@ -247,3 +247,3 @@ const match = name.match(/^did\/(pub|svc)\/(\w+)(\/(\w+))?(\/(\w+))?$/)

} else if (event._eventName === eventNames.DIDOwnerChanged) {
const currentEvent = <DIDOwnerChanged>event
const currentEvent = event as DIDOwnerChanged
controller = currentEvent.owner

@@ -258,3 +258,3 @@ if (currentEvent.owner === nullAddress) {

(event._eventName === eventNames.DIDAttributeChanged &&
(<DIDAttributeChanged>event).name.match(/^did\/pub\//))
(event as DIDAttributeChanged).name.match(/^did\/pub\//))
) {

@@ -264,3 +264,3 @@ delegateCount++

event._eventName === eventNames.DIDAttributeChanged &&
(<DIDAttributeChanged>event).name.match(/^did\/svc\//)
(event as DIDAttributeChanged).name.match(/^did\/svc\//)
) {

@@ -267,0 +267,0 @@ serviceCount++

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc