Closed thisisrafael closed 3 years ago
I can't reproduce this error.
Are you sure, you've cloned the repo with --recursive
? Please try to run git submodule init && git submodule update --recursive
, because it looks like you're missing our customized cose-js
repository.
Thank you so much! "git submodule init && git submodule update --recursive" solved everything It works perfectly
Usage (JS) ./gradlew jsBrowserDevelopmentWebpack; just testing demo.html
everything is okay but the Random or Fixed Generator. It's "stucking" on QR Code Contents: Generating... Nothing happen (no code and no qr). I've got this error:
Cose.kt?5e47:24 Uncaught TypeError: sign$Companion.createSync is not a function at Cose.sign_4mr2q2$ (Cose.kt?5e47:24) at CoseCreationAdapter.sign_x1bysv$ (CoseCreationAdapter.kt?1914:28) at DefaultCoseService.encode_fqrh44$ (DefaultCoseService.kt?863c:32) at Chain.encode (Chain.kt?e7ee:40) at Generator.encode (JsInterface.kt?35f0:148) at generateRandom (demo.html:38) at HTMLButtonElement.onclick (demo.html:312)
for... return sign.createSync(header, Buffer(input.toUint8Array()), signer)
file: .\src\jsMain\kotlin\ehn\techiop\hcert\kotlin\crypto\Cose.kt
package ehn.techiop.hcert.kotlin.crypto
import Buffer import cose.Signer import cose.Verifier import cose.sign import ehn.techiop.hcert.kotlin.chain.toByteArray import ehn.techiop.hcert.kotlin.chain.toUint8Array
internal object Cose { fun verifySync(signedBitString: ByteArray, pubKey: PubKey): ByteArray { val key = (pubKey as JsPubKey).toCoseRepresentation() val verifier = object : Verifier { override val key = key } return sign.verifySync(Buffer.from(signedBitString.toUint8Array()), verifier).toByteArray() }
}