Skip to content

Commit

Permalink
expose jwks.json and vault.uvf endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed May 10, 2024
1 parent b0790aa commit 98cd173
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions backend/src/main/java/org/cryptomator/hub/api/VaultResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,38 @@ public Response unlock(@PathParam("vaultId") UUID vaultId, @QueryParam("evenIfAr
}
}

@GET
@Path("/{vaultId}/uvf/vault.uvf")
@RolesAllowed("user")
@Transactional
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "get the vault.uvf file")
@APIResponse(responseCode = "200")
@APIResponse(responseCode = "404", description = "unknown vault")
public String getUvfMetadata(@PathParam("vaultId") UUID vaultId) {
var vault = vaultRepo.findById(vaultId);
if (vault == null || vault.getUvfMetadataFile() == null) {
throw new NotFoundException();
}
return vault.getUvfMetadataFile();
}

@GET
@Path("/{vaultId}/uvf/jwks.json")
@RolesAllowed("user")
@Transactional
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "get public vault keys", description = "retrieves a JWK Set containing public keys related to this vault")
@APIResponse(responseCode = "200")
@APIResponse(responseCode = "404", description = "unknown vault")
public String getUvfKeys(@PathParam("vaultId") UUID vaultId) {
var vault = vaultRepo.findById(vaultId);
if (vault == null || vault.getUvfMetadataFile() == null) {
throw new NotFoundException();
}
return vault.getUvfKeySet();
}

@POST
@Path("/{vaultId}/access-tokens")
@RolesAllowed("user")
Expand Down

0 comments on commit 98cd173

Please sign in to comment.