feat: exchange api security handle

This commit is contained in:
icy
2025-11-07 16:22:56 +08:00
parent 6197eb468e
commit 75aa20b36b
4 changed files with 52 additions and 47 deletions

View File

@@ -12,6 +12,11 @@ export class CryptoService {
private static publicKeyPEM: string | null = null;
static async initialize(publicKeyPEM: string) {
// 检查 Web Crypto API 是否可用
if (!window.crypto || !window.crypto.subtle) {
throw new Error('Web Crypto API is not available. Please use HTTPS or localhost to access the application.');
}
if (this.publicKey && this.publicKeyPEM === publicKeyPEM) {
return;
}