• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger-identus / sdk-ts / 18018580535

25 Sep 2025 07:31PM UTC coverage: 72.298% (-0.3%) from 72.59%
18018580535

Pull #460

github

web-flow
Merge f772a72c5 into a4a9d0b23
Pull Request #460: feat: DIDResolverHttpProxy for #459

1341 of 2051 branches covered (65.38%)

Branch coverage included in aggregate %.

4 of 25 new or added lines in 1 file covered. (16.0%)

41 existing lines in 5 files now uncovered.

3101 of 4093 relevant lines covered (75.76%)

44.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.15
/src/castor/resolver/DIDResolverHttpProxy.ts
1

2
import {
3
  DIDResolver,
4
  DIDDocument,
5
  DID,
6
} from "../../domain/models";
7

8
export class DIDResolverHttpProxy implements DIDResolver {
9
  method: string;
10
  resolverEndpoint: string;
11

12
  constructor(
13
    resolverEndpoint: string = "https://raw.githubusercontent.com/blockfrost/prism-vdr/refs/heads/main/mainnet/diddoc/",
×
14
    method: string = "prism"
153✔
15
  ) {
16
    this.resolverEndpoint = resolverEndpoint;
153✔
17
    this.method = method
153✔
18
  }
19

20
  async resolve(didString: string): Promise<DIDDocument> {
21
    const url = this.resolverEndpoint + didString;
75✔
22
    const response = await fetch(url, {
75✔
23
      "headers": {
24
        "accept": "*/*",
25
        "accept-language": "en",
26
        "cache-control": "no-cache",
27
        "pragma": "no-cache",
28
        "sec-gpc": "1"
29
      },
30
      "method": "GET",
31
      "mode": "cors",
32
      "credentials": "omit"
33
    })
NEW
34
    if (!response.ok) {
×
NEW
35
      throw new Error('Failed to fetch data');
×
36
    }
NEW
37
    const data = await response.json();
×
NEW
38
    const didDocument = data.didDocument;
×
39

NEW
40
    const servicesProperty = new DIDDocument.Services(
×
41
      didDocument.service
42
    )
NEW
43
    const verificationMethodsProperty = new DIDDocument.VerificationMethods(
×
44
      didDocument.verificationMethod
45
    )
NEW
46
    const coreProperties: DIDDocument.CoreProperty[] = [];
×
NEW
47
    const authenticate: DIDDocument.Authentication[] = [];
×
NEW
48
    const assertion: DIDDocument.AssertionMethod[] = [];
×
49

NEW
50
    for (const verificationMethod of didDocument.verificationMethod) {
×
NEW
51
      const isAssertion = didDocument.assertionMethod.find((method: any) => method === verificationMethod.id)
×
NEW
52
      if (isAssertion) {
×
NEW
53
        assertion.push(new DIDDocument.AssertionMethod([isAssertion], [verificationMethod]))
×
54
      }
NEW
55
      const isAuthentication = didDocument.authentication.find((method: any) => method === verificationMethod.id)
×
NEW
56
      if (isAuthentication) {
×
NEW
57
        authenticate.push(new DIDDocument.Authentication([isAuthentication], [verificationMethod]));
×
58
      }
59
    }
60

NEW
61
    coreProperties.push(...authenticate);
×
NEW
62
    coreProperties.push(servicesProperty);
×
NEW
63
    coreProperties.push(verificationMethodsProperty);
×
64

NEW
65
    const resolved = new DIDDocument(
×
66
      DID.fromString(didString),
67
      coreProperties
68
    );
69

NEW
70
    return resolved;
×
71
  }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc