个人密码生成器安全到我自己都记不住
一个基于 PBKDF2-SHA512 算法的纯客户端密码生成器,确保零信任架构下的密码安全
index.html
文件或访问演示页面 demo.html
# 克隆项目
git clone <repository-url>
cd mnemonic-fortress
# 安装依赖
npm install
# 启动开发服务器
npm run dev
访问 http://localhost:3000
即可使用。
index.html
- 主应用程序demo.html
- 功能演示页面test.html
- 测试页面js/
- JavaScript 源代码目录V4 (双因素安全) - 推荐 🌟
V3 (增强隐私)
V2 (兼容旧版)
启用高级策略后可以:
salt = version + ":" + normalizedPlatformName
derivedKey = PBKDF2(masterKey, salt, 100000 iterations, SHA-512)
password = assemblePassword(derivedKey, strategy, advancedConfig)
生成的密码包含以下组件:
项目包含完整的测试套件:
# 在浏览器中打开测试页面
open test.html
测试包括:
项目提供了自动化部署脚本,支持多种部署方式:
# 使用部署脚本
chmod +x deploy.sh
# Docker 部署
./deploy.sh docker
# Nginx 部署
./deploy.sh nginx /var/www/topsecret
# Apache 部署
./deploy.sh apache /var/www/html/topsecret
由于 Top Secret 是纯前端应用,可以部署到任何支持静态文件的服务器:
# 1. 上传文件到服务器
scp -r ./* user@your-server:/var/www/topsecret/
# 2. 配置 Nginx
sudo nano /etc/nginx/sites-available/topsecret
Nginx 配置示例:
server {
listen 80;
server_name your-domain.com;
root /var/www/topsecret;
index index.html;
# 启用 gzip 压缩
gzip on;
gzip_types text/css application/javascript text/javascript application/json;
# 缓存静态资源
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# 安全头
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# 主页面
location / {
try_files $uri $uri/ /index.html;
}
}
# 3. 启用站点
sudo ln -s /etc/nginx/sites-available/topsecret /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
# 1. 上传文件
scp -r ./* user@your-server:/var/www/html/topsecret/
# 2. 创建 .htaccess 文件
nano /var/www/html/topsecret/.htaccess
.htaccess 配置:
# 启用压缩
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
</IfModule>
# 缓存设置
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
</IfModule>
# 安全头
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
# 1. 安装 Vercel CLI
npm i -g vercel
# 2. 在项目目录下部署
vercel
# 3. 按提示配置域名和设置
# 1. 安装 Netlify CLI
npm install -g netlify-cli
# 2. 部署
netlify deploy --prod --dir .
# 或直接拖拽文件到 Netlify 网站
# 1. 推送代码到 GitHub
git add .
git commit -m "Deploy to GitHub Pages"
git push origin main
# 2. 在 GitHub 仓库设置中启用 Pages
# Settings -> Pages -> Source: Deploy from a branch -> main
创建 Dockerfile
:
FROM nginx:alpine
# 复制文件到 nginx 目录
COPY . /usr/share/nginx/html
# 复制 nginx 配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
创建 nginx.conf
:
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/css application/javascript text/javascript application/json;
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
try_files $uri $uri/ /index.html;
}
}
部署命令:
# 构建镜像
docker build -t topsecret .
# 运行容器
docker run -d -p 80:80 --name topsecret topsecret
# 或使用 docker-compose
echo "version: '3'
services:
topsecret:
build: .
ports:
- '80:80'
restart: unless-stopped" > docker-compose.yml
docker-compose up -d
# 1. 安装 Certbot
sudo apt update
sudo apt install certbot python3-certbot-nginx
# 2. 获取 SSL 证书
sudo certbot --nginx -d your-domain.com
# 3. 自动续期
sudo crontab -e
# 添加: 0 12 * * * /usr/bin/certbot renew --quiet
启用 CDN
压缩优化
缓存策略
安全加固
部署完成后,使用健康检查脚本验证服务状态:
# 检查本地服务
./health-check.sh
# 检查指定 URL
./health-check.sh http://your-domain.com
# 检查指定端口
./health-check.sh http://localhost 8080
健康检查包括:
top-secret/
├── index.html # 主应用页面
├── demo.html # 功能演示页面
├── test.html # 测试页面
├── package.json # 项目配置
├── README.md # 项目说明
├── 开发文档.md # 详细开发文档
└── js/
├── app.js # 主应用逻辑
├── password-generator.js # 密码生成算法
└── platform-data.js # 平台数据和自动补全
demo.html
个人密钥安全:
使用环境:
备份策略:
MIT License - 详见 LICENSE 文件
欢迎提交 Issue 和 Pull Request!
本工具仅供个人使用,请确保在安全的环境中使用。开发者不对因使用本工具而导致的任何损失承担责任。
🔐 Top Secret - 您的密码安全守护者