Skip to content

Commit

Permalink
alg fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavoyan committed Feb 14, 2024
1 parent 8912cf4 commit 2cdc224
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum class VCLSignatureAlgorithm(val value: String) {
when (value) {
ES256.value -> ES256
SECP256k1.value -> SECP256k1
else -> ES256
else -> SECP256k1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import io.velocitycareerlabs.api.VCLSignatureAlgorithm

data class VCLCryptoServicesDescriptor(
val cryptoServiceType: VCLCryptoServiceType = VCLCryptoServiceType.Local,
val signatureAlgorithm: VCLSignatureAlgorithm = VCLSignatureAlgorithm.ES256,
val signatureAlgorithm: VCLSignatureAlgorithm = VCLSignatureAlgorithm.SECP256k1,
val injectedCryptoServicesDescriptor: VCLInjectedCryptoServicesDescriptor? = null,
val remoteCryptoServicesUrlsDescriptor: VCLRemoteCryptoServicesUrlsDescriptor? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal object GlobalConfig {

var CurrentEnvironment = VCLEnvironment.Prod
var XVnfProtocolVersion = VCLXVnfProtocolVersion.XVnfProtocolVersion1
var SignatureAlgorithm = VCLSignatureAlgorithm.ES256
var SignatureAlgorithm = VCLSignatureAlgorithm.SECP256k1

var IsDebugOn = false //BuildConfig.DEBUG

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ internal class JwtServiceUseCaseTest {
) {
it.handleResult(
{ jwt ->
assert(jwt.header?.toJSONObject()?.get("alg") as? String == VCLSignatureAlgorithm.SECP256k1.jwsAlgorithm.name)
assert(((jwt.header?.toJSONObject()?.get("jwk") as? Map<*, *>)!!["crv"] as? String) == VCLSignatureAlgorithm.SECP256k1.curve.name)
assert(jwt.header?.toJSONObject()?.get("typ") as? String == "JWT")
},
Expand All @@ -106,6 +107,7 @@ internal class JwtServiceUseCaseTest {
) {
it.handleResult(
{ jwt ->
assert(jwt.header?.toJSONObject()?.get("alg") as? String == VCLSignatureAlgorithm.ES256.jwsAlgorithm.name)
assert(((jwt.header?.toJSONObject()?.get("jwk") as? Map<*, *>)!!["crv"] as? String) == VCLSignatureAlgorithm.ES256.curve.name)
assert(jwt.header?.toJSONObject()?.get("typ") as? String == "JWT")
},
Expand Down

0 comments on commit 2cdc224

Please sign in to comment.