Skip to content

Commit f68e7c0

Browse files
committed
Rename ByteArray field from base64 to base64url
1 parent 91ee550 commit f68e7c0

File tree

1 file changed

+12
-12
lines changed
  • webauthn-server-core/src/main/java/com/yubico/webauthn/data

1 file changed

+12
-12
lines changed

webauthn-server-core/src/main/java/com/yubico/webauthn/data/ByteArray.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ public final class ByteArray implements Comparable<ByteArray>, JsonStringSeriali
5151

5252
@NonNull private final byte[] bytes;
5353

54-
@NonNull private final String base64;
54+
@NonNull private final String base64url;
5555

5656
/** Create a new instance by copying the contents of <code>bytes</code>. */
5757
public ByteArray(@NonNull byte[] bytes) {
5858
this.bytes = BinaryUtil.copy(bytes);
59-
this.base64 = BASE64URL_ENCODER.encodeToString(this.bytes);
59+
this.base64url = BASE64URL_ENCODER.encodeToString(this.bytes);
6060
}
6161

62-
private ByteArray(String base64) throws Base64UrlException {
62+
private ByteArray(String base64url) throws Base64UrlException {
6363
try {
64-
this.bytes = BASE64URL_DECODER.decode(base64);
64+
this.bytes = BASE64URL_DECODER.decode(base64url);
6565
} catch (IllegalArgumentException e) {
66-
throw new Base64UrlException("Invalid Base64Url encoding: " + base64, e);
66+
throw new Base64UrlException("Invalid Base64Url encoding: " + base64url, e);
6767
}
68-
this.base64 = base64;
68+
this.base64url = base64url;
6969
}
7070

7171
/** Create a new instance by decoding <code>base64</code> as classic Base64 data. */
@@ -74,13 +74,13 @@ public static ByteArray fromBase64(@NonNull final String base64) {
7474
}
7575

7676
/**
77-
* Create a new instance by decoding <code>base64</code> as Base64Url data.
77+
* Create a new instance by decoding <code>base64url</code> as Base64Url data.
7878
*
79-
* @throws Base64UrlException if <code>base64</code> is not valid Base64Url data.
79+
* @throws Base64UrlException if <code>base64url</code> is not valid Base64Url data.
8080
*/
8181
@JsonCreator
82-
public static ByteArray fromBase64Url(@NonNull final String base64) throws Base64UrlException {
83-
return new ByteArray(base64.split("=")[0]);
82+
public static ByteArray fromBase64Url(@NonNull final String base64url) throws Base64UrlException {
83+
return new ByteArray(base64url.split("=")[0]);
8484
}
8585

8686
/**
@@ -124,7 +124,7 @@ public String getBase64() {
124124

125125
/** @return the content bytes encoded as Base64Url data, without padding. */
126126
public String getBase64Url() {
127-
return base64;
127+
return base64url;
128128
}
129129

130130
/** @return the content bytes encoded as hexadecimal data. */
@@ -136,7 +136,7 @@ public String getHex() {
136136
/** Used by JSON serializer. */
137137
@Override
138138
public String toJsonString() {
139-
return base64;
139+
return base64url;
140140
}
141141

142142
@Override

0 commit comments

Comments
 (0)