Skip to content

Commit

Permalink
Be more specific about encodings in /v1/archive docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-signal authored and jon-signal committed Dec 6, 2023
1 parent 78b2df2 commit 072b470
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ArchiveController(

public record SetBackupIdRequest(
@Schema(description = """
A BackupAuthCredentialRequest containing a blinded encrypted backup-id, encoded as a base64 string
A BackupAuthCredentialRequest containing a blinded encrypted backup-id, encoded in standard padded base64
""", implementation = String.class)
@JsonDeserialize(using = BackupAuthCredentialAdapter.CredentialRequestDeserializer.class)
@JsonSerialize(using = BackupAuthCredentialAdapter.CredentialRequestSerializer.class)
Expand Down Expand Up @@ -118,7 +118,7 @@ public record BackupAuthCredentialsResponse(
List<BackupAuthCredential> credentials) {

public record BackupAuthCredential(
@Schema(description = "A base64 encoded BackupAuthCredential")
@Schema(description = "A BackupAuthCredential, encoded in standard padded base64")
byte[] credential,
@Schema(description = "The day on which this credential is valid. Seconds since epoch truncated to day boundary")
long redemptionTime) {}
Expand Down Expand Up @@ -172,7 +172,7 @@ public CompletionStage<BackupAuthCredentialsResponse> getBackupZKCredentials(

public record BackupAuthCredentialPresentationHeader(BackupAuthCredentialPresentation presentation) {

private static final String DESCRIPTION = "Presentation of a ZK backup auth credential acquired from /v1/archives/auth as a base64 encoded string";
private static final String DESCRIPTION = "Presentation of a ZK backup auth credential acquired from /v1/archives/auth, encoded in standard padded base64";

public BackupAuthCredentialPresentationHeader(final String header) {
this(deserialize(header));
Expand All @@ -190,7 +190,7 @@ private static BackupAuthCredentialPresentation deserialize(final String base64P

public record BackupAuthCredentialPresentationSignature(byte[] signature) {

private static final String DESCRIPTION = "Signature of the ZK auth credential's presentation as a base64 encoded string";
private static final String DESCRIPTION = "Signature of the ZK auth credential's presentation, encoded in standard padded base64";

public BackupAuthCredentialPresentationSignature(final String header) {
this(Base64.getDecoder().decode(header));
Expand Down Expand Up @@ -276,7 +276,7 @@ public CompletionStage<BackupInfoResponse> backupInfo(
public record SetPublicKeyRequest(
@JsonSerialize(using = ECPublicKeyAdapter.Serializer.class)
@JsonDeserialize(using = ECPublicKeyAdapter.Deserializer.class)
@Schema(type = "string", description = "The public key, serialized in libsignal's elliptic-curve public key format and then base64-encoded.")
@Schema(type = "string", description = "The public key, serialized in libsignal's elliptic-curve public key format, and encoded in standard padded base64.")
ECPublicKey backupIdPublicKey) {}

@PUT
Expand Down Expand Up @@ -369,26 +369,26 @@ public record CopyMediaRequest(
@NotNull
int objectLength,

@Schema(description = "mediaId to copy on to the backup CDN in URL-safe base64", implementation = String.class)
@Schema(description = "mediaId to copy on to the backup CDN, encoded in URL-safe padded base64", implementation = String.class)
@JsonSerialize(using = ByteArrayBase64UrlAdapter.Serializing.class)
@JsonDeserialize(using = ByteArrayBase64UrlAdapter.Deserializing.class)
@NotNull
@ExactlySize(15)
byte[] mediaId,

@Schema(description = "A 32-byte key for the MAC, base64 encoded", implementation = String.class)
@Schema(description = "A 32-byte key for the MAC, encoded in standard padded base64", implementation = String.class)
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
@NotNull
@ExactlySize(32)
byte[] hmacKey,

@Schema(description = "A 32-byte encryption key for AES, base64 encoded", implementation = String.class)
@Schema(description = "A 32-byte encryption key for AES, encoded in standard padded base64", implementation = String.class)
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
@NotNull
@ExactlySize(32)
byte[] encryptionKey,

@Schema(description = "A 16-byte IV for AES, base64 encoded", implementation = String.class)
@Schema(description = "A 16-byte IV for AES, encoded in standard padded base64", implementation = String.class)
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
@NotNull
@ExactlySize(16)
Expand Down Expand Up @@ -496,7 +496,7 @@ public record Entry(
@Schema(description = "The backup cdn where this media object is stored")
Integer cdn,

@Schema(description = "The mediaId of the object in URL-safe base64", implementation = String.class)
@Schema(description = "The mediaId of the object, encoded in URL-safe padded base64", implementation = String.class)
@JsonSerialize(using = ByteArrayBase64UrlAdapter.Serializing.class)
@JsonDeserialize(using = ByteArrayBase64UrlAdapter.Deserializing.class)
@NotNull
Expand Down

0 comments on commit 072b470

Please sign in to comment.