Skip to content

Critical code review PR - Last sprint handover checklist of 0.7.0 release#110

Merged
Prafulrakhade merged 0 commit into
masterfrom
release-0.7.x
Jul 25, 2025
Merged

Critical code review PR - Last sprint handover checklist of 0.7.0 release#110
Prafulrakhade merged 0 commit into
masterfrom
release-0.7.x

Conversation

@vishwa-vyom

Copy link
Copy Markdown
Member

This PR is created just to add the review comments as part of the critical code review task of last sprint handover checklist for release of 0.7.0 version.

** THIS PR SHOULD NOT BE MERGED **

else -> {}
}

return Base64.decode(base64, Base64.DEFAULT)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not simply do "return Base64.decode(input, Base64.DEFAULT or Base64.URL_SAFE)" ?


}catch (e: Exception){
Log.e("PixelPass",e.toString())
logger.severe("Error occurred while converting Qr Data to Base64 String::$e")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are catching a generic exception class, how we can give a specific error message here ?

return toBitmap(qrcode)
fun generateQRCode(data: String, ecc: ECC = ECC.L, header: String = ""): String {
val dataWithHeader = generateQRData(data, header)
val qrcodeImage = convertQrDataIntoBase64(dataWithHeader, ecc)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the method name as per proper camel convention ? like convertQRDataIntoBase64

toolVersion = "0.8.11"
reportsDirectory = layout.buildDirectory.dir("reports/jacoco")
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is kotlin/PixelPass/libs/cose-java-1.1.0.jar commit to the repo and not taken as a maven dependency ?

fun encodeToString(image: Bitmap): String? {
val imageString: String?
val bos = ByteArrayOutputStream()
image.compress(Bitmap.CompressFormat.PNG, 100, bos)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is 100 hardcode here, should this be a setting ?

return toBitmap(qrcode)
fun generateQRCode(data: String, ecc: ECC = ECC.L, header: String = ""): String {
val dataWithHeader = generateQRData(data, header)
val qrcodeImage = convertQrDataIntoBase64(dataWithHeader, ecc)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason this is base64 encoded and not URL safe base 64 encoded ?


private fun verifyAndDecode(rawCbor: ByteArray, oneKey: OneKey, mapper: Map<String, String>): String {
try {
val ctx: CwtCryptoCtx = CwtCryptoCtx.sign1Verify(oneKey.PublicKey())

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why in philsys QR code alone we do the verification also here ? Is that not the responsibility of vc-verifier ?

val dataWithHeader = generateQRData(data, header).toByteArray()
val qrcode = QrCode.encodeText(String(dataWithHeader), ecc.mEcc)
return toBitmap(qrcode)
fun generateQRCode(data: String, ecc: ECC = ECC.L, header: String = ""): String {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is readme file updated as per the new interface returns ?

}


fun decodeCWT(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readme on this new method missing

package io.mosip.pixelpass.common


expect fun decodeFromBase64UrlFormatEncoded(content: String): ByteArray

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can rename this to decodeFromBase64UrlFormat

@Prafulrakhade Prafulrakhade merged commit 4fa6606 into master Jul 25, 2025
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants