Skip to content

Commit fd26f49

Browse files
authored
fix: use correct base encoding with JWK (#6)
* fix: use correct base encoding with JWK * fix: remove workaround for base64 decoding * enhancements: update invalid key size error message
1 parent 6665c8b commit fd26f49

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ buildscript {
2020
}
2121

2222
allprojects {
23-
version = "1.0.2-alpha"
23+
version = "1.0.3-alpha"
2424
group = "io.iohk.atala.prism.didcomm"
2525

2626
repositories {

didcomm/didcomm.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'didcomm'
3-
spec.version = '1.0.2-alpha'
3+
spec.version = '1.0.3-alpha'
44
spec.homepage = ''
55
spec.source = { :http=> ''}
66
spec.authors = 'IOG'

didpeer/didpeer.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'didpeer'
3-
spec.version = '1.0.2-alpha'
3+
spec.version = '1.0.3-alpha'
44
spec.homepage = ''
55
spec.source = { :http=> ''}
66
spec.authors = 'IOG'

didpeer/src/commonMain/kotlin/io.iohk.atala.prism.didcomm.didpeer/core/JWK_OKP.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.iohk.atala.prism.didcomm.didpeer.core
22

3+
import io.iohk.atala.prism.apollo.base64.base64UrlDecodedBytes
34
import io.iohk.atala.prism.apollo.base64.base64UrlEncoded
4-
import io.iohk.atala.prism.apollo.base64.base64UrlPadDecodedBytes
55
import io.iohk.atala.prism.didcomm.didpeer.VerificationMaterialPeerDID
66
import io.iohk.atala.prism.didcomm.didpeer.VerificationMethodTypeAgreement
77
import io.iohk.atala.prism.didcomm.didpeer.VerificationMethodTypeAuthentication
@@ -39,9 +39,9 @@ fun fromJwk(verMaterial: VerificationMaterialPeerDID<out VerificationMethodTypeP
3939
// Base64.decodeBase64(value) // this line in JVM handle both Base64 Standard & Base64 URL
4040
// The following if condition is a workaround for a bug in Apollo Base64URLPad decoding which will be
4141
// fixed in the next release
42-
var decoded = value.base64UrlPadDecodedBytes
43-
if (decoded.isNotEmpty() && decoded.last().toInt() == 0) {
44-
decoded = decoded.dropLast(1).toByteArray()
45-
}
46-
return decoded
42+
// var decoded = value.base64UrlDecodedBytes
43+
// if (decoded.isNotEmpty() && decoded.last().toInt() == 0) {
44+
// decoded = decoded.dropLast(1).toByteArray()
45+
// }
46+
return value.base64UrlDecodedBytes
4747
}

didpeer/src/commonMain/kotlin/io.iohk.atala.prism.didcomm.didpeer/core/Validation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ internal fun validateJson(value: String) {
2929
internal fun validateRawKeyLength(key: ByteArray) {
3030
// for all supported key types now (ED25519 and X25510) the expected size is 32
3131
if (key.size != 32)
32-
throw IllegalArgumentException("Invalid key $key")
32+
throw IllegalArgumentException("Invalid key $key, size should be 32 and it is: ${key.size}")
3333
}

0 commit comments

Comments
 (0)