已发布的源代码
下载源代码 ZIP
CH-J Tools Mobile
浏览特定应用版本的目录和文件。
CH-J / CH-J Tools Mobile
175 个文件
sm-mobile-20261016T185235Z-8e93ecc1b59a
添加时间: · 构建时间:
1
import '../core/failure.dart';2
import 'vault.dart';4
typedef TrustPrompt =5
Future<bool> Function(String endpoint, String type, String fingerprint);7
class HostVerifier {8
final Vault vault;9
HostVerifier(this.vault);10
Future<bool> verify(11
String endpoint,12
String type,13
String fingerprint,14
TrustPrompt prompt,15
) async {16
if (!RegExp(r'^SHA256:[A-Za-z0-9+/]{43}$').hasMatch(fingerprint)) {17
throw const Failure('hostRejected');18
}19
final epoch = vault.generation;20
final previous = vault.fingerprint(endpoint);21
if (previous != null) {22
if (previous != fingerprint) throw const Failure('hostChanged');23
return true;24
}25
if (!await prompt(endpoint, type, fingerprint)) {26
throw const Failure('hostRejected');27
}28
if (epoch != vault.generation) throw const Failure('locked');29
await vault.trust(endpoint, fingerprint);30
return true;31
}32
}SHA-256
abd25d6bc94824a18c99bac9cd4646d347dd37a381d02b27b852b44f69b2117dCH-J Proprietary Software License 1.14 · 源代码依据 CH-J Proprietary Software License 1.14 提供。公开源代码不会改变许可条款,也不会授予额外权利。
压缩包 SHA-256
46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655