Skip to content

Commit

Permalink
feat: Remove strange character #2082
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 8, 2023
1 parent 3a75eb7 commit 0a6a500
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/app/shared/extension/extension.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'credential_status.dart';
export 'iterable_extension.dart';
export 'string_extension.dart';
export 'unit8List_extension.dart';
21 changes: 21 additions & 0 deletions lib/app/shared/extension/unit8List_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:typed_data';

extension Uint8ListExtension on Uint8List {
Uint8List get filterPayload {
final tester = Uint8List.fromList([5, 1]);

if (length <= 6) {
return this;
}

if (this[0] != tester[0]) {
return this;
}

if (this[1] != tester[1]) {
return this;
}

return sublist(6);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class SignPayloadCubit extends Cubit<SignPayloadState> {
encodedPayload = stringToHexPrefixedWith05(payload: payload);
signingType = SigningType.raw;
}
final bytes = hexToBytes(encodedPayload);
final bytes = hexToBytes(encodedPayload).filterPayload;

payloadMessage = utf8.decode(bytes, allowMalformed: true);

case ConnectionBridgeType.walletconnect:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class _SignPayloadViewState extends State<SignPayloadView> {
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: Sizes.spaceXLarge),
const SizedBox(height: Sizes.spaceXSmall),
Text(
message,
textAlign: TextAlign.left,
Expand Down

0 comments on commit 0a6a500

Please sign in to comment.