Skip to content

Commit

Permalink
Deprecate the toHex and toBase64 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ronhombre committed Aug 28, 2024
1 parent 688d4f6 commit 3e541f5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/commonMain/kotlin/asia/hombre/kyber/KyberCipherText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ class KyberCipherText internal constructor( //TODO: Copy parameter variables
* @param isUppercase
* @return [String]
*/
@Deprecated("Conversion to hex values are up to the user.", level = DeprecationLevel.WARNING, replaceWith =
ReplaceWith("fullBytes.toHexString(if (isUppercase) HexFormat.UpperCase else HexFormat.Default)")
)
@OptIn(ExperimentalStdlibApi::class)
override fun toHex(isUppercase: Boolean): String {
return fullBytes.toHexString(if(isUppercase) HexFormat.UpperCase else HexFormat.Default)
Expand All @@ -140,6 +143,9 @@ class KyberCipherText internal constructor( //TODO: Copy parameter variables
*
* @return [String]
*/
@Deprecated("Conversion to base64 values are up to the user.", level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Base64.encode(fullBytes)", "kotlin.io.encoding.Base64")
)
@OptIn(ExperimentalEncodingApi::class)
override fun toBase64(): String {
return Base64.encode(fullBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class KyberDecapsulationKey internal constructor(
* @param isUppercase
* @return [String]
*/
@Deprecated("Conversion to hex values are up to the user.", level = DeprecationLevel.WARNING, replaceWith =
ReplaceWith("fullBytes.toHexString(if (isUppercase) HexFormat.UpperCase else HexFormat.Default)")
)
@OptIn(ExperimentalStdlibApi::class)
override fun toHex(isUppercase: Boolean): String {
return fullBytes.toHexString(if(isUppercase) HexFormat.UpperCase else HexFormat.Default)
Expand All @@ -151,6 +154,9 @@ class KyberDecapsulationKey internal constructor(
*
* @return [String]
*/
@Deprecated("Conversion to base64 values are up to the user.", level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Base64.encode(fullBytes)", "kotlin.io.encoding.Base64")
)
@OptIn(ExperimentalEncodingApi::class)
override fun toBase64(): String {
return Base64.encode(fullBytes)
Expand Down
6 changes: 6 additions & 0 deletions src/commonMain/kotlin/asia/hombre/kyber/KyberDecryptionKey.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class KyberDecryptionKey internal constructor(
* @param isUppercase
* @return [String]
*/
@Deprecated("Conversion to hex values are up to the user.", level = DeprecationLevel.WARNING, replaceWith =
ReplaceWith("fullBytes.toHexString(if (isUppercase) HexFormat.UpperCase else HexFormat.Default)")
)
@OptIn(ExperimentalStdlibApi::class)
override fun toHex(isUppercase: Boolean): String {
return fullBytes.toHexString(if(isUppercase) HexFormat.UpperCase else HexFormat.Default)
Expand All @@ -132,6 +135,9 @@ class KyberDecryptionKey internal constructor(
*
* @return [String]
*/
@Deprecated("Conversion to base64 values are up to the user.", level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Base64.encode(fullBytes)", "kotlin.io.encoding.Base64")
)
@OptIn(ExperimentalEncodingApi::class)
override fun toBase64(): String {
return Base64.encode(fullBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class KyberEncapsulationKey internal constructor(
* @param isUppercase
* @return [String]
*/
@Deprecated("Conversion to hex values are up to the user.", level = DeprecationLevel.WARNING, replaceWith =
ReplaceWith("fullBytes.toHexString(if (isUppercase) HexFormat.UpperCase else HexFormat.Default)")
)
@OptIn(ExperimentalStdlibApi::class)
override fun toHex(isUppercase: Boolean): String {
return fullBytes.toHexString(if(isUppercase) HexFormat.UpperCase else HexFormat.Default)
Expand All @@ -117,6 +120,9 @@ class KyberEncapsulationKey internal constructor(
*
* @return [String]
*/
@Deprecated("Conversion to base64 values are up to the user.", level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Base64.encode(fullBytes)", "kotlin.io.encoding.Base64")
)
@OptIn(ExperimentalEncodingApi::class)
override fun toBase64(): String {
return Base64.encode(fullBytes)
Expand Down
6 changes: 6 additions & 0 deletions src/commonMain/kotlin/asia/hombre/kyber/KyberEncryptionKey.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ class KyberEncryptionKey internal constructor(
* @param isUppercase
* @return [String]
*/
@Deprecated("Conversion to hex values are up to the user.", level = DeprecationLevel.WARNING, replaceWith =
ReplaceWith("fullBytes.toHexString(if (isUppercase) HexFormat.UpperCase else HexFormat.Default)")
)
@OptIn(ExperimentalStdlibApi::class)
override fun toHex(isUppercase: Boolean): String {
return fullBytes.toHexString(if(isUppercase) HexFormat.UpperCase else HexFormat.Default)
Expand All @@ -146,6 +149,9 @@ class KyberEncryptionKey internal constructor(
*
* @return [String]
*/
@Deprecated("Conversion to base64 values are up to the user.", level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Base64.encode(fullBytes)", "kotlin.io.encoding.Base64")
)
@OptIn(ExperimentalEncodingApi::class)
override fun toBase64(): String {
return Base64.encode(fullBytes)
Expand Down

0 comments on commit 3e541f5

Please sign in to comment.