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

LukaJCB / ts-mls / 17112783508

20 Aug 2025 11:28PM UTC coverage: 91.936% (+0.004%) from 91.932%
17112783508

Pull #77

github

web-flow
Merge f2bcb7620 into 9d50ecfeb
Pull Request #77: Modularize crypto implementation

747 of 979 branches covered (76.3%)

Branch coverage included in aggregate %.

172 of 183 new or added lines in 13 files covered. (93.99%)

2662 of 2729 relevant lines covered (97.54%)

156478.35 hits per line

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

88.57
/src/crypto/implementation/default/makeDhKem.ts
1
import {
80✔
2
  KemInterface,
3
  DhkemP256HkdfSha256,
4
  DhkemX25519HkdfSha256,
5
  DhkemX448HkdfSha512,
6
  DhkemP521HkdfSha512,
7
  DhkemP384HkdfSha384,
8
} from "@hpke/core"
9
import { DependencyError } from "../../../mlsError"
80✔
10
import { KemAlgorithm } from "../../kem"
11

12
export async function makeDhKem(kemAlg: KemAlgorithm): Promise<KemInterface> {
80✔
13
  switch (kemAlg) {
2,450✔
14
    case "DHKEM-P256-HKDF-SHA256":
15
      return new DhkemP256HkdfSha256()
214✔
16
    case "DHKEM-X25519-HKDF-SHA256":
17
      return new DhkemX25519HkdfSha256()
430✔
18
    case "DHKEM-X448-HKDF-SHA512":
19
      return new DhkemX448HkdfSha512()
426✔
20
    case "DHKEM-P521-HKDF-SHA512":
21
      return new DhkemP521HkdfSha512()
204✔
22
    case "DHKEM-P384-HKDF-SHA384":
23
      return new DhkemP384HkdfSha384()
210✔
24
    case "ML-KEM-512":
25
      try {
160✔
26
        const { MlKem512 } = await import("@hpke/ml-kem")
320✔
27
        return new MlKem512()
160✔
28
      } catch (err) {
NEW
29
        throw new DependencyError(
×
30
          "Optional dependency '@hpke/ml-kem' is not installed. Please install it to use this feature.",
31
        )
32
      }
33

34
    case "ML-KEM-768":
35
      try {
166✔
36
        const { MlKem768 } = await import("@hpke/ml-kem")
332✔
37
        return new MlKem768()
166✔
38
      } catch (err) {
NEW
39
        throw new DependencyError(
×
40
          "Optional dependency '@hpke/ml-kem' is not installed. Please install it to use this feature.",
41
        )
42
      }
43
    case "ML-KEM-1024":
44
      try {
320✔
45
        const { MlKem1024 } = await import("@hpke/ml-kem")
640✔
46
        return new MlKem1024()
320✔
47
      } catch (err) {
NEW
48
        throw new DependencyError(
×
49
          "Optional dependency '@hpke/ml-kem' is not installed. Please install it to use this feature.",
50
        )
51
      }
52
    case "X-Wing":
53
      try {
320✔
54
        const { XWing } = await import("@hpke/hybridkem-x-wing")
640✔
55
        return new XWing()
320✔
56
      } catch (err) {
NEW
57
        throw new DependencyError(
×
58
          "Optional dependency '@hpke/hybridkem-x-wing' is not installed. Please install it to use this feature.",
59
        )
60
      }
61
  }
62
}
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