Skip to content

Commit

Permalink
allow device registration from older Cryptomator desktop clients
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jun 16, 2023
1 parent f5a335d commit 54156b3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public Response createOrUpdate(@Valid @NotNull DeviceDto dto, @PathParam("device
device.id = deviceId;
device.owner = User.findById(jwt.getSubject());
device.creationTime = Instant.now().truncatedTo(ChronoUnit.MILLIS);
device.type = dto.type;
device.type = dto.type != null ? dto.type : Device.Type.DESKTOP; // default to desktop for backwards compatibility
}
device.name = dto.name;
device.publickey = dto.publicKey;
Expand Down Expand Up @@ -155,7 +155,7 @@ public Response remove(@PathParam("deviceId") @ValidId String deviceId) {

public record DeviceDto(@JsonProperty("id") @ValidId String id,
@JsonProperty("name") @NoHtmlOrScriptChars @NotBlank String name,
@JsonProperty("type") @NotNull Device.Type type,
@JsonProperty("type") Device.Type type,
@JsonProperty("publicKey") @NotNull @OnlyBase64UrlChars String publicKey, // for historic reasons, the device public key is base64url-encoded, instead of base64
@JsonProperty("userKey") @ValidJWE String userKey,
@JsonProperty("owner") @ValidId String ownerId,
Expand Down

0 comments on commit 54156b3

Please sign in to comment.