diff --git a/src/iden3comm/constants.ts b/src/iden3comm/constants.ts index 43ee3699..379e1007 100644 --- a/src/iden3comm/constants.ts +++ b/src/iden3comm/constants.ts @@ -41,11 +41,6 @@ export enum MediaType { SignedMessage = 'application/iden3comm-signed-json' } -/** - * Universal resolver url - */ -export const UNIVERSAL_RESOLVER_URL = 'https://dev.uniresolver.io/1.0/identifiers'; - export const SUPPORTED_PUBLIC_KEY_TYPES = { ES256K: [ 'EcdsaSecp256k1VerificationKey2019', diff --git a/src/iden3comm/packers/jws.ts b/src/iden3comm/packers/jws.ts index 84e4c74b..965ee266 100644 --- a/src/iden3comm/packers/jws.ts +++ b/src/iden3comm/packers/jws.ts @@ -1,10 +1,6 @@ import { BasicMessage, IPacker, PackerParams } from '../types'; import { MediaType, SUPPORTED_PUBLIC_KEY_TYPES } from '../constants'; -import { - extractPublicKeyBytes, - resolveVerificationMethods, - resolveDIDDocument -} from '../utils/did'; +import { extractPublicKeyBytes, resolveVerificationMethods } from '../utils/did'; import { keyPath, KMS } from '../../kms/'; import { Signer, verifyJWS } from 'did-jwt'; @@ -31,13 +27,10 @@ export class JWSPacker implements IPacker { * Creates an instance of JWSPacker. * * @param {KMS} _kms - * @param {Resolvable} [_documentResolver={ resolve: resolveDIDDocument }] + * @param {Resolvable} _documentResolver * @memberof JWSPacker */ - constructor( - private readonly _kms: KMS, - private readonly _documentResolver: Resolvable = { resolve: resolveDIDDocument } - ) {} + constructor(private readonly _kms: KMS, private readonly _documentResolver: Resolvable) {} /** * creates JSON Web Signature token * diff --git a/src/iden3comm/utils/did.ts b/src/iden3comm/utils/did.ts index 758ed617..242b6572 100644 --- a/src/iden3comm/utils/did.ts +++ b/src/iden3comm/utils/did.ts @@ -1,29 +1,10 @@ -import { SUPPORTED_PUBLIC_KEY_TYPES, UNIVERSAL_RESOLVER_URL } from '../constants'; +import { SUPPORTED_PUBLIC_KEY_TYPES } from '../constants'; import elliptic from 'elliptic'; -import { - DIDDocument, - DIDResolutionOptions, - DIDResolutionResult, - VerificationMethod -} from 'did-resolver'; +import { DIDDocument, VerificationMethod } from 'did-resolver'; import { KmsKeyType } from '../../kms'; import { base58ToBytes, base64ToBytes, bytesToHex, hexToBytes } from '../../utils'; -export const resolveDIDDocument = async ( - didUrl: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - options?: DIDResolutionOptions -): Promise => { - try { - const response = await fetch(`${UNIVERSAL_RESOLVER_URL}/${didUrl}`); - const data = await response.json(); - return data as DIDResolutionResult; - } catch (error: unknown) { - throw new Error(`Can't resolve did document: ${(error as Error).message}`); - } -}; - const DIDAuthenticationSection = 'authentication'; export const resolveVerificationMethods = (didDocument: DIDDocument): VerificationMethod[] => { const vms: VerificationMethod[] = didDocument.verificationMethod || [];