Skip to content

Commit 143457b

Browse files
committed
fix: format webhooks
1 parent 3a15ffd commit 143457b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/WebhookServiceImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ private const val SIGNATURE_VERSION = "v1"
2525
private const val SIGNATURE_DELIMITER = " "
2626
private const val SIGNATURE_KEY_VALUE_DELIMITER = "="
2727

28-
class WebhookServiceImpl
29-
constructor(
30-
private val clientOptions: ClientOptions,
31-
) : WebhookService {
28+
class WebhookServiceImpl constructor(private val clientOptions: ClientOptions) : WebhookService {
3229
@kotlin.ExperimentalStdlibApi
3330
override fun unwrap(payload: String, headers: Headers, secret: String?): JsonValue {
3431
verifySignature(payload, headers, secret)
@@ -86,7 +83,7 @@ constructor(
8683
if (
8784
MessageDigest.isEqual(
8885
actualSignature,
89-
expectedSignature.toByteArray(Charsets.UTF_8)
86+
expectedSignature.toByteArray(Charsets.UTF_8),
9087
)
9188
) {
9289
return

orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/WebhookServiceTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal class WebhookServiceTest {
7575
.atOffset(ZoneOffset.UTC)
7676
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
7777
),
78-
SECRET
78+
SECRET,
7979
)
8080
}
8181
.isInstanceOf(OrbException::class.java)
@@ -97,7 +97,7 @@ internal class WebhookServiceTest {
9797
.atOffset(ZoneOffset.UTC)
9898
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
9999
),
100-
SECRET
100+
SECRET,
101101
)
102102
}
103103
.isInstanceOf(OrbException::class.java)
@@ -131,7 +131,7 @@ internal class WebhookServiceTest {
131131
.verifySignature(
132132
PAYLOAD.trimIndent(),
133133
buildHeaders(signature = "$SIGNATURE v1=Zm9v"),
134-
SECRET
134+
SECRET,
135135
)
136136
}
137137
.doesNotThrowAnyException()
@@ -141,7 +141,7 @@ internal class WebhookServiceTest {
141141
.verifySignature(
142142
PAYLOAD.trimIndent(),
143143
buildHeaders(signature = "v1=$SIGNATURE v2=$SIGNATURE"),
144-
SECRET
144+
SECRET,
145145
)
146146
}
147147
.doesNotThrowAnyException()
@@ -156,7 +156,7 @@ internal class WebhookServiceTest {
156156
.verifySignature(
157157
PAYLOAD.trimIndent(),
158158
buildHeaders(signature = "v2=$SIGNATURE"),
159-
SECRET
159+
SECRET,
160160
)
161161
}
162162
.isInstanceOf(OrbException::class.java)

0 commit comments

Comments
 (0)