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

hyperledger-identus / sdk-ts / 15879559936

25 Jun 2025 02:45PM UTC coverage: 72.405% (-3.8%) from 76.16%
15879559936

push

github

web-flow
fix: db improvements and inference (#442)

Signed-off-by: Francisco Javier Ribo Labrador <elribonazo@gmail.com>

1320 of 2008 branches covered (65.74%)

Branch coverage included in aggregate %.

13 of 14 new or added lines in 4 files covered. (92.86%)

162 existing lines in 12 files now uncovered.

3054 of 4033 relevant lines covered (75.73%)

44.17 hits per line

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

23.33
/src/pluto/repositories/CredentialRepository.ts
1
import * as Domain from "../../domain";
2
import type * as Models from "../models";
3
import type { Pluto } from "../Pluto";
4
import { MapperRepository } from "./builders/MapperRepository";
5
import { AnonCredsCredential, AnonCredsRecoveryId } from "../../pollux/models/AnonCredsVerifiableCredential";
6
import { JWTCredential, JWTVerifiableCredentialRecoveryId } from "../../pollux/models/JWTVerifiableCredential";
7
import { SDJWTCredential, SDJWTVerifiableCredentialRecoveryId } from "../../pollux/models/SDJWTVerifiableCredential";
8

9
export class CredentialRepository extends MapperRepository<Models.Credential, Domain.Credential> {
10
  constructor(store: Pluto.Store) {
11
    super(store, "credentials");
99✔
12
  }
13

14
  toDomain(model: Models.Credential): Domain.Credential {
UNCOV
15
    switch (model.recoveryId) {
×
16
      case SDJWTVerifiableCredentialRecoveryId: {
17
        const jwtModel = JSON.parse(model.dataJson);
×
18
        const jws = jwtModel.id;
×
19
        const credential = SDJWTCredential.fromJWS(
×
20
          jws,
21
          jwtModel.revoked ?? false,
×
22
        );
23
        return this.withId(credential, model.uuid);
×
24
      }
25
      case JWTVerifiableCredentialRecoveryId: {
UNCOV
26
        const jwtModel = JSON.parse(model.dataJson);
×
UNCOV
27
        const credential = JWTCredential.fromJWS(
×
28
          jwtModel.id,
29
          jwtModel.revoked ?? false
×
30
        );
UNCOV
31
        return this.withId(credential, model.uuid);
×
32
      }
33
      case AnonCredsRecoveryId: {
UNCOV
34
        const json = JSON.parse(model.dataJson);
×
UNCOV
35
        const credential = new AnonCredsCredential(
×
36
          json,
37
          json.revoked ?? false
×
38
        );
UNCOV
39
        return this.withId(credential, model.uuid);
×
40
      }
41
    }
42

43
    throw new Domain.PlutoError.UnknownCredentialTypeError();
×
44
  }
45

46
  toModel(credential: Domain.Credential): Models.Credential {
47
    if (!credential.isStorable()) {
12!
48
      throw new Domain.PlutoError.CredentialNotStorable();
×
49
    }
50
    const item = credential.toStorable();
12✔
51
    return {
12✔
52
      uuid: credential.uuid,
53
      id: item.id,
54
      recoveryId: credential.recoveryId,
55
      dataJson: item.credentialData,
56
      issuer: item.issuer,
57
      subject: item.subject,
58
      credentialCreated: item.credentialCreated,
59
      credentialUpdated: item.credentialUpdated,
60
      credentialSchema: item.credentialSchema,
61
      validUntil: item.validUntil,
62
      revoked: item.revoked ?? false
18✔
63
    };
64
  }
65
}
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