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

input-output-hk / atala-prism-building-blocks / 5544147843

13 Jul 2023 02:11PM UTC coverage: 28.655% (+0.3%) from 28.368%
5544147843

push

web-flow
feat: ATL-4888 Anoncred schema type (#590)

* feat: ATL-4888 Anoncred Schema

* feat: ATL-4888 Added test

* feat: ATL-4888 Include version in type

2799 of 9768 relevant lines covered (28.65%)

0.29 hits per line

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

0.0
/mercury/mercury-library/agent-cli-didcommx/src/main/scala/io/iohk/atala/QRcode.scala
1
package io.iohk.atala
2

3
import com.google.zxing.BarcodeFormat;
4
import com.google.zxing.EncodeHintType;
5
import com.google.zxing.MultiFormatWriter;
6
import com.google.zxing.WriterException;
7
import com.google.zxing.common.BitMatrix;
8
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
9
import java.util.Hashtable
10

11
object QRcode {
12

×
13
  def getQr(text: String) = {
14
    val width = 40
15
    val height = 40
×
16
    val qrParam = new Hashtable[EncodeHintType, Object]()
×
17
    qrParam.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L)
×
18
    qrParam.put(EncodeHintType.CHARACTER_SET, "utf-8")
×
19
    try {
×
20
      val bitMatrix: BitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height, qrParam);
×
21
      toAscii(bitMatrix)
×
22
    } catch case e: WriterException => e.printStackTrace()
23
  }
24

×
25
  def toAscii(bitMatrix: BitMatrix) =
×
26
    val sb = new StringBuilder()
×
27
    for (rows <- 0 to bitMatrix.getHeight - 1)
×
28
      for (cols <- 0 to bitMatrix.getWidth - 1)
×
29
        if (!bitMatrix.get(rows, cols))
×
30
          sb.append("  ") // white
×
31
        else sb.append("██") // black
×
32
      sb.append("\n")
×
33
    sb.toString()
34

35
}
36

×
37
@main def QRcodeMain() = {
38
  val text = "https://localhost:8000/?_oob=asfyukfuhgkflajfl"
×
39
  System.out.println(QRcode.getQr(text))
40
}
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

© 2025 Coveralls, Inc