Skip to content

Commit

Permalink
feat: Hex to string util
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Aug 6, 2024
1 parent 40d9220 commit 7e5a18f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions logic/lib/src/domain/utils/mxc_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ class MXCType {
return hexToBytes(value);
}

static String hexToString(String value) {
final bytes = hexToBytes(value);
return String.fromCharCodes(bytes);
}

static String uint8ListToString(
Uint8List value, {
bool include0x = false,
int? forcePadLength,
bool padToEvenLength = false,
}) {
return bytesToHex(value,
include0x: include0x,
forcePadLength: forcePadLength,
padToEvenLength: padToEvenLength);
return bytesToHex(
value,
include0x: include0x,
forcePadLength: forcePadLength,
padToEvenLength: padToEvenLength,
);
}

static BigInt stringToBigInt(String value) {
Expand Down

0 comments on commit 7e5a18f

Please sign in to comment.