j256 / two-factor-auth

Two Factor Authentication Java code implementing the Time-based One-time Password Algorithm
ISC License
319 stars 110 forks source link

Custom QR Image Dimensions #12

Closed alvin-reyes closed 3 years ago

alvin-reyes commented 6 years ago

Parameterize the dimensions so that the size can be customized.

//    200x200 or 400x400
public static String qrImageUrl(String keyId, String secret, String dimension) {
    StringBuilder sb = new StringBuilder(128);
    sb.append("https://chart.googleapis.com/chart?chs="+dimension+"&cht=qr&chl="+dimension+"&chld=M|0&cht=qr&chl=");
        addOtpAuthPart(keyId, secret, sb);
    return sb.toString();
}
j256 commented 3 years ago

Thanks added.