mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-10-01 06:55:46 -04:00
17 lines
287 B
Dart
17 lines
287 B
Dart
|
import 'package:veilid/base64url_no_pad.dart';
|
||
|
|
||
|
bool isValidDHTKey(String key) {
|
||
|
if (key.length != 43) {
|
||
|
return false;
|
||
|
}
|
||
|
try {
|
||
|
var dec = base64UrlNoPadDecode(key);
|
||
|
if (dec.length != 32) {
|
||
|
return false;
|
||
|
}
|
||
|
} catch (e) {
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
}
|