diff --git a/src/lib/didcomm.ts b/src/lib/didcomm.ts index c2c59f2..977362f 100644 --- a/src/lib/didcomm.ts +++ b/src/lib/didcomm.ts @@ -13,6 +13,7 @@ import { PackEncryptedMetadata, MessagingServiceMetadata, IMessage, + Service, } from "didcomm" import DIDPeer from "./peer2" import { v4 as uuidv4 } from "uuid" @@ -234,7 +235,7 @@ export class DIDComm { return await this.resolver.resolve(did) } - async resolveDIDCommServices(did: DID): Promise { + async resolveDIDCommServices(did: DID): Promise { const doc = await this.resolve(did) if (!doc) { throw new Error("Unable to resolve DID") @@ -273,7 +274,7 @@ export class DIDComm { */ async httpEndpoint(did: DID): Promise { const services = await this.resolveDIDCommServices(did) - const service = services.filter((s: any) => + const service = services.filter((s: Service) => s.serviceEndpoint.uri.startsWith("http") )[0] return { diff --git a/src/lib/peer2.ts b/src/lib/peer2.ts index 6e52504..eb0bada 100644 --- a/src/lib/peer2.ts +++ b/src/lib/peer2.ts @@ -240,7 +240,7 @@ export default class DIDPeer { if (!Array.isArray(doc.service)) { doc.service = []; } - doc.service.concat(services) + doc.service = doc.service.concat(services) break }