Skip to content

Base64String

Namespace: Signal.Bot

Full Name: Signal.Bot.Base64String

Summary

Represents a validated base64-encoded string with conversion utilities for byte arrays.

Methods

FromBytes

csharp
FromBytes(bytes)

Creates a Base64String from a byte array.

Parameters:

  • bytes - The byte array to encode as base64.

Returns: A new Base64String instance.

ToBytes

csharp
ToBytes()

Converts the base64 string to its byte array representation.

Returns: The decoded byte array.

ToString

csharp
ToString()

Returns the base64-encoded string value.

Returns: The base64 string.

op_Implicit

csharp
op_Implicit(base64)

Implicitly converts a Base64String to a regular string.

Parameters:

  • base64 - The Base64String to convert.

op_Implicit

csharp
op_Implicit(value)

Implicitly converts a string to a Base64String with validation.

Parameters:

  • value - The string to convert.

Exceptions:

  • System.ArgumentException - Thrown when the provided string is not valid base64.

IsValidBase64

csharp
IsValidBase64(value)

Validates whether a string is valid base64-encoded data.

Parameters:

  • value - The string to validate.

Returns: True if the string is valid base64; otherwise, false.