Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bumping web5-kt version to 0.16.0 #213

Merged
merged 7 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ plugins {

repositories {
mavenCentral()
// block's cache artifactory for tbd's oss third party dependencies
// that do not live in maven central
maven {
name = "tbd-oss-thirdparty"
url = uri("https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/")
mavenContent {
releasesOnly()
}
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ com_networknt = "1.0.87"
com_squareup_okhttp = "4.12.0"
de_fxlae = "0.2.0"
io_ktor = "2.3.7"
xyz_block_web5 = "0.14.0"
xyz_block_web5 = "0.16.0"

[libraries]
comFasterXmlJacksonModuleKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "com_fasterxml_jackson" }
Expand Down
16 changes: 4 additions & 12 deletions httpclient/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,15 @@ plugins {

repositories {
mavenCentral()
// temp maven repo for danubetech
// block's cache artifactory for tbd's oss third party dependencies
// that do not live in maven central
maven {
name = "tbd-danubetech-temp"
url = uri("https://blockxyz.jfrog.io/artifactory/danubetech-temp/")
name = "tbd-oss-thirdparty"
url = uri("https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/")
mavenContent {
releasesOnly()
}
}
maven {
url = uri("https://repo.danubetech.com/repository/maven-public")
}
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri("https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/")
}
}

val jackson_version = "2.14.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.nimbusds.jose.util.Base64URL
import com.nimbusds.jwt.JWTClaimsSet
import com.nimbusds.jwt.SignedJWT
import web5.sdk.common.Convert
import web5.sdk.dids.Did
import web5.sdk.dids.DidResolvers
import web5.sdk.dids.did.BearerDid
import web5.sdk.dids.didcore.VerificationMethod
import java.time.Instant
import java.util.Date
Expand Down Expand Up @@ -36,7 +36,7 @@ object RequestToken {
* @return signed request token to be included as Authorization header for sending to PFI endpoints
*
*/
fun generate(did: Did, pfiDid: String, assertionMethodId: String? = null): String {
fun generate(did: BearerDid, pfiDid: String, assertionMethodId: String? = null): String {

val didResolutionResult = DidResolvers.resolve(did.uri)
val assertionMethod: VerificationMethod =
Expand All @@ -50,7 +50,7 @@ object RequestToken {
val keyAlias = did.keyManager.getDeterministicAlias(publicKeyJwk)

// TODO: figure out how to make more reliable since algorithm is technically not a required property of a JWK
val algorithm = publicKeyJwk.algorithm
val algorithm = publicKeyJwk.alg
val jwsAlgorithm = JWSAlgorithm.parse(algorithm.toString())

val kid = when (assertionMethod.id.startsWith("#")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import tbdex.sdk.protocol.models.Order
import tbdex.sdk.protocol.models.Rfq
import tbdex.sdk.protocol.serialization.Json
import tbdex.sdk.protocol.serialization.Json.jsonMapper
import web5.sdk.dids.Did
import web5.sdk.dids.did.BearerDid

/**
* A client of the tbDEX HTTP interface for communicating with a PFI.
Expand Down Expand Up @@ -174,7 +174,7 @@ object TbdexHttpClient {
.post(requestBody)
.build()

println("Attempting to send message to exchange ${exchangeId} to: ${request.url}")
println("Attempting to send message to exchange $exchangeId to: ${request.url}")

executeRequest(request)
}
Expand All @@ -188,7 +188,7 @@ object TbdexHttpClient {
* @return An [Exchange] containing the requested exchange.
* @throws TbdexResponseException for request or response errors.
*/
fun getExchange(pfiDid: String, requesterDid: Did, exchangeId: String): Exchange {
fun getExchange(pfiDid: String, requesterDid: BearerDid, exchangeId: String): Exchange {
val pfiServiceEndpoint = getPfiServiceEndpoint(pfiDid)
val baseUrl = "$pfiServiceEndpoint/exchanges/$exchangeId"
val requestToken = RequestToken.generate(requesterDid, pfiDid)
Expand Down Expand Up @@ -226,7 +226,7 @@ object TbdexHttpClient {
* @return A list of matching [Exchange].
* @throws TbdexResponseException for request or response errors.
*/
fun getExchanges(pfiDid: String, requesterDid: Did, filter: GetExchangesFilter? = null): List<Exchange> {
fun getExchanges(pfiDid: String, requesterDid: BearerDid, filter: GetExchangesFilter? = null): List<Exchange> {
val pfiServiceEndpoint = getPfiServiceEndpoint(pfiDid)
val baseUrl = "$pfiServiceEndpoint/exchanges/"
val requestToken = RequestToken.generate(requesterDid, pfiDid)
Expand Down
21 changes: 9 additions & 12 deletions httpclient/src/test/kotlin/tbdex/sdk/httpclient/E2ETest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tbdex.sdk.httpclient

import com.nimbusds.jose.jwk.JWK
import org.junit.jupiter.api.Disabled
import tbdex.sdk.httpclient.models.GetExchangesFilter
import tbdex.sdk.httpclient.models.GetOfferingsFilter
Expand All @@ -14,7 +13,9 @@ import tbdex.sdk.protocol.models.RfqData
import tbdex.sdk.protocol.models.SelectedPaymentMethod
import web5.sdk.credentials.VerifiableCredential
import web5.sdk.crypto.InMemoryKeyManager
import web5.sdk.dids.Did
import web5.sdk.crypto.JwaCurve
import web5.sdk.crypto.jwk.Jwk
import web5.sdk.dids.did.BearerDid
import web5.sdk.dids.didcore.Purpose
import web5.sdk.dids.didcore.Service
import web5.sdk.dids.methods.dht.CreateDidDhtOptions
Expand All @@ -41,13 +42,9 @@ class E2ETest {
CreateDidDhtOptions(
verificationMethods = listOf(
Triple(
JWK.parse(
"""{
"crv": "Ed25519",
"kty": "OKP",
"x": "i6cnsuH4JTBMXKbseg28Hi3w4Xp13E85UwnSW3ZgYk8"
}"""
),
Jwk.Builder("OKP", JwaCurve.Ed25519.name)
.x("i6cnsuH4JTBMXKbseg28Hi3w4Xp13E85UwnSW3ZgYk8")
.build(),
listOf(Purpose.Authentication),
UUID.randomUUID().toString()
)
Expand Down Expand Up @@ -153,7 +150,7 @@ class E2ETest {
private fun getExchangeWithOrderStatus(
client: TbdexHttpClient,
pfiDid: String,
myDid: DidKey,
myDid: BearerDid,
rfq: Rfq,
): List<Message> {
var attempt = 0
Expand Down Expand Up @@ -206,7 +203,7 @@ class E2ETest {
private fun getCurrentExchange(
client: TbdexHttpClient,
pfiDid: String,
myDid: Did,
myDid: BearerDid,
rfq: Rfq
): List<Message> {
var listOfExchanges: List<List<Message>>
Expand Down Expand Up @@ -274,7 +271,7 @@ class E2ETest {
claims = listOf(vcJwt)
)

private fun buildVC(myDid: DidKey) = VerifiableCredential.create(
private fun buildVC(myDid: BearerDid) = VerifiableCredential.create(
type = "SanctionCredential",
issuer = myDid.uri,
subject = myDid.uri,
Expand Down
6 changes: 3 additions & 3 deletions httpclient/src/test/kotlin/tbdex/sdk/httpclient/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import web5.sdk.credentials.model.FieldV2
import web5.sdk.credentials.model.InputDescriptorV2
import web5.sdk.credentials.model.PresentationDefinitionV2
import web5.sdk.crypto.InMemoryKeyManager
import web5.sdk.dids.Did
import web5.sdk.dids.did.BearerDid
import web5.sdk.dids.methods.key.DidKey
import java.net.URI
import java.time.OffsetDateTime
Expand All @@ -30,8 +30,8 @@ import java.util.UUID
object TestData {
private val aliceKeyManager = InMemoryKeyManager()
private val pfiKeyManager = InMemoryKeyManager()
val ALICE_DID: Did = DidKey.create(aliceKeyManager)
val PFI_DID: Did = DidKey.create(pfiKeyManager)
val ALICE_DID: BearerDid = DidKey.create(aliceKeyManager)
val PFI_DID: BearerDid = DidKey.create(pfiKeyManager)

fun getPresentationDefinition(): PresentationDefinitionV2 {
return buildPresentationDefinition(
Expand Down
17 changes: 4 additions & 13 deletions httpserver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,16 @@ plugins {

repositories {
mavenCentral()
// temp maven repo for danubetech
// block's cache artifactory for tbd's oss third party dependencies
// that do not live in maven central
maven {
name = "tbd-danubetech-temp"
url = uri("https://blockxyz.jfrog.io/artifactory/danubetech-temp/")
name = "tbd-oss-thirdparty"
url = uri("https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/")
mavenContent {
releasesOnly()
}
}
maven {
url = uri("https://repo.danubetech.com/repository/maven-public")
}
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri("https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/")
}
}

application {
mainClass.set("tbdex.sdk.httpserver.TbdexHttpServerKt")
}
Expand Down
16 changes: 4 additions & 12 deletions protocol/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,15 @@ plugins {

repositories {
mavenCentral()
// temp maven repo for danubetech
// block's cache artifactory for tbd's oss third party dependencies
// that do not live in maven central
maven {
name = "tbd-danubetech-temp"
url = uri("https://blockxyz.jfrog.io/artifactory/danubetech-temp/")
name = "tbd-oss-thirdparty"
url = uri("https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/")
mavenContent {
releasesOnly()
}
}
maven {
url = uri("https://repo.danubetech.com/repository/maven-public")
}
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri("https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/")
}
}

dependencies {
Expand Down
Loading
Loading