Skip to content

Commit

Permalink
adjust DTO to carry both EC keys
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jun 6, 2024
1 parent 847ecc4 commit 26369a5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions backend/src/main/java/org/cryptomator/hub/api/MemberDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@

public final class MemberDto extends AuthorityDto {

@JsonProperty("publicKey")
public final String publicKey;
@JsonProperty("ecdhPublicKey")
public final String ecdhPublicKey;
@JsonProperty("ecdsaPublicKey")
public final String ecdsaPublicKey;
@JsonProperty("role")
public final VaultAccess.Role role;

MemberDto(@JsonProperty("id") String id, @JsonProperty("type") Type type, @JsonProperty("name") String name, @JsonProperty("pictureUrl") String pictureUrl, @JsonProperty("publicKey") String publicKey, @JsonProperty("role") VaultAccess.Role role) {
MemberDto(@JsonProperty("id") String id, @JsonProperty("type") Type type, @JsonProperty("name") String name, @JsonProperty("pictureUrl") String pictureUrl, @JsonProperty("ecdhPublicKey") String ecdhPublicKey, @JsonProperty("ecdsaPublicKey") String ecdsaPublicKey, @JsonProperty("role") VaultAccess.Role role) {
super(id, type, name, pictureUrl);
this.publicKey = publicKey;
this.ecdhPublicKey = ecdhPublicKey;
this.ecdsaPublicKey = ecdsaPublicKey;
this.role = role;
}

public static MemberDto fromEntity(User user, VaultAccess.Role role) {
return new MemberDto(user.getId(), Type.USER, user.getName(), user.getPictureUrl(), user.getPublicKey(), role);
return new MemberDto(user.getId(), Type.USER, user.getName(), user.getPictureUrl(), user.getEcdhPublicKey(), user.getEcdsaPublicKey(), role);
}

public static MemberDto fromEntity(Group group, VaultAccess.Role role) {
return new MemberDto(group.getId(), Type.GROUP, group.getName(), null, null, role);
return new MemberDto(group.getId(), Type.GROUP, group.getName(), null, null, null, role);
}

}

0 comments on commit 26369a5

Please sign in to comment.