Skip to content

Commit f2ea14f

Browse files
Support commitment of multiple payloads64 in Unseal request.
1 parent dd196ee commit f2ea14f

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/main/kotlin/org/exploit/keeper/controller/keeper/SystemController.kt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package org.exploit.keeper.controller.keeper
22

3-
import jakarta.ws.rs.GET
4-
import jakarta.ws.rs.POST
5-
import jakarta.ws.rs.PUT
6-
import jakarta.ws.rs.Path
3+
import jakarta.ws.rs.*
74
import jakarta.ws.rs.container.ContainerRequestContext
85
import org.exploit.keeper.constant.Permission
96
import org.exploit.keeper.model.request.Unseal
@@ -37,7 +34,25 @@ class SystemController(
3734
@Path("/unseal")
3835
fun unseal(req: Unseal): Progress {
3936
policyChecker.ensureHasPermission(ctx, Permission.systemUnseal())
40-
return keeper.submit(req.payload64)
37+
38+
val payloads = buildList {
39+
req.payload64?.let { add(it) }
40+
addAll(req.payloads64)
41+
}
42+
43+
if (payloads.isEmpty()) {
44+
throw BadRequestException("At least one payload64 must be provided")
45+
}
46+
47+
for (payload in payloads) {
48+
val progress = keeper.submit(payload)
49+
50+
if (progress.ready) {
51+
return progress
52+
}
53+
}
54+
55+
return keeper.status().progress
4156
}
4257

4358
@PUT
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.exploit.keeper.model.request
22

33
data class Unseal(
4-
val payload64: String,
4+
val payload64: String?,
5+
val payloads64: List<String>,
56
val reset: Boolean? = false
67
)

0 commit comments

Comments
 (0)