diff --git a/README.md b/README.md
index c2371c7..1f1a60b 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@
| 🌐 朋友圈 | 发动态(文字+最多9张图)、点赞(显示好友头像)、评论、标签可见性控制 |
| 🏷️ 好友标签 | 为好友设置多个标签(12色预设调色板),按标签分类筛选通讯录 |
| 🗂️ R2 对象存储 | Cloudflare R2 存储图片/语音,可选公开 CDN 直链 |
+| 🔑 两步验证 (2FA) | Google Authenticator 兼容 TOTP 验证,8 个一次性恢复码,登录时强制验证 |
| 🏗️ 可自托管 | Docker Compose 一键部署,支持 Node.js + Redis 多节点 |
---
@@ -273,7 +274,8 @@ paperphone/
│ │ ├── moments.js # 朋友圈(动态/点赞/评论)
│ │ ├── calls.js # TURN 凭据派发
│ │ ├── push.js # 推送订阅管理(Web Push + OneSignal)
-│ │ └── stickers.js # Telegram 贴纸包代理(缓存)
+│ │ ├── stickers.js # Telegram 贴纸包代理(缓存)
+│ │ └── totp.js # TOTP 两步验证(设置/验证/恢复码)
│ ├── services/
│ │ ├── push.js # Web Push VAPID 服务
│ │ └── onesignal.js # OneSignal REST API 服务
@@ -312,7 +314,7 @@ paperphone/
## 数据库结构
-共 11 张表,首次启动自动创建(`CREATE TABLE IF NOT EXISTS`):
+共 12 张表,首次启动自动创建(`CREATE TABLE IF NOT EXISTS`):
| 表名 | 说明 |
|------|------|
@@ -327,6 +329,7 @@ paperphone/
| `moment_comments` | 评论(最多 512 字/条) |
| `push_subscriptions` | Web Push 推送订阅(VAPID) |
| `onesignal_players` | OneSignal 设备注册(Median.co) |
+| `user_totp` | TOTP 两步验证密钥与恢复码 |
---
diff --git a/README_DE.md b/README_DE.md
index 064ebad..ce8bd24 100644
--- a/README_DE.md
+++ b/README_DE.md
@@ -27,6 +27,7 @@ Eine Instant-Messaging-App im WeChat-Stil mit Ende-zu-Ende-Verschlüsselung übe
| 🌐 Momente | Sozialer Feed: Text + bis zu 9 Fotos, Likes (Freunde-Avatare), Kommentare, Tag-basierte Sichtbarkeit |
| 🏷️ Freunde-Tags | Mehrere Tags pro Freund (12-Farben-Palette), Kontakte nach Tags filtern |
| 🗂️ R2-Speicher | Cloudflare R2 für Bild-/Audiodateien — optionale CDN-URL |
+| 🔑 Zwei-Faktor-Auth (2FA) | Google Authenticator–kompatibles TOTP, 8 einmalige Wiederherstellungscodes, Pflichtprüfung bei Anmeldung |
| 🏗️ Self-Hosting | Docker Compose Ein-Befehl-Deployment |
---
@@ -139,7 +140,7 @@ Server sieht: ✅ Chiffretext + Routing-Metadaten ❌ Klartext / private Schlü
## Datenbankschema
-11 Tabellen, automatisch beim ersten Start erstellt:
+12 Tabellen, automatisch beim ersten Start erstellt:
| Tabelle | Zweck |
|---------|-------|
@@ -152,6 +153,7 @@ Server sieht: ✅ Chiffretext + Routing-Metadaten ❌ Klartext / private Schlü
| `moment_likes` / `moment_comments` | Likes + Kommentare |
| `push_subscriptions` | Web Push (VAPID) |
| `onesignal_players` | OneSignal-Geräte (Median.co) |
+| `user_totp` | TOTP-Zwei-Faktor-Authentifizierungsschlüssel und Wiederherstellungscodes |
---
diff --git a/README_EN.md b/README_EN.md
index c091f97..a34df11 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -26,6 +26,7 @@ A WeChat-style end-to-end encrypted instant messaging app with stateless ECDH +
| 🌐 Moments | WeChat-style social feed: text + up to 9 photos, likes (friend avatars), comments, tag-based visibility control |
| 🏷️ Friend Tags | Assign multiple tags to friends (12-color preset palette), filter contacts by tag |
| 🗂️ R2 Object Storage | Cloudflare R2 for image/voice files — optional public CDN URL |
+| 🔑 Two-Factor Auth (2FA) | Google Authenticator–compatible TOTP, 8 one-time recovery codes, enforced at login |
| 🏗️ Self-Hostable | Docker Compose one-command deployment; Node.js + Redis multi-node ready |
---
@@ -272,7 +273,8 @@ paperphone/
│ │ ├── moments.js # Moments feed (posts / likes / comments)
│ │ ├── calls.js # TURN credential issuance
│ │ ├── push.js # Push subscription mgmt (Web Push + OneSignal)
-│ │ └── stickers.js # Telegram sticker pack proxy (cached)
+│ │ ├── stickers.js # Telegram sticker pack proxy (cached)
+│ │ └── totp.js # TOTP two-factor auth (setup / verify / recovery)
│ ├── services/
│ │ ├── push.js # Web Push VAPID service
│ │ └── onesignal.js # OneSignal REST API service
@@ -311,7 +313,7 @@ paperphone/
## Database Schema
-11 tables, auto-created on first server startup (`CREATE TABLE IF NOT EXISTS`):
+12 tables, auto-created on first server startup (`CREATE TABLE IF NOT EXISTS`):
| Table | Purpose |
|-------|---------|
@@ -326,6 +328,7 @@ paperphone/
| `moment_comments` | Comments (≤ 512 chars each) |
| `push_subscriptions` | Web Push subscriptions (VAPID) |
| `onesignal_players` | OneSignal device registrations (Median.co) |
+| `user_totp` | TOTP two-factor auth secrets & recovery codes |
---
diff --git a/README_ES.md b/README_ES.md
index 3e032e5..1e20adf 100644
--- a/README_ES.md
+++ b/README_ES.md
@@ -27,6 +27,7 @@ Una aplicación de mensajería instantánea cifrada de extremo a extremo estilo
| 🌐 Momentos | Feed social: texto + hasta 9 fotos, likes (avatares de amigos), comentarios, visibilidad por etiquetas |
| 🏷️ Etiquetas de amigos | Múltiples etiquetas por amigo (paleta de 12 colores), filtrar contactos por etiqueta |
| 🗂️ Almacenamiento R2 | Cloudflare R2 para imágenes/audio — URL CDN opcional |
+| 🔑 Auth de dos factores (2FA) | TOTP compatible con Google Authenticator, 8 códigos de recuperación, verificación obligatoria al iniciar sesión |
| 🏗️ Auto-alojable | Despliegue Docker Compose en un comando |
---
@@ -139,7 +140,7 @@ El servidor ve: ✅ texto cifrado + metadatos de enrutamiento ❌ texto plano /
## Esquema de base de datos
-11 tablas, creadas automáticamente en el primer inicio:
+12 tablas, creadas automáticamente en el primer inicio:
| Tabla | Propósito |
|-------|-----------|
@@ -152,6 +153,7 @@ El servidor ve: ✅ texto cifrado + metadatos de enrutamiento ❌ texto plano /
| `moment_likes` / `moment_comments` | Likes + comentarios |
| `push_subscriptions` | Web Push (VAPID) |
| `onesignal_players` | Dispositivos OneSignal |
+| `user_totp` | Secretos TOTP 2FA y códigos de recuperación |
---
diff --git a/README_FR.md b/README_FR.md
index 337dfc5..44f25b1 100644
--- a/README_FR.md
+++ b/README_FR.md
@@ -27,6 +27,7 @@ Une application de messagerie instantanée chiffrée de bout en bout, style WeCh
| 🌐 Moments | Fil social : texte + 9 photos, likes (avatars), commentaires, visibilité par tags |
| 🏷️ Tags d'amis | Plusieurs tags par ami (12 couleurs), filtrage des contacts |
| 🗂️ Stockage R2 | Cloudflare R2 pour images/audio — CDN optionnel |
+| 🔑 Auth à deux facteurs (2FA) | TOTP compatible Google Authenticator, 8 codes de récupération, vérification obligatoire à la connexion |
| 🏗️ Auto-hébergeable | Docker Compose en une commande |
---
diff --git a/README_JA.md b/README_JA.md
index 918a9c5..534304f 100644
--- a/README_JA.md
+++ b/README_JA.md
@@ -27,6 +27,7 @@ WeChatスタイルのエンドツーエンド暗号化インスタントメッ
| 🌐 モーメンツ | テキスト+最大9枚写真、いいね(友達アバター表示)、コメント、タグベースの公開範囲制御 |
| 🏷️ フレンドタグ | 友達に複数タグを設定(12色プリセット)、タグ別に連絡先をフィルタリング |
| 🗂️ R2 オブジェクトストレージ | Cloudflare R2 で画像/音声ファイルを保存 — オプションの CDN 直リンク |
+| 🔑 二段階認証 (2FA) | Google Authenticator 対応 TOTP、8つのリカバリーコード、ログイン時に強制検証 |
| 🏗️ セルフホスト対応 | Docker Compose ワンコマンドデプロイ、Node.js + Redis マルチノード対応 |
---
@@ -255,7 +256,7 @@ server {
## データベーススキーマ
-11テーブル、サーバー初回起動時に自動作成(`CREATE TABLE IF NOT EXISTS`):
+11テーブル→ 12テーブル、サーバー初回起動時に自動作成(`CREATE TABLE IF NOT EXISTS`):
| テーブル | 用途 |
|----------|------|
@@ -270,6 +271,7 @@ server {
| `moment_comments` | コメント(≤ 512文字/件) |
| `push_subscriptions` | Web Push サブスクリプション(VAPID) |
| `onesignal_players` | OneSignal デバイス登録(Median.co) |
+| `user_totp` | TOTP 二段階認証のシークレットとリカバリーコード |
---
diff --git a/README_KO.md b/README_KO.md
index d6c225e..0a566f1 100644
--- a/README_KO.md
+++ b/README_KO.md
@@ -27,6 +27,7 @@ WeChat 스타일의 종단간 암호화 인스턴트 메시징 앱. 무상태 EC
| 🌐 모먼트 | 텍스트 + 최대 9장 사진, 좋아요 (친구 아바타 표시), 댓글, 태그 기반 공개 범위 제어 |
| 🏷️ 친구 태그 | 친구에게 여러 태그 할당 (12색 프리셋), 태그별 연락처 필터링 |
| 🗂️ R2 오브젝트 스토리지 | Cloudflare R2로 이미지/음성 파일 저장 — 선택적 공개 CDN URL |
+| 🔑 2단계 인증 (2FA) | Google Authenticator 호환 TOTP, 8개 일회용 복구 코드, 로그인 시 강제 인증 |
| 🏗️ 셀프 호스팅 가능 | Docker Compose 원커맨드 배포, Node.js + Redis 멀티 노드 지원 |
---
@@ -255,7 +256,7 @@ server {
## 데이터베이스 스키마
-11개 테이블, 서버 첫 시작 시 자동 생성 (`CREATE TABLE IF NOT EXISTS`):
+12개 테이블, 서버 첫 시작 시 자동 생성 (`CREATE TABLE IF NOT EXISTS`):
| 테이블 | 용도 |
|--------|------|
@@ -270,6 +271,7 @@ server {
| `moment_comments` | 댓글 (≤ 512자) |
| `push_subscriptions` | Web Push 구독 (VAPID) |
| `onesignal_players` | OneSignal 기기 등록 (Median.co) |
+| `user_totp` | TOTP 2단계 인증 비밀 키 및 복구 코드 |
---
diff --git a/README_RU.md b/README_RU.md
index d302d1e..62bcd49 100644
--- a/README_RU.md
+++ b/README_RU.md
@@ -27,6 +27,7 @@
| 🌐 Моменты | Социальная лента: текст + до 9 фото, лайки (аватары друзей), комментарии, управление видимостью по тегам |
| 🏷️ Теги друзей | Несколько тегов на друга (палитра из 12 цветов), фильтрация контактов по тегам |
| 🗂️ Хранилище R2 | Cloudflare R2 для изображений/аудио — опциональный CDN URL |
+| 🔑 Двухфакторная аутент. (2FA) | TOTP совместимый с Google Authenticator, 8 одноразовых кодов восстановления, обязательная проверка при входе |
| 🏗️ Самостоятельное размещение | Docker Compose в одну команду |
---
@@ -139,7 +140,7 @@ npx web-push generate-vapid-keys
## Схема базы данных
-11 таблиц, создаются автоматически при первом запуске:
+12 таблиц, создаются автоматически при первом запуске:
| Таблица | Назначение |
|---------|------------|
@@ -152,6 +153,7 @@ npx web-push generate-vapid-keys
| `moment_likes` / `moment_comments` | Лайки + комментарии |
| `push_subscriptions` | Web Push (VAPID) |
| `onesignal_players` | OneSignal устройства |
+| `user_totp` | TOTP 2FA — секреты и коды восстановления |
---
diff --git a/client/src/api.js b/client/src/api.js
index ac295ca..2ef2c1b 100644
--- a/client/src/api.js
+++ b/client/src/api.js
@@ -114,6 +114,26 @@ export const api = {
stickerPacks: () => req('GET', '/api/stickers/packs'),
stickerSet: (name) => req('GET', `/api/stickers/set/${encodeURIComponent(name)}`),
stickerFileUrl: (fileId) => `${BASE}/api/stickers/file/${encodeURIComponent(fileId)}`,
+
+ // TOTP 2FA
+ totpStatus: () => req('GET', '/api/totp/status'),
+ totpSetup: () => req('POST', '/api/totp/setup'),
+ totpVerifySetup: (code) => req('POST', '/api/totp/verify-setup', { code }),
+ totpDisable: (code) => req('POST', '/api/totp/disable', { code }),
+ totpVerifyLogin: (code, loginToken) => {
+ return fetch(`${BASE}/api/totp/verify-login`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ code, login_token: loginToken }),
+ }).then(async r => {
+ if (!r.ok) {
+ let msg = `HTTP ${r.status}`;
+ try { const j = await r.json(); msg = j.error || msg; } catch {}
+ throw new Error(msg);
+ }
+ return r.json();
+ });
+ },
};
export const WS_URL = (() => {
diff --git a/client/src/i18n.js b/client/src/i18n.js
index 15021e4..d8b120b 100644
--- a/client/src/i18n.js
+++ b/client/src/i18n.js
@@ -229,6 +229,36 @@ const TRANSLATIONS = {
likedBy: '赞',
likedUsers: '点赞的人',
nLikes: '人赞了',
+ // 2FA
+ twoFactorAuth: '两步验证',
+ twoFactorTitle: '两步验证',
+ twoFactorSubtitle: '请输入验证器应用中的 6 位验证码',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: '验证',
+ verifying: '验证中...',
+ enterCode: '请输入验证码',
+ lostDevice: '丢失了设备?',
+ useRecoveryCode: '使用恢复码',
+ backToLogin: '返回登录',
+ totpEnabled: '已开启',
+ totpDisabled: '未开启',
+ totpEnabledDesc: '两步验证已启用,登录时需要输入验证码。',
+ totpDisable: '关闭两步验证',
+ totpDisablePrompt: '请输入当前验证码以关闭两步验证',
+ totpDisabledSuccess: '两步验证已关闭',
+ totpSetupTitle: '增强账户安全',
+ totpSetupDesc: '开启两步验证后,登录时除密码外还需输入验证器应用生成的动态验证码,有效防止账号被盗。',
+ totpStartSetup: '开始设置',
+ totpScanQR: '使用 Google Authenticator 或其他验证器应用扫描以下二维码',
+ totpManualKey: '或手动输入密钥:',
+ totpConfirmSetup: '确认绑定',
+ totpSetupComplete: '两步验证已启用!',
+ totpRecoveryDesc: '请妥善保存以下恢复码。如果丢失验证器设备,可以使用恢复码登录。每个恢复码只能使用一次。',
+ copyRecoveryCodes: '复制恢复码',
+ totpDone: '完成',
+ totpRecoveryWarning: '请将恢复码保存在安全的地方,这是您找回账号的最后手段。',
+ copied: '已复制',
},
en: {
@@ -448,6 +478,36 @@ const TRANSLATIONS = {
likedBy: 'Likes',
likedUsers: 'Liked by',
nLikes: 'likes',
+ // 2FA
+ twoFactorAuth: 'Two-Factor Auth',
+ twoFactorTitle: 'Two-Factor Verification',
+ twoFactorSubtitle: 'Enter the 6-digit code from your authenticator app',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: 'Verify',
+ verifying: 'Verifying...',
+ enterCode: 'Please enter a code',
+ lostDevice: 'Lost your device?',
+ useRecoveryCode: 'Use a recovery code',
+ backToLogin: 'Back to login',
+ totpEnabled: 'On',
+ totpDisabled: 'Off',
+ totpEnabledDesc: 'Two-factor authentication is enabled. You will be asked for a code when logging in.',
+ totpDisable: 'Disable Two-Factor Auth',
+ totpDisablePrompt: 'Enter your current code to disable 2FA',
+ totpDisabledSuccess: 'Two-factor auth disabled',
+ totpSetupTitle: 'Enhance Account Security',
+ totpSetupDesc: 'Add an extra layer of security. When enabled, you\'ll need to enter a code from your authenticator app each time you sign in.',
+ totpStartSetup: 'Get Started',
+ totpScanQR: 'Scan this QR code with Google Authenticator or another authenticator app',
+ totpManualKey: 'Or enter the key manually:',
+ totpConfirmSetup: 'Confirm Setup',
+ totpSetupComplete: 'Two-Factor Auth Enabled!',
+ totpRecoveryDesc: 'Save these recovery codes securely. If you lose access to your authenticator, you can use these codes to sign in. Each code can only be used once.',
+ copyRecoveryCodes: 'Copy Codes',
+ totpDone: 'Done',
+ totpRecoveryWarning: 'Store these codes in a safe place. They are your last resort to recover your account.',
+ copied: 'Copied',
},
ja: {
@@ -667,6 +727,36 @@ const TRANSLATIONS = {
likedBy: 'いいね',
likedUsers: 'いいねした人',
nLikes: 'いいね',
+ // 2FA
+ twoFactorAuth: '二段階認証',
+ twoFactorTitle: '二段階認証',
+ twoFactorSubtitle: '認証アプリの6桁コードを入力してください',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: '認証',
+ verifying: '認証中...',
+ enterCode: 'コードを入力してください',
+ lostDevice: 'デバイスを紛失しましたか?',
+ useRecoveryCode: 'リカバリーコードを使用',
+ backToLogin: 'ログインに戻る',
+ totpEnabled: 'オン',
+ totpDisabled: 'オフ',
+ totpEnabledDesc: '二段階認証が有効です。ログイン時にコードの入力が必要です。',
+ totpDisable: '二段階認証を無効にする',
+ totpDisablePrompt: '現在のコードを入力して二段階認証を無効にしてください',
+ totpDisabledSuccess: '二段階認証を無効にしました',
+ totpSetupTitle: 'アカウントセキュリティを強化',
+ totpSetupDesc: '有効にすると、ログイン時に認証アプリのコードが必要になり、アカウントのセキュリティが向上します。',
+ totpStartSetup: '設定を開始',
+ totpScanQR: 'Google Authenticatorまたは他の認証アプリでこのQRコードをスキャンしてください',
+ totpManualKey: 'または手動でキーを入力:',
+ totpConfirmSetup: '設定を確認',
+ totpSetupComplete: '二段階認証が有効になりました!',
+ totpRecoveryDesc: 'リカバリーコードを安全に保管してください。認証アプリにアクセスできなくなった場合、これらのコードでログインできます。各コードは1回のみ使用可能です。',
+ copyRecoveryCodes: 'コードをコピー',
+ totpDone: '完了',
+ totpRecoveryWarning: 'これらのコードを安全な場所に保管してください。アカウント回復の最後の手段です。',
+ copied: 'コピーしました',
},
ko: {
@@ -886,6 +976,36 @@ const TRANSLATIONS = {
likedBy: '좋아요',
likedUsers: '좋아한 사람',
nLikes: '좋아요',
+ // 2FA
+ twoFactorAuth: '2단계 인증',
+ twoFactorTitle: '2단계 인증',
+ twoFactorSubtitle: '인증 앱의 6자리 코드를 입력하세요',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: '인증',
+ verifying: '인증 중...',
+ enterCode: '코드를 입력해 주세요',
+ lostDevice: '기기를 분실하셨나요?',
+ useRecoveryCode: '복구 코드 사용',
+ backToLogin: '로그인으로 돌아가기',
+ totpEnabled: '켜짐',
+ totpDisabled: '꺼짐',
+ totpEnabledDesc: '2단계 인증이 활성화되어 있습니다. 로그인 시 코드를 입력해야 합니다.',
+ totpDisable: '2단계 인증 비활성화',
+ totpDisablePrompt: '현재 코드를 입력하여 2단계 인증을 비활성화하세요',
+ totpDisabledSuccess: '2단계 인증이 비활성화되었습니다',
+ totpSetupTitle: '계정 보안 강화',
+ totpSetupDesc: '활성화하면 로그인 시 인증 앱의 코드가 필요하여 계정 보안이 강화됩니다.',
+ totpStartSetup: '설정 시작',
+ totpScanQR: 'Google Authenticator 또는 다른 인증 앱으로 이 QR 코드를 스캔하세요',
+ totpManualKey: '또는 수동으로 키 입력:',
+ totpConfirmSetup: '설정 확인',
+ totpSetupComplete: '2단계 인증이 활성화되었습니다!',
+ totpRecoveryDesc: '복구 코드를 안전하게 보관하세요. 인증 앱에 접근할 수 없을 때 이 코드로 로그인할 수 있습니다. 각 코드는 한 번만 사용할 수 있습니다.',
+ copyRecoveryCodes: '코드 복사',
+ totpDone: '완료',
+ totpRecoveryWarning: '이 코드를 안전한 곳에 보관하세요. 계정 복구의 마지막 수단입니다.',
+ copied: '복사됨',
},
fr: {
@@ -1105,6 +1225,36 @@ const TRANSLATIONS = {
likedBy: 'J\'aime',
likedUsers: 'Aimé par',
nLikes: 'j\'aime',
+ // 2FA
+ twoFactorAuth: 'Authentification 2FA',
+ twoFactorTitle: 'Vérification en 2 étapes',
+ twoFactorSubtitle: 'Entrez le code à 6 chiffres de votre appli d\'authentification',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: 'Vérifier',
+ verifying: 'Vérification...',
+ enterCode: 'Veuillez entrer un code',
+ lostDevice: 'Appareil perdu ?',
+ useRecoveryCode: 'Utiliser un code de récupération',
+ backToLogin: 'Retour à la connexion',
+ totpEnabled: 'Activée',
+ totpDisabled: 'Désactivée',
+ totpEnabledDesc: 'L\'authentification à deux facteurs est activée. Un code sera demandé à chaque connexion.',
+ totpDisable: 'Désactiver l\'authentification 2FA',
+ totpDisablePrompt: 'Entrez votre code actuel pour désactiver la 2FA',
+ totpDisabledSuccess: 'Authentification 2FA désactivée',
+ totpSetupTitle: 'Renforcer la sécurité du compte',
+ totpSetupDesc: 'Ajoutez une couche de sécurité supplémentaire. Activé, un code de votre appli d\'authentification sera requis à chaque connexion.',
+ totpStartSetup: 'Commencer',
+ totpScanQR: 'Scannez ce QR code avec Google Authenticator ou une autre appli d\'authentification',
+ totpManualKey: 'Ou entrez la clé manuellement :',
+ totpConfirmSetup: 'Confirmer la configuration',
+ totpSetupComplete: 'Authentification 2FA activée !',
+ totpRecoveryDesc: 'Conservez ces codes de récupération en lieu sûr. Si vous perdez l\'accès à votre authentificateur, vous pourrez utiliser ces codes pour vous connecter. Chaque code ne peut être utilisé qu\'une seule fois.',
+ copyRecoveryCodes: 'Copier les codes',
+ totpDone: 'Terminé',
+ totpRecoveryWarning: 'Stockez ces codes en lieu sûr. Ils sont votre dernier recours pour récupérer votre compte.',
+ copied: 'Copié',
},
de: {
@@ -1323,6 +1473,36 @@ const TRANSLATIONS = {
likedBy: 'Gefällt mir',
likedUsers: 'Gefällt',
nLikes: 'Likes',
+ // 2FA
+ twoFactorAuth: 'Zwei-Faktor-Auth',
+ twoFactorTitle: 'Zwei-Faktor-Verifizierung',
+ twoFactorSubtitle: 'Geben Sie den 6-stelligen Code aus Ihrer Authentifizierungs-App ein',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: 'Verifizieren',
+ verifying: 'Wird verifiziert...',
+ enterCode: 'Bitte geben Sie einen Code ein',
+ lostDevice: 'Gerät verloren?',
+ useRecoveryCode: 'Wiederherstellungscode verwenden',
+ backToLogin: 'Zurück zur Anmeldung',
+ totpEnabled: 'Aktiviert',
+ totpDisabled: 'Deaktiviert',
+ totpEnabledDesc: 'Die Zwei-Faktor-Authentifizierung ist aktiviert. Bei der Anmeldung wird ein Code abgefragt.',
+ totpDisable: 'Zwei-Faktor-Auth deaktivieren',
+ totpDisablePrompt: 'Geben Sie Ihren aktuellen Code ein, um 2FA zu deaktivieren',
+ totpDisabledSuccess: 'Zwei-Faktor-Auth deaktiviert',
+ totpSetupTitle: 'Kontosicherheit erhöhen',
+ totpSetupDesc: 'Fügen Sie eine zusätzliche Sicherheitsebene hinzu. Nach der Aktivierung wird bei jeder Anmeldung ein Code aus Ihrer Authentifizierungs-App benötigt.',
+ totpStartSetup: 'Einrichtung starten',
+ totpScanQR: 'Scannen Sie diesen QR-Code mit Google Authenticator oder einer anderen Authentifizierungs-App',
+ totpManualKey: 'Oder geben Sie den Schlüssel manuell ein:',
+ totpConfirmSetup: 'Einrichtung bestätigen',
+ totpSetupComplete: 'Zwei-Faktor-Auth aktiviert!',
+ totpRecoveryDesc: 'Bewahren Sie diese Wiederherstellungscodes sicher auf. Falls Sie den Zugriff auf Ihren Authenticator verlieren, können Sie diese Codes zum Anmelden verwenden. Jeder Code kann nur einmal verwendet werden.',
+ copyRecoveryCodes: 'Codes kopieren',
+ totpDone: 'Fertig',
+ totpRecoveryWarning: 'Bewahren Sie diese Codes an einem sicheren Ort auf. Sie sind Ihr letztes Mittel zur Kontowiederherstellung.',
+ copied: 'Kopiert',
},
ru: {
@@ -1541,6 +1721,36 @@ const TRANSLATIONS = {
likedBy: 'Лайк',
likedUsers: 'Понравилось',
nLikes: 'лайков',
+ // 2FA
+ twoFactorAuth: 'Двухфакторная аутент.',
+ twoFactorTitle: 'Двухфакторная проверка',
+ twoFactorSubtitle: 'Введите 6-значный код из приложения-аутентификатора',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: 'Подтвердить',
+ verifying: 'Проверка...',
+ enterCode: 'Введите код',
+ lostDevice: 'Потеряли устройство?',
+ useRecoveryCode: 'Использовать код восстановления',
+ backToLogin: 'Назад к входу',
+ totpEnabled: 'Включена',
+ totpDisabled: 'Отключена',
+ totpEnabledDesc: 'Двухфакторная аутентификация включена. При входе потребуется код.',
+ totpDisable: 'Отключить двухфакторную аутент.',
+ totpDisablePrompt: 'Введите текущий код для отключения 2FA',
+ totpDisabledSuccess: 'Двухфакторная аутентификация отключена',
+ totpSetupTitle: 'Усилить безопасность аккаунта',
+ totpSetupDesc: 'Добавьте дополнительный уровень защиты. При входе потребуется код из приложения-аутентификатора.',
+ totpStartSetup: 'Начать настройку',
+ totpScanQR: 'Отсканируйте этот QR-код с помощью Google Authenticator или другого приложения',
+ totpManualKey: 'Или введите ключ вручную:',
+ totpConfirmSetup: 'Подтвердить настройку',
+ totpSetupComplete: 'Двухфакторная аутент. включена!',
+ totpRecoveryDesc: 'Сохраните эти коды восстановления. Если вы потеряете доступ к аутентификатору, можно войти с помощью этих кодов. Каждый код одноразовый.',
+ copyRecoveryCodes: 'Скопировать коды',
+ totpDone: 'Готово',
+ totpRecoveryWarning: 'Храните коды в надёжном месте. Это последнее средство восстановления аккаунта.',
+ copied: 'Скопировано',
},
es: {
@@ -1759,6 +1969,36 @@ const TRANSLATIONS = {
likedBy: 'Me gusta',
likedUsers: 'Les gusta',
nLikes: 'me gusta',
+ // 2FA
+ twoFactorAuth: 'Autenticación 2FA',
+ twoFactorTitle: 'Verificación de dos pasos',
+ twoFactorSubtitle: 'Introduce el código de 6 dígitos de tu app autenticadora',
+ totpCodePlaceholder: '000000',
+ recoveryCodePlaceholder: 'XXXX-XXXX',
+ verify: 'Verificar',
+ verifying: 'Verificando...',
+ enterCode: 'Introduce un código',
+ lostDevice: '¿Perdiste tu dispositivo?',
+ useRecoveryCode: 'Usar código de recuperación',
+ backToLogin: 'Volver al inicio de sesión',
+ totpEnabled: 'Activada',
+ totpDisabled: 'Desactivada',
+ totpEnabledDesc: 'La autenticación de dos factores está activada. Se pedirá un código al iniciar sesión.',
+ totpDisable: 'Desactivar autenticación 2FA',
+ totpDisablePrompt: 'Introduce tu código actual para desactivar 2FA',
+ totpDisabledSuccess: 'Autenticación 2FA desactivada',
+ totpSetupTitle: 'Mejorar la seguridad de la cuenta',
+ totpSetupDesc: 'Añade una capa extra de seguridad. Al activar, necesitarás un código de tu app autenticadora cada vez que inicies sesión.',
+ totpStartSetup: 'Comenzar',
+ totpScanQR: 'Escanea este código QR con Google Authenticator u otra app autenticadora',
+ totpManualKey: 'O introduce la clave manualmente:',
+ totpConfirmSetup: 'Confirmar configuración',
+ totpSetupComplete: '¡Autenticación 2FA activada!',
+ totpRecoveryDesc: 'Guarda estos códigos de recuperación de forma segura. Si pierdes acceso a tu autenticador, puedes usar estos códigos para iniciar sesión. Cada código solo se puede usar una vez.',
+ copyRecoveryCodes: 'Copiar códigos',
+ totpDone: 'Listo',
+ totpRecoveryWarning: 'Guarda estos códigos en un lugar seguro. Son tu último recurso para recuperar tu cuenta.',
+ copied: 'Copiado',
},
};
diff --git a/client/src/pages/login.js b/client/src/pages/login.js
index 9e3943f..0585e22 100644
--- a/client/src/pages/login.js
+++ b/client/src/pages/login.js
@@ -10,12 +10,140 @@ import { t, getLang, getSupportedLangs, getLangFlag, getLangName, setLang } from
export function renderLogin(root) {
let isRegister = false;
+ let pending2FA = null; // { login_token }
function build() {
root.innerHTML = '';
const screen = document.createElement('div');
screen.className = 'auth-screen';
+ if (pending2FA) {
+ // ── 2FA Verification Screen ─────────────────────────────────────
+ screen.innerHTML = `
+
@@ -168,6 +174,17 @@ export function renderProfile(root) {
});
};
+ // ── TOTP 2FA ──────────────────────────────────────────────────────
+ const totpStatusEl = root.querySelector('#totp-status');
+ (async () => {
+ try {
+ const { enabled } = await api.totpStatus();
+ totpStatusEl.textContent = enabled ? t('totpEnabled') : t('totpDisabled');
+ } catch { totpStatusEl.textContent = '-'; }
+ })();
+
+ root.querySelector('#totp-2fa-btn').onclick = () => open2FAPage(buildPage);
+
// Push notification toggle — async check & toggle
const pushToggleEl = root.querySelector('#push-toggle');
const pushStatusEl = root.querySelector('#push-status');
@@ -282,3 +299,225 @@ function openLangPicker(onClose) {
function esc(s) {
return String(s || '').replace(/&/g,'&').replace(//g,'>');
}
+
+/**
+ * Full-page 2FA management
+ */
+async function open2FAPage(onBack) {
+ const appEl = document.getElementById('app');
+ const page = document.createElement('div');
+ page.className = 'page';
+
+ let step = 'loading'; // loading | setup | confirm | recovery | enabled
+
+ async function render() {
+ page.innerHTML = `
+
+
+
${t('twoFactorAuth')}
+
+
+
+ `;
+
+ appEl.innerHTML = '';
+ appEl.appendChild(page);
+
+ page.querySelector('#totp-back').onclick = () => {
+ const pg = document.createElement('div');
+ pg.className = 'page';
+ renderProfile(pg);
+ appEl.innerHTML = '';
+ appEl.appendChild(pg);
+ };
+
+ const content = page.querySelector('#totp-content');
+
+ if (step === 'loading') {
+ content.innerHTML = `
${t('loading') || '...'}
`;
+ try {
+ const { enabled } = await api.totpStatus();
+ step = enabled ? 'enabled' : 'setup';
+ render();
+ } catch {
+ content.innerHTML = `
${t('opFailed')}
`;
+ }
+ return;
+ }
+
+ if (step === 'enabled') {
+ content.innerHTML = `
+
+
+
${t('totpEnabledDesc')}
+
+
+
+
+ ${t('totpDisable')}
+
+
+ `;
+
+ content.querySelector('#totp-disable-btn').onclick = async () => {
+ const code = prompt(t('totpDisablePrompt'));
+ if (!code) return;
+ try {
+ await api.totpDisable(code.trim());
+ showToast(t('totpDisabledSuccess'));
+ step = 'setup';
+ render();
+ } catch (err) {
+ showToast(err.message || t('opFailed'));
+ }
+ };
+ return;
+ }
+
+ if (step === 'setup') {
+ content.innerHTML = `
+
+
+
${t('totpSetupTitle')}
+
${t('totpSetupDesc')}
+
+
+
+ `;
+
+ content.querySelector('#totp-start-btn').onclick = async () => {
+ const btn = content.querySelector('#totp-start-btn');
+ btn.disabled = true;
+ btn.textContent = '...';
+ try {
+ const setupData = await api.totpSetup();
+ step = 'confirm';
+ renderConfirm(setupData);
+ } catch (err) {
+ showToast(err.message || t('opFailed'));
+ btn.disabled = false;
+ btn.textContent = t('totpStartSetup');
+ }
+ };
+ return;
+ }
+ }
+
+ function renderConfirm(setupData) {
+ const content = page.querySelector('#totp-content');
+ content.innerHTML = `
+
+
${t('totpScanQR')}
+
+

+
+
+
${t('totpManualKey')}
+
${setupData.secret}
+
+
+
+
+
+ `;
+
+ // Copy secret
+ content.querySelector('#totp-copy-secret').onclick = () => {
+ navigator.clipboard?.writeText(setupData.secret).then(() => showToast(t('copied') || 'Copied'));
+ };
+
+ // Auto-focus
+ setTimeout(() => content.querySelector('#inp-totp-confirm')?.focus(), 100);
+
+ // Confirm form
+ content.querySelector('#totp-confirm-form').onsubmit = async (e) => {
+ e.preventDefault();
+ const errEl = content.querySelector('#totp-confirm-err');
+ const btn = content.querySelector('#totp-confirm-btn');
+ const code = content.querySelector('#inp-totp-confirm').value.trim();
+ errEl.textContent = '';
+ if (!code) { errEl.textContent = t('enterCode'); return; }
+
+ btn.disabled = true;
+ btn.textContent = t('verifying');
+
+ try {
+ const result = await api.totpVerifySetup(code);
+ renderRecoveryCodes(result.recoveryCodes);
+ } catch (err) {
+ errEl.textContent = err.message || t('opFailed');
+ btn.disabled = false;
+ btn.textContent = t('totpConfirmSetup');
+ }
+ };
+ }
+
+ function renderRecoveryCodes(codes) {
+ const content = page.querySelector('#totp-content');
+ content.innerHTML = `
+
+
+
${t('totpSetupComplete')}
+
${t('totpRecoveryDesc')}
+
+
+ ${codes.map((c, i) => `
${i + 1}${c}
`).join('')}
+
+
+
+
+
+
+
+
+
+
+ ${t('totpRecoveryWarning')}
+
+
+ `;
+
+ content.querySelector('#totp-copy-codes').onclick = () => {
+ const text = codes.join('\n');
+ navigator.clipboard?.writeText(text).then(() => showToast(t('copied') || 'Copied'));
+ };
+
+ content.querySelector('#totp-done-btn').onclick = () => {
+ const pg = document.createElement('div');
+ pg.className = 'page';
+ renderProfile(pg);
+ appEl.innerHTML = '';
+ appEl.appendChild(pg);
+ };
+ }
+
+ render();
+}
diff --git a/client/src/style.css b/client/src/style.css
index 0eb2eea..210758c 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -2807,3 +2807,207 @@ html, body {
max-height: 80px;
overflow-y: auto;
}
+
+/* ── TOTP 2FA ─────────────────────────────────────────────── */
+
+/* Shield icon on login 2FA screen */
+.totp-shield-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 96px;
+ height: 96px;
+ animation: totpPulse 2s ease-in-out infinite;
+}
+@keyframes totpPulse {
+ 0%, 100% { transform: scale(1); }
+ 50% { transform: scale(1.06); }
+}
+
+/* QR code section */
+.totp-qr-section {
+ text-align: center;
+}
+.totp-qr-wrap {
+ display: inline-block;
+ padding: 16px;
+ background: #fff;
+ border-radius: var(--radius);
+ box-shadow: var(--shadow);
+ margin-bottom: 16px;
+}
+.totp-qr-image {
+ width: 220px;
+ height: 220px;
+ border-radius: var(--radius-xs);
+ display: block;
+}
+
+/* Secret key display */
+.totp-secret-wrap {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ padding: 12px 16px;
+ background: var(--surface);
+ backdrop-filter: blur(20px) saturate(180%);
+ -webkit-backdrop-filter: blur(20px) saturate(180%);
+ border: 0.5px solid var(--glass-border);
+ border-radius: var(--radius-sm);
+ margin: 0 auto;
+ max-width: 380px;
+ flex-wrap: wrap;
+}
+.totp-secret-label {
+ font-size: 12px;
+ color: var(--text-muted);
+ width: 100%;
+ text-align: center;
+ margin-bottom: 4px;
+}
+.totp-secret-code {
+ font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Consolas', monospace;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--text);
+ letter-spacing: 2px;
+ word-break: break-all;
+ user-select: all;
+}
+.totp-copy-btn {
+ background: none;
+ border: none;
+ cursor: pointer;
+ padding: 4px;
+ color: var(--green);
+ border-radius: 6px;
+ display: flex;
+ align-items: center;
+ transition: background .15s ease, transform .12s ease;
+}
+.totp-copy-btn:active {
+ background: rgba(7,193,96,.1);
+ transform: scale(0.9);
+}
+
+/* Status card */
+.totp-status-card {
+ text-align: center;
+ padding: 32px 16px;
+}
+.totp-status-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin: 0 auto 16px;
+ width: 80px;
+ height: 80px;
+ border-radius: 50%;
+ background: var(--surface);
+ backdrop-filter: blur(20px) saturate(180%);
+ -webkit-backdrop-filter: blur(20px) saturate(180%);
+ border: 0.5px solid var(--glass-border);
+ box-shadow: var(--glass-specular), var(--shadow);
+ color: var(--text-muted);
+}
+.totp-status-icon.totp-enabled {
+ background: rgba(52, 199, 89, 0.12);
+ color: #34C759;
+ border-color: rgba(52, 199, 89, 0.25);
+ box-shadow: 0 0 24px rgba(52, 199, 89, 0.15), var(--glass-specular);
+}
+.totp-status-text {
+ font-size: 15px;
+ color: var(--text-2);
+ line-height: 1.5;
+ max-width: 300px;
+ margin: 0 auto;
+}
+
+/* Setup intro */
+.totp-setup-intro {
+ text-align: center;
+ padding: 24px 16px;
+}
+
+/* Recovery codes grid */
+.totp-recovery-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 8px;
+ max-width: 360px;
+ margin: 0 auto;
+}
+.totp-recovery-code {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 10px 14px;
+ background: var(--surface);
+ backdrop-filter: blur(20px) saturate(180%);
+ -webkit-backdrop-filter: blur(20px) saturate(180%);
+ border: 0.5px solid var(--glass-border);
+ border-radius: var(--radius-xs);
+ font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Consolas', monospace;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--text);
+ letter-spacing: 1px;
+ box-shadow: var(--glass-highlight);
+}
+.totp-recovery-num {
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: rgba(7,193,96,.1);
+ color: var(--green);
+ font-size: 11px;
+ font-weight: 700;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ font-family: 'Inter', sans-serif;
+}
+
+/* Recovery warning */
+.totp-recovery-warning {
+ font-size: 13px;
+ color: var(--orange, #FF9500);
+ text-align: center;
+ margin-top: 16px;
+ line-height: 1.4;
+}
+
+/* Secondary button style */
+.totp-secondary-btn {
+ background: var(--surface) !important;
+ color: var(--text) !important;
+ border: 0.5px solid var(--glass-border) !important;
+ box-shadow: var(--glass-specular), var(--shadow-sm) !important;
+}
+.totp-secondary-btn:active {
+ background: var(--surface-2) !important;
+}
+
+/* TOTP input on login page */
+.totp-input {
+ font-variant-numeric: tabular-nums;
+}
+
+/* Topbar back button clickable area */
+.topbar-back {
+ background: none;
+ border: none;
+ cursor: pointer;
+ padding: 8px;
+ min-width: 44px;
+ color: var(--green);
+ display: flex;
+ align-items: center;
+ transition: transform .12s ease;
+}
+.topbar-back:active {
+ transform: scale(0.9);
+}
diff --git a/server/db/schema.sql b/server/db/schema.sql
index 93d63fa..a98f4f6 100644
--- a/server/db/schema.sql
+++ b/server/db/schema.sql
@@ -285,3 +285,13 @@ SET @m_sql = IF(@m_vis = 0,
PREPARE m_stmt FROM @m_sql;
EXECUTE m_stmt;
DEALLOCATE PREPARE m_stmt;
+
+-- ── TOTP Two-Factor Authentication ───────────────────────────────────────
+CREATE TABLE IF NOT EXISTS user_totp (
+ user_id VARCHAR(36) PRIMARY KEY,
+ totp_secret VARCHAR(64) NOT NULL,
+ recovery_codes TEXT DEFAULT NULL,
+ enabled TINYINT(1) NOT NULL DEFAULT 0,
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/server/node_modules/.bin/qrcode b/server/node_modules/.bin/qrcode
new file mode 120000
index 0000000..aae83f0
--- /dev/null
+++ b/server/node_modules/.bin/qrcode
@@ -0,0 +1 @@
+../qrcode/bin/qrcode
\ No newline at end of file
diff --git a/server/node_modules/.package-lock.json b/server/node_modules/.package-lock.json
index 6587f42..8089072 100644
--- a/server/node_modules/.package-lock.json
+++ b/server/node_modules/.package-lock.json
@@ -909,6 +909,18 @@
"node": ">=18.0.0"
}
},
+ "node_modules/@noble/hashes": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz",
+ "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20.19.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
"node_modules/@redis/bloom": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.2.0.tgz",
@@ -1733,6 +1745,30 @@
"node": ">= 14"
}
},
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
@@ -1932,6 +1968,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@@ -1957,6 +2002,17 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/cliui": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ }
+ },
"node_modules/cluster-key-slot": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz",
@@ -1966,6 +2022,24 @@
"node": ">=0.10.0"
}
},
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "license": "MIT"
+ },
"node_modules/concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
@@ -2079,6 +2153,15 @@
"ms": "2.0.0"
}
},
+ "node_modules/decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/denque": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
@@ -2107,6 +2190,12 @@
"npm": "1.2.8000 || >= 1.4.16"
}
},
+ "node_modules/dijkstrajs": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
+ "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
+ "license": "MIT"
+ },
"node_modules/dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
@@ -2148,6 +2237,12 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "license": "MIT"
+ },
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
@@ -2294,6 +2389,19 @@
"node": ">= 0.8"
}
},
+ "node_modules/find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -2354,6 +2462,15 @@
"node": ">= 4"
}
},
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
@@ -2563,6 +2680,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
@@ -2647,6 +2773,18 @@
"safe-buffer": "^5.0.1"
}
},
+ "node_modules/locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/lodash.includes": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
@@ -3003,6 +3141,54 @@
"node": ">= 0.8"
}
},
+ "node_modules/otpauth": {
+ "version": "9.5.0",
+ "resolved": "https://registry.npmjs.org/otpauth/-/otpauth-9.5.0.tgz",
+ "integrity": "sha512-Ldhc6UYl4baR5toGr8nfKC+L/b8/RgHKoIixAebgoNGzUUCET02g04rMEZ2ZsPfeVQhMHcuaOgb28nwMr81zCA==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "2.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/hectorm/otpauth?sponsor=1"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
+ "license": "MIT",
+ "dependencies": {
+ "p-try": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -3012,6 +3198,15 @@
"node": ">= 0.8"
}
},
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/path-expression-matcher": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.2.0.tgz",
@@ -3046,6 +3241,15 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/pngjs": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
+ "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -3081,6 +3285,23 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/qrcode": {
+ "version": "1.5.4",
+ "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
+ "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
+ "license": "MIT",
+ "dependencies": {
+ "dijkstrajs": "^1.0.1",
+ "pngjs": "^5.0.0",
+ "yargs": "^15.3.1"
+ },
+ "bin": {
+ "qrcode": "bin/qrcode"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
"node_modules/qs": {
"version": "6.14.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
@@ -3150,6 +3371,21 @@
"@redis/time-series": "1.1.0"
}
},
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/require-main-filename": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
+ "license": "ISC"
+ },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -3233,6 +3469,12 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
+ "license": "ISC"
+ },
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
@@ -3356,6 +3598,32 @@
"node": ">=10.0.0"
}
},
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strnum": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.2.tgz",
@@ -3517,6 +3785,26 @@
"node": ">= 16"
}
},
+ "node_modules/which-module": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
+ "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
+ "license": "ISC"
+ },
+ "node_modules/wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/ws": {
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
@@ -3547,11 +3835,52 @@
"node": ">=0.4"
}
},
+ "node_modules/y18n": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
+ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
+ "license": "ISC"
+ },
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
+ },
+ "node_modules/yargs": {
+ "version": "15.4.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
+ "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^6.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^4.1.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^4.2.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^18.1.2"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "18.1.3",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
+ "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
+ "license": "ISC",
+ "dependencies": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
}
}
}
diff --git a/server/node_modules/@noble/hashes/LICENSE b/server/node_modules/@noble/hashes/LICENSE
new file mode 100644
index 0000000..9297a04
--- /dev/null
+++ b/server/node_modules/@noble/hashes/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2022 Paul Miller (https://paulmillr.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the “Software”), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/README.md b/server/node_modules/@noble/hashes/README.md
new file mode 100644
index 0000000..5a34df6
--- /dev/null
+++ b/server/node_modules/@noble/hashes/README.md
@@ -0,0 +1,575 @@
+# noble-hashes
+
+Audited & minimal JS implementation of hash functions, MACs and KDFs.
+
+- 🔒 [**Audited**](#security) by an independent security firm
+- 🔻 Tree-shakeable: unused code is excluded from your builds
+- 🏎 Fast: hand-optimized for caveats of JS engines
+- 🔍 Reliable: chained / sliding window / DoS / ACVP tests and fuzzing
+- 🔁 No unrolled loops: makes it easier to verify and reduces source code size up to 5x
+- 🦘 Includes SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF, Scrypt, Argon2
+- 🥈 Optional, friendly wrapper over native WebCrypto
+- 🪶 21KB (gzipped) for everything, 2.4KB for single-hash build
+
+Check out [Upgrading](#upgrading) for information about upgrading from previous versions.
+Take a glance at [GitHub Discussions](https://github.com/paulmillr/noble-hashes/discussions) for questions and support.
+The library's initial development was funded by [Ethereum Foundation](https://ethereum.org/).
+
+### This library belongs to _noble_ cryptography
+
+> **noble cryptography** — high-security, easily auditable set of contained cryptographic libraries and tools.
+
+- Zero or minimal dependencies
+- Highly readable TypeScript / JS code
+- PGP-signed releases and transparent NPM builds
+- All libraries:
+ [ciphers](https://github.com/paulmillr/noble-ciphers),
+ [curves](https://github.com/paulmillr/noble-curves),
+ [hashes](https://github.com/paulmillr/noble-hashes),
+ [post-quantum](https://github.com/paulmillr/noble-post-quantum),
+ 5kb [secp256k1](https://github.com/paulmillr/noble-secp256k1) /
+ [ed25519](https://github.com/paulmillr/noble-ed25519)
+- [Check out homepage](https://paulmillr.com/noble/)
+ for reading resources, documentation and apps built with noble
+
+## Usage
+
+> `npm install @noble/hashes`
+
+> `deno add jsr:@noble/hashes`
+
+We support all major platforms and runtimes.
+For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values).
+A standalone file [noble-hashes.js](https://github.com/paulmillr/noble-hashes/releases) is also available.
+
+```js
+// import * from '@noble/hashes'; // Error: use sub-imports, to ensure small app size
+import { sha256 } from '@noble/hashes/sha2.js';
+const hash = sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23]));
+
+// Available modules
+import { sha256, sha384, sha512, sha224, sha512_224, sha512_256 } from '@noble/hashes/sha2.js';
+import {
+ sha3_256, sha3_512,
+ keccak_256, keccak_512,
+ shake128, shake256,
+} from '@noble/hashes/sha3.js';
+import {
+ cshake256, turboshake256, kmac256, tuplehash256,
+ kt128, kt256, keccakprg,
+} from '@noble/hashes/sha3-addons.js';
+import { blake3 } from '@noble/hashes/blake3.js';
+import { blake2b, blake2s } from '@noble/hashes/blake2.js';
+import { blake256, blake512 } from '@noble/hashes/blake1.js';
+import { sha1, md5, ripemd160 } from '@noble/hashes/legacy.js';
+import { hmac } from '@noble/hashes/hmac.js';
+import { hkdf } from '@noble/hashes/hkdf.js';
+import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
+import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
+import { argon2d, argon2i, argon2id } from '@noble/hashes/argon2.js';
+import * as webcrypto from '@noble/hashes/webcrypto.js';
+// const { sha256, sha384, sha512, hmac, hkdf, pbkdf2 } = webcrypto;
+import * as utils from '@noble/hashes/utils.js';
+const { bytesToHex, concatBytes, equalBytes, hexToBytes } = utils;
+```
+
+- [sha2: sha256, sha384, sha512](#sha2-sha256-sha384-sha512-and-others)
+- [sha3: FIPS, SHAKE, Keccak](#sha3-fips-shake-keccak)
+- [sha3-addons: cSHAKE, KMAC, KT128, TurboSHAKE](#sha3-addons-cshake-kmac-kt128-turboshake)
+- [blake1, blake2, blake3](#blake1-blake2-blake3)
+- [legacy: sha1, md5, ripemd160](#legacy-sha1-md5-ripemd160)
+- MACs: [hmac](#hmac) | [kmac](#sha3-addons-cshake-kmac-kt128-turboshake) | [blake3 key mode](#blake1-blake2-blake3)
+- KDFs: [hkdf](#hkdf) | [pbkdf2](#pbkdf2) | [scrypt](#scrypt) | [argon2](#argon2)
+- [webcrypto: friendly wrapper](#webcrypto-friendly-wrapper)
+- [utils](#utils)
+- [Security](#security) | [Speed](#speed) | [Contributing & testing](#contributing--testing) | [License](#license)
+
+### Implementations
+
+Hash functions:
+
+- `sha256()`: receive & return `Uint8Array`
+- `sha256.create().update(a).update(b).digest()`: support partial updates
+- `blake3.create({ context: 'e', dkLen: 32 })`: can have options
+- support little-endian architecture; also experimentally big-endian
+- can hash up to 4GB per chunk, with any amount of chunks
+
+#### sha2: sha256, sha384, sha512 and others
+
+```typescript
+import { sha224, sha256, sha384, sha512, sha512_224, sha512_256 } from '@noble/hashes/sha2.js';
+const res = sha256(Uint8Array.from([0xbc])); // basic
+for (let hash of [sha256, sha384, sha512, sha224, sha512_224, sha512_256]) {
+ const arr = Uint8Array.from([0x10, 0x20, 0x30]);
+ const a = hash(arr);
+ const b = hash.create().update(arr).digest();
+}
+```
+
+Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
+[the paper on truncated SHA512/256](https://eprint.iacr.org/2010/548.pdf).
+
+#### sha3: FIPS, SHAKE, Keccak
+
+```typescript
+import {
+ sha3_224, sha3_256, sha3_384, sha3_512,
+ keccak_224, keccak_256, keccak_384, keccak_512,
+ shake128, shake256,
+} from '@noble/hashes/sha3.js';
+for (let hash of [
+ sha3_224, sha3_256, sha3_384, sha3_512,
+ keccak_224, keccak_256, keccak_384, keccak_512,
+]) {
+ const arr = Uint8Array.from([0x10, 0x20, 0x30]);
+ const a = hash(arr);
+ const b = hash.create().update(arr).digest();
+}
+const shka = shake128(Uint8Array.from([0x10]), { dkLen: 512 });
+const shkb = shake256(Uint8Array.from([0x30]), { dkLen: 512 });
+```
+
+Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),
+[Website](https://keccak.team/keccak.html).
+
+Check out [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub)
+
+#### sha3-addons: cSHAKE, KMAC, K12, TurboSHAKE
+
+```typescript
+import {
+ cshake128, cshake256, kt128, kt256,
+ keccakprg, kmac128, kmac256,
+ parallelhash256, tuplehash256,
+ turboshake128, turboshake256,
+} from '@noble/hashes/sha3-addons.js';
+const data = Uint8Array.from([0x10, 0x20, 0x30]);
+const ec1 = cshake128(data, { personalization: 'def' });
+const ec2 = cshake256(data, { personalization: 'def' });
+const et1 = turboshake128(data);
+const et2 = turboshake256(data, { D: 0x05 });
+// tuplehash(['ab', 'c']) !== tuplehash(['a', 'bc']) !== tuplehash([data])
+const et3 = tuplehash256([new TextEncoder().encode('ab'), new TextEncoder().encode('c')]);
+// Not parallel in JS (similar to blake3 / kt128), added for compat
+const ep1 = parallelhash256(data, { blockLen: 8 });
+const kk = Uint8Array.from([0xca]);
+const ek10 = kmac128(kk, data);
+const ek11 = kmac256(kk, data);
+const ek12 = kt128(data); // kangarootwelve 128-bit
+const ek13 = kt256(data); // kangarootwelve 256-bit
+// pseudo-random generator, first argument is capacity. XKCP recommends 254 bits capacity for 128-bit security strength.
+// * with a capacity of 254 bits.
+const p = keccakprg(254);
+p.feed('test');
+const rand1b = p.fetch(1);
+```
+
+- cSHAKE, KMAC, TupleHash, ParallelHash + XOF are available, matching
+ [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf)
+- Reduced-round Keccak KT128 (KangarooTwelve 🦘, K12) and TurboSHAKE are available, matching
+ [kangaroo-draft-17](https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/).
+- [KeccakPRG](https://keccak.team/files/CSF-0.1.pdf): pseudo-random generator based on Keccak
+
+#### blake1, blake2, blake3
+
+```typescript
+import { blake224, blake256, blake384, blake512 } from '@noble/hashes/blake1.js';
+import { blake2b, blake2s } from '@noble/hashes/blake2.js';
+import { blake3 } from '@noble/hashes/blake3.js';
+
+for (let hash of [blake224, blake256, blake384, blake512, blake2b, blake2s, blake3]) {
+ const arr = Uint8Array.from([0x10, 0x20, 0x30]);
+ const a = hash(arr);
+ const b = hash.create().update(arr).digest();
+}
+
+// blake2 advanced usage
+const ab = Uint8Array.from([0x01]);
+blake2s(ab);
+blake2s(ab, { key: new Uint8Array(32) });
+blake2s(ab, { personalization: 'pers1234' });
+blake2s(ab, { salt: 'salt1234' });
+blake2b(ab);
+blake2b(ab, { key: new Uint8Array(64) });
+blake2b(ab, { personalization: 'pers1234pers1234' });
+blake2b(ab, { salt: 'salt1234salt1234' });
+
+// blake3 advanced usage
+blake3(ab);
+blake3(ab, { dkLen: 256 });
+blake3(ab, { key: new Uint8Array(32) });
+blake3(ab, { context: 'application-name' });
+```
+
+- Blake1 is legacy hash, one of SHA3 proposals. It is rarely used anywhere. See [pdf](https://www.aumasson.jp/blake/blake.pdf).
+- Blake2 is popular fast hash. blake2b focuses on 64-bit platforms while blake2s is for 8-bit to 32-bit ones. See [RFC 7693](https://datatracker.ietf.org/doc/html/rfc7693), [Website](https://www.blake2.net)
+- Blake3 is faster, reduced-round blake2. See [Website & specs](https://blake3.io)
+
+#### legacy: sha1, md5, ripemd160
+
+SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.
+Don't use them in a new protocol. What "weak" means:
+
+- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
+- No practical pre-image attacks (only theoretical, 2^123.4)
+- HMAC seems kinda ok: https://datatracker.ietf.org/doc/html/rfc6151
+
+```typescript
+import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';
+for (let hash of [md5, ripemd160, sha1]) {
+ const arr = Uint8Array.from([0x10, 0x20, 0x30]);
+ const a = hash(arr);
+ const b = hash.create().update(arr).digest();
+}
+```
+
+#### hmac
+
+```typescript
+import { hmac } from '@noble/hashes/hmac.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+const key = new Uint8Array(32).fill(1);
+const msg = new Uint8Array(32).fill(2);
+const mac1 = hmac(sha256, key, msg);
+const mac2 = hmac.create(sha256, key).update(msg).digest();
+```
+
+Conforms to [RFC 2104](https://datatracker.ietf.org/doc/html/rfc2104).
+
+#### hkdf
+
+```typescript
+import { hkdf } from '@noble/hashes/hkdf.js';
+import { randomBytes } from '@noble/hashes/utils.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+const inputKey = randomBytes(32);
+const salt = randomBytes(32);
+const info = 'application-key';
+const hk1 = hkdf(sha256, inputKey, salt, info, 32);
+
+// == same as
+import { extract, expand } from '@noble/hashes/hkdf.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+const prk = extract(sha256, inputKey, salt);
+const hk2 = expand(sha256, prk, info, 32);
+```
+
+Conforms to [RFC 5869](https://datatracker.ietf.org/doc/html/rfc5869).
+
+#### pbkdf2
+
+```typescript
+import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+const pbkey1 = pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });
+const pbkey2 = await pbkdf2Async(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });
+const pbkey3 = await pbkdf2Async(sha256, Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), {
+ c: 524288,
+ dkLen: 32,
+});
+```
+
+Conforms to [RFC 2898](https://datatracker.ietf.org/doc/html/rfc2898).
+
+#### scrypt
+
+```typescript
+import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
+const scr1 = scrypt('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 });
+const scr2 = await scryptAsync('password', 'salt', { N: 2 ** 16, r: 8, p: 1, dkLen: 32 });
+const scr3 = await scryptAsync(Uint8Array.from([1, 2, 3]), Uint8Array.from([4, 5, 6]), {
+ N: 2 ** 17,
+ r: 8,
+ p: 1,
+ dkLen: 32,
+ onProgress(percentage) {
+ console.log('progress', percentage);
+ },
+ maxmem: 2 ** 32 + 128 * 8 * 1, // N * r * p * 128 + (128*r*p)
+});
+```
+
+Conforms to [RFC 7914](https://datatracker.ietf.org/doc/html/rfc7914),
+[Website](https://www.tarsnap.com/scrypt.html)
+
+- `N, r, p` are work factors. It is common to only adjust N, while keeping `r: 8, p: 1`.
+ See [the blog post](https://blog.filippo.io/the-scrypt-parameters/).
+ JS doesn't support parallelization, making increasing `p` meaningless.
+- `dkLen` is the length of output bytes e.g. `32` or `64`
+- `onProgress` can be used with async version of the function to report progress to a user.
+- `maxmem` prevents DoS and is limited to `1GB + 1KB` (`2**30 + 2**10`), but can be adjusted using formula: `N * r * p * 128 + (128 * r * p)`
+
+Time it takes to derive Scrypt key under different values of N (2\*\*N) on Apple M4 (mobile phones can be 1x-4x slower):
+
+| N pow | Time | RAM |
+| ----- | ---- | ----- |
+| 16 | 0.1s | 64MB |
+| 17 | 0.2s | 128MB |
+| 18 | 0.4s | 256MB |
+| 19 | 0.8s | 512MB |
+| 20 | 1.5s | 1GB |
+| 21 | 3.1s | 2GB |
+| 22 | 6.2s | 4GB |
+| 23 | 13s | 8GB |
+| 24 | 27s | 16GB |
+
+> [!NOTE]
+> We support N larger than `2**20` where available, however,
+> not all JS engines support >= 2GB ArrayBuffer-s.
+> When using such N, you'll need to manually adjust `maxmem`, using formula above.
+> Other JS implementations don't support large N-s.
+
+#### argon2
+
+```ts
+import { argon2d, argon2i, argon2id } from '@noble/hashes/argon2.js';
+const arg1 = argon2id('password', 'saltsalt', { t: 2, m: 65536, p: 1, maxmem: 2 ** 32 - 1 });
+```
+
+Argon2 [RFC 9106](https://datatracker.ietf.org/doc/html/rfc9106) implementation.
+
+> [!WARNING]
+> Argon2 can't be fast in JS, because there is no fast Uint64Array.
+> It is suggested to use [Scrypt](#scrypt) instead.
+> Being 5x slower than native code means brute-forcing attackers have bigger advantage.
+
+#### webcrypto: friendly wrapper
+
+```js
+import { sha256, sha384, sha512, hmac, hkdf, pbkdf2 } from '@noble/hashes/webcrypto.js';
+const whash = await sha256(Uint8Array.from([0xca, 0xfe, 0x01, 0x23]));
+
+const key = new Uint8Array(32).fill(1);
+const msg = new Uint8Array(32).fill(2);
+const wmac = await hmac(sha256, key, msg);
+
+const inputKey = randomBytes(32);
+const salt = randomBytes(32);
+const info = 'application-key';
+const hk1 = await hkdf(sha256, inputKey, salt, info, 32);
+
+const pbkey1 = await pbkdf2(sha256, 'password', 'salt', { c: 524288, dkLen: 32 });
+```
+
+Sometimes people want to use built-in `crypto.subtle` instead of pure JS implementation.
+However, it has terrible API.
+
+We simplify access to built-ins with API which mirrors noble-hashes.
+The overhead is minimal - just 30+ lines of code, which verify input correctness.
+
+> [!NOTE]
+> Webcrypto methods are always async.
+
+#### utils
+
+```typescript
+import { bytesToHex as toHex, randomBytes } from '@noble/hashes/utils.js';
+console.log(toHex(randomBytes(32)));
+```
+
+- `bytesToHex` will convert `Uint8Array` to a hex string
+- `randomBytes(bytes)` will produce cryptographically secure random `Uint8Array` of length `bytes`
+
+## Security
+
+The library has been independently audited:
+
+- at version 1.0.0, in Jan 2022, by [Cure53](https://cure53.de)
+ - PDFs: [website](https://cure53.de/pentest-report_hashing-libs.pdf), [in-repo](./audit/2022-01-05-cure53-audit-nbl2.pdf)
+ - [Changes since audit](https://github.com/paulmillr/noble-hashes/compare/1.0.0..main).
+ - Scope: everything, besides `blake3`, `sha3-addons`, `sha1` and `argon2`, which have not been audited
+ - The audit has been funded by [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io)
+
+It is tested against property-based, cross-library and Wycheproof vectors,
+and is being fuzzed in [the separate repo](https://github.com/paulmillr/fuzzing).
+
+If you see anything unusual: investigate and report.
+
+### Constant-timeness
+
+We're targetting algorithmic constant time. _JIT-compiler_ and _Garbage Collector_ make "constant time"
+extremely hard to achieve [timing attack](https://en.wikipedia.org/wiki/Timing_attack) resistance
+in a scripting language. Which means _any other JS library can't have
+constant-timeness_. Even statically typed Rust, a language without GC,
+[makes it harder to achieve constant-time](https://www.chosenplaintext.ca/open-source/rust-timing-shield/security)
+for some cases. If your goal is absolute security, don't use any JS lib — including bindings to native ones.
+Use low-level libraries & languages.
+
+### Memory dumping
+
+The library shares state buffers between hash
+function calls. The buffers are zeroed-out after each call. However, if an attacker
+can read application memory, you are doomed in any case:
+
+- At some point, input will be a string and strings are immutable in JS:
+ there is no way to overwrite them with zeros. For example: deriving
+ key from `scrypt(password, salt)` where password and salt are strings
+- Input from a file will stay in file buffers
+- Input / output will be re-used multiple times in application which means it could stay in memory
+- `await anything()` will always write all internal variables (including numbers)
+ to memory. With async functions / Promises there are no guarantees when the code
+ chunk would be executed. Which means attacker can have plenty of time to read data from memory
+- There is no way to guarantee anything about zeroing sensitive data without
+ complex tests-suite which will dump process memory and verify that there is
+ no sensitive data left. For JS it means testing all browsers (incl. mobile),
+ which is complex. And of course it will be useless without using the same
+ test-suite in the actual application that consumes the library
+
+### Supply chain security
+
+- **Commits** are signed with PGP keys, to prevent forgery. Make sure to verify commit signatures
+- **Releases** are transparent and built on GitHub CI.
+ Check out [attested checksums of single-file builds](https://github.com/paulmillr/noble-hashes/attestations)
+ and [provenance logs](https://github.com/paulmillr/noble-hashes/actions/workflows/release.yml)
+- **Rare releasing** is followed to ensure less re-audit need for end-users
+- **Dependencies** are minimized and locked-down: any dependency could get hacked and users will be downloading malware with every install.
+ - We make sure to use as few dependencies as possible
+ - Automatic dep updates are prevented by locking-down version ranges; diffs are checked with `npm-diff`
+- **Dev Dependencies** are disabled for end-users; they are only used to develop / build the source code
+
+For this package, there are 0 dependencies; and a few dev dependencies:
+
+- jsbt contains helpers for building, benchmarking & testing secure JS apps. It is developed by the same author
+- prettier, fast-check and typescript are used for code quality / test generation / ts compilation. It's hard to audit their source code thoroughly and fully because of their size
+
+### Randomness
+
+We're deferring to built-in
+[crypto.getRandomValues](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
+which is considered cryptographically secure (CSPRNG).
+
+In the past, browsers had bugs that made it weak: it may happen again.
+Implementing a userspace CSPRNG to get resilient to the weakness
+is even worse: there is no reliable userspace source of quality entropy.
+
+### Quantum computers
+
+Cryptographically relevant quantum computer, if built, will allow to
+utilize Grover's algorithm to break hashes in 2^n/2 operations, instead of 2^n.
+
+This means SHA256 should be replaced with SHA512, SHA3-256 with SHA3-512, SHAKE128 with SHAKE256 etc.
+
+Australian ASD prohibits SHA256 and similar hashes [after 2030](https://www.cyber.gov.au/resources-business-and-government/essential-cyber-security/ism/cyber-security-guidelines/guidelines-cryptography).
+
+## Speed
+
+```sh
+npm run bench
+```
+
+Benchmarks measured on Apple M4.
+
+```
+# 32B
+sha256 x 2,016,129 ops/sec @ 496ns/op
+sha512 x 740,740 ops/sec @ 1μs/op
+sha3_256 x 287,686 ops/sec @ 3μs/op
+sha3_512 x 288,267 ops/sec @ 3μs/op
+k12 x 476,190 ops/sec @ 2μs/op
+blake2b x 464,252 ops/sec @ 2μs/op
+blake2s x 766,871 ops/sec @ 1μs/op
+blake3 x 879,507 ops/sec @ 1μs/op
+
+# 1MB
+sha256 x 331 ops/sec @ 3ms/op
+sha512 x 129 ops/sec @ 7ms/op
+sha3_256 x 38 ops/sec @ 25ms/op
+sha3_512 x 20 ops/sec @ 47ms/op
+k12 x 88 ops/sec @ 11ms/op
+blake2b x 69 ops/sec @ 14ms/op
+blake2s x 57 ops/sec @ 17ms/op
+blake3 x 72 ops/sec @ 13ms/op
+
+# MAC
+hmac(sha256) x 599,880 ops/sec @ 1μs/op
+hmac(sha512) x 197,122 ops/sec @ 5μs/op
+kmac256 x 87,981 ops/sec @ 11μs/op
+blake3(key) x 796,812 ops/sec @ 1μs/op
+
+# KDF
+hkdf(sha256) x 259,942 ops/sec @ 3μs/op
+blake3(context) x 424,808 ops/sec @ 2μs/op
+pbkdf2(sha256, c: 2 ** 18) x 5 ops/sec @ 197ms/op
+pbkdf2(sha512, c: 2 ** 18) x 1 ops/sec @ 630ms/op
+scrypt(n: 2 ** 18, r: 8, p: 1) x 2 ops/sec @ 400ms/op
+argon2id(t: 1, m: 256MB) 2881ms
+```
+
+Compare to native node.js implementation that uses C bindings instead of pure-js code:
+
+```
+# native (node) 32B
+sha256 x 2,267,573 ops/sec
+sha512 x 983,284 ops/sec
+sha3_256 x 1,522,070 ops/sec
+blake2b x 1,512,859 ops/sec
+blake2s x 1,821,493 ops/sec
+hmac(sha256) x 1,085,776 ops/sec
+hkdf(sha256) x 312,109 ops/sec
+# native (node) KDF
+pbkdf2(sha256, c: 2 ** 18) x 5 ops/sec @ 197ms/op
+pbkdf2(sha512, c: 2 ** 18) x 1 ops/sec @ 630ms/op
+scrypt(n: 2 ** 18, r: 8, p: 1) x 2 ops/sec @ 378ms/op
+```
+
+It is possible to [make this library 3x+ faster](./test/benchmark/README.md) by
+_doing code generation of full loop unrolls_. We've decided against it. Reasons:
+
+- current perf is good enough, even compared to other libraries - SHA256 only takes 500 nanoseconds
+- the library must be auditable, with minimum amount of code, and zero dependencies
+- most method invocations with the lib are going to be something like hashing 32b to 64kb of data
+- hashing big inputs is 10x faster with low-level languages, which means you should probably pick 'em instead
+
+## Upgrading
+
+Supported node.js versions:
+
+- v2: v20.19+ (ESM-only)
+- v1: v14.21+ (ESM & CJS)
+
+v2.0 changelog:
+
+- The package is now ESM-only. ESM can finally be loaded from common.js on node v20.19+
+- `.js` extension must be used for all modules
+ - Old: `@noble/hashes/sha3`
+ - New: `@noble/hashes/sha3.js`
+ - This simplifies working in browsers natively without transpilers
+- Only allow Uint8Array as hash inputs, prohibit `string`
+ - Strict validation checks improve security
+ - To replicate previous behavior, use `utils.utf8ToBytes`
+- Rename / remove some modules for consistency. Previously, sha384 resided in sha512, which was weird
+ - `sha256`, `sha512` => `sha2.js` (consistent with `sha3.js`)
+ - `blake2b`, `blake2s` => `blake2.js` (consistent with `blake3.js`, `blake1.js`)
+ - `ripemd160`, `sha1`, `md5` => `legacy.js` (all low-security hashes are there)
+ - `_assert` => `utils.js`
+ - `crypto` internal module got removed: use built-in WebCrypto instead
+- Improve typescript types & option autocomplete
+- Bump compilation target from es2020 to es2022
+
+## Contributing & testing
+
+`test/misc` directory contains implementations of loop unrolling and md5.
+
+- `npm install && npm run build && npm test` will build the code and run tests.
+- `npm run lint` / `npm run format` will run linter / fix linter issues.
+- `npm run bench` will run benchmarks
+- `npm run build:release` will build single file
+- There is **additional** 20-min DoS test `npm run test:dos` and 2-hour "big" multicore test `npm run test:big`.
+ See [our approach to testing](./test/README.md)
+
+Additional resources:
+
+- NTT hashes are outside of scope of the library. They depend on some math which is not available in noble-hashes, it doesn't make sense to add it here. You can view some of them in different repos:
+ - [Pedersen in micro-zk-proofs](https://github.com/paulmillr/micro-zk-proofs/blob/1ed5ce1253583b2e540eef7f3477fb52bf5344ff/src/pedersen.ts)
+ - [Poseidon in noble-curves](https://github.com/paulmillr/noble-curves/blob/3d124dd3ecec8b6634cc0b2ba1c183aded5304f9/src/abstract/poseidon.ts)
+- Polynomial MACs are also outside of scope of the library. They are rarely used outside of encryption. Check out [Poly1305 & GHash in noble-ciphers](https://github.com/paulmillr/noble-ciphers).
+- See [paulmillr.com/noble](https://paulmillr.com/noble/) for useful resources, articles, documentation and demos
+ related to the library.
+
+## License
+
+The MIT License (MIT)
+
+Copyright (c) 2022 Paul Miller [(https://paulmillr.com)](https://paulmillr.com)
+
+See LICENSE file.
diff --git a/server/node_modules/@noble/hashes/_blake.d.ts b/server/node_modules/@noble/hashes/_blake.d.ts
new file mode 100644
index 0000000..71ed85f
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_blake.d.ts
@@ -0,0 +1,14 @@
+/**
+ * Internal blake variable.
+ * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
+ */
+export declare const BSIGMA: Uint8Array;
+export type Num4 = {
+ a: number;
+ b: number;
+ c: number;
+ d: number;
+};
+export declare function G1s(a: number, b: number, c: number, d: number, x: number): Num4;
+export declare function G2s(a: number, b: number, c: number, d: number, x: number): Num4;
+//# sourceMappingURL=_blake.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_blake.d.ts.map b/server/node_modules/@noble/hashes/_blake.d.ts.map
new file mode 100644
index 0000000..7b11ac1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_blake.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"_blake.d.ts","sourceRoot":"","sources":["src/_blake.ts"],"names":[],"mappings":"AAMA;;;GAGG;AAEH,eAAO,MAAM,MAAM,EAAE,UAkBnB,CAAC;AAGH,MAAM,MAAM,IAAI,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;CAAE,CAAC;AAGnE,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_blake.js b/server/node_modules/@noble/hashes/_blake.js
new file mode 100644
index 0000000..3573ee9
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_blake.js
@@ -0,0 +1,45 @@
+/**
+ * Internal helpers for blake hash.
+ * @module
+ */
+import { rotr } from "./utils.js";
+/**
+ * Internal blake variable.
+ * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
+ */
+// prettier-ignore
+export const BSIGMA = /* @__PURE__ */ Uint8Array.from([
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
+ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
+ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
+ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
+ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
+ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,
+ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,
+ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,
+ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
+ // Blake1, unused in others
+ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
+ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
+ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
+ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
+]);
+// Mixing function G splitted in two halfs
+export function G1s(a, b, c, d, x) {
+ a = (a + b + x) | 0;
+ d = rotr(d ^ a, 16);
+ c = (c + d) | 0;
+ b = rotr(b ^ c, 12);
+ return { a, b, c, d };
+}
+export function G2s(a, b, c, d, x) {
+ a = (a + b + x) | 0;
+ d = rotr(d ^ a, 8);
+ c = (c + d) | 0;
+ b = rotr(b ^ c, 7);
+ return { a, b, c, d };
+}
+//# sourceMappingURL=_blake.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_blake.js.map b/server/node_modules/@noble/hashes/_blake.js.map
new file mode 100644
index 0000000..4a418be
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_blake.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_blake.js","sourceRoot":"","sources":["src/_blake.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;GAGG;AACH,kBAAkB;AAClB,MAAM,CAAC,MAAM,MAAM,GAAe,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC;IAChE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACp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CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACnB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_md.d.ts b/server/node_modules/@noble/hashes/_md.d.ts
new file mode 100644
index 0000000..c0f6ee8
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_md.d.ts
@@ -0,0 +1,49 @@
+/**
+ * Internal Merkle-Damgard hash utils.
+ * @module
+ */
+import { type Hash } from './utils.ts';
+/** Choice: a ? b : c */
+export declare function Chi(a: number, b: number, c: number): number;
+/** Majority function, true if any two inputs is true. */
+export declare function Maj(a: number, b: number, c: number): number;
+/**
+ * Merkle-Damgard hash construction base class.
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
+ */
+export declare abstract class HashMD
> implements Hash {
+ protected abstract process(buf: DataView, offset: number): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+ abstract destroy(): void;
+ protected abstract roundClean(): void;
+ readonly blockLen: number;
+ readonly outputLen: number;
+ readonly padOffset: number;
+ readonly isLE: boolean;
+ protected buffer: Uint8Array;
+ protected view: DataView;
+ protected finished: boolean;
+ protected length: number;
+ protected pos: number;
+ protected destroyed: boolean;
+ constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean);
+ update(data: Uint8Array): this;
+ digestInto(out: Uint8Array): void;
+ digest(): Uint8Array;
+ _cloneInto(to?: T): T;
+ clone(): T;
+}
+/**
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
+ */
+/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
+export declare const SHA256_IV: Uint32Array;
+/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */
+export declare const SHA224_IV: Uint32Array;
+/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */
+export declare const SHA384_IV: Uint32Array;
+/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */
+export declare const SHA512_IV: Uint32Array;
+//# sourceMappingURL=_md.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_md.d.ts.map b/server/node_modules/@noble/hashes/_md.d.ts.map
new file mode 100644
index 0000000..6e14289
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_md.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"_md.d.ts","sourceRoot":"","sources":["src/_md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAA+C,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpF,wBAAwB;AACxB,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,yDAAyD;AACzD,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,8BAAsB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAC/D,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAC/C,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI;IAErC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAGvB,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,MAAM,SAAK;IACrB,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,SAAS,UAAS;gBAEhB,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAQjF,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAyB9B,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAkCjC,MAAM,IAAI,UAAU;IAOpB,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC;IAWrB,KAAK,IAAI,CAAC;CAGX;AAED;;;GAGG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,SAAS,EAAE,WAEtB,CAAC;AAEH,8EAA8E;AAC9E,eAAO,MAAM,SAAS,EAAE,WAEtB,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,SAAS,EAAE,WAGtB,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,SAAS,EAAE,WAGtB,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_md.js b/server/node_modules/@noble/hashes/_md.js
new file mode 100644
index 0000000..9dd5b61
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_md.js
@@ -0,0 +1,147 @@
+/**
+ * Internal Merkle-Damgard hash utils.
+ * @module
+ */
+import { abytes, aexists, aoutput, clean, createView } from "./utils.js";
+/** Choice: a ? b : c */
+export function Chi(a, b, c) {
+ return (a & b) ^ (~a & c);
+}
+/** Majority function, true if any two inputs is true. */
+export function Maj(a, b, c) {
+ return (a & b) ^ (a & c) ^ (b & c);
+}
+/**
+ * Merkle-Damgard hash construction base class.
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
+ */
+export class HashMD {
+ blockLen;
+ outputLen;
+ padOffset;
+ isLE;
+ // For partial updates less than block size
+ buffer;
+ view;
+ finished = false;
+ length = 0;
+ pos = 0;
+ destroyed = false;
+ constructor(blockLen, outputLen, padOffset, isLE) {
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.padOffset = padOffset;
+ this.isLE = isLE;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ for (let pos = 0; pos < len;) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ const dataView = createView(data);
+ for (; blockLen <= len - pos; pos += blockLen)
+ this.process(dataView, pos);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.process(view, 0);
+ this.pos = 0;
+ }
+ }
+ this.length += data.length;
+ this.roundClean();
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ // We can avoid allocation of buffer for padding completely if it
+ // was previously not allocated here. But it won't change performance.
+ const { buffer, view, blockLen, isLE } = this;
+ let { pos } = this;
+ // append the bit '1' to the message
+ buffer[pos++] = 0b10000000;
+ clean(this.buffer.subarray(pos));
+ // we have less than padOffset left in buffer, so we cannot put length in
+ // current block, need process it and pad again
+ if (this.padOffset > blockLen - pos) {
+ this.process(view, 0);
+ pos = 0;
+ }
+ // Pad until full block byte with zeros
+ for (let i = pos; i < blockLen; i++)
+ buffer[i] = 0;
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
+ // So we just write lowest 64 bits of that value.
+ view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
+ this.process(view, 0);
+ const oview = createView(out);
+ const len = this.outputLen;
+ // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
+ if (len % 4)
+ throw new Error('_sha2: outputLen must be aligned to 32bit');
+ const outLen = len / 4;
+ const state = this.get();
+ if (outLen > state.length)
+ throw new Error('_sha2: outputLen bigger than state');
+ for (let i = 0; i < outLen; i++)
+ oview.setUint32(4 * i, state[i], isLE);
+ }
+ digest() {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to) {
+ to ||= new this.constructor();
+ to.set(...this.get());
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ if (length % blockLen)
+ to.buffer.set(buffer);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+/**
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
+ */
+/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
+export const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
+]);
+/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */
+export const SHA224_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,
+]);
+/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */
+export const SHA384_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,
+ 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,
+]);
+/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */
+export const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,
+ 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,
+]);
+//# sourceMappingURL=_md.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_md.js.map b/server/node_modules/@noble/hashes/_md.js.map
new file mode 100644
index 0000000..b2c29d6
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_md.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_md.js","sourceRoot":"","sources":["src/_md.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,YAAY,CAAC;AAEpF,wBAAwB;AACxB,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAOjB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,IAA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E,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,SAAS,GAAgB,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IACrE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_u64.d.ts b/server/node_modules/@noble/hashes/_u64.d.ts
new file mode 100644
index 0000000..ac5523a
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_u64.d.ts
@@ -0,0 +1,55 @@
+declare function fromBig(n: bigint, le?: boolean): {
+ h: number;
+ l: number;
+};
+declare function split(lst: bigint[], le?: boolean): Uint32Array[];
+declare const toBig: (h: number, l: number) => bigint;
+declare const shrSH: (h: number, _l: number, s: number) => number;
+declare const shrSL: (h: number, l: number, s: number) => number;
+declare const rotrSH: (h: number, l: number, s: number) => number;
+declare const rotrSL: (h: number, l: number, s: number) => number;
+declare const rotrBH: (h: number, l: number, s: number) => number;
+declare const rotrBL: (h: number, l: number, s: number) => number;
+declare const rotr32H: (_h: number, l: number) => number;
+declare const rotr32L: (h: number, _l: number) => number;
+declare const rotlSH: (h: number, l: number, s: number) => number;
+declare const rotlSL: (h: number, l: number, s: number) => number;
+declare const rotlBH: (h: number, l: number, s: number) => number;
+declare const rotlBL: (h: number, l: number, s: number) => number;
+declare function add(Ah: number, Al: number, Bh: number, Bl: number): {
+ h: number;
+ l: number;
+};
+declare const add3L: (Al: number, Bl: number, Cl: number) => number;
+declare const add3H: (low: number, Ah: number, Bh: number, Ch: number) => number;
+declare const add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number;
+declare const add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number;
+declare const add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number;
+declare const add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number;
+export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };
+declare const u64: {
+ fromBig: typeof fromBig;
+ split: typeof split;
+ toBig: (h: number, l: number) => bigint;
+ shrSH: (h: number, _l: number, s: number) => number;
+ shrSL: (h: number, l: number, s: number) => number;
+ rotrSH: (h: number, l: number, s: number) => number;
+ rotrSL: (h: number, l: number, s: number) => number;
+ rotrBH: (h: number, l: number, s: number) => number;
+ rotrBL: (h: number, l: number, s: number) => number;
+ rotr32H: (_h: number, l: number) => number;
+ rotr32L: (h: number, _l: number) => number;
+ rotlSH: (h: number, l: number, s: number) => number;
+ rotlSL: (h: number, l: number, s: number) => number;
+ rotlBH: (h: number, l: number, s: number) => number;
+ rotlBL: (h: number, l: number, s: number) => number;
+ add: typeof add;
+ add3L: (Al: number, Bl: number, Cl: number) => number;
+ add3H: (low: number, Ah: number, Bh: number, Ch: number) => number;
+ add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number;
+ add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number;
+ add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number;
+ add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number;
+};
+export default u64;
+//# sourceMappingURL=_u64.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_u64.d.ts.map b/server/node_modules/@noble/hashes/_u64.d.ts.map
new file mode 100644
index 0000000..211a4c6
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_u64.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"_u64.d.ts","sourceRoot":"","sources":["src/_u64.ts"],"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,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAOrpC,CAAC;AACF,eAAe,GAAG,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_u64.js b/server/node_modules/@noble/hashes/_u64.js
new file mode 100644
index 0000000..6519354
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_u64.js
@@ -0,0 +1,67 @@
+/**
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
+ * @todo re-check https://issues.chromium.org/issues/42212588
+ * @module
+ */
+const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
+const _32n = /* @__PURE__ */ BigInt(32);
+function fromBig(n, le = false) {
+ if (le)
+ return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
+ return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
+}
+function split(lst, le = false) {
+ const len = lst.length;
+ let Ah = new Uint32Array(len);
+ let Al = new Uint32Array(len);
+ for (let i = 0; i < len; i++) {
+ const { h, l } = fromBig(lst[i], le);
+ [Ah[i], Al[i]] = [h, l];
+ }
+ return [Ah, Al];
+}
+const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
+// for Shift in [0, 32)
+const shrSH = (h, _l, s) => h >>> s;
+const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
+// Right rotate for Shift in [1, 32)
+const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
+const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
+// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
+const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
+// Right rotate for shift===32 (just swaps l&h)
+const rotr32H = (_h, l) => l;
+const rotr32L = (h, _l) => h;
+// Left rotate for Shift in [1, 32)
+const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
+const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
+// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
+const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
+// JS uses 32-bit signed integers for bitwise operations which means we cannot
+// simple take carry out of low bit sum by shift, we need to use division.
+function add(Ah, Al, Bh, Bl) {
+ const l = (Al >>> 0) + (Bl >>> 0);
+ return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
+}
+// Addition with more than 2 elements
+const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
+const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
+const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
+const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
+const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
+const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
+// prettier-ignore
+export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };
+// prettier-ignore
+const u64 = {
+ fromBig, split, toBig,
+ shrSH, shrSL,
+ rotrSH, rotrSL, rotrBH, rotrBL,
+ rotr32H, rotr32L,
+ rotlSH, rotlSL, rotlBH, rotlBL,
+ add, add3L, add3H, add4L, add4H, add5H, add5L,
+};
+export default u64;
+//# sourceMappingURL=_u64.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/_u64.js.map b/server/node_modules/@noble/hashes/_u64.js.map
new file mode 100644
index 0000000..558394b
--- /dev/null
+++ b/server/node_modules/@noble/hashes/_u64.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"_u64.js","sourceRoot":"","sources":["src/_u64.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AACvD,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAExC,SAAS,OAAO,CACd,CAAS,EACT,EAAE,GAAG,KAAK;IAKV,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;IAClF,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;AACpF,CAAC;AAED,SAAS,KAAK,CAAC,GAAa,EAAE,EAAE,GAAG,KAAK;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC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/server/node_modules/@noble/hashes/argon2.d.ts
new file mode 100644
index 0000000..67cb8f6
--- /dev/null
+++ b/server/node_modules/@noble/hashes/argon2.d.ts
@@ -0,0 +1,32 @@
+import { type KDFInput } from './utils.ts';
+/**
+ * Argon2 options.
+ * * t: time cost, m: mem cost in kb, p: parallelization.
+ * * key: optional key. personalization: arbitrary extra data.
+ * * dkLen: desired number of output bytes.
+ */
+export type ArgonOpts = {
+ t: number;
+ m: number;
+ p: number;
+ version?: number;
+ key?: KDFInput;
+ personalization?: KDFInput;
+ dkLen?: number;
+ asyncTick?: number;
+ maxmem?: number;
+ onProgress?: (progress: number) => void;
+};
+/** argon2d GPU-resistant version. */
+export declare const argon2d: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Uint8Array;
+/** argon2i side-channel-resistant version. */
+export declare const argon2i: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Uint8Array;
+/** argon2id, combining i+d, the most popular version from RFC 9106 */
+export declare const argon2id: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Uint8Array;
+/** argon2d async GPU-resistant version. */
+export declare const argon2dAsync: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Promise;
+/** argon2i async side-channel-resistant version. */
+export declare const argon2iAsync: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Promise;
+/** argon2id async, combining i+d, the most popular version from RFC 9106 */
+export declare const argon2idAsync: (password: KDFInput, salt: KDFInput, opts: ArgonOpts) => Promise;
+//# sourceMappingURL=argon2.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/argon2.d.ts.map b/server/node_modules/@noble/hashes/argon2.d.ts.map
new file mode 100644
index 0000000..9d1bbbf
--- /dev/null
+++ b/server/node_modules/@noble/hashes/argon2.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["src/argon2.ts"],"names":[],"mappings":"AAYA,OAAO,EAAsD,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AA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ashes/argon2.js
new file mode 100644
index 0000000..eb8f313
--- /dev/null
+++ b/server/node_modules/@noble/hashes/argon2.js
@@ -0,0 +1,391 @@
+/**
+ * Argon2 KDF from RFC 9106. Can be used to create a key from password and salt.
+ * We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness:
+ * * argon uses uint64, but JS doesn't have fast uint64array
+ * * uint64 multiplication is 1/3 of time
+ * * `P` function would be very nice with u64, because most of value will be in registers,
+ * hovewer with u32 it will require 32 registers, which is too much.
+ * * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down
+ * @module
+ */
+import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from "./_u64.js";
+import { blake2b } from "./blake2.js";
+import { anumber, clean, kdfInputToBytes, nextTick, u32, u8 } from "./utils.js";
+const AT = { Argond2d: 0, Argon2i: 1, Argon2id: 2 };
+const ARGON2_SYNC_POINTS = 4;
+const abytesOrZero = (buf, errorTitle = '') => {
+ if (buf === undefined)
+ return Uint8Array.of();
+ return kdfInputToBytes(buf, errorTitle);
+};
+// u32 * u32 = u64
+function mul(a, b) {
+ const aL = a & 0xffff;
+ const aH = a >>> 16;
+ const bL = b & 0xffff;
+ const bH = b >>> 16;
+ const ll = Math.imul(aL, bL);
+ const hl = Math.imul(aH, bL);
+ const lh = Math.imul(aL, bH);
+ const hh = Math.imul(aH, bH);
+ const carry = (ll >>> 16) + (hl & 0xffff) + lh;
+ const high = (hh + (hl >>> 16) + (carry >>> 16)) | 0;
+ const low = (carry << 16) | (ll & 0xffff);
+ return { h: high, l: low };
+}
+function mul2(a, b) {
+ // 2 * a * b (via shifts)
+ const { h, l } = mul(a, b);
+ return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff };
+}
+// BlaMka permutation for Argon2
+// A + B + (2 * u32(A) * u32(B))
+function blamka(Ah, Al, Bh, Bl) {
+ const { h: Ch, l: Cl } = mul2(Al, Bl);
+ // A + B + (2 * A * B)
+ const Rll = add3L(Al, Bl, Cl);
+ return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 };
+}
+// Temporary block buffer
+const A2_BUF = new Uint32Array(256); // 1024 bytes (matrix 16x16)
+function G(a, b, c, d) {
+ let Al = A2_BUF[2 * a], Ah = A2_BUF[2 * a + 1]; // prettier-ignore
+ let Bl = A2_BUF[2 * b], Bh = A2_BUF[2 * b + 1]; // prettier-ignore
+ let Cl = A2_BUF[2 * c], Ch = A2_BUF[2 * c + 1]; // prettier-ignore
+ let Dl = A2_BUF[2 * d], Dh = A2_BUF[2 * d + 1]; // prettier-ignore
+ ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
+ ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
+ ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
+ ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
+ ((A2_BUF[2 * a] = Al), (A2_BUF[2 * a + 1] = Ah));
+ ((A2_BUF[2 * b] = Bl), (A2_BUF[2 * b + 1] = Bh));
+ ((A2_BUF[2 * c] = Cl), (A2_BUF[2 * c + 1] = Ch));
+ ((A2_BUF[2 * d] = Dl), (A2_BUF[2 * d + 1] = Dh));
+}
+// prettier-ignore
+function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) {
+ G(v00, v04, v08, v12);
+ G(v01, v05, v09, v13);
+ G(v02, v06, v10, v14);
+ G(v03, v07, v11, v15);
+ G(v00, v05, v10, v15);
+ G(v01, v06, v11, v12);
+ G(v02, v07, v08, v13);
+ G(v03, v04, v09, v14);
+}
+function block(x, xPos, yPos, outPos, needXor) {
+ for (let i = 0; i < 256; i++)
+ A2_BUF[i] = x[xPos + i] ^ x[yPos + i];
+ // columns (8)
+ for (let i = 0; i < 128; i += 16) {
+ // prettier-ignore
+ P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15);
+ }
+ // rows (8)
+ for (let i = 0; i < 16; i += 2) {
+ // prettier-ignore
+ P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113);
+ }
+ if (needXor)
+ for (let i = 0; i < 256; i++)
+ x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
+ else
+ for (let i = 0; i < 256; i++)
+ x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
+ clean(A2_BUF);
+}
+// Variable-Length Hash Function H'
+function Hp(A, dkLen) {
+ const A8 = u8(A);
+ const T = new Uint32Array(1);
+ const T8 = u8(T);
+ T[0] = dkLen;
+ // Fast path
+ if (dkLen <= 64)
+ return blake2b.create({ dkLen }).update(T8).update(A8).digest();
+ const out = new Uint8Array(dkLen);
+ let V = blake2b.create({}).update(T8).update(A8).digest();
+ let pos = 0;
+ // First block
+ out.set(V.subarray(0, 32));
+ pos += 32;
+ // Rest blocks
+ for (; dkLen - pos > 64; pos += 32) {
+ const Vh = blake2b.create({}).update(V);
+ Vh.digestInto(V);
+ Vh.destroy();
+ out.set(V.subarray(0, 32), pos);
+ }
+ // Last block
+ out.set(blake2b(V, { dkLen: dkLen - pos }), pos);
+ clean(V, T);
+ return u32(out);
+}
+// Used only inside process block!
+function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) {
+ // This is ugly, but close enough to reference implementation.
+ let area;
+ if (r === 0) {
+ if (s === 0)
+ area = index - 1;
+ else if (sameLane)
+ area = s * segmentLen + index - 1;
+ else
+ area = s * segmentLen + (index == 0 ? -1 : 0);
+ }
+ else if (sameLane)
+ area = laneLen - segmentLen + index - 1;
+ else
+ area = laneLen - segmentLen + (index == 0 ? -1 : 0);
+ const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0;
+ const rel = area - 1 - mul(area, mul(randL, randL).h).h;
+ return (startPos + rel) % laneLen;
+}
+const maxUint32 = Math.pow(2, 32);
+function isU32(num) {
+ return Number.isSafeInteger(num) && num >= 0 && num < maxUint32;
+}
+function argon2Opts(opts) {
+ const merged = {
+ version: 0x13,
+ dkLen: 32,
+ maxmem: maxUint32 - 1,
+ asyncTick: 10,
+ };
+ for (let [k, v] of Object.entries(opts))
+ if (v !== undefined)
+ merged[k] = v;
+ const { dkLen, p, m, t, version, onProgress, asyncTick } = merged;
+ if (!isU32(dkLen) || dkLen < 4)
+ throw new Error('"dkLen" must be 4..');
+ if (!isU32(p) || p < 1 || p >= Math.pow(2, 24))
+ throw new Error('"p" must be 1..2^24');
+ if (!isU32(m))
+ throw new Error('"m" must be 0..2^32');
+ if (!isU32(t) || t < 1)
+ throw new Error('"t" (iterations) must be 1..2^32');
+ if (onProgress !== undefined && typeof onProgress !== 'function')
+ throw new Error('"progressCb" must be a function');
+ anumber(asyncTick, 'asyncTick');
+ /*
+ Memory size m MUST be an integer number of kibibytes from 8*p to 2^(32)-1. The actual number of blocks is m', which is m rounded down to the nearest multiple of 4*p.
+ */
+ if (!isU32(m) || m < 8 * p)
+ throw new Error('"m" (memory) must be at least 8*p bytes');
+ if (version !== 0x10 && version !== 0x13)
+ throw new Error('"version" must be 0x10 or 0x13, got ' + version);
+ return merged;
+}
+function argon2Init(password, salt, type, opts) {
+ password = kdfInputToBytes(password, 'password');
+ salt = kdfInputToBytes(salt, 'salt');
+ if (!isU32(password.length))
+ throw new Error('"password" must be less of length 1..4Gb');
+ if (!isU32(salt.length) || salt.length < 8)
+ throw new Error('"salt" must be of length 8..4Gb');
+ if (!Object.values(AT).includes(type))
+ throw new Error('"type" was invalid');
+ let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } = argon2Opts(opts);
+ // Validation
+ key = abytesOrZero(key, 'key');
+ personalization = abytesOrZero(personalization, 'personalization');
+ // H_0 = H^(64)(LE32(p) || LE32(T) || LE32(m) || LE32(t) ||
+ // LE32(v) || LE32(y) || LE32(length(P)) || P ||
+ // LE32(length(S)) || S || LE32(length(K)) || K ||
+ // LE32(length(X)) || X)
+ const h = blake2b.create();
+ const BUF = new Uint32Array(1);
+ const BUF8 = u8(BUF);
+ for (let item of [p, dkLen, m, t, version, type]) {
+ BUF[0] = item;
+ h.update(BUF8);
+ }
+ for (let i of [password, salt, key, personalization]) {
+ BUF[0] = i.length; // BUF is u32 array, this is valid
+ h.update(BUF8).update(i);
+ }
+ const H0 = new Uint32Array(18);
+ const H0_8 = u8(H0);
+ h.digestInto(H0_8);
+ // 256 u32 = 1024 (BLOCK_SIZE), fills A2_BUF on processing
+ // Params
+ const lanes = p;
+ // m' = 4 * p * floor (m / 4p)
+ const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p));
+ //q = m' / p columns
+ const laneLen = Math.floor(mP / p);
+ const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS);
+ const memUsed = mP * 256;
+ if (!isU32(maxmem) || memUsed > maxmem)
+ throw new Error('"maxmem" expected <2**32, got: maxmem=' + maxmem + ', memused=' + memUsed);
+ const B = new Uint32Array(memUsed);
+ // Fill first blocks
+ for (let l = 0; l < p; l++) {
+ const i = 256 * laneLen * l;
+ // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))
+ H0[17] = l;
+ H0[16] = 0;
+ B.set(Hp(H0, 1024), i);
+ // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))
+ H0[16] = 1;
+ B.set(Hp(H0, 1024), i + 256);
+ }
+ let perBlock = () => { };
+ if (onProgress) {
+ const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen;
+ // Invoke callback if progress changes from 10.01 to 10.02
+ // Allows to draw smooth progress bar on up to 8K screen
+ const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1);
+ let blockCnt = 0;
+ perBlock = () => {
+ blockCnt++;
+ if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock))
+ onProgress(blockCnt / totalBlock);
+ };
+ }
+ clean(BUF, H0);
+ return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick };
+}
+function argon2Output(B, p, laneLen, dkLen) {
+ const B_final = new Uint32Array(256);
+ for (let l = 0; l < p; l++)
+ for (let j = 0; j < 256; j++)
+ B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j];
+ const res = u8(Hp(B_final, dkLen));
+ clean(B_final);
+ return res;
+}
+function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) {
+ if (offset % laneLen)
+ prev = offset - 1;
+ let randL, randH;
+ if (dataIndependent) {
+ let i128 = index % 128;
+ if (i128 === 0) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ randL = address[2 * i128];
+ randH = address[2 * i128 + 1];
+ }
+ else {
+ const T = 256 * prev;
+ randL = B[T];
+ randH = B[T + 1];
+ }
+ // address block
+ const refLane = r === 0 && s === 0 ? l : randH % lanes;
+ const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l);
+ const refBlock = laneLen * refLane + refPos;
+ // B[i][j] = G(B[i][j-1], B[l][z])
+ block(B, 256 * prev, 256 * refBlock, offset * 256, needXor);
+}
+function argon2(type, password, salt, opts) {
+ const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(password, salt, type, opts);
+ // Pre-loop setup
+ // [address, input, zero_block] format so we can pass single U32 to block function
+ const address = new Uint32Array(3 * 256);
+ address[256 + 6] = mP;
+ address[256 + 8] = t;
+ address[256 + 10] = type;
+ for (let r = 0; r < t; r++) {
+ const needXor = r !== 0 && version === 0x13;
+ address[256 + 0] = r;
+ for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
+ address[256 + 4] = s;
+ const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
+ for (let l = 0; l < p; l++) {
+ address[256 + 2] = l;
+ address[256 + 12] = 0;
+ let startPos = 0;
+ if (r === 0 && s === 0) {
+ startPos = 2;
+ if (dataIndependent) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ }
+ // current block postion
+ let offset = l * laneLen + s * segmentLen + startPos;
+ // previous block position
+ let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
+ for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
+ perBlock();
+ processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
+ }
+ }
+ }
+ }
+ clean(address);
+ return argon2Output(B, p, laneLen, dkLen);
+}
+/** argon2d GPU-resistant version. */
+export const argon2d = (password, salt, opts) => argon2(AT.Argond2d, password, salt, opts);
+/** argon2i side-channel-resistant version. */
+export const argon2i = (password, salt, opts) => argon2(AT.Argon2i, password, salt, opts);
+/** argon2id, combining i+d, the most popular version from RFC 9106 */
+export const argon2id = (password, salt, opts) => argon2(AT.Argon2id, password, salt, opts);
+async function argon2Async(type, password, salt, opts) {
+ const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } = argon2Init(password, salt, type, opts);
+ // Pre-loop setup
+ // [address, input, zero_block] format so we can pass single U32 to block function
+ const address = new Uint32Array(3 * 256);
+ address[256 + 6] = mP;
+ address[256 + 8] = t;
+ address[256 + 10] = type;
+ let ts = Date.now();
+ for (let r = 0; r < t; r++) {
+ const needXor = r !== 0 && version === 0x13;
+ address[256 + 0] = r;
+ for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
+ address[256 + 4] = s;
+ const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
+ for (let l = 0; l < p; l++) {
+ address[256 + 2] = l;
+ address[256 + 12] = 0;
+ let startPos = 0;
+ if (r === 0 && s === 0) {
+ startPos = 2;
+ if (dataIndependent) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ }
+ // current block postion
+ let offset = l * laneLen + s * segmentLen + startPos;
+ // previous block position
+ let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
+ for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
+ perBlock();
+ processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
+ // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
+ const diff = Date.now() - ts;
+ if (!(diff >= 0 && diff < asyncTick)) {
+ await nextTick();
+ ts += diff;
+ }
+ }
+ }
+ }
+ }
+ clean(address);
+ return argon2Output(B, p, laneLen, dkLen);
+}
+/** argon2d async GPU-resistant version. */
+export const argon2dAsync = (password, salt, opts) => argon2Async(AT.Argond2d, password, salt, opts);
+/** argon2i async side-channel-resistant version. */
+export const argon2iAsync = (password, salt, opts) => argon2Async(AT.Argon2i, password, salt, opts);
+/** argon2id async, combining i+d, the most popular version from RFC 9106 */
+export const argon2idAsync = (password, salt, opts) => argon2Async(AT.Argon2id, password, salt, opts);
+//# sourceMappingURL=argon2.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/argon2.js.map b/server/node_modules/@noble/hashes/argon2.js.map
new file mode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AAC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzE,oDAAoD;AACpD,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,QAAkB,EAClB,IAAc,EACd,IAAe,EACM,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACxE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,QAAkB,EAClB,IAAc,EACd,IAAe,EACM,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake1.d.ts b/server/node_modules/@noble/hashes/blake1.d.ts
new file mode 100644
index 0000000..08af340
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake1.d.ts
@@ -0,0 +1,110 @@
+import { type CHash, type Hash } from './utils.ts';
+/** Blake1 options. Basically just "salt" */
+export type BlakeOpts = {
+ salt?: Uint8Array;
+};
+declare abstract class BLAKE1> implements Hash {
+ protected finished: boolean;
+ protected length: number;
+ protected pos: number;
+ protected destroyed: boolean;
+ protected buffer: Uint8Array;
+ protected view: DataView;
+ protected salt: Uint32Array;
+ abstract compress(view: DataView, offset: number, withLength?: boolean): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+ readonly blockLen: number;
+ readonly outputLen: number;
+ private lengthFlag;
+ private counterLen;
+ protected constants: Uint32Array;
+ constructor(blockLen: number, outputLen: number, lengthFlag: number, counterLen: number, saltLen: number, constants: Uint32Array, opts?: BlakeOpts);
+ update(data: Uint8Array): this;
+ destroy(): void;
+ _cloneInto(to?: T): T;
+ clone(): T;
+ digestInto(out: Uint8Array): void;
+ digest(): Uint8Array;
+}
+declare class BLAKE1_32B extends BLAKE1 {
+ private v0;
+ private v1;
+ private v2;
+ private v3;
+ private v4;
+ private v5;
+ private v6;
+ private v7;
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts);
+ protected get(): [number, number, number, number, number, number, number, number];
+ protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void;
+ destroy(): void;
+ compress(view: DataView, offset: number, withLength?: boolean): void;
+}
+declare class BLAKE1_64B extends BLAKE1 {
+ private v0l;
+ private v0h;
+ private v1l;
+ private v1h;
+ private v2l;
+ private v2h;
+ private v3l;
+ private v3h;
+ private v4l;
+ private v4h;
+ private v5l;
+ private v5h;
+ private v6l;
+ private v6h;
+ private v7l;
+ private v7h;
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts);
+ protected get(): [
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number
+ ];
+ protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void;
+ destroy(): void;
+ compress(view: DataView, offset: number, withLength?: boolean): void;
+}
+/** Internal blake1-224 hash class. */
+export declare class _BLAKE224 extends BLAKE1_32B {
+ constructor(opts?: BlakeOpts);
+}
+/** Internal blake1-256 hash class. */
+export declare class _BLAKE256 extends BLAKE1_32B {
+ constructor(opts?: BlakeOpts);
+}
+/** Internal blake1-384 hash class. */
+export declare class _BLAKE384 extends BLAKE1_64B {
+ constructor(opts?: BlakeOpts);
+}
+/** Internal blake1-512 hash class. */
+export declare class _BLAKE512 extends BLAKE1_64B {
+ constructor(opts?: BlakeOpts);
+}
+/** blake1-224 hash function */
+export declare const blake224: CHash<_BLAKE224, BlakeOpts>;
+/** blake1-256 hash function */
+export declare const blake256: CHash<_BLAKE256, BlakeOpts>;
+/** blake1-384 hash function */
+export declare const blake384: CHash<_BLAKE384, BlakeOpts>;
+/** blake1-512 hash function */
+export declare const blake512: CHash<_BLAKE512, BlakeOpts>;
+export {};
+//# sourceMappingURL=blake1.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake1.d.ts.map b/server/node_modules/@noble/hashes/blake1.d.ts.map
new file mode 100644
index 0000000..be0fe26
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake1.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake1.d.ts","sourceRoot":"","sources":["src/blake1.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,4CAA4C;AAC5C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAKF,uBAAe,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IAC3D,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,MAAM,SAAK;IACrB,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,SAAS,UAAS;IAE5B,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI;IAC7E,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAE/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3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EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAClD,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GACjD,IAAI;IAkBP,OAAO,IAAI,IAAI;IAIf,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,IAAI;CAiDlE;AAED,sCAAsC;AACtC,qBAAa,SAAU,SAAQ,UAAU;gBAC3B,IAAI,GAAE,SAAc;CAGjC;AACD,sCAAsC;AACtC,qBAAa,SAAU,SAAQ,UAAU;gBAC3B,IAAI,GAAE,SAAc;CAGjC;AACD,sCAAsC;AACtC,qBAAa,SAAU,SAAQ,UAAU;gBAC3B,IAAI,GAAE,SAAc;CAGjC;AACD,sCAAsC;AACtC,qBAAa,SAAU,SAAQ,UAAU;gBAC3B,IAAI,GAAE,SAAc;CAGjC;AACD,+BAA+B;AAC/B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAEhD,CAAC;AACF,+BAA+B;AAC/B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAEhD,CAAC;AACF,+BAA+B;AAC/B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAEhD,CAAC;AACF,+BAA+B;AAC/B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAEhD,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake1.js b/server/node_modules/@noble/hashes/blake1.js
new file mode 100644
index 0000000..1472b71
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake1.js
@@ -0,0 +1,485 @@
+/**
+ * Blake1 legacy hash function, one of SHA3 proposals.
+ * Rarely used. Check out blake2 or blake3 instead.
+ * https://www.aumasson.jp/blake/blake.pdf
+ *
+ * In the best case, there are 0 allocations.
+ *
+ * Differences from blake2:
+ *
+ * - BE instead of LE
+ * - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but:
+ * - length flag is located before actual length
+ * - padding block is compressed differently (no lengths)
+ * Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]`
+ * (-1 for g1, g2 without -1)
+ * - Salt is XOR-ed into constants instead of state
+ * - Salt is XOR-ed with output in `compress`
+ * - Additional rows (+64 bytes) in SIGMA for new rounds
+ * - Different round count:
+ * - 14 / 10 rounds in blake256 / blake2s
+ * - 16 / 12 rounds in blake512 / blake2b
+ * - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11
+ * @module
+ */
+import { BSIGMA, G1s, G2s } from "./_blake.js";
+import { SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js";
+import * as u64 from "./_u64.js";
+// prettier-ignore
+import { abytes, aexists, aoutput, clean, createHasher, createView } from "./utils.js";
+// Empty zero-filled salt
+const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8);
+class BLAKE1 {
+ finished = false;
+ length = 0;
+ pos = 0;
+ destroyed = false;
+ // For partial updates less than block size
+ buffer;
+ view;
+ salt;
+ blockLen;
+ outputLen;
+ lengthFlag;
+ counterLen;
+ constants;
+ constructor(blockLen, outputLen, lengthFlag, counterLen, saltLen, constants, opts = {}) {
+ const { salt } = opts;
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.lengthFlag = lengthFlag;
+ this.counterLen = counterLen;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ if (salt !== undefined) {
+ let slt = salt;
+ abytes(slt, 4 * saltLen, 'salt');
+ // if (slt.length !== 4 * saltLen) throw new Error('wrong salt length');
+ const salt32 = (this.salt = new Uint32Array(saltLen));
+ const sv = createView(slt);
+ this.constants = constants.slice();
+ for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) {
+ salt32[i] = sv.getUint32(offset, false);
+ this.constants[i] ^= salt32[i];
+ }
+ }
+ else {
+ this.salt = EMPTY_SALT;
+ this.constants = constants;
+ }
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ // From _md, but update length before each compress
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ let dataView;
+ for (let pos = 0; pos < len;) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ if (!dataView)
+ dataView = createView(data);
+ for (; blockLen <= len - pos; pos += blockLen) {
+ this.length += blockLen;
+ this.compress(dataView, pos);
+ }
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.length += blockLen;
+ this.compress(view, 0, true);
+ this.pos = 0;
+ }
+ }
+ return this;
+ }
+ destroy() {
+ this.destroyed = true;
+ if (this.salt !== EMPTY_SALT) {
+ clean(this.salt, this.constants);
+ }
+ }
+ _cloneInto(to) {
+ to ||= new this.constructor();
+ to.set(...this.get());
+ const { buffer, length, finished, destroyed, constants, salt, pos } = this;
+ to.buffer.set(buffer);
+ to.constants = constants.slice();
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ to.salt = salt.slice();
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ digestInto(out) {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ const { buffer, blockLen, counterLen, lengthFlag, view } = this;
+ clean(buffer.subarray(this.pos)); // clean buf
+ const counter = BigInt((this.length + this.pos) * 8);
+ const counterPos = blockLen - counterLen - 1;
+ buffer[this.pos] |= 0b1000_0000; // End block flag
+ this.length += this.pos; // add unwritten length
+ // Not enough in buffer for length: write what we have.
+ if (this.pos > counterPos) {
+ this.compress(view, 0);
+ clean(buffer);
+ this.pos = 0;
+ }
+ // Difference with md: here we have lengthFlag!
+ buffer[counterPos] |= lengthFlag; // Length flag
+ // We always set 8 byte length flag. Because length will overflow significantly sooner.
+ view.setBigUint64(blockLen - 8, counter, false);
+ this.compress(view, 0, this.pos !== 0); // don't add length if length is not empty block?
+ // Write output
+ clean(buffer);
+ const v = createView(out);
+ const state = this.get();
+ for (let i = 0; i < this.outputLen / 4; ++i)
+ v.setUint32(i * 4, state[i]);
+ }
+ digest() {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+}
+// Constants
+const B64C = /* @__PURE__ */ Uint32Array.from([
+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
+ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
+ 0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
+ 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69,
+]);
+// first half of C512
+const B32C = B64C.slice(0, 16);
+const B256_IV = /* @__PURE__ */ SHA256_IV.slice();
+const B224_IV = /* @__PURE__ */ SHA224_IV.slice();
+const B384_IV = /* @__PURE__ */ SHA384_IV.slice();
+const B512_IV = /* @__PURE__ */ SHA512_IV.slice();
+function generateTBL256() {
+ const TBL = [];
+ for (let i = 0, j = 0; i < 14; i++, j += 16) {
+ for (let offset = 1; offset < 16; offset += 2) {
+ TBL.push(B32C[BSIGMA[j + offset]]);
+ TBL.push(B32C[BSIGMA[j + offset - 1]]);
+ }
+ }
+ return new Uint32Array(TBL);
+}
+const TBL256 = /* @__PURE__ */ generateTBL256(); // C256[SIGMA[X]] precompute
+// Reusable temporary buffer
+const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16);
+class BLAKE1_32B extends BLAKE1 {
+ v0;
+ v1;
+ v2;
+ v3;
+ v4;
+ v5;
+ v6;
+ v7;
+ constructor(outputLen, IV, lengthFlag, opts = {}) {
+ super(64, outputLen, lengthFlag, 8, 4, B32C, opts);
+ this.v0 = IV[0] | 0;
+ this.v1 = IV[1] | 0;
+ this.v2 = IV[2] | 0;
+ this.v3 = IV[3] | 0;
+ this.v4 = IV[4] | 0;
+ this.v5 = IV[5] | 0;
+ this.v6 = IV[6] | 0;
+ this.v7 = IV[7] | 0;
+ }
+ get() {
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
+ }
+ // prettier-ignore
+ set(v0, v1, v2, v3, v4, v5, v6, v7) {
+ this.v0 = v0 | 0;
+ this.v1 = v1 | 0;
+ this.v2 = v2 | 0;
+ this.v3 = v3 | 0;
+ this.v4 = v4 | 0;
+ this.v5 = v5 | 0;
+ this.v6 = v6 | 0;
+ this.v7 = v7 | 0;
+ }
+ destroy() {
+ super.destroy();
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ compress(view, offset, withLength = true) {
+ for (let i = 0; i < 16; i++, offset += 4)
+ BLAKE256_W[i] = view.getUint32(offset, false);
+ // NOTE: we cannot re-use compress from blake2s, since there is additional xor over u256[SIGMA[e]]
+ let v00 = this.v0 | 0;
+ let v01 = this.v1 | 0;
+ let v02 = this.v2 | 0;
+ let v03 = this.v3 | 0;
+ let v04 = this.v4 | 0;
+ let v05 = this.v5 | 0;
+ let v06 = this.v6 | 0;
+ let v07 = this.v7 | 0;
+ let v08 = this.constants[0] | 0;
+ let v09 = this.constants[1] | 0;
+ let v10 = this.constants[2] | 0;
+ let v11 = this.constants[3] | 0;
+ const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0));
+ let v12 = (this.constants[4] ^ l) >>> 0;
+ let v13 = (this.constants[5] ^ l) >>> 0;
+ let v14 = (this.constants[6] ^ h) >>> 0;
+ let v15 = (this.constants[7] ^ h) >>> 0;
+ // prettier-ignore
+ for (let i = 0, k = 0, j = 0; i < 14; i++) {
+ ({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ }
+ this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0;
+ this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0;
+ this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0;
+ this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0;
+ this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0;
+ this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0;
+ this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0;
+ this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0;
+ clean(BLAKE256_W);
+ }
+}
+const BBUF = /* @__PURE__ */ new Uint32Array(32);
+const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32);
+function generateTBL512() {
+ const TBL = [];
+ for (let r = 0, k = 0; r < 16; r++, k += 16) {
+ for (let offset = 1; offset < 16; offset += 2) {
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]);
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]);
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]);
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]);
+ }
+ }
+ return new Uint32Array(TBL);
+}
+const TBL512 = /* @__PURE__ */ generateTBL512(); // C512[SIGMA[X]] precompute
+// Mixing function G splitted in two halfs
+function G1b(a, b, c, d, msg, k) {
+ const Xpos = 2 * BSIGMA[k];
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0;
+ Al = (ll | 0) >>> 0;
+ // v[d] = rotr(v[d] ^ v[a], 32)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 25)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) });
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
+}
+function G2b(a, b, c, d, msg, k) {
+ const Xpos = 2 * BSIGMA[k];
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 16)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 11)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) });
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
+}
+class BLAKE1_64B extends BLAKE1 {
+ v0l;
+ v0h;
+ v1l;
+ v1h;
+ v2l;
+ v2h;
+ v3l;
+ v3h;
+ v4l;
+ v4h;
+ v5l;
+ v5h;
+ v6l;
+ v6h;
+ v7l;
+ v7h;
+ constructor(outputLen, IV, lengthFlag, opts = {}) {
+ super(128, outputLen, lengthFlag, 16, 8, B64C, opts);
+ this.v0l = IV[0] | 0;
+ this.v0h = IV[1] | 0;
+ this.v1l = IV[2] | 0;
+ this.v1h = IV[3] | 0;
+ this.v2l = IV[4] | 0;
+ this.v2h = IV[5] | 0;
+ this.v3l = IV[6] | 0;
+ this.v3h = IV[7] | 0;
+ this.v4l = IV[8] | 0;
+ this.v4h = IV[9] | 0;
+ this.v5l = IV[10] | 0;
+ this.v5h = IV[11] | 0;
+ this.v6l = IV[12] | 0;
+ this.v6h = IV[13] | 0;
+ this.v7l = IV[14] | 0;
+ this.v7h = IV[15] | 0;
+ }
+ // prettier-ignore
+ get() {
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
+ }
+ // prettier-ignore
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
+ this.v0l = v0l | 0;
+ this.v0h = v0h | 0;
+ this.v1l = v1l | 0;
+ this.v1h = v1h | 0;
+ this.v2l = v2l | 0;
+ this.v2h = v2h | 0;
+ this.v3l = v3l | 0;
+ this.v3h = v3h | 0;
+ this.v4l = v4l | 0;
+ this.v4h = v4h | 0;
+ this.v5l = v5l | 0;
+ this.v5h = v5h | 0;
+ this.v6l = v6l | 0;
+ this.v6h = v6h | 0;
+ this.v7l = v7l | 0;
+ this.v7h = v7h | 0;
+ }
+ destroy() {
+ super.destroy();
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ compress(view, offset, withLength = true) {
+ for (let i = 0; i < 32; i++, offset += 4)
+ BLAKE512_W[i] = view.getUint32(offset, false);
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
+ BBUF.set(this.constants.subarray(0, 16), 16);
+ if (withLength) {
+ const { h, l } = u64.fromBig(BigInt(this.length * 8));
+ BBUF[24] = (BBUF[24] ^ h) >>> 0;
+ BBUF[25] = (BBUF[25] ^ l) >>> 0;
+ BBUF[26] = (BBUF[26] ^ h) >>> 0;
+ BBUF[27] = (BBUF[27] ^ l) >>> 0;
+ }
+ for (let i = 0, k = 0; i < 16; i++) {
+ G1b(0, 4, 8, 12, BLAKE512_W, k++);
+ G2b(0, 4, 8, 12, BLAKE512_W, k++);
+ G1b(1, 5, 9, 13, BLAKE512_W, k++);
+ G2b(1, 5, 9, 13, BLAKE512_W, k++);
+ G1b(2, 6, 10, 14, BLAKE512_W, k++);
+ G2b(2, 6, 10, 14, BLAKE512_W, k++);
+ G1b(3, 7, 11, 15, BLAKE512_W, k++);
+ G2b(3, 7, 11, 15, BLAKE512_W, k++);
+ G1b(0, 5, 10, 15, BLAKE512_W, k++);
+ G2b(0, 5, 10, 15, BLAKE512_W, k++);
+ G1b(1, 6, 11, 12, BLAKE512_W, k++);
+ G2b(1, 6, 11, 12, BLAKE512_W, k++);
+ G1b(2, 7, 8, 13, BLAKE512_W, k++);
+ G2b(2, 7, 8, 13, BLAKE512_W, k++);
+ G1b(3, 4, 9, 14, BLAKE512_W, k++);
+ G2b(3, 4, 9, 14, BLAKE512_W, k++);
+ }
+ this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0];
+ this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1];
+ this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2];
+ this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3];
+ this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4];
+ this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5];
+ this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6];
+ this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7];
+ this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0];
+ this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1];
+ this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2];
+ this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3];
+ this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4];
+ this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5];
+ this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6];
+ this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7];
+ clean(BBUF, BLAKE512_W);
+ }
+}
+/** Internal blake1-224 hash class. */
+export class _BLAKE224 extends BLAKE1_32B {
+ constructor(opts = {}) {
+ super(28, B224_IV, 0b0000_0000, opts);
+ }
+}
+/** Internal blake1-256 hash class. */
+export class _BLAKE256 extends BLAKE1_32B {
+ constructor(opts = {}) {
+ super(32, B256_IV, 0b0000_0001, opts);
+ }
+}
+/** Internal blake1-384 hash class. */
+export class _BLAKE384 extends BLAKE1_64B {
+ constructor(opts = {}) {
+ super(48, B384_IV, 0b0000_0000, opts);
+ }
+}
+/** Internal blake1-512 hash class. */
+export class _BLAKE512 extends BLAKE1_64B {
+ constructor(opts = {}) {
+ super(64, B512_IV, 0b0000_0001, opts);
+ }
+}
+/** blake1-224 hash function */
+export const blake224 = /* @__PURE__ */ createHasher((opts) => new _BLAKE224(opts));
+/** blake1-256 hash function */
+export const blake256 = /* @__PURE__ */ createHasher((opts) => new _BLAKE256(opts));
+/** blake1-384 hash function */
+export const blake384 = /* @__PURE__ */ createHasher((opts) => new _BLAKE384(opts));
+/** blake1-512 hash function */
+export const blake512 = /* @__PURE__ */ createHasher((opts) => new _BLAKE512(opts));
+//# sourceMappingURL=blake1.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake1.js.map b/server/node_modules/@noble/hashes/blake1.js.map
new file mode 100644
index 0000000..a97bd58
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake1.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake1.js","sourceRoot":"","sources":["src/blake1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAA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IAAI,CAAC,CAC9B,CAAC;AACF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAgC,eAAe,CAAC,YAAY,CAC/E,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC;AACF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAgC,eAAe,CAAC,YAAY,CAC/E,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAC9B,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake2.d.ts b/server/node_modules/@noble/hashes/blake2.d.ts
new file mode 100644
index 0000000..8c79b2d
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake2.d.ts
@@ -0,0 +1,120 @@
+import { type CHash, type Hash } from './utils.ts';
+/** Blake hash options. dkLen is output length. key is used in MAC mode. salt is used in KDF mode. */
+export type Blake2Opts = {
+ dkLen?: number;
+ key?: Uint8Array;
+ salt?: Uint8Array;
+ personalization?: Uint8Array;
+};
+/** Internal base class for BLAKE2. */
+export declare abstract class _BLAKE2> implements Hash {
+ protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+ abstract destroy(): void;
+ protected buffer: Uint8Array;
+ protected buffer32: Uint32Array;
+ protected finished: boolean;
+ protected destroyed: boolean;
+ protected length: number;
+ protected pos: number;
+ readonly blockLen: number;
+ readonly outputLen: number;
+ constructor(blockLen: number, outputLen: number);
+ update(data: Uint8Array): this;
+ digestInto(out: Uint8Array): void;
+ digest(): Uint8Array;
+ _cloneInto(to?: T): T;
+ clone(): T;
+}
+/** Internal blake2b hash class. */
+export declare class _BLAKE2b extends _BLAKE2<_BLAKE2b> {
+ private v0l;
+ private v0h;
+ private v1l;
+ private v1h;
+ private v2l;
+ private v2h;
+ private v3l;
+ private v3h;
+ private v4l;
+ private v4h;
+ private v5l;
+ private v5h;
+ private v6l;
+ private v6h;
+ private v7l;
+ private v7h;
+ constructor(opts?: Blake2Opts);
+ protected get(): [
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number
+ ];
+ protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void;
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
+ destroy(): void;
+}
+/**
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export declare const blake2b: CHash<_BLAKE2b, Blake2Opts>;
+/** Internal type, 16 numbers. */
+export type Num16 = {
+ v0: number;
+ v1: number;
+ v2: number;
+ v3: number;
+ v4: number;
+ v5: number;
+ v6: number;
+ v7: number;
+ v8: number;
+ v9: number;
+ v10: number;
+ v11: number;
+ v12: number;
+ v13: number;
+ v14: number;
+ v15: number;
+};
+/** BLAKE2-compress core method. */
+export declare function compress(s: Uint8Array, offset: number, msg: Uint32Array, rounds: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number): Num16;
+/** Internal blake2s hash class. */
+export declare class _BLAKE2s extends _BLAKE2<_BLAKE2s> {
+ private v0;
+ private v1;
+ private v2;
+ private v3;
+ private v4;
+ private v5;
+ private v6;
+ private v7;
+ constructor(opts?: Blake2Opts);
+ protected get(): [number, number, number, number, number, number, number, number];
+ protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void;
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
+ destroy(): void;
+}
+/**
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export declare const blake2s: CHash<_BLAKE2s, Blake2Opts>;
+//# sourceMappingURL=blake2.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake2.d.ts.map b/server/node_modules/@noble/hashes/blake2.d.ts.map
new file mode 100644
index 0000000..63d03f2
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake2.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake2.d.ts","sourceRoot":"","sources":["src/blake2.ts"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,qGAAqG;AACrG,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B,CAAC;AA6EF,sCAAsC;AACtC,8BAAsB,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IACpF,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAC/C,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAChC,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,SAAS,UAAS;IAC5B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAK;IAC7B,SA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AQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAkB3E,OAAO,IAAI,IAAI;CAKhB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,CAE/C,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake2.js b/server/node_modules/@noble/hashes/blake2.js
new file mode 100644
index 0000000..792e689
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake2.js
@@ -0,0 +1,417 @@
+/**
+ * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
+ * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
+ * @module
+ */
+import { BSIGMA, G1s, G2s } from "./_blake.js";
+import { SHA256_IV } from "./_md.js";
+import * as u64 from "./_u64.js";
+// prettier-ignore
+import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, swap8IfBE, u32 } from "./utils.js";
+// Same as SHA512_IV, but swapped endianness: LE instead of BE. iv[1] is iv[0], etc.
+const B2B_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
+ 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
+]);
+// Temporary buffer
+const BBUF = /* @__PURE__ */ new Uint32Array(32);
+// Mixing function G splitted in two halfs
+function G1b(a, b, c, d, msg, x) {
+ // NOTE: V is LE here
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 32)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 24)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
+}
+function G2b(a, b, c, d, msg, x) {
+ // NOTE: V is LE here
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 16)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 63)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
+}
+function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
+ anumber(keyLen);
+ if (outputLen < 0 || outputLen > keyLen)
+ throw new Error('outputLen bigger than keyLen');
+ const { key, salt, personalization } = opts;
+ if (key !== undefined && (key.length < 1 || key.length > keyLen))
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
+ if (salt !== undefined)
+ abytes(salt, saltLen, 'salt');
+ if (personalization !== undefined)
+ abytes(personalization, persLen, 'personalization');
+}
+/** Internal base class for BLAKE2. */
+export class _BLAKE2 {
+ buffer;
+ buffer32;
+ finished = false;
+ destroyed = false;
+ length = 0;
+ pos = 0;
+ blockLen;
+ outputLen;
+ constructor(blockLen, outputLen) {
+ anumber(blockLen);
+ anumber(outputLen);
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.buffer = new Uint8Array(blockLen);
+ this.buffer32 = u32(this.buffer);
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ // Main difference with other hashes: there is flag for last block,
+ // so we cannot process current block before we know that there
+ // is the next one. This significantly complicates logic and reduces ability
+ // to do zero-copy processing
+ const { blockLen, buffer, buffer32 } = this;
+ const len = data.length;
+ const offset = data.byteOffset;
+ const buf = data.buffer;
+ for (let pos = 0; pos < len;) {
+ // If buffer is full and we still have input (don't process last block, same as blake2s)
+ if (this.pos === blockLen) {
+ swap32IfBE(buffer32);
+ this.compress(buffer32, 0, false);
+ swap32IfBE(buffer32);
+ this.pos = 0;
+ }
+ const take = Math.min(blockLen - this.pos, len - pos);
+ const dataOffset = offset + pos;
+ // full block && aligned to 4 bytes && not last in input
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
+ swap32IfBE(data32);
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
+ this.length += blockLen;
+ this.compress(data32, pos32, false);
+ }
+ swap32IfBE(data32);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ this.length += take;
+ pos += take;
+ }
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ aoutput(out, this);
+ const { pos, buffer32 } = this;
+ this.finished = true;
+ // Padding
+ clean(this.buffer.subarray(pos));
+ swap32IfBE(buffer32);
+ this.compress(buffer32, 0, true);
+ swap32IfBE(buffer32);
+ const out32 = u32(out);
+ this.get().forEach((v, i) => (out32[i] = swap8IfBE(v)));
+ }
+ digest() {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to) {
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
+ to ||= new this.constructor({ dkLen: outputLen });
+ to.set(...this.get());
+ to.buffer.set(buffer);
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ // @ts-ignore
+ to.outputLen = outputLen;
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+/** Internal blake2b hash class. */
+export class _BLAKE2b extends _BLAKE2 {
+ // Same as SHA-512, but LE
+ v0l = B2B_IV[0] | 0;
+ v0h = B2B_IV[1] | 0;
+ v1l = B2B_IV[2] | 0;
+ v1h = B2B_IV[3] | 0;
+ v2l = B2B_IV[4] | 0;
+ v2h = B2B_IV[5] | 0;
+ v3l = B2B_IV[6] | 0;
+ v3h = B2B_IV[7] | 0;
+ v4l = B2B_IV[8] | 0;
+ v4h = B2B_IV[9] | 0;
+ v5l = B2B_IV[10] | 0;
+ v5h = B2B_IV[11] | 0;
+ v6l = B2B_IV[12] | 0;
+ v6h = B2B_IV[13] | 0;
+ v7l = B2B_IV[14] | 0;
+ v7h = B2B_IV[15] | 0;
+ constructor(opts = {}) {
+ const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
+ super(128, olen);
+ checkBlake2Opts(olen, opts, 64, 16, 16);
+ let { key, personalization, salt } = opts;
+ let keyLength = 0;
+ if (key !== undefined) {
+ abytes(key, undefined, 'key');
+ keyLength = key.length;
+ }
+ this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
+ if (salt !== undefined) {
+ abytes(salt, undefined, 'salt');
+ const slt = u32(salt);
+ this.v4l ^= swap8IfBE(slt[0]);
+ this.v4h ^= swap8IfBE(slt[1]);
+ this.v5l ^= swap8IfBE(slt[2]);
+ this.v5h ^= swap8IfBE(slt[3]);
+ }
+ if (personalization !== undefined) {
+ abytes(personalization, undefined, 'personalization');
+ const pers = u32(personalization);
+ this.v6l ^= swap8IfBE(pers[0]);
+ this.v6h ^= swap8IfBE(pers[1]);
+ this.v7l ^= swap8IfBE(pers[2]);
+ this.v7h ^= swap8IfBE(pers[3]);
+ }
+ if (key !== undefined) {
+ // Pad to blockLen and update
+ const tmp = new Uint8Array(this.blockLen);
+ tmp.set(key);
+ this.update(tmp);
+ }
+ }
+ // prettier-ignore
+ get() {
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
+ }
+ // prettier-ignore
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
+ this.v0l = v0l | 0;
+ this.v0h = v0h | 0;
+ this.v1l = v1l | 0;
+ this.v1h = v1h | 0;
+ this.v2l = v2l | 0;
+ this.v2h = v2h | 0;
+ this.v3l = v3l | 0;
+ this.v3h = v3h | 0;
+ this.v4l = v4l | 0;
+ this.v4h = v4h | 0;
+ this.v5l = v5l | 0;
+ this.v5h = v5h | 0;
+ this.v6l = v6l | 0;
+ this.v6h = v6h | 0;
+ this.v7l = v7l | 0;
+ this.v7h = v7h | 0;
+ }
+ compress(msg, offset, isLast) {
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
+ BBUF.set(B2B_IV, 16); // Second half from IV.
+ let { h, l } = u64.fromBig(BigInt(this.length));
+ BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
+ BBUF[25] = B2B_IV[9] ^ h; // High word.
+ // Invert all bits for last block
+ if (isLast) {
+ BBUF[28] = ~BBUF[28];
+ BBUF[29] = ~BBUF[29];
+ }
+ let j = 0;
+ const s = BSIGMA;
+ for (let i = 0; i < 12; i++) {
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
+ }
+ this.v0l ^= BBUF[0] ^ BBUF[16];
+ this.v0h ^= BBUF[1] ^ BBUF[17];
+ this.v1l ^= BBUF[2] ^ BBUF[18];
+ this.v1h ^= BBUF[3] ^ BBUF[19];
+ this.v2l ^= BBUF[4] ^ BBUF[20];
+ this.v2h ^= BBUF[5] ^ BBUF[21];
+ this.v3l ^= BBUF[6] ^ BBUF[22];
+ this.v3h ^= BBUF[7] ^ BBUF[23];
+ this.v4l ^= BBUF[8] ^ BBUF[24];
+ this.v4h ^= BBUF[9] ^ BBUF[25];
+ this.v5l ^= BBUF[10] ^ BBUF[26];
+ this.v5h ^= BBUF[11] ^ BBUF[27];
+ this.v6l ^= BBUF[12] ^ BBUF[28];
+ this.v6h ^= BBUF[13] ^ BBUF[29];
+ this.v7l ^= BBUF[14] ^ BBUF[30];
+ this.v7h ^= BBUF[15] ^ BBUF[31];
+ clean(BBUF);
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.buffer32);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+/**
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
+/** BLAKE2-compress core method. */
+// prettier-ignore
+export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
+ let j = 0;
+ for (let i = 0; i < rounds; i++) {
+ ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
+ ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
+ ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
+ ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]]));
+ ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]]));
+ ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]]));
+ ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]]));
+ ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]]));
+ ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]]));
+ ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]]));
+ ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]]));
+ ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]]));
+ ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]]));
+ ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]]));
+ ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
+ ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
+ }
+ return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
+}
+const B2S_IV = /* @__PURE__ */ SHA256_IV.slice();
+/** Internal blake2s hash class. */
+export class _BLAKE2s extends _BLAKE2 {
+ // Internal state, same as SHA-256
+ v0 = B2S_IV[0] | 0;
+ v1 = B2S_IV[1] | 0;
+ v2 = B2S_IV[2] | 0;
+ v3 = B2S_IV[3] | 0;
+ v4 = B2S_IV[4] | 0;
+ v5 = B2S_IV[5] | 0;
+ v6 = B2S_IV[6] | 0;
+ v7 = B2S_IV[7] | 0;
+ constructor(opts = {}) {
+ const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
+ super(64, olen);
+ checkBlake2Opts(olen, opts, 32, 8, 8);
+ let { key, personalization, salt } = opts;
+ let keyLength = 0;
+ if (key !== undefined) {
+ abytes(key, undefined, 'key');
+ keyLength = key.length;
+ }
+ this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
+ if (salt !== undefined) {
+ abytes(salt, undefined, 'salt');
+ const slt = u32(salt);
+ this.v4 ^= swap8IfBE(slt[0]);
+ this.v5 ^= swap8IfBE(slt[1]);
+ }
+ if (personalization !== undefined) {
+ abytes(personalization, undefined, 'personalization');
+ const pers = u32(personalization);
+ this.v6 ^= swap8IfBE(pers[0]);
+ this.v7 ^= swap8IfBE(pers[1]);
+ }
+ if (key !== undefined) {
+ // Pad to blockLen and update
+ const tmp = new Uint8Array(this.blockLen);
+ tmp.set(key);
+ this.update(tmp);
+ }
+ }
+ get() {
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
+ }
+ // prettier-ignore
+ set(v0, v1, v2, v3, v4, v5, v6, v7) {
+ this.v0 = v0 | 0;
+ this.v1 = v1 | 0;
+ this.v2 = v2 | 0;
+ this.v3 = v3 | 0;
+ this.v4 = v4 | 0;
+ this.v5 = v5 | 0;
+ this.v6 = v6 | 0;
+ this.v7 = v7 | 0;
+ }
+ compress(msg, offset, isLast) {
+ const { h, l } = u64.fromBig(BigInt(this.length));
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(BSIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]);
+ this.v0 ^= v0 ^ v8;
+ this.v1 ^= v1 ^ v9;
+ this.v2 ^= v2 ^ v10;
+ this.v3 ^= v3 ^ v11;
+ this.v4 ^= v4 ^ v12;
+ this.v5 ^= v5 ^ v13;
+ this.v6 ^= v6 ^ v14;
+ this.v7 ^= v7 ^ v15;
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.buffer32);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+/**
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export const blake2s = /* @__PURE__ */ createHasher((opts) => new _BLAKE2s(opts));
+//# sourceMappingURL=blake2.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake2.js.map b/server/node_modules/@noble/hashes/blake2.js.map
new file mode 100644
index 0000000..a1ed307
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake2.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake2.js","sourceRoot":"","sources":["src/blake2.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,kBAAkB;AAClB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACjC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,SAAS,EACrB,GAAG,EAGJ,MAAM,YAAY,CAAC;AAUpB,oFAAoF;AACpF,MAAM,MAAM,GAAG,eAAe,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AAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAgC,eAAe,CAAC,YAAY,CAC9E,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAC7B,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake3.d.ts b/server/node_modules/@noble/hashes/blake3.d.ts
new file mode 100644
index 0000000..0607da7
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake3.d.ts
@@ -0,0 +1,54 @@
+import { _BLAKE2 } from './blake2.ts';
+import { type CHashXOF, type HashXOF } from './utils.ts';
+/**
+ * Ensure to use EITHER `key` OR `context`, not both.
+ *
+ * * `key`: 32-byte MAC key.
+ * * `context`: string for KDF. must be hardcoded, globally unique, and application - specific.
+ * A good default format for the context string is "[application] [commit timestamp] [purpose]".
+ */
+export type Blake3Opts = {
+ dkLen?: number;
+ key?: Uint8Array;
+ context?: Uint8Array;
+};
+/** Blake3 hash. Can be used as MAC and KDF. */
+export declare class _BLAKE3 extends _BLAKE2<_BLAKE3> implements HashXOF<_BLAKE3> {
+ private chunkPos;
+ private chunksDone;
+ private flags;
+ private IV;
+ private state;
+ private stack;
+ private posOut;
+ private bufferOut32;
+ private bufferOut;
+ private chunkOut;
+ private enableXOF;
+ constructor(opts?: Blake3Opts, flags?: number);
+ protected get(): [];
+ protected set(): void;
+ private b2Compress;
+ protected compress(buf: Uint32Array, bufPos?: number, isLast?: boolean): void;
+ _cloneInto(to?: _BLAKE3): _BLAKE3;
+ destroy(): void;
+ private b2CompressOut;
+ protected finish(): void;
+ private writeInto;
+ xofInto(out: Uint8Array): Uint8Array;
+ xof(bytes: number): Uint8Array;
+ digestInto(out: Uint8Array): Uint8Array;
+ digest(): Uint8Array;
+}
+/**
+ * BLAKE3 hash function. Can be used as MAC and KDF.
+ * @param msg - message that would be hashed
+ * @param opts - `dkLen` for output length, `key` for MAC mode, `context` for KDF mode
+ * @example
+ * const data = new Uint8Array(32);
+ * const hash = blake3(data);
+ * const mac = blake3(data, { key: new Uint8Array(32) });
+ * const kdf = blake3(data, { context: 'application name' });
+ */
+export declare const blake3: CHashXOF<_BLAKE3, Blake3Opts>;
+//# sourceMappingURL=blake3.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake3.d.ts.map b/server/node_modules/@noble/hashes/blake3.d.ts.map
new file mode 100644
index 0000000..2bf8358
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake3.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake3.d.ts","sourceRoot":"","sources":["src/blake3.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AAEhD,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,OAAO,EACb,MAAM,YAAY,CAAC;AAwBpB;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpF,+CAA+C;AAC/C,qBAAa,OAAQ,SAAQ,OAAO,CAAC,OAAO,CAAE,YAAW,OAAO,CAAC,OAAO,CAAC;IACvE,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAqB;IAElC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,SAAS,CAAQ;gBAEb,IAAI,GAAE,UAAe,EAAE,KAAK,SAAI;IA4B5C,SAAS,CAAC,GAAG,IAAI,EAAE;IAGnB,SAAS,CAAC,GAAG,IAAI,IAAI;IACrB,OAAO,CAAC,UAAU;IAmBlB,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAAE,MAAU,EAAE,MAAM,GAAE,OAAe,GAAG,IAAI;IAiCvF,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO;IAejC,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,aAAa;IA+BrB,SAAS,CAAC,MAAM,IAAI,IAAI;IAoBxB,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU;IAIpC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAI9B,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU;IAQvC,MAAM,IAAI,UAAU;CAGrB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAEhD,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake3.js b/server/node_modules/@noble/hashes/blake3.js
new file mode 100644
index 0000000..59e0aa1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake3.js
@@ -0,0 +1,255 @@
+/**
+ * Blake3 fast hash is Blake2 with reduced security (round count). Can also be used as MAC & KDF.
+ *
+ * It is advertised as "the fastest cryptographic hash". However, it isn't true in JS.
+ * Why is this so slow? While it must be 6x faster than blake2b, perf diff is only 20%:
+ *
+ * * There is only 30% reduction in number of rounds from blake2s
+ * * Speed-up comes from tree structure, which is parallelized using SIMD & threading.
+ * These features are not present in JS, so we only get overhead from trees.
+ * * Parallelization only happens on 1024-byte chunks: there is no benefit for small inputs.
+ * * It is still possible to make it faster using: a) loop unrolling b) web workers c) wasm
+ * @module
+ */
+import { SHA256_IV } from "./_md.js";
+import { fromBig } from "./_u64.js";
+import { _BLAKE2, compress } from "./blake2.js";
+// prettier-ignore
+import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, u32, u8 } from "./utils.js";
+// Flag bitset
+const B3_Flags = {
+ CHUNK_START: 0b1,
+ CHUNK_END: 0b10,
+ PARENT: 0b100,
+ ROOT: 0b1000,
+ KEYED_HASH: 0b10000,
+ DERIVE_KEY_CONTEXT: 0b100000,
+ DERIVE_KEY_MATERIAL: 0b1000000,
+};
+const B3_IV = /* @__PURE__ */ SHA256_IV.slice();
+const B3_SIGMA = /* @__PURE__ */ (() => {
+ const Id = Array.from({ length: 16 }, (_, i) => i);
+ const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]);
+ const res = [];
+ for (let i = 0, v = Id; i < 7; i++, v = permute(v))
+ res.push(...v);
+ return Uint8Array.from(res);
+})();
+/** Blake3 hash. Can be used as MAC and KDF. */
+export class _BLAKE3 extends _BLAKE2 {
+ chunkPos = 0; // Position of current block in chunk
+ chunksDone = 0; // How many chunks we already have
+ flags = 0 | 0;
+ IV;
+ state;
+ stack = [];
+ // Output
+ posOut = 0;
+ bufferOut32 = new Uint32Array(16);
+ bufferOut;
+ chunkOut = 0; // index of output chunk
+ enableXOF = true;
+ constructor(opts = {}, flags = 0) {
+ super(64, opts.dkLen === undefined ? 32 : opts.dkLen);
+ const { key, context } = opts;
+ const hasContext = context !== undefined;
+ if (key !== undefined) {
+ if (hasContext)
+ throw new Error('Only "key" or "context" can be specified at same time');
+ abytes(key, 32, 'key');
+ const k = key.slice();
+ this.IV = u32(k);
+ swap32IfBE(this.IV);
+ this.flags = flags | B3_Flags.KEYED_HASH;
+ }
+ else if (hasContext) {
+ abytes(context, undefined, 'context');
+ const ctx = context;
+ const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT)
+ .update(ctx)
+ .digest();
+ this.IV = u32(contextKey);
+ swap32IfBE(this.IV);
+ this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL;
+ }
+ else {
+ this.IV = B3_IV.slice();
+ this.flags = flags;
+ }
+ this.state = this.IV.slice();
+ this.bufferOut = u8(this.bufferOut32);
+ }
+ // Unused
+ get() {
+ return [];
+ }
+ set() { }
+ b2Compress(counter, flags, buf, bufPos = 0) {
+ const { state: s, pos } = this;
+ const { h, l } = fromBig(BigInt(counter), true);
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], h, l, pos, flags);
+ s[0] = v0 ^ v8;
+ s[1] = v1 ^ v9;
+ s[2] = v2 ^ v10;
+ s[3] = v3 ^ v11;
+ s[4] = v4 ^ v12;
+ s[5] = v5 ^ v13;
+ s[6] = v6 ^ v14;
+ s[7] = v7 ^ v15;
+ }
+ compress(buf, bufPos = 0, isLast = false) {
+ // Compress last block
+ let flags = this.flags;
+ if (!this.chunkPos)
+ flags |= B3_Flags.CHUNK_START;
+ if (this.chunkPos === 15 || isLast)
+ flags |= B3_Flags.CHUNK_END;
+ if (!isLast)
+ this.pos = this.blockLen;
+ this.b2Compress(this.chunksDone, flags, buf, bufPos);
+ this.chunkPos += 1;
+ // If current block is last in chunk (16 blocks), then compress chunks
+ if (this.chunkPos === 16 || isLast) {
+ let chunk = this.state;
+ this.state = this.IV.slice();
+ // If not the last one, compress only when there are trailing zeros in chunk counter
+ // chunks used as binary tree where current stack is path. Zero means current leaf is finished and can be compressed.
+ // 1 (001) - leaf not finished (just push current chunk to stack)
+ // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back)
+ // 3 (011) - last leaf not finished
+ // 4 (100) - leafs finished at depth=1 and depth=2
+ for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) {
+ if (!(last = this.stack.pop()))
+ break;
+ this.buffer32.set(last, 0);
+ this.buffer32.set(chunk, 8);
+ this.pos = this.blockLen;
+ this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0);
+ chunk = this.state;
+ this.state = this.IV.slice();
+ }
+ this.chunksDone++;
+ this.chunkPos = 0;
+ this.stack.push(chunk);
+ }
+ this.pos = 0;
+ }
+ _cloneInto(to) {
+ to = super._cloneInto(to);
+ const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this;
+ to.state.set(state.slice());
+ to.stack = stack.map((i) => Uint32Array.from(i));
+ to.IV.set(IV);
+ to.flags = flags;
+ to.chunkPos = chunkPos;
+ to.chunksDone = chunksDone;
+ to.posOut = posOut;
+ to.chunkOut = chunkOut;
+ to.enableXOF = this.enableXOF;
+ to.bufferOut32.set(this.bufferOut32);
+ return to;
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.state, this.buffer32, this.IV, this.bufferOut32);
+ clean(...this.stack);
+ }
+ // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8)
+ b2CompressOut() {
+ const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this;
+ const { h, l } = fromBig(BigInt(this.chunkOut++));
+ swap32IfBE(buffer32);
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], l, h, pos, flags);
+ out32[0] = v0 ^ v8;
+ out32[1] = v1 ^ v9;
+ out32[2] = v2 ^ v10;
+ out32[3] = v3 ^ v11;
+ out32[4] = v4 ^ v12;
+ out32[5] = v5 ^ v13;
+ out32[6] = v6 ^ v14;
+ out32[7] = v7 ^ v15;
+ out32[8] = s[0] ^ v8;
+ out32[9] = s[1] ^ v9;
+ out32[10] = s[2] ^ v10;
+ out32[11] = s[3] ^ v11;
+ out32[12] = s[4] ^ v12;
+ out32[13] = s[5] ^ v13;
+ out32[14] = s[6] ^ v14;
+ out32[15] = s[7] ^ v15;
+ swap32IfBE(buffer32);
+ swap32IfBE(out32);
+ this.posOut = 0;
+ }
+ finish() {
+ if (this.finished)
+ return;
+ this.finished = true;
+ // Padding
+ clean(this.buffer.subarray(this.pos));
+ // Process last chunk
+ let flags = this.flags | B3_Flags.ROOT;
+ if (this.stack.length) {
+ flags |= B3_Flags.PARENT;
+ swap32IfBE(this.buffer32);
+ this.compress(this.buffer32, 0, true);
+ swap32IfBE(this.buffer32);
+ this.chunksDone = 0;
+ this.pos = this.blockLen;
+ }
+ else {
+ flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END;
+ }
+ this.flags = flags;
+ this.b2CompressOut();
+ }
+ writeInto(out) {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const { blockLen, bufferOut } = this;
+ for (let pos = 0, len = out.length; pos < len;) {
+ if (this.posOut >= blockLen)
+ this.b2CompressOut();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out) {
+ if (!this.enableXOF)
+ throw new Error('XOF is not possible after digest call');
+ return this.writeInto(out);
+ }
+ xof(bytes) {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out) {
+ aoutput(out, this);
+ if (this.finished)
+ throw new Error('digest() was already called');
+ this.enableXOF = false;
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest() {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+}
+/**
+ * BLAKE3 hash function. Can be used as MAC and KDF.
+ * @param msg - message that would be hashed
+ * @param opts - `dkLen` for output length, `key` for MAC mode, `context` for KDF mode
+ * @example
+ * const data = new Uint8Array(32);
+ * const hash = blake3(data);
+ * const mac = blake3(data, { key: new Uint8Array(32) });
+ * const kdf = blake3(data, { context: 'application name' });
+ */
+export const blake3 = /* @__PURE__ */ createHasher((opts = {}) => new _BLAKE3(opts));
+//# sourceMappingURL=blake3.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/blake3.js.map b/server/node_modules/@noble/hashes/blake3.js.map
new file mode 100644
index 0000000..abba8c0
--- /dev/null
+++ b/server/node_modules/@noble/hashes/blake3.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"blake3.js","sourceRoot":"","sources":["src/blake3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChD,kBAAkB;AAClB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACjC,KAAK,EAAE,YAAY,EAAE,UAAU,EAC/B,GAAG,EAAE,EAAE,EAGR,MAAM,YAAY,CAAC;AAEpB,cAAc;AACd,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,OAAO;IACnB,kBAAkB,EAAE,QAAQ;IAC5B,mBAAmB,EAAE,SAAS;CACtB,CAAC;AAEX,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;AAEhD,MAAM,QAAQ,GAAe,eAAe,CAAC,CAAC,GAAG,EAAE;IACjD,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,C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AAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,GAAG,CAAC,KAAa;QACf,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,UAAU,CAAC,GAAe;QACxB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkC,eAAe,CAAC,YAAY,CAC/E,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CACjC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/eskdf.d.ts b/server/node_modules/@noble/hashes/eskdf.d.ts
new file mode 100644
index 0000000..35ab42c
--- /dev/null
+++ b/server/node_modules/@noble/hashes/eskdf.d.ts
@@ -0,0 +1,50 @@
+/** Scrypt KDF */
+export declare function scrypt(password: string, salt: string): Uint8Array;
+/** PBKDF2-HMAC-SHA256 */
+export declare function pbkdf2(password: string, salt: string): Uint8Array;
+/**
+ * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead.
+ */
+export declare function deriveMainSeed(username: string, password: string): Uint8Array;
+type AccountID = number | string;
+type OptsLength = {
+ keyLength: number;
+};
+type OptsMod = {
+ modulus: bigint;
+};
+type KeyOpts = undefined | OptsLength | OptsMod;
+/** Not using classes because constructor cannot be async */
+export interface ESKDF {
+ /**
+ * Derives a child key. Child key will not be associated with any
+ * other child key because of properties of underlying KDF.
+ *
+ * @param protocol - 3-15 character protocol name
+ * @param accountId - numeric identifier of account
+ * @param options - `keyLength: 64` or `modulus: 41920438n`
+ * @example deriveChildKey('aes', 0)
+ */
+ deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => Uint8Array;
+ /**
+ * Deletes the main seed from eskdf instance
+ */
+ expire: () => void;
+ /**
+ * Account fingerprint
+ */
+ fingerprint: string;
+}
+/**
+ * ESKDF
+ * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
+ * @param password - password, min: 8 characters, should have enough entropy
+ * @example
+ * const kdf = await eskdf('example-university', 'beginning-new-example');
+ * const key = kdf.deriveChildKey('aes', 0);
+ * console.log(kdf.fingerprint);
+ * kdf.expire();
+ */
+export declare function eskdf(username: string, password: string): Promise;
+export {};
+//# sourceMappingURL=eskdf.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/eskdf.d.ts.map b/server/node_modules/@noble/hashes/eskdf.d.ts.map
new file mode 100644
index 0000000..cb9bd4e
--- /dev/null
+++ b/server/node_modules/@noble/hashes/eskdf.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"eskdf.d.ts","sourceRoot":"","sources":["src/eskdf.ts"],"names":[],"mappings":"AAiBA,iBAAiB;AACjB,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAEjE;AAED,yBAAyB;AACzB,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAEjE;AAiBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAY7E;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAgCjC,KAAK,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,KAAK,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACnC,KAAK,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAuChD,4DAA4D;AAC5D,MAAM,WAAW,KAAK;IACpB;;;;;;;;OAQG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,UAAU,CAAC;IAC1F;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAuB9E"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/eskdf.js b/server/node_modules/@noble/hashes/eskdf.js
new file mode 100644
index 0000000..3d417c1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/eskdf.js
@@ -0,0 +1,161 @@
+/**
+ * Experimental KDF for AES.
+ * @module
+ */
+import { hkdf } from "./hkdf.js";
+import { pbkdf2 as _pbkdf2 } from "./pbkdf2.js";
+import { scrypt as _scrypt } from "./scrypt.js";
+import { sha256 } from "./sha2.js";
+import { abytes, bytesToHex, clean, createView, hexToBytes, kdfInputToBytes } from "./utils.js";
+// A tiny KDF for various applications like AES key-gen.
+// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure".
+// Which is good enough: assume sha2-256 retained preimage resistance.
+const SCRYPT_FACTOR = 2 ** 19;
+const PBKDF2_FACTOR = 2 ** 17;
+/** Scrypt KDF */
+export function scrypt(password, salt) {
+ return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 });
+}
+/** PBKDF2-HMAC-SHA256 */
+export function pbkdf2(password, salt) {
+ return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 });
+}
+// Combines two 32-byte byte arrays
+function xor32(a, b) {
+ abytes(a, 32);
+ abytes(b, 32);
+ const arr = new Uint8Array(32);
+ for (let i = 0; i < 32; i++) {
+ arr[i] = a[i] ^ b[i];
+ }
+ return arr;
+}
+function strHasLength(str, min, max) {
+ return typeof str === 'string' && str.length >= min && str.length <= max;
+}
+/**
+ * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead.
+ */
+export function deriveMainSeed(username, password) {
+ if (!strHasLength(username, 8, 255))
+ throw new Error('invalid username');
+ if (!strHasLength(password, 8, 255))
+ throw new Error('invalid password');
+ // Declared like this to throw off minifiers which auto-convert .fromCharCode(1) to actual string.
+ // String with non-ascii may be problematic in some envs
+ const codes = { _1: 1, _2: 2 };
+ const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) };
+ const scr = scrypt(password + sep.s, username + sep.s);
+ const pbk = pbkdf2(password + sep.p, username + sep.p);
+ const res = xor32(scr, pbk);
+ clean(scr, pbk);
+ return res;
+}
+/**
+ * Converts protocol & accountId pair to HKDF salt & info params.
+ */
+function getSaltInfo(protocol, accountId = 0) {
+ // Note that length here also repeats two lines below
+ // We do an additional length check here to reduce the scope of DoS attacks
+ if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) {
+ throw new Error('invalid protocol');
+ }
+ // Allow string account ids for some protocols
+ const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol);
+ let salt; // Extract salt. Default is undefined.
+ if (typeof accountId === 'string') {
+ if (!allowsStr)
+ throw new Error('accountId must be a number');
+ if (!strHasLength(accountId, 1, 255))
+ throw new Error('accountId must be string of length 1..255');
+ salt = kdfInputToBytes(accountId);
+ }
+ else if (Number.isSafeInteger(accountId)) {
+ if (accountId < 0 || accountId > Math.pow(2, 32) - 1)
+ throw new Error('invalid accountId');
+ // Convert to Big Endian Uint32
+ salt = new Uint8Array(4);
+ createView(salt).setUint32(0, accountId, false);
+ }
+ else {
+ throw new Error('accountId must be a number' + (allowsStr ? ' or string' : ''));
+ }
+ const info = kdfInputToBytes(protocol);
+ return { salt, info };
+}
+function countBytes(num) {
+ if (typeof num !== 'bigint' || num <= BigInt(128))
+ throw new Error('invalid number');
+ return Math.ceil(num.toString(2).length / 8);
+}
+/**
+ * Parses keyLength and modulus options to extract length of result key.
+ * If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias.
+ */
+function getKeyLength(options) {
+ if (!options || typeof options !== 'object')
+ return 32;
+ const hasLen = 'keyLength' in options;
+ const hasMod = 'modulus' in options;
+ if (hasLen && hasMod)
+ throw new Error('cannot combine keyLength and modulus options');
+ if (!hasLen && !hasMod)
+ throw new Error('must have either keyLength or modulus option');
+ // FIPS 186 B.4.1 requires at least 64 more bits
+ const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength;
+ if (!(typeof l === 'number' && l >= 16 && l <= 8192))
+ throw new Error('invalid keyLength');
+ return l;
+}
+/**
+ * Converts key to bigint and divides it by modulus. Big Endian.
+ * Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output.
+ */
+function modReduceKey(key, modulus) {
+ const _1 = BigInt(1);
+ const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber()
+ const res = (num % (modulus - _1)) + _1; // Remove 0 from output
+ if (res < _1)
+ throw new Error('expected positive number'); // Guard against bad values
+ const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes
+ const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex()
+ const bytes = hexToBytes(hex);
+ if (bytes.length !== len)
+ throw new Error('invalid length of result key');
+ return bytes;
+}
+/**
+ * ESKDF
+ * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
+ * @param password - password, min: 8 characters, should have enough entropy
+ * @example
+ * const kdf = await eskdf('example-university', 'beginning-new-example');
+ * const key = kdf.deriveChildKey('aes', 0);
+ * console.log(kdf.fingerprint);
+ * kdf.expire();
+ */
+export async function eskdf(username, password) {
+ // We are using closure + object instead of class because
+ // we want to make `seed` non-accessible for any external function.
+ let seed = deriveMainSeed(username, password);
+ function deriveCK(protocol, accountId = 0, options) {
+ abytes(seed, 32);
+ const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId
+ const keyLength = getKeyLength(options); // validate options
+ const key = hkdf(sha256, seed, salt, info, keyLength);
+ // Modulus has already been validated
+ return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key;
+ }
+ function expire() {
+ if (seed)
+ seed.fill(1);
+ seed = undefined;
+ }
+ // prettier-ignore
+ const fingerprint = Array.from(deriveCK('fingerprint', 0))
+ .slice(0, 6)
+ .map((char) => char.toString(16).padStart(2, '0').toUpperCase())
+ .join(':');
+ return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint });
+}
+//# sourceMappingURL=eskdf.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/eskdf.js.map b/server/node_modules/@noble/hashes/eskdf.js.map
new file mode 100644
index 0000000..1e00dce
--- /dev/null
+++ b/server/node_modules/@noble/hashes/eskdf.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"eskdf.js","sourceRoot":"","sources":["src/eskdf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhG,wDAAwD;AACxD,gFAAgF;AAChF,sEAAsE;AAEtE,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC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BAAkB;IAClB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SACvD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/D,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hkdf.d.ts b/server/node_modules/@noble/hashes/hkdf.d.ts
new file mode 100644
index 0000000..494f987
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hkdf.d.ts
@@ -0,0 +1,36 @@
+import { type CHash } from './utils.ts';
+/**
+ * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK`
+ * Arguments position differs from spec (IKM is first one, since it is not optional)
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ */
+export declare function extract(hash: CHash, ikm: Uint8Array, salt?: Uint8Array): Uint8Array;
+/**
+ * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ */
+export declare function expand(hash: CHash, prk: Uint8Array, info?: Uint8Array, length?: number): Uint8Array;
+/**
+ * HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * import { hkdf } from '@noble/hashes/hkdf';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * import { randomBytes } from '@noble/hashes/utils';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1 = hkdf(sha256, inputKey, salt, info, 32);
+ */
+export declare const hkdf: (hash: CHash, ikm: Uint8Array, salt: Uint8Array | undefined, info: Uint8Array | undefined, length: number) => Uint8Array;
+//# sourceMappingURL=hkdf.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hkdf.d.ts.map b/server/node_modules/@noble/hashes/hkdf.d.ts.map
new file mode 100644
index 0000000..9887669
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hkdf.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["src/hkdf.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAOnF;AAKD;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,KAAK,EACX,GAAG,EAAE,UAAU,EACf,IAAI,CAAC,EAAE,UAAU,EACjB,MAAM,GAAE,MAAW,GAClB,UAAU,CA6BZ;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,GACf,MAAM,KAAK,EACX,KAAK,UAAU,EACf,MAAM,UAAU,GAAG,SAAS,EAC5B,MAAM,UAAU,GAAG,SAAS,EAC5B,QAAQ,MAAM,KACb,UAAkE,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hkdf.js b/server/node_modules/@noble/hashes/hkdf.js
new file mode 100644
index 0000000..e418526
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hkdf.js
@@ -0,0 +1,84 @@
+/**
+ * HKDF (RFC 5869): extract + expand in one step.
+ * See https://soatok.blog/2021/11/17/understanding-hkdf/.
+ * @module
+ */
+import { hmac } from "./hmac.js";
+import { abytes, ahash, anumber, clean } from "./utils.js";
+/**
+ * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK`
+ * Arguments position differs from spec (IKM is first one, since it is not optional)
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ */
+export function extract(hash, ikm, salt) {
+ ahash(hash);
+ // NOTE: some libraries treat zero-length array as 'not provided';
+ // we don't, since we have undefined as 'not provided'
+ // https://github.com/RustCrypto/KDFs/issues/15
+ if (salt === undefined)
+ salt = new Uint8Array(hash.outputLen);
+ return hmac(hash, salt, ikm);
+}
+const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
+const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
+/**
+ * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ */
+export function expand(hash, prk, info, length = 32) {
+ ahash(hash);
+ anumber(length, 'length');
+ const olen = hash.outputLen;
+ if (length > 255 * olen)
+ throw new Error('Length must be <= 255*HashLen');
+ const blocks = Math.ceil(length / olen);
+ if (info === undefined)
+ info = EMPTY_BUFFER;
+ else
+ abytes(info, undefined, 'info');
+ // first L(ength) octets of T
+ const okm = new Uint8Array(blocks * olen);
+ // Re-use HMAC instance between blocks
+ const HMAC = hmac.create(hash, prk);
+ const HMACTmp = HMAC._cloneInto();
+ const T = new Uint8Array(HMAC.outputLen);
+ for (let counter = 0; counter < blocks; counter++) {
+ HKDF_COUNTER[0] = counter + 1;
+ // T(0) = empty string (zero length)
+ // T(N) = HMAC-Hash(PRK, T(N-1) | info | N)
+ HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T)
+ .update(info)
+ .update(HKDF_COUNTER)
+ .digestInto(T);
+ okm.set(T, olen * counter);
+ HMAC._cloneInto(HMACTmp);
+ }
+ HMAC.destroy();
+ HMACTmp.destroy();
+ clean(T, HKDF_COUNTER);
+ return okm.slice(0, length);
+}
+/**
+ * HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * import { hkdf } from '@noble/hashes/hkdf';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * import { randomBytes } from '@noble/hashes/utils';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1 = hkdf(sha256, inputKey, salt, info, 32);
+ */
+export const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);
+//# sourceMappingURL=hkdf.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hkdf.js.map b/server/node_modules/@noble/hashes/hkdf.js.map
new file mode 100644
index 0000000..00bc982
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hkdf.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"hkdf.js","sourceRoot":"","sources":["src/hkdf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,IAAW,EAAE,GAAe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AAS,CAAC,CAAC;IACzC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;QAClD,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;QAC9B,oCAAoC;QACpC,2CAA2C;QAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C,MAAM,CAAC,IAAI,CAAC;aACZ,MAAM,CAAC,YAAY,CAAC;aACpB,UAAU,CAAC,CAAC,CAAC,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAW,EACX,GAAe,EACf,IAA4B,EAC5B,IAA4B,EAC5B,MAAc,EACF,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hmac.d.ts b/server/node_modules/@noble/hashes/hmac.d.ts
new file mode 100644
index 0000000..96c921b
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hmac.d.ts
@@ -0,0 +1,36 @@
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @module
+ */
+import { type CHash, type Hash } from './utils.ts';
+/** Internal class for HMAC. */
+export declare class _HMAC> implements Hash<_HMAC> {
+ oHash: T;
+ iHash: T;
+ blockLen: number;
+ outputLen: number;
+ private finished;
+ private destroyed;
+ constructor(hash: CHash, key: Uint8Array);
+ update(buf: Uint8Array): this;
+ digestInto(out: Uint8Array): void;
+ digest(): Uint8Array;
+ _cloneInto(to?: _HMAC): _HMAC;
+ clone(): _HMAC;
+ destroy(): void;
+}
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256
+ * @param key - message key
+ * @param message - message data
+ * @example
+ * import { hmac } from '@noble/hashes/hmac';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * const mac1 = hmac(sha256, 'key', 'message');
+ */
+export declare const hmac: {
+ (hash: CHash, key: Uint8Array, message: Uint8Array): Uint8Array;
+ create(hash: CHash, key: Uint8Array): _HMAC;
+};
+//# sourceMappingURL=hmac.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hmac.d.ts.map b/server/node_modules/@noble/hashes/hmac.d.ts.map
new file mode 100644
index 0000000..24bf509
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hmac.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["src/hmac.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAiC,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAElF,+BAA+B;AAC/B,qBAAa,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU;IAqBxC,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAK7B,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IASjC,MAAM,IAAI,UAAU;IAKpB,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAanC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IAGjB,OAAO,IAAI,IAAI;CAKhB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,EAAE;IACjB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC;IAChE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;CAEC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hmac.js b/server/node_modules/@noble/hashes/hmac.js
new file mode 100644
index 0000000..1d9ff79
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hmac.js
@@ -0,0 +1,90 @@
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @module
+ */
+import { abytes, aexists, ahash, clean } from "./utils.js";
+/** Internal class for HMAC. */
+export class _HMAC {
+ oHash;
+ iHash;
+ blockLen;
+ outputLen;
+ finished = false;
+ destroyed = false;
+ constructor(hash, key) {
+ ahash(hash);
+ abytes(key, undefined, 'key');
+ this.iHash = hash.create();
+ if (typeof this.iHash.update !== 'function')
+ throw new Error('Expected instance of class which extends utils.Hash');
+ this.blockLen = this.iHash.blockLen;
+ this.outputLen = this.iHash.outputLen;
+ const blockLen = this.blockLen;
+ const pad = new Uint8Array(blockLen);
+ // blockLen can be bigger than outputLen
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
+ for (let i = 0; i < pad.length; i++)
+ pad[i] ^= 0x36;
+ this.iHash.update(pad);
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
+ this.oHash = hash.create();
+ // Undo internal XOR && apply outer XOR
+ for (let i = 0; i < pad.length; i++)
+ pad[i] ^= 0x36 ^ 0x5c;
+ this.oHash.update(pad);
+ clean(pad);
+ }
+ update(buf) {
+ aexists(this);
+ this.iHash.update(buf);
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ abytes(out, this.outputLen, 'output');
+ this.finished = true;
+ this.iHash.digestInto(out);
+ this.oHash.update(out);
+ this.oHash.digestInto(out);
+ this.destroy();
+ }
+ digest() {
+ const out = new Uint8Array(this.oHash.outputLen);
+ this.digestInto(out);
+ return out;
+ }
+ _cloneInto(to) {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ to ||= Object.create(Object.getPrototypeOf(this), {});
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
+ to = to;
+ to.finished = finished;
+ to.destroyed = destroyed;
+ to.blockLen = blockLen;
+ to.outputLen = outputLen;
+ to.oHash = oHash._cloneInto(to.oHash);
+ to.iHash = iHash._cloneInto(to.iHash);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ destroy() {
+ this.destroyed = true;
+ this.oHash.destroy();
+ this.iHash.destroy();
+ }
+}
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256
+ * @param key - message key
+ * @param message - message data
+ * @example
+ * import { hmac } from '@noble/hashes/hmac';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * const mac1 = hmac(sha256, 'key', 'message');
+ */
+export const hmac = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
+hmac.create = (hash, key) => new _HMAC(hash, key);
+//# sourceMappingURL=hmac.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/hmac.js.map b/server/node_modules/@noble/hashes/hmac.js.map
new file mode 100644
index 0000000..5e2b11e
--- /dev/null
+++ b/server/node_modules/@noble/hashes/hmac.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"hmac.js","sourceRoot":"","sources":["src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C;QACtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QACxE,EAAE,GAAG,EAAU,CAAC;QAChB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;QACzB,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,IAAI,GAGb,CAAC,IAAW,EAAE,GAAe,EAAE,OAAmB,EAAc,EAAE,CACpE,IAAI,KAAK,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACrD,IAAI,CAAC,MAAM,GAAG,CAAC,IAAW,EAAE,GAAe,EAAE,EAAE,CAAC,IAAI,KAAK,CAAM,IAAI,EAAE,GAAG,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/index.d.ts b/server/node_modules/@noble/hashes/index.d.ts
new file mode 100644
index 0000000..e26a57a
--- /dev/null
+++ b/server/node_modules/@noble/hashes/index.d.ts
@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/index.d.ts.map b/server/node_modules/@noble/hashes/index.d.ts.map
new file mode 100644
index 0000000..4e8c581
--- /dev/null
+++ b/server/node_modules/@noble/hashes/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/index.js b/server/node_modules/@noble/hashes/index.js
new file mode 100644
index 0000000..56354cb
--- /dev/null
+++ b/server/node_modules/@noble/hashes/index.js
@@ -0,0 +1,34 @@
+/**
+ * Audited & minimal JS implementation of hash functions, MACs and KDFs. Check out individual modules.
+ * @module
+ * @example
+```js
+import {
+ sha256, sha384, sha512, sha224, sha512_224, sha512_256
+} from '@noble/hashes/sha2.js';
+import {
+ sha3_224, sha3_256, sha3_384, sha3_512,
+ keccak_224, keccak_256, keccak_384, keccak_512,
+ shake128, shake256
+} from '@noble/hashes/sha3.js';
+import {
+ cshake128, cshake256,
+ turboshake128, turboshake256,
+ kt128, kt256,
+ kmac128, kmac256,
+ tuplehash256, parallelhash256,
+ keccakprg
+} from '@noble/hashes/sha3-addons.js';
+import { blake3 } from '@noble/hashes/blake3.js';
+import { blake2b, blake2s } from '@noble/hashes/blake2.js';
+import { hmac } from '@noble/hashes/hmac.js';
+import { hkdf } from '@noble/hashes/hkdf.js';
+import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
+import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
+import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';
+import * as utils from '@noble/hashes/utils.js';
+```
+ */
+throw new Error('root module cannot be imported: import submodules instead. Check out README');
+export {};
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/index.js.map b/server/node_modules/@noble/hashes/index.js.map
new file mode 100644
index 0000000..d0d21b9
--- /dev/null
+++ b/server/node_modules/@noble/hashes/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/legacy.d.ts b/server/node_modules/@noble/hashes/legacy.d.ts
new file mode 100644
index 0000000..e3645c0
--- /dev/null
+++ b/server/node_modules/@noble/hashes/legacy.d.ts
@@ -0,0 +1,71 @@
+/**
+
+SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.
+Don't use them in a new protocol. What "weak" means:
+
+- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
+- No practical pre-image attacks (only theoretical, 2^123.4)
+- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151
+ * @module
+ */
+import { HashMD } from './_md.ts';
+import { type CHash } from './utils.ts';
+/** Internal SHA1 legacy hash class. */
+export declare class _SHA1 extends HashMD<_SHA1> {
+ private A;
+ private B;
+ private C;
+ private D;
+ private E;
+ constructor();
+ protected get(): [number, number, number, number, number];
+ protected set(A: number, B: number, C: number, D: number, E: number): void;
+ protected process(view: DataView, offset: number): void;
+ protected roundClean(): void;
+ destroy(): void;
+}
+/** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+export declare const sha1: CHash;
+/** Internal MD5 legacy hash class. */
+export declare class _MD5 extends HashMD<_MD5> {
+ private A;
+ private B;
+ private C;
+ private D;
+ constructor();
+ protected get(): [number, number, number, number];
+ protected set(A: number, B: number, C: number, D: number): void;
+ protected process(view: DataView, offset: number): void;
+ protected roundClean(): void;
+ destroy(): void;
+}
+/**
+ * MD5 (RFC 1321) legacy hash function. It was cryptographically broken.
+ * MD5 architecture is similar to SHA1, with some differences:
+ * - Reduced output length: 16 bytes (128 bit) instead of 20
+ * - 64 rounds, instead of 80
+ * - Little-endian: could be faster, but will require more code
+ * - Non-linear index selection: huge speed-up for unroll
+ * - Per round constants: more memory accesses, additional speed-up for unroll
+ */
+export declare const md5: CHash;
+export declare class _RIPEMD160 extends HashMD<_RIPEMD160> {
+ private h0;
+ private h1;
+ private h2;
+ private h3;
+ private h4;
+ constructor();
+ protected get(): [number, number, number, number, number];
+ protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void;
+ protected process(view: DataView, offset: number): void;
+ protected roundClean(): void;
+ destroy(): void;
+}
+/**
+ * RIPEMD-160 - a legacy hash function from 1990s.
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
+ */
+export declare const ripemd160: CHash;
+//# sourceMappingURL=legacy.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/legacy.d.ts.map b/server/node_modules/@noble/hashes/legacy.d.ts.map
new file mode 100644
index 0000000..344bccc
--- /dev/null
+++ b/server/node_modules/@noble/hashes/legacy.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["src/legacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAO,MAAM,EAAO,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,KAAK,EAA6B,MAAM,YAAY,CAAC;AAUnE,uCAAuC;AACvC,qBAAa,KAAM,SAAQ,MAAM,CAAC,KAAK,CAAC;IACtC,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;IAC3B,OAAO,CAAC,CAAC,CAAkB;;IAK3B,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIzD,SAAS,CA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IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIzD,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAO/E,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAmCvD,SAAS,CAAC,UAAU,IAAI,IAAI;IAG5B,OAAO,IAAI,IAAI;CAKhB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KAA4D,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/legacy.js b/server/node_modules/@noble/hashes/legacy.js
new file mode 100644
index 0000000..841667a
--- /dev/null
+++ b/server/node_modules/@noble/hashes/legacy.js
@@ -0,0 +1,281 @@
+/**
+
+SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.
+Don't use them in a new protocol. What "weak" means:
+
+- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
+- No practical pre-image attacks (only theoretical, 2^123.4)
+- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151
+ * @module
+ */
+import { Chi, HashMD, Maj } from "./_md.js";
+import { clean, createHasher, rotl } from "./utils.js";
+/** Initial SHA1 state */
+const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,
+]);
+// Reusable temporary buffer
+const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
+/** Internal SHA1 legacy hash class. */
+export class _SHA1 extends HashMD {
+ A = SHA1_IV[0] | 0;
+ B = SHA1_IV[1] | 0;
+ C = SHA1_IV[2] | 0;
+ D = SHA1_IV[3] | 0;
+ E = SHA1_IV[4] | 0;
+ constructor() {
+ super(64, 20, 8, false);
+ }
+ get() {
+ const { A, B, C, D, E } = this;
+ return [A, B, C, D, E];
+ }
+ set(A, B, C, D, E) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ }
+ process(view, offset) {
+ for (let i = 0; i < 16; i++, offset += 4)
+ SHA1_W[i] = view.getUint32(offset, false);
+ for (let i = 16; i < 80; i++)
+ SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
+ // Compression function main loop, 80 rounds
+ let { A, B, C, D, E } = this;
+ for (let i = 0; i < 80; i++) {
+ let F, K;
+ if (i < 20) {
+ F = Chi(B, C, D);
+ K = 0x5a827999;
+ }
+ else if (i < 40) {
+ F = B ^ C ^ D;
+ K = 0x6ed9eba1;
+ }
+ else if (i < 60) {
+ F = Maj(B, C, D);
+ K = 0x8f1bbcdc;
+ }
+ else {
+ F = B ^ C ^ D;
+ K = 0xca62c1d6;
+ }
+ const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
+ E = D;
+ D = C;
+ C = rotl(B, 30);
+ B = A;
+ A = T;
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ E = (E + this.E) | 0;
+ this.set(A, B, C, D, E);
+ }
+ roundClean() {
+ clean(SHA1_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+/** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+export const sha1 = /* @__PURE__ */ createHasher(() => new _SHA1());
+/** Per-round constants */
+const p32 = /* @__PURE__ */ Math.pow(2, 32);
+const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) => Math.floor(p32 * Math.abs(Math.sin(i + 1))));
+/** md5 initial state: same as sha1, but 4 u32 instead of 5. */
+const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4);
+// Reusable temporary buffer
+const MD5_W = /* @__PURE__ */ new Uint32Array(16);
+/** Internal MD5 legacy hash class. */
+export class _MD5 extends HashMD {
+ A = MD5_IV[0] | 0;
+ B = MD5_IV[1] | 0;
+ C = MD5_IV[2] | 0;
+ D = MD5_IV[3] | 0;
+ constructor() {
+ super(64, 16, 8, true);
+ }
+ get() {
+ const { A, B, C, D } = this;
+ return [A, B, C, D];
+ }
+ set(A, B, C, D) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ }
+ process(view, offset) {
+ for (let i = 0; i < 16; i++, offset += 4)
+ MD5_W[i] = view.getUint32(offset, true);
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D } = this;
+ for (let i = 0; i < 64; i++) {
+ let F, g, s;
+ if (i < 16) {
+ F = Chi(B, C, D);
+ g = i;
+ s = [7, 12, 17, 22];
+ }
+ else if (i < 32) {
+ F = Chi(D, B, C);
+ g = (5 * i + 1) % 16;
+ s = [5, 9, 14, 20];
+ }
+ else if (i < 48) {
+ F = B ^ C ^ D;
+ g = (3 * i + 5) % 16;
+ s = [4, 11, 16, 23];
+ }
+ else {
+ F = C ^ (B | ~D);
+ g = (7 * i) % 16;
+ s = [6, 10, 15, 21];
+ }
+ F = F + A + K[i] + MD5_W[g];
+ A = D;
+ D = C;
+ C = B;
+ B = B + rotl(F, s[i % 4]);
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ this.set(A, B, C, D);
+ }
+ roundClean() {
+ clean(MD5_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+/**
+ * MD5 (RFC 1321) legacy hash function. It was cryptographically broken.
+ * MD5 architecture is similar to SHA1, with some differences:
+ * - Reduced output length: 16 bytes (128 bit) instead of 20
+ * - 64 rounds, instead of 80
+ * - Little-endian: could be faster, but will require more code
+ * - Non-linear index selection: huge speed-up for unroll
+ * - Per round constants: more memory accesses, additional speed-up for unroll
+ */
+export const md5 = /* @__PURE__ */ createHasher(() => new _MD5());
+// RIPEMD-160
+const Rho160 = /* @__PURE__ */ Uint8Array.from([
+ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
+]);
+const Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
+const Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
+const idxLR = /* @__PURE__ */ (() => {
+ const L = [Id160];
+ const R = [Pi160];
+ const res = [L, R];
+ for (let i = 0; i < 4; i++)
+ for (let j of res)
+ j.push(j[i].map((k) => Rho160[k]));
+ return res;
+})();
+const idxL = /* @__PURE__ */ (() => idxLR[0])();
+const idxR = /* @__PURE__ */ (() => idxLR[1])();
+// const [idxL, idxR] = idxLR;
+const shifts160 = /* @__PURE__ */ [
+ [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
+ [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
+ [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
+ [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
+ [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],
+].map((i) => Uint8Array.from(i));
+const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
+const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
+const Kl160 = /* @__PURE__ */ Uint32Array.from([
+ 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,
+]);
+const Kr160 = /* @__PURE__ */ Uint32Array.from([
+ 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,
+]);
+// It's called f() in spec.
+function ripemd_f(group, x, y, z) {
+ if (group === 0)
+ return x ^ y ^ z;
+ if (group === 1)
+ return (x & y) | (~x & z);
+ if (group === 2)
+ return (x | ~y) ^ z;
+ if (group === 3)
+ return (x & z) | (y & ~z);
+ return x ^ (y | ~z);
+}
+// Reusable temporary buffer
+const BUF_160 = /* @__PURE__ */ new Uint32Array(16);
+export class _RIPEMD160 extends HashMD {
+ h0 = 0x67452301 | 0;
+ h1 = 0xefcdab89 | 0;
+ h2 = 0x98badcfe | 0;
+ h3 = 0x10325476 | 0;
+ h4 = 0xc3d2e1f0 | 0;
+ constructor() {
+ super(64, 20, 8, true);
+ }
+ get() {
+ const { h0, h1, h2, h3, h4 } = this;
+ return [h0, h1, h2, h3, h4];
+ }
+ set(h0, h1, h2, h3, h4) {
+ this.h0 = h0 | 0;
+ this.h1 = h1 | 0;
+ this.h2 = h2 | 0;
+ this.h3 = h3 | 0;
+ this.h4 = h4 | 0;
+ }
+ process(view, offset) {
+ for (let i = 0; i < 16; i++, offset += 4)
+ BUF_160[i] = view.getUint32(offset, true);
+ // prettier-ignore
+ let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
+ // Instead of iterating 0 to 80, we split it into 5 groups
+ // And use the groups in constants, functions, etc. Much simpler
+ for (let group = 0; group < 5; group++) {
+ const rGroup = 4 - group;
+ const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore
+ const rl = idxL[group], rr = idxR[group]; // prettier-ignore
+ const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore
+ for (let i = 0; i < 16; i++) {
+ const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0;
+ al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore
+ }
+ // 2 loops are 10% faster
+ for (let i = 0; i < 16; i++) {
+ const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0;
+ ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore
+ }
+ }
+ // Add the compressed chunk to the current hash value
+ this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);
+ }
+ roundClean() {
+ clean(BUF_160);
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0);
+ }
+}
+/**
+ * RIPEMD-160 - a legacy hash function from 1990s.
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
+ */
+export const ripemd160 = /* @__PURE__ */ createHasher(() => new _RIPEMD160());
+//# sourceMappingURL=legacy.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/legacy.js.map b/server/node_modules/@noble/hashes/legacy.js.map
new file mode 100644
index 0000000..dda3808
--- /dev/null
+++ b/server/node_modules/@noble/hashes/legacy.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"legacy.js","sourceRoot":"","sources":["src/legacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAc,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnE,yBAAyB;AACzB,MAAM,OAAO,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC3D,CAAC,CAAC;AAEH,4BAA4B;AAC5B,MAAM,MA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CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EACvB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CACxB,CAAC;IACJ,CAAC;IACS,UAAU;QAClB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAU,eAAe,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/package.json b/server/node_modules/@noble/hashes/package.json
new file mode 100644
index 0000000..dc8e673
--- /dev/null
+++ b/server/node_modules/@noble/hashes/package.json
@@ -0,0 +1,93 @@
+{
+ "name": "@noble/hashes",
+ "version": "2.0.1",
+ "description": "Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt",
+ "files": [
+ "*.js",
+ "*.js.map",
+ "*.d.ts",
+ "*.d.ts.map",
+ "src"
+ ],
+ "devDependencies": {
+ "@paulmillr/jsbt": "0.4.4",
+ "@types/node": "24.2.1",
+ "fast-check": "4.2.0",
+ "prettier": "3.6.2",
+ "typescript": "5.9.2"
+ },
+ "scripts": {
+ "bench": "node test/benchmark/noble.ts",
+ "bench:compare": "MBENCH_DIMS='algorithm,buffer,library' node test/benchmark/hashes.ts",
+ "bench:compare-scrypt": "MBENCH_DIMS='iters,library' MBENCH_FILTER='async' node test/benchmark/scrypt.ts",
+ "bench:install": "cd test/benchmark; npm install",
+ "build": "tsc",
+ "build:release": "npx --no @paulmillr/jsbt esbuild test/build",
+ "build:clean": "rm *.{js,js.map,d.ts,d.ts.map} 2> /dev/null",
+ "format": "prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'",
+ "test": "node --experimental-strip-types --no-warnings test/index.ts",
+ "test:bun": "bun test/index.ts",
+ "test:deno": "deno --allow-env --allow-read test/index.ts",
+ "test:node20": "cd test; npx tsc; node compiled/test/index.js",
+ "test:dos": "node --experimental-strip-types test/slow-dos.test.ts",
+ "test:big": "node --experimental-strip-types test/slow-big.test.ts",
+ "test:acvp": "node --experimental-strip-types test/slow-acvp.test.ts",
+ "test:kdf": "node --experimental-strip-types test/slow-kdf.test.ts"
+ },
+ "exports": {
+ ".": "./index.js",
+ "./_md.js": "./_md.js",
+ "./argon2.js": "./argon2.js",
+ "./blake1.js": "./blake1.js",
+ "./blake2.js": "./blake2.js",
+ "./blake3.js": "./blake3.js",
+ "./eskdf.js": "./eskdf.js",
+ "./hkdf.js": "./hkdf.js",
+ "./hmac.js": "./hmac.js",
+ "./legacy.js": "./legacy.js",
+ "./pbkdf2.js": "./pbkdf2.js",
+ "./scrypt.js": "./scrypt.js",
+ "./sha2.js": "./sha2.js",
+ "./sha3-addons.js": "./sha3-addons.js",
+ "./sha3.js": "./sha3.js",
+ "./webcrypto.js": "./webcrypto.js",
+ "./utils.js": "./utils.js"
+ },
+ "engines": {
+ "node": ">= 20.19.0"
+ },
+ "keywords": [
+ "sha1",
+ "sha2",
+ "sha3",
+ "blake",
+ "blake2",
+ "blake3",
+ "hmac",
+ "hkdf",
+ "pbkdf2",
+ "scrypt",
+ "sha256",
+ "sha512",
+ "keccak",
+ "ripemd160",
+ "kdf",
+ "hash",
+ "cryptography",
+ "security",
+ "noble"
+ ],
+ "homepage": "https://paulmillr.com/noble/",
+ "funding": "https://paulmillr.com/funding/",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/paulmillr/noble-hashes.git"
+ },
+ "type": "module",
+ "main": "index.js",
+ "module": "index.js",
+ "types": "index.d.ts",
+ "sideEffects": false,
+ "author": "Paul Miller (https://paulmillr.com)",
+ "license": "MIT"
+}
diff --git a/server/node_modules/@noble/hashes/pbkdf2.d.ts b/server/node_modules/@noble/hashes/pbkdf2.d.ts
new file mode 100644
index 0000000..753b14f
--- /dev/null
+++ b/server/node_modules/@noble/hashes/pbkdf2.d.ts
@@ -0,0 +1,29 @@
+import { type CHash, type KDFInput } from './utils.ts';
+/**
+ * PBKDF2 options:
+ * * c: iterations, should probably be higher than 100_000
+ * * dkLen: desired length of derived key in bytes
+ * * asyncTick: max time in ms for which async function can block execution
+ */
+export type Pbkdf2Opt = {
+ c: number;
+ dkLen?: number;
+ asyncTick?: number;
+};
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ */
+export declare function pbkdf2(hash: CHash, password: KDFInput, salt: KDFInput, opts: Pbkdf2Opt): Uint8Array;
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
+ * @example
+ * await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
+ */
+export declare function pbkdf2Async(hash: CHash, password: KDFInput, salt: KDFInput, opts: Pbkdf2Opt): Promise;
+//# sourceMappingURL=pbkdf2.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/pbkdf2.d.ts.map b/server/node_modules/@noble/hashes/pbkdf2.d.ts.map
new file mode 100644
index 0000000..9932d16
--- /dev/null
+++ b/server/node_modules/@noble/hashes/pbkdf2.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["src/pbkdf2.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,KAAK,EAEV,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAkCF;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,SAAS,GACd,UAAU,CAsBZ;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,CAAC,CAsBrB"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/pbkdf2.js b/server/node_modules/@noble/hashes/pbkdf2.js
new file mode 100644
index 0000000..927b025
--- /dev/null
+++ b/server/node_modules/@noble/hashes/pbkdf2.js
@@ -0,0 +1,97 @@
+/**
+ * PBKDF (RFC 2898). Can be used to create a key from password and salt.
+ * @module
+ */
+import { hmac } from "./hmac.js";
+// prettier-ignore
+import { ahash, anumber, asyncLoop, checkOpts, clean, createView, kdfInputToBytes } from "./utils.js";
+// Common start and end for sync/async functions
+function pbkdf2Init(hash, _password, _salt, _opts) {
+ ahash(hash);
+ const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
+ const { c, dkLen, asyncTick } = opts;
+ anumber(c, 'c');
+ anumber(dkLen, 'dkLen');
+ anumber(asyncTick, 'asyncTick');
+ if (c < 1)
+ throw new Error('iterations (c) must be >= 1');
+ const password = kdfInputToBytes(_password, 'password');
+ const salt = kdfInputToBytes(_salt, 'salt');
+ // DK = PBKDF2(PRF, Password, Salt, c, dkLen);
+ const DK = new Uint8Array(dkLen);
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ const PRF = hmac.create(hash, password);
+ const PRFSalt = PRF._cloneInto().update(salt);
+ return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
+}
+function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
+ PRF.destroy();
+ PRFSalt.destroy();
+ if (prfW)
+ prfW.destroy();
+ clean(u);
+ return DK;
+}
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ */
+export function pbkdf2(hash, password, salt, opts) {
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
+ let prfW; // Working copy
+ const arr = new Uint8Array(4);
+ const view = createView(arr);
+ const u = new Uint8Array(PRF.outputLen);
+ // DK = T1 + T2 + ⋯ + Tdklen/hlen
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
+ // Ti = F(Password, Salt, c, i)
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
+ view.setInt32(0, ti, false);
+ // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
+ Ti.set(u.subarray(0, Ti.length));
+ for (let ui = 1; ui < c; ui++) {
+ // Uc = PRF(Password, Uc−1)
+ PRF._cloneInto(prfW).update(u).digestInto(u);
+ for (let i = 0; i < Ti.length; i++)
+ Ti[i] ^= u[i];
+ }
+ }
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
+}
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
+ * @example
+ * await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
+ */
+export async function pbkdf2Async(hash, password, salt, opts) {
+ const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
+ let prfW; // Working copy
+ const arr = new Uint8Array(4);
+ const view = createView(arr);
+ const u = new Uint8Array(PRF.outputLen);
+ // DK = T1 + T2 + ⋯ + Tdklen/hlen
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
+ // Ti = F(Password, Salt, c, i)
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
+ view.setInt32(0, ti, false);
+ // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
+ Ti.set(u.subarray(0, Ti.length));
+ await asyncLoop(c - 1, asyncTick, () => {
+ // Uc = PRF(Password, Uc−1)
+ PRF._cloneInto(prfW).update(u).digestInto(u);
+ for (let i = 0; i < Ti.length; i++)
+ Ti[i] ^= u[i];
+ });
+ }
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
+}
+//# sourceMappingURL=pbkdf2.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/pbkdf2.js.map b/server/node_modules/@noble/hashes/pbkdf2.js.map
new file mode 100644
index 0000000..73a5afb
--- /dev/null
+++ b/server/node_modules/@noble/hashes/pbkdf2.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["src/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,kBAAkB;AAClB,OAAO,EACL,KAAK,EAAE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Q,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAC5B,6CAA6C;QAC7C,0CAA0C;QAC1C,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5D,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACjC,MAAM,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YACrC,2BAA2B;YAC3B,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/scrypt.d.ts b/server/node_modules/@noble/hashes/scrypt.d.ts
new file mode 100644
index 0000000..cb05a20
--- /dev/null
+++ b/server/node_modules/@noble/hashes/scrypt.d.ts
@@ -0,0 +1,33 @@
+import { type KDFInput } from './utils.ts';
+/**
+ * Scrypt options:
+ * - `N` is cpu/mem work factor (power of 2 e.g. `2**18`)
+ * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance
+ * - `p` is parallelization factor (1 is common)
+ * - `dkLen` is output key length in bytes e.g. 32.
+ * - `asyncTick` - (default: 10) max time in ms for which async function can block execution
+ * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt
+ * - `onProgress` - callback function that would be executed for progress report
+ */
+export type ScryptOpts = {
+ N: number;
+ r: number;
+ p: number;
+ dkLen?: number;
+ asyncTick?: number;
+ maxmem?: number;
+ onProgress?: (progress: number) => void;
+};
+/**
+ * Scrypt KDF from RFC 7914. See {@link ScryptOpts}.
+ * @example
+ * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export declare function scrypt(password: KDFInput, salt: KDFInput, opts: ScryptOpts): Uint8Array;
+/**
+ * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}.
+ * @example
+ * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export declare function scryptAsync(password: KDFInput, salt: KDFInput, opts: ScryptOpts): Promise;
+//# sourceMappingURL=scrypt.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/scrypt.d.ts.map b/server/node_modules/@noble/hashes/scrypt.d.ts.map
new file mode 100644
index 0000000..2d178f1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/scrypt.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["src/scrypt.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAuEpB;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AA2EF;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CA2BvF;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CA4BrB"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/scrypt.js b/server/node_modules/@noble/hashes/scrypt.js
new file mode 100644
index 0000000..cb71fe8
--- /dev/null
+++ b/server/node_modules/@noble/hashes/scrypt.js
@@ -0,0 +1,216 @@
+/**
+ * RFC 7914 Scrypt KDF. Can be used to create a key from password and salt.
+ * @module
+ */
+import { pbkdf2 } from "./pbkdf2.js";
+import { sha256 } from "./sha2.js";
+// prettier-ignore
+import { anumber, asyncLoop, checkOpts, clean, rotl, swap32IfBE, u32 } from "./utils.js";
+// The main Scrypt loop: uses Salsa extensively.
+// Six versions of the function were tried, this is the fastest one.
+// prettier-ignore
+function XorAndSalsa(prev, pi, input, ii, out, oi) {
+ // Based on https://cr.yp.to/salsa20.html
+ // Xor blocks
+ let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
+ let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
+ let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];
+ let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];
+ let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];
+ let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];
+ let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];
+ let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];
+ // Save state to temporary variables (salsa)
+ let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;
+ // Main loop (salsa)
+ for (let i = 0; i < 8; i += 2) {
+ x04 ^= rotl(x00 + x12 | 0, 7);
+ x08 ^= rotl(x04 + x00 | 0, 9);
+ x12 ^= rotl(x08 + x04 | 0, 13);
+ x00 ^= rotl(x12 + x08 | 0, 18);
+ x09 ^= rotl(x05 + x01 | 0, 7);
+ x13 ^= rotl(x09 + x05 | 0, 9);
+ x01 ^= rotl(x13 + x09 | 0, 13);
+ x05 ^= rotl(x01 + x13 | 0, 18);
+ x14 ^= rotl(x10 + x06 | 0, 7);
+ x02 ^= rotl(x14 + x10 | 0, 9);
+ x06 ^= rotl(x02 + x14 | 0, 13);
+ x10 ^= rotl(x06 + x02 | 0, 18);
+ x03 ^= rotl(x15 + x11 | 0, 7);
+ x07 ^= rotl(x03 + x15 | 0, 9);
+ x11 ^= rotl(x07 + x03 | 0, 13);
+ x15 ^= rotl(x11 + x07 | 0, 18);
+ x01 ^= rotl(x00 + x03 | 0, 7);
+ x02 ^= rotl(x01 + x00 | 0, 9);
+ x03 ^= rotl(x02 + x01 | 0, 13);
+ x00 ^= rotl(x03 + x02 | 0, 18);
+ x06 ^= rotl(x05 + x04 | 0, 7);
+ x07 ^= rotl(x06 + x05 | 0, 9);
+ x04 ^= rotl(x07 + x06 | 0, 13);
+ x05 ^= rotl(x04 + x07 | 0, 18);
+ x11 ^= rotl(x10 + x09 | 0, 7);
+ x08 ^= rotl(x11 + x10 | 0, 9);
+ x09 ^= rotl(x08 + x11 | 0, 13);
+ x10 ^= rotl(x09 + x08 | 0, 18);
+ x12 ^= rotl(x15 + x14 | 0, 7);
+ x13 ^= rotl(x12 + x15 | 0, 9);
+ x14 ^= rotl(x13 + x12 | 0, 13);
+ x15 ^= rotl(x14 + x13 | 0, 18);
+ }
+ // Write output (salsa)
+ out[oi++] = (y00 + x00) | 0;
+ out[oi++] = (y01 + x01) | 0;
+ out[oi++] = (y02 + x02) | 0;
+ out[oi++] = (y03 + x03) | 0;
+ out[oi++] = (y04 + x04) | 0;
+ out[oi++] = (y05 + x05) | 0;
+ out[oi++] = (y06 + x06) | 0;
+ out[oi++] = (y07 + x07) | 0;
+ out[oi++] = (y08 + x08) | 0;
+ out[oi++] = (y09 + x09) | 0;
+ out[oi++] = (y10 + x10) | 0;
+ out[oi++] = (y11 + x11) | 0;
+ out[oi++] = (y12 + x12) | 0;
+ out[oi++] = (y13 + x13) | 0;
+ out[oi++] = (y14 + x14) | 0;
+ out[oi++] = (y15 + x15) | 0;
+}
+function BlockMix(input, ii, out, oi, r) {
+ // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)
+ let head = oi + 0;
+ let tail = oi + 16 * r;
+ for (let i = 0; i < 16; i++)
+ out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]
+ for (let i = 0; i < r; i++, head += 16, ii += 16) {
+ // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1
+ XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])
+ if (i > 0)
+ tail += 16; // First iteration overwrites tmp value in tail
+ XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])
+ }
+}
+// Common prologue and epilogue for sync/async functions
+function scryptInit(password, salt, _opts) {
+ // Maxmem - 1GB+1KB by default
+ const opts = checkOpts({
+ dkLen: 32,
+ asyncTick: 10,
+ maxmem: 1024 ** 3 + 1024,
+ }, _opts);
+ const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;
+ anumber(N, 'N');
+ anumber(r, 'r');
+ anumber(p, 'p');
+ anumber(dkLen, 'dkLen');
+ anumber(asyncTick, 'asyncTick');
+ anumber(maxmem, 'maxmem');
+ if (onProgress !== undefined && typeof onProgress !== 'function')
+ throw new Error('progressCb must be a function');
+ const blockSize = 128 * r;
+ const blockSize32 = blockSize / 4;
+ // Max N is 2^32 (Integrify is 32-bit).
+ // Real limit can be 2^22: some JS engines limit Uint8Array to 4GB.
+ // Spec check `N >= 2^(blockSize / 8)` is not done for compat with popular libs,
+ // which used incorrect r: 1, p: 8. Also, the check seems to be a spec error:
+ // https://www.rfc-editor.org/errata_search.php?rfc=7914
+ const pow32 = Math.pow(2, 32);
+ if (N <= 1 || (N & (N - 1)) !== 0 || N > pow32)
+ throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');
+ if (p < 1 || p > ((pow32 - 1) * 32) / blockSize)
+ throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');
+ if (dkLen < 1 || dkLen > (pow32 - 1) * 32)
+ throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');
+ const memUsed = blockSize * (N + p);
+ if (memUsed > maxmem)
+ throw new Error('"maxmem" limit was hit, expected 128*r*(N+p) <= "maxmem"=' + maxmem);
+ // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)
+ // Since it has only one iteration there is no reason to use async variant
+ const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });
+ const B32 = u32(B);
+ // Re-used between parallel iterations. Array(iterations) of B
+ const V = u32(new Uint8Array(blockSize * N));
+ const tmp = u32(new Uint8Array(blockSize));
+ let blockMixCb = () => { };
+ if (onProgress) {
+ const totalBlockMix = 2 * N * p;
+ // Invoke callback if progress changes from 10.01 to 10.02
+ // Allows to draw smooth progress bar on up to 8K screen
+ const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);
+ let blockMixCnt = 0;
+ blockMixCb = () => {
+ blockMixCnt++;
+ if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))
+ onProgress(blockMixCnt / totalBlockMix);
+ };
+ }
+ return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
+}
+function scryptOutput(password, dkLen, B, V, tmp) {
+ const res = pbkdf2(sha256, password, B, { c: 1, dkLen });
+ clean(B, V, tmp);
+ return res;
+}
+/**
+ * Scrypt KDF from RFC 7914. See {@link ScryptOpts}.
+ * @example
+ * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export function scrypt(password, salt, opts) {
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);
+ swap32IfBE(B32);
+ for (let pi = 0; pi < p; pi++) {
+ const Pi = blockSize32 * pi;
+ for (let i = 0; i < blockSize32; i++)
+ V[i] = B32[Pi + i]; // V[0] = B[i]
+ for (let i = 0, pos = 0; i < N - 1; i++) {
+ BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);
+ blockMixCb();
+ }
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element
+ blockMixCb();
+ for (let i = 0; i < N; i++) {
+ // First u32 of the last 64-byte block (u32 is LE)
+ // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked above; >>> 0 for unsigned, input fits in u32
+ const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations
+ for (let k = 0; k < blockSize32; k++)
+ tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]
+ BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])
+ blockMixCb();
+ }
+ }
+ swap32IfBE(B32);
+ return scryptOutput(password, dkLen, B, V, tmp);
+}
+/**
+ * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}.
+ * @example
+ * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export async function scryptAsync(password, salt, opts) {
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);
+ swap32IfBE(B32);
+ for (let pi = 0; pi < p; pi++) {
+ const Pi = blockSize32 * pi;
+ for (let i = 0; i < blockSize32; i++)
+ V[i] = B32[Pi + i]; // V[0] = B[i]
+ let pos = 0;
+ await asyncLoop(N - 1, asyncTick, () => {
+ BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);
+ blockMixCb();
+ });
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element
+ blockMixCb();
+ await asyncLoop(N, asyncTick, () => {
+ // First u32 of the last 64-byte block (u32 is LE)
+ // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked above; >>> 0 for unsigned, input fits in u32
+ const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations
+ for (let k = 0; k < blockSize32; k++)
+ tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]
+ BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])
+ blockMixCb();
+ });
+ }
+ swap32IfBE(B32);
+ return scryptOutput(password, dkLen, B, V, tmp);
+}
+//# sourceMappingURL=scrypt.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/scrypt.js.map b/server/node_modules/@noble/hashes/scrypt.js.map
new file mode 100644
index 0000000..ddb00d5
--- /dev/null
+++ b/server/node_modules/@noble/hashes/scrypt.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["src/scrypt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,kBAAkB;AAClB,OAAO,EACL,OAAO,EAAE,SAAS,EAClB,SAAS,EAAE,KAAK,EACD,IAAI,EACnB,UAAU,EACV,GAAG,EACJ,MAAM,YAAY,CAAC;AAEpB,gDAAgD;AAChD,oEAAoE;AACpE,kBAAkB;AAClB,SAAS,WAAW,CAClB,IAAiB,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C,EAAE;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB;YACtG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,yBAAyB;YACvD,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IACD,UAAU,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha2.d.ts b/server/node_modules/@noble/hashes/sha2.d.ts
new file mode 100644
index 0000000..6727043
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha2.d.ts
@@ -0,0 +1,199 @@
+/**
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
+ * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
+ * @module
+ */
+import { HashMD } from './_md.ts';
+import { type CHash } from './utils.ts';
+/** Internal 32-byte base SHA2 hash class. */
+declare abstract class SHA2_32B> extends HashMD {
+ protected abstract A: number;
+ protected abstract B: number;
+ protected abstract C: number;
+ protected abstract D: number;
+ protected abstract E: number;
+ protected abstract F: number;
+ protected abstract G: number;
+ protected abstract H: number;
+ constructor(outputLen: number);
+ protected get(): [number, number, number, number, number, number, number, number];
+ protected set(A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number): void;
+ protected process(view: DataView, offset: number): void;
+ protected roundClean(): void;
+ destroy(): void;
+}
+/** Internal SHA2-256 hash class. */
+export declare class _SHA256 extends SHA2_32B<_SHA256> {
+ protected A: number;
+ protected B: number;
+ protected C: number;
+ protected D: number;
+ protected E: number;
+ protected F: number;
+ protected G: number;
+ protected H: number;
+ constructor();
+}
+/** Internal SHA2-224 hash class. */
+export declare class _SHA224 extends SHA2_32B<_SHA224> {
+ protected A: number;
+ protected B: number;
+ protected C: number;
+ protected D: number;
+ protected E: number;
+ protected F: number;
+ protected G: number;
+ protected H: number;
+ constructor();
+}
+/** Internal 64-byte base SHA2 hash class. */
+declare abstract class SHA2_64B> extends HashMD {
+ protected abstract Ah: number;
+ protected abstract Al: number;
+ protected abstract Bh: number;
+ protected abstract Bl: number;
+ protected abstract Ch: number;
+ protected abstract Cl: number;
+ protected abstract Dh: number;
+ protected abstract Dl: number;
+ protected abstract Eh: number;
+ protected abstract El: number;
+ protected abstract Fh: number;
+ protected abstract Fl: number;
+ protected abstract Gh: number;
+ protected abstract Gl: number;
+ protected abstract Hh: number;
+ protected abstract Hl: number;
+ constructor(outputLen: number);
+ protected get(): [
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number,
+ number
+ ];
+ protected set(Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number, Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number): void;
+ protected process(view: DataView, offset: number): void;
+ protected roundClean(): void;
+ destroy(): void;
+}
+/** Internal SHA2-512 hash class. */
+export declare class _SHA512 extends SHA2_64B<_SHA512> {
+ protected Ah: number;
+ protected Al: number;
+ protected Bh: number;
+ protected Bl: number;
+ protected Ch: number;
+ protected Cl: number;
+ protected Dh: number;
+ protected Dl: number;
+ protected Eh: number;
+ protected El: number;
+ protected Fh: number;
+ protected Fl: number;
+ protected Gh: number;
+ protected Gl: number;
+ protected Hh: number;
+ protected Hl: number;
+ constructor();
+}
+/** Internal SHA2-384 hash class. */
+export declare class _SHA384 extends SHA2_64B<_SHA384> {
+ protected Ah: number;
+ protected Al: number;
+ protected Bh: number;
+ protected Bl: number;
+ protected Ch: number;
+ protected Cl: number;
+ protected Dh: number;
+ protected Dl: number;
+ protected Eh: number;
+ protected El: number;
+ protected Fh: number;
+ protected Fl: number;
+ protected Gh: number;
+ protected Gl: number;
+ protected Hh: number;
+ protected Hl: number;
+ constructor();
+}
+/** Internal SHA2-512/224 hash class. */
+export declare class _SHA512_224 extends SHA2_64B<_SHA512_224> {
+ protected Ah: number;
+ protected Al: number;
+ protected Bh: number;
+ protected Bl: number;
+ protected Ch: number;
+ protected Cl: number;
+ protected Dh: number;
+ protected Dl: number;
+ protected Eh: number;
+ protected El: number;
+ protected Fh: number;
+ protected Fl: number;
+ protected Gh: number;
+ protected Gl: number;
+ protected Hh: number;
+ protected Hl: number;
+ constructor();
+}
+/** Internal SHA2-512/256 hash class. */
+export declare class _SHA512_256 extends SHA2_64B<_SHA512_256> {
+ protected Ah: number;
+ protected Al: number;
+ protected Bh: number;
+ protected Bl: number;
+ protected Ch: number;
+ protected Cl: number;
+ protected Dh: number;
+ protected Dl: number;
+ protected Eh: number;
+ protected El: number;
+ protected Fh: number;
+ protected Fl: number;
+ protected Gh: number;
+ protected Gl: number;
+ protected Hh: number;
+ protected Hl: number;
+ constructor();
+}
+/**
+ * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
+ *
+ * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
+ * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
+ * - Each sha256 hash is executing 2^18 bit operations.
+ * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
+ */
+export declare const sha256: CHash<_SHA256>;
+/** SHA2-224 hash function from RFC 4634 */
+export declare const sha224: CHash<_SHA224>;
+/** SHA2-512 hash function from RFC 4634. */
+export declare const sha512: CHash<_SHA512>;
+/** SHA2-384 hash function from RFC 4634. */
+export declare const sha384: CHash<_SHA384>;
+/**
+ * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export declare const sha512_256: CHash<_SHA512_256>;
+/**
+ * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export declare const sha512_224: CHash<_SHA512_224>;
+export {};
+//# sourceMappingURL=sha2.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha2.d.ts.map b/server/node_modules/@noble/hashes/sha2.d.ts.map
new file mode 100644
index 0000000..6096ce0
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha2.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["src/sha2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAO,MAAM,EAAmD,MAAM,UAAU,CAAC;AAExF,OAAO,EAAE,KAAK,KAAK,EAAsC,MAAM,YAAY,CAAC;AAqB5E,6CAA6C;AAC7C,uBAAe,QAAQ,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IAG9D,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;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AE,EAAE,MAAM,CAAmB;IACvC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAmB;IACvC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAmB;IACvC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAmB;;CAKxC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,OAAO,CAGjC,CAAC;AACF,2CAA2C;AAC3C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,OAAO,CAGjC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,OAAO,CAGjC,CAAC;AACF,4CAA4C;AAC5C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,OAAO,CAGjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,WAAW,CAGzC,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,WAAW,CAGzC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha2.js b/server/node_modules/@noble/hashes/sha2.js
new file mode 100644
index 0000000..21553b1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha2.js
@@ -0,0 +1,397 @@
+/**
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
+ * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
+ * @module
+ */
+import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js";
+import * as u64 from "./_u64.js";
+import { clean, createHasher, oidNist, rotr } from "./utils.js";
+/**
+ * Round constants:
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
+ */
+// prettier-ignore
+const SHA256_K = /* @__PURE__ */ Uint32Array.from([
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+]);
+/** Reusable temporary buffer. "W" comes straight from spec. */
+const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
+/** Internal 32-byte base SHA2 hash class. */
+class SHA2_32B extends HashMD {
+ constructor(outputLen) {
+ super(64, outputLen, 8, false);
+ }
+ get() {
+ const { A, B, C, D, E, F, G, H } = this;
+ return [A, B, C, D, E, F, G, H];
+ }
+ // prettier-ignore
+ set(A, B, C, D, E, F, G, H) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ this.F = F | 0;
+ this.G = G | 0;
+ this.H = H | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
+ for (let i = 0; i < 16; i++, offset += 4)
+ SHA256_W[i] = view.getUint32(offset, false);
+ for (let i = 16; i < 64; i++) {
+ const W15 = SHA256_W[i - 15];
+ const W2 = SHA256_W[i - 2];
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
+ SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
+ }
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D, E, F, G, H } = this;
+ for (let i = 0; i < 64; i++) {
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
+ const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
+ const T2 = (sigma0 + Maj(A, B, C)) | 0;
+ H = G;
+ G = F;
+ F = E;
+ E = (D + T1) | 0;
+ D = C;
+ C = B;
+ B = A;
+ A = (T1 + T2) | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ E = (E + this.E) | 0;
+ F = (F + this.F) | 0;
+ G = (G + this.G) | 0;
+ H = (H + this.H) | 0;
+ this.set(A, B, C, D, E, F, G, H);
+ }
+ roundClean() {
+ clean(SHA256_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+/** Internal SHA2-256 hash class. */
+export class _SHA256 extends SHA2_32B {
+ // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ A = SHA256_IV[0] | 0;
+ B = SHA256_IV[1] | 0;
+ C = SHA256_IV[2] | 0;
+ D = SHA256_IV[3] | 0;
+ E = SHA256_IV[4] | 0;
+ F = SHA256_IV[5] | 0;
+ G = SHA256_IV[6] | 0;
+ H = SHA256_IV[7] | 0;
+ constructor() {
+ super(32);
+ }
+}
+/** Internal SHA2-224 hash class. */
+export class _SHA224 extends SHA2_32B {
+ A = SHA224_IV[0] | 0;
+ B = SHA224_IV[1] | 0;
+ C = SHA224_IV[2] | 0;
+ D = SHA224_IV[3] | 0;
+ E = SHA224_IV[4] | 0;
+ F = SHA224_IV[5] | 0;
+ G = SHA224_IV[6] | 0;
+ H = SHA224_IV[7] | 0;
+ constructor() {
+ super(28);
+ }
+}
+// SHA2-512 is slower than sha256 in js because u64 operations are slow.
+// Round contants
+// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409
+// prettier-ignore
+const K512 = /* @__PURE__ */ (() => u64.split([
+ '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
+ '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
+ '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
+ '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
+ '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
+ '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
+ '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
+ '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
+ '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
+ '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
+ '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
+ '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
+ '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
+ '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
+ '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
+ '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
+ '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
+ '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
+ '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
+ '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
+].map(n => BigInt(n))))();
+const SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
+const SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
+// Reusable temporary buffers
+const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
+const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
+/** Internal 64-byte base SHA2 hash class. */
+class SHA2_64B extends HashMD {
+ constructor(outputLen) {
+ super(128, outputLen, 16, false);
+ }
+ // prettier-ignore
+ get() {
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
+ }
+ // prettier-ignore
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
+ this.Ah = Ah | 0;
+ this.Al = Al | 0;
+ this.Bh = Bh | 0;
+ this.Bl = Bl | 0;
+ this.Ch = Ch | 0;
+ this.Cl = Cl | 0;
+ this.Dh = Dh | 0;
+ this.Dl = Dl | 0;
+ this.Eh = Eh | 0;
+ this.El = El | 0;
+ this.Fh = Fh | 0;
+ this.Fl = Fl | 0;
+ this.Gh = Gh | 0;
+ this.Gl = Gl | 0;
+ this.Hh = Hh | 0;
+ this.Hl = Hl | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
+ for (let i = 0; i < 16; i++, offset += 4) {
+ SHA512_W_H[i] = view.getUint32(offset);
+ SHA512_W_L[i] = view.getUint32((offset += 4));
+ }
+ for (let i = 16; i < 80; i++) {
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
+ const W15h = SHA512_W_H[i - 15] | 0;
+ const W15l = SHA512_W_L[i - 15] | 0;
+ const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
+ const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
+ const W2h = SHA512_W_H[i - 2] | 0;
+ const W2l = SHA512_W_L[i - 2] | 0;
+ const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
+ const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
+ const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
+ const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
+ SHA512_W_H[i] = SUMh | 0;
+ SHA512_W_L[i] = SUMl | 0;
+ }
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ // Compression function main loop, 80 rounds
+ for (let i = 0; i < 80; i++) {
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
+ const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
+ const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const CHIh = (Eh & Fh) ^ (~Eh & Gh);
+ const CHIl = (El & Fl) ^ (~El & Gl);
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
+ // prettier-ignore
+ const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
+ const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
+ const T1l = T1ll | 0;
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
+ const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
+ const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
+ const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
+ const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
+ Hh = Gh | 0;
+ Hl = Gl | 0;
+ Gh = Fh | 0;
+ Gl = Fl | 0;
+ Fh = Eh | 0;
+ Fl = El | 0;
+ ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
+ Dh = Ch | 0;
+ Dl = Cl | 0;
+ Ch = Bh | 0;
+ Cl = Bl | 0;
+ Bh = Ah | 0;
+ Bl = Al | 0;
+ const All = u64.add3L(T1l, sigma0l, MAJl);
+ Ah = u64.add3H(All, T1h, sigma0h, MAJh);
+ Al = All | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
+ ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
+ ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
+ ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
+ ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
+ ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
+ ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
+ ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
+ }
+ roundClean() {
+ clean(SHA512_W_H, SHA512_W_L);
+ }
+ destroy() {
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+/** Internal SHA2-512 hash class. */
+export class _SHA512 extends SHA2_64B {
+ Ah = SHA512_IV[0] | 0;
+ Al = SHA512_IV[1] | 0;
+ Bh = SHA512_IV[2] | 0;
+ Bl = SHA512_IV[3] | 0;
+ Ch = SHA512_IV[4] | 0;
+ Cl = SHA512_IV[5] | 0;
+ Dh = SHA512_IV[6] | 0;
+ Dl = SHA512_IV[7] | 0;
+ Eh = SHA512_IV[8] | 0;
+ El = SHA512_IV[9] | 0;
+ Fh = SHA512_IV[10] | 0;
+ Fl = SHA512_IV[11] | 0;
+ Gh = SHA512_IV[12] | 0;
+ Gl = SHA512_IV[13] | 0;
+ Hh = SHA512_IV[14] | 0;
+ Hl = SHA512_IV[15] | 0;
+ constructor() {
+ super(64);
+ }
+}
+/** Internal SHA2-384 hash class. */
+export class _SHA384 extends SHA2_64B {
+ Ah = SHA384_IV[0] | 0;
+ Al = SHA384_IV[1] | 0;
+ Bh = SHA384_IV[2] | 0;
+ Bl = SHA384_IV[3] | 0;
+ Ch = SHA384_IV[4] | 0;
+ Cl = SHA384_IV[5] | 0;
+ Dh = SHA384_IV[6] | 0;
+ Dl = SHA384_IV[7] | 0;
+ Eh = SHA384_IV[8] | 0;
+ El = SHA384_IV[9] | 0;
+ Fh = SHA384_IV[10] | 0;
+ Fl = SHA384_IV[11] | 0;
+ Gh = SHA384_IV[12] | 0;
+ Gl = SHA384_IV[13] | 0;
+ Hh = SHA384_IV[14] | 0;
+ Hl = SHA384_IV[15] | 0;
+ constructor() {
+ super(48);
+ }
+}
+/**
+ * Truncated SHA512/256 and SHA512/224.
+ * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
+ * Then t hashes string to produce result IV.
+ * See `test/misc/sha2-gen-iv.js`.
+ */
+/** SHA512/224 IV */
+const T224_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,
+ 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,
+]);
+/** SHA512/256 IV */
+const T256_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,
+ 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,
+]);
+/** Internal SHA2-512/224 hash class. */
+export class _SHA512_224 extends SHA2_64B {
+ Ah = T224_IV[0] | 0;
+ Al = T224_IV[1] | 0;
+ Bh = T224_IV[2] | 0;
+ Bl = T224_IV[3] | 0;
+ Ch = T224_IV[4] | 0;
+ Cl = T224_IV[5] | 0;
+ Dh = T224_IV[6] | 0;
+ Dl = T224_IV[7] | 0;
+ Eh = T224_IV[8] | 0;
+ El = T224_IV[9] | 0;
+ Fh = T224_IV[10] | 0;
+ Fl = T224_IV[11] | 0;
+ Gh = T224_IV[12] | 0;
+ Gl = T224_IV[13] | 0;
+ Hh = T224_IV[14] | 0;
+ Hl = T224_IV[15] | 0;
+ constructor() {
+ super(28);
+ }
+}
+/** Internal SHA2-512/256 hash class. */
+export class _SHA512_256 extends SHA2_64B {
+ Ah = T256_IV[0] | 0;
+ Al = T256_IV[1] | 0;
+ Bh = T256_IV[2] | 0;
+ Bl = T256_IV[3] | 0;
+ Ch = T256_IV[4] | 0;
+ Cl = T256_IV[5] | 0;
+ Dh = T256_IV[6] | 0;
+ Dl = T256_IV[7] | 0;
+ Eh = T256_IV[8] | 0;
+ El = T256_IV[9] | 0;
+ Fh = T256_IV[10] | 0;
+ Fl = T256_IV[11] | 0;
+ Gh = T256_IV[12] | 0;
+ Gl = T256_IV[13] | 0;
+ Hh = T256_IV[14] | 0;
+ Hl = T256_IV[15] | 0;
+ constructor() {
+ super(32);
+ }
+}
+/**
+ * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
+ *
+ * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
+ * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
+ * - Each sha256 hash is executing 2^18 bit operations.
+ * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
+ */
+export const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(),
+/* @__PURE__ */ oidNist(0x01));
+/** SHA2-224 hash function from RFC 4634 */
+export const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(),
+/* @__PURE__ */ oidNist(0x04));
+/** SHA2-512 hash function from RFC 4634. */
+export const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(),
+/* @__PURE__ */ oidNist(0x03));
+/** SHA2-384 hash function from RFC 4634. */
+export const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(),
+/* @__PURE__ */ oidNist(0x02));
+/**
+ * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(),
+/* @__PURE__ */ oidNist(0x06));
+/**
+ * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(),
+/* @__PURE__ */ oidNist(0x05));
+//# sourceMappingURL=sha2.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha2.js.map b/server/node_modules/@noble/hashes/sha2.js.map
new file mode 100644
index 0000000..4ddb77e
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha2.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha2.js","sourceRoot":"","sources":["src/sha2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAc,KAAK,EAAE,YAAY,EAAE,OAAO,EAA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AGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAuB,eAAe,CAAC,YAAY,CACxE,GAAG,EAAE,CAAC,IAAI,WAAW,EAAE;AACvB,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAC9B,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3-addons.d.ts b/server/node_modules/@noble/hashes/sha3-addons.d.ts
new file mode 100644
index 0000000..32bc523
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3-addons.d.ts
@@ -0,0 +1,149 @@
+/**
+ * SHA3 (keccak) addons.
+ *
+ * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from
+ * [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf)
+ * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from
+ * [k12-draft-17](https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/17/)
+ * * KeccakPRG: Pseudo-random generator based on Keccak [(pdf)](https://keccak.team/files/CSF-0.1.pdf)
+ * @module
+ */
+import { Keccak, type ShakeOpts } from './sha3.ts';
+import { type CHash, type CHashXOF, type Hash, type HashXOF, type KDFInput, type PRG } from './utils.ts';
+export type cShakeOpts = ShakeOpts & {
+ personalization?: Uint8Array;
+ NISTfn?: KDFInput;
+};
+export type ITupleHash = {
+ (messages: Uint8Array[], opts?: cShakeOpts): Uint8Array;
+ create(opts?: cShakeOpts): _TupleHash;
+};
+/** 128-bit NIST cSHAKE XOF. */
+export declare const cshake128: CHashXOF;
+/** 256-bit NIST cSHAKE XOF. */
+export declare const cshake256: CHashXOF;
+/** Internal KMAC mac class. */
+export declare class _KMAC extends Keccak implements HashXOF<_KMAC> {
+ constructor(blockLen: number, outputLen: number, enableXOF: boolean, key: Uint8Array, opts?: cShakeOpts);
+ protected finish(): void;
+ _cloneInto(to?: _KMAC): _KMAC;
+ clone(): _KMAC;
+}
+export type IKMAC = {
+ (key: Uint8Array, message: Uint8Array, opts?: KangarooOpts): Uint8Array;
+ create(key: Uint8Array, opts?: cShakeOpts): _KMAC;
+};
+/** 128-bit Keccak MAC. */
+export declare const kmac128: IKMAC;
+/** 256-bit Keccak MAC. */
+export declare const kmac256: IKMAC;
+/** 128-bit Keccak-MAC XOF. */
+export declare const kmac128xof: IKMAC;
+/** 256-bit Keccak-MAC XOF. */
+export declare const kmac256xof: IKMAC;
+/** Internal TupleHash class. */
+export declare class _TupleHash extends Keccak implements HashXOF<_TupleHash> {
+ constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts?: cShakeOpts);
+ protected finish(): void;
+ _cloneInto(to?: _TupleHash): _TupleHash;
+ clone(): _TupleHash;
+}
+/** 128-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export declare const tuplehash128: ITupleHash;
+/** 256-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export declare const tuplehash256: ITupleHash;
+/** 128-bit TupleHASH XOF. */
+export declare const tuplehash128xof: ITupleHash;
+/** 256-bit TupleHASH XOF. */
+export declare const tuplehash256xof: ITupleHash;
+type ParallelOpts = KangarooOpts & {
+ blockLen?: number;
+};
+/** Internal Parallel Keccak Hash class. */
+export declare class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> {
+ private leafHash?;
+ protected leafCons: () => Hash;
+ private chunkPos;
+ private chunksDone;
+ private chunkLen;
+ constructor(blockLen: number, outputLen: number, leafCons: () => Hash, enableXOF: boolean, opts?: ParallelOpts);
+ protected finish(): void;
+ _cloneInto(to?: _ParallelHash): _ParallelHash;
+ destroy(): void;
+ clone(): _ParallelHash;
+}
+/** 128-bit ParallelHash. In JS, it is not parallel. */
+export declare const parallelhash128: CHash;
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export declare const parallelhash256: CHash;
+/** 128-bit ParallelHash XOF. In JS, it is not parallel. */
+export declare const parallelhash128xof: CHashXOF;
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export declare const parallelhash256xof: CHashXOF;
+/** D means Domain separation byte */
+export type TurboshakeOpts = ShakeOpts & {
+ D?: number;
+};
+/**
+ * TurboSHAKE 128-bit: reduced 12-round keccak.
+ * Should've been a simple "shake with 12 rounds", but we got a whole new spec about Turbo SHAKE Pro MAX.
+ */
+export declare const turboshake128: CHashXOF;
+/** TurboSHAKE 256-bit: reduced 12-round keccak. */
+export declare const turboshake256: CHashXOF;
+/** K12 options. */
+export type KangarooOpts = {
+ dkLen?: number;
+ personalization?: Uint8Array;
+};
+/** Internal K12 hash class. */
+export declare class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> {
+ readonly chunkLen = 8192;
+ private leafHash?;
+ protected leafLen: number;
+ private personalization;
+ private chunkPos;
+ private chunksDone;
+ constructor(blockLen: number, leafLen: number, outputLen: number, rounds: number, opts: KangarooOpts);
+ update(data: Uint8Array): this;
+ protected finish(): void;
+ destroy(): void;
+ _cloneInto(to?: _KangarooTwelve): _KangarooTwelve;
+ clone(): _KangarooTwelve;
+}
+/** 128-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export declare const kt128: CHash<_KangarooTwelve, KangarooOpts>;
+/** 256-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export declare const kt256: CHash<_KangarooTwelve, KangarooOpts>;
+/** KangarooTwelve-based MAC options. */
+export type HopMAC = (key: Uint8Array, message: Uint8Array, personalization: Uint8Array, dkLen?: number) => Uint8Array;
+/**
+ * 128-bit KangarooTwelve-based MAC.
+ *
+ * These untested (there is no test vectors or implementation available). Use at your own risk.
+ * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L)
+ * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L)
+ */
+export declare const HopMAC128: HopMAC;
+/** 256-bit KangarooTwelve-based MAC. */
+export declare const HopMAC256: HopMAC;
+/**
+ * More at https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG.
+ */
+export declare class _KeccakPRG extends Keccak implements PRG {
+ protected rate: number;
+ constructor(capacity: number);
+ protected keccak(): void;
+ update(data: Uint8Array): this;
+ protected finish(): void;
+ digestInto(_out: Uint8Array): Uint8Array;
+ addEntropy(seed: Uint8Array): void;
+ randomBytes(length: number): Uint8Array;
+ clean(): void;
+ _cloneInto(to?: _KeccakPRG): _KeccakPRG;
+ clone(): _KeccakPRG;
+}
+/** KeccakPRG: Pseudo-random generator based on Keccak. https://keccak.team/files/CSF-0.1.pdf */
+export declare const keccakprg: (capacity?: number) => _KeccakPRG;
+export {};
+//# sourceMappingURL=sha3-addons.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3-addons.d.ts.map b/server/node_modules/@noble/hashes/sha3-addons.d.ts.map
new file mode 100644
index 0000000..ed38b7c
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3-addons.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha3-addons.d.ts","sourceRoot":"","sources":["src/sha3-addons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,QAAQ,EAEb,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,KAAK,QAAQ,EAEb,KAAK,GAAG,EAET,MAAM,YAAY,CAAC;AAqCpB,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IAAE,eAAe,CAAC,EAAE,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAyBzF,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACxD,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CACvC,CAAC;AACF,+BAA+B;AAC/B,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAA4C,CAAC;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AE,UAAU,EACf,OAAO,EAAE,UAAU,EACnB,eAAe,EAAE,UAAU,EAC3B,KAAK,CAAC,EAAE,MAAM,KACX,UAAU,CAAC;AAMhB;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,MAAyC,CAAC;AAClE,wCAAwC;AACxC,eAAO,MAAM,SAAS,EAAE,MAAyC,CAAC;AAElE;;GAEG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,GAAG;IACnD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBACX,QAAQ,EAAE,MAAM;IAW5B,SAAS,CAAC,MAAM,IAAI,IAAI;IAQxB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK9B,SAAS,CAAC,MAAM,IAAI,IAAI;IACxB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU;IAGxC,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAGlC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAGvC,KAAK,IAAI,IAAI;IAQb,UAAU,CAAC,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU;IAOvC,KAAK,IAAI,UAAU;CAGpB;AAED,gGAAgG;AAChG,eAAO,MAAM,SAAS,GAAI,iBAAc,KAAG,UAAsC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3-addons.js b/server/node_modules/@noble/hashes/sha3-addons.js
new file mode 100644
index 0000000..50e34ad
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3-addons.js
@@ -0,0 +1,420 @@
+/**
+ * SHA3 (keccak) addons.
+ *
+ * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from
+ * [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf)
+ * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from
+ * [k12-draft-17](https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/17/)
+ * * KeccakPRG: Pseudo-random generator based on Keccak [(pdf)](https://keccak.team/files/CSF-0.1.pdf)
+ * @module
+ */
+import { Keccak } from "./sha3.js";
+import { abytes, anumber, createHasher, kdfInputToBytes, u32, } from "./utils.js";
+// cSHAKE && KMAC (NIST SP800-185)
+const _8n = /* @__PURE__ */ BigInt(8);
+const _ffn = /* @__PURE__ */ BigInt(0xff);
+// It is safe to use bigints here, since they used only for length encoding (not actual data).
+// We use bigints in sha256 for lengths too.
+function leftEncode(n) {
+ n = BigInt(n);
+ const res = [Number(n & _ffn)];
+ n >>= _8n;
+ for (; n > 0; n >>= _8n)
+ res.unshift(Number(n & _ffn));
+ res.unshift(res.length);
+ return new Uint8Array(res);
+}
+function rightEncode(n) {
+ n = BigInt(n);
+ const res = [Number(n & _ffn)];
+ n >>= _8n;
+ for (; n > 0; n >>= _8n)
+ res.unshift(Number(n & _ffn));
+ res.push(res.length);
+ return new Uint8Array(res);
+}
+function chooseLen(opts, outputLen) {
+ return opts.dkLen === undefined ? outputLen : opts.dkLen;
+}
+const abytesOrZero = (buf, title = '') => {
+ if (buf === undefined)
+ return EMPTY_BUFFER;
+ abytes(buf, undefined, title);
+ return buf;
+};
+// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block
+const getPadding = (len, block) => new Uint8Array((block - (len % block)) % block);
+// Personalization
+function cshakePers(hash, opts = {}) {
+ if (!opts || (opts.personalization === undefined && opts.NISTfn === undefined))
+ return hash;
+ // Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later)
+ // bytepad(encode_string(N) || encode_string(S), 168)
+ const blockLenBytes = leftEncode(hash.blockLen);
+ const fn = opts.NISTfn === undefined ? EMPTY_BUFFER : kdfInputToBytes(opts.NISTfn);
+ const fnLen = leftEncode(_8n * BigInt(fn.length)); // length in bits
+ const pers = abytesOrZero(opts.personalization, 'personalization');
+ const persLen = leftEncode(_8n * BigInt(pers.length)); // length in bits
+ if (!fn.length && !pers.length)
+ return hash;
+ hash.suffix = 0x04;
+ hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers);
+ let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length;
+ hash.update(getPadding(totalLen, hash.blockLen));
+ return hash;
+}
+const gencShake = (suffix, blockLen, outputLen) => createHasher((opts = {}) => cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts));
+/** 128-bit NIST cSHAKE XOF. */
+export const cshake128 = /* @__PURE__ */ gencShake(0x1f, 168, 16);
+/** 256-bit NIST cSHAKE XOF. */
+export const cshake256 = /* @__PURE__ */ gencShake(0x1f, 136, 32);
+/** Internal KMAC mac class. */
+export class _KMAC extends Keccak {
+ constructor(blockLen, outputLen, enableXOF, key, opts = {}) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization });
+ abytes(key, undefined, 'key');
+ // 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L).
+ const blockLenBytes = leftEncode(this.blockLen);
+ const keyLen = leftEncode(_8n * BigInt(key.length));
+ this.update(blockLenBytes).update(keyLen).update(key);
+ const totalLen = blockLenBytes.length + keyLen.length + key.length;
+ this.update(getPadding(totalLen, this.blockLen));
+ }
+ finish() {
+ if (!this.finished)
+ this.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to) {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ // Force "to" to be instance of KMAC instead of Sha3.
+ if (!to) {
+ to = Object.create(Object.getPrototypeOf(this), {});
+ to.state = this.state.slice();
+ to.blockLen = this.blockLen;
+ to.state32 = u32(to.state);
+ }
+ return super._cloneInto(to);
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+function genKmac(blockLen, outputLen, xof = false) {
+ const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest();
+ kmac.create = (key, opts = {}) => new _KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts);
+ return kmac;
+}
+/** 128-bit Keccak MAC. */
+export const kmac128 = /* @__PURE__ */ genKmac(168, 16);
+/** 256-bit Keccak MAC. */
+export const kmac256 = /* @__PURE__ */ genKmac(136, 32);
+/** 128-bit Keccak-MAC XOF. */
+export const kmac128xof = /* @__PURE__ */ genKmac(168, 16, true);
+/** 256-bit Keccak-MAC XOF. */
+export const kmac256xof = /* @__PURE__ */ genKmac(136, 32, true);
+/** Internal TupleHash class. */
+export class _TupleHash extends Keccak {
+ constructor(blockLen, outputLen, enableXOF, opts = {}) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization });
+ // Change update after cshake processed
+ this.update = (data) => {
+ abytes(data);
+ super.update(leftEncode(_8n * BigInt(data.length)));
+ super.update(data);
+ return this;
+ };
+ }
+ finish() {
+ if (!this.finished)
+ super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to) {
+ to ||= new _TupleHash(this.blockLen, this.outputLen, this.enableXOF);
+ return super._cloneInto(to);
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+function genTuple(blockLen, outputLen, xof = false) {
+ const tuple = (messages, opts) => {
+ const h = tuple.create(opts);
+ if (!Array.isArray(messages))
+ throw new Error('expected array of messages');
+ for (const msg of messages)
+ h.update(msg);
+ return h.digest();
+ };
+ tuple.create = (opts = {}) => new _TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts);
+ return tuple;
+}
+/** 128-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export const tuplehash128 = /* @__PURE__ */ genTuple(168, 16);
+/** 256-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export const tuplehash256 = /* @__PURE__ */ genTuple(136, 32);
+/** 128-bit TupleHASH XOF. */
+export const tuplehash128xof = /* @__PURE__ */ genTuple(168, 16, true);
+/** 256-bit TupleHASH XOF. */
+export const tuplehash256xof = /* @__PURE__ */ genTuple(136, 32, true);
+/** Internal Parallel Keccak Hash class. */
+export class _ParallelHash extends Keccak {
+ leafHash;
+ leafCons;
+ chunkPos = 0; // Position of current block in chunk
+ chunksDone = 0; // How many chunks we already have
+ chunkLen;
+ constructor(blockLen, outputLen, leafCons, enableXOF, opts = {}) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization });
+ this.leafCons = leafCons;
+ let { blockLen: B = 8 } = opts;
+ anumber(B);
+ this.chunkLen = B;
+ super.update(leftEncode(B));
+ // Change update after cshake processed
+ this.update = (data) => {
+ abytes(data);
+ const { chunkLen, leafCons } = this;
+ for (let pos = 0, len = data.length; pos < len;) {
+ if (this.chunkPos == chunkLen || !this.leafHash) {
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ this.chunksDone++;
+ }
+ this.leafHash = leafCons();
+ this.chunkPos = 0;
+ }
+ const take = Math.min(chunkLen - this.chunkPos, len - pos);
+ this.leafHash.update(data.subarray(pos, pos + take));
+ this.chunkPos += take;
+ pos += take;
+ }
+ return this;
+ };
+ }
+ finish() {
+ if (this.finished)
+ return;
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ this.chunksDone++;
+ }
+ super.update(rightEncode(this.chunksDone));
+ super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to) {
+ to ||= new _ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF);
+ if (this.leafHash)
+ to.leafHash = this.leafHash._cloneInto(to.leafHash);
+ to.chunkPos = this.chunkPos;
+ to.chunkLen = this.chunkLen;
+ to.chunksDone = this.chunksDone;
+ return super._cloneInto(to);
+ }
+ destroy() {
+ super.destroy.call(this);
+ if (this.leafHash)
+ this.leafHash.destroy();
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+function genPrl(blockLen, outputLen, leaf, xof = false) {
+ const parallel = (message, opts) => parallel.create(opts).update(message).digest();
+ parallel.create = (opts = {}) => new _ParallelHash(blockLen, chooseLen(opts, outputLen), () => leaf.create({ dkLen: 2 * outputLen }), xof, opts);
+ parallel.outputLen = outputLen;
+ parallel.blockLen = blockLen;
+ return parallel;
+}
+/** 128-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash128 = /* @__PURE__ */ genPrl(168, 16, cshake128);
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash256 = /* @__PURE__ */ genPrl(136, 32, cshake256);
+/** 128-bit ParallelHash XOF. In JS, it is not parallel. */
+export const parallelhash128xof = /* @__PURE__ */ genPrl(168, 16, cshake128, true);
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash256xof = /* @__PURE__ */ genPrl(136, 32, cshake256, true);
+const genTurbo = (blockLen, outputLen) => createHasher((opts = {}) => {
+ const D = opts.D === undefined ? 0x1f : opts.D;
+ // Section 2.1 of https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/17/
+ if (!Number.isSafeInteger(D) || D < 0x01 || D > 0x7f)
+ throw new Error('"D" (domain separation byte) must be 0x01..0x7f, got: ' + D);
+ return new Keccak(blockLen, D, opts.dkLen === undefined ? outputLen : opts.dkLen, true, 12);
+});
+/**
+ * TurboSHAKE 128-bit: reduced 12-round keccak.
+ * Should've been a simple "shake with 12 rounds", but we got a whole new spec about Turbo SHAKE Pro MAX.
+ */
+export const turboshake128 = /* @__PURE__ */ genTurbo(168, 32);
+/** TurboSHAKE 256-bit: reduced 12-round keccak. */
+export const turboshake256 = /* @__PURE__ */ genTurbo(136, 64);
+// Same as NIST rightEncode, but returns [0] for zero string
+function rightEncodeK12(n) {
+ n = BigInt(n);
+ const res = [];
+ for (; n > 0; n >>= _8n)
+ res.unshift(Number(n & _ffn));
+ res.push(res.length);
+ return Uint8Array.from(res);
+}
+const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
+/** Internal K12 hash class. */
+export class _KangarooTwelve extends Keccak {
+ chunkLen = 8192;
+ leafHash;
+ leafLen;
+ personalization;
+ chunkPos = 0; // Position of current block in chunk
+ chunksDone = 0; // How many chunks we already have
+ constructor(blockLen, leafLen, outputLen, rounds, opts) {
+ super(blockLen, 0x07, outputLen, true, rounds);
+ this.leafLen = leafLen;
+ this.personalization = abytesOrZero(opts.personalization, 'personalization');
+ }
+ update(data) {
+ abytes(data);
+ const { chunkLen, blockLen, leafLen, rounds } = this;
+ for (let pos = 0, len = data.length; pos < len;) {
+ if (this.chunkPos == chunkLen) {
+ if (this.leafHash)
+ super.update(this.leafHash.digest());
+ else {
+ this.suffix = 0x06; // Its safe to change suffix here since its used only in digest()
+ super.update(Uint8Array.from([3, 0, 0, 0, 0, 0, 0, 0]));
+ }
+ this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds);
+ this.chunksDone++;
+ this.chunkPos = 0;
+ }
+ const take = Math.min(chunkLen - this.chunkPos, len - pos);
+ const chunk = data.subarray(pos, pos + take);
+ if (this.leafHash)
+ this.leafHash.update(chunk);
+ else
+ super.update(chunk);
+ this.chunkPos += take;
+ pos += take;
+ }
+ return this;
+ }
+ finish() {
+ if (this.finished)
+ return;
+ const { personalization } = this;
+ this.update(personalization).update(rightEncodeK12(personalization.length));
+ // Leaf hash
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ super.update(rightEncodeK12(this.chunksDone));
+ super.update(Uint8Array.from([0xff, 0xff]));
+ }
+ super.finish.call(this);
+ }
+ destroy() {
+ super.destroy.call(this);
+ if (this.leafHash)
+ this.leafHash.destroy();
+ // We cannot zero personalization buffer since it is user provided and we don't want to mutate user input
+ this.personalization = EMPTY_BUFFER;
+ }
+ _cloneInto(to) {
+ const { blockLen, leafLen, leafHash, outputLen, rounds } = this;
+ to ||= new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, {});
+ super._cloneInto(to);
+ if (leafHash)
+ to.leafHash = leafHash._cloneInto(to.leafHash);
+ to.personalization.set(this.personalization);
+ to.leafLen = this.leafLen;
+ to.chunkPos = this.chunkPos;
+ to.chunksDone = this.chunksDone;
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+/** 128-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export const kt128 = /* @__PURE__ */ createHasher((opts = {}) => new _KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts));
+/** 256-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export const kt256 = /* @__PURE__ */ createHasher((opts = {}) => new _KangarooTwelve(136, 64, chooseLen(opts, 64), 12, opts));
+const genHopMAC = (hash) => (key, message, personalization, dkLen) => hash(key, { personalization: hash(message, { personalization }), dkLen });
+/**
+ * 128-bit KangarooTwelve-based MAC.
+ *
+ * These untested (there is no test vectors or implementation available). Use at your own risk.
+ * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L)
+ * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L)
+ */
+export const HopMAC128 = /* @__PURE__ */ genHopMAC(kt128);
+/** 256-bit KangarooTwelve-based MAC. */
+export const HopMAC256 = /* @__PURE__ */ genHopMAC(kt256);
+/**
+ * More at https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG.
+ */
+export class _KeccakPRG extends Keccak {
+ rate;
+ constructor(capacity) {
+ anumber(capacity);
+ const rate = 1600 - capacity;
+ const rho = rate - 2;
+ // Rho must be full bytes
+ if (capacity < 0 || capacity > 1600 - 10 || rho % 8)
+ throw new Error('invalid capacity');
+ // blockLen = rho in bytes
+ super(rho / 8, 0, 0, true);
+ this.rate = rate;
+ this.posOut = Math.floor((rate + 7) / 8);
+ }
+ keccak() {
+ // Duplex padding
+ this.state[this.pos] ^= 0x01;
+ this.state[this.blockLen] ^= 0x02; // Rho is full bytes
+ super.keccak();
+ this.pos = 0;
+ this.posOut = 0;
+ }
+ update(data) {
+ super.update(data);
+ this.posOut = this.blockLen;
+ return this;
+ }
+ finish() { }
+ digestInto(_out) {
+ throw new Error('digest is not allowed, use .fetch instead');
+ }
+ addEntropy(seed) {
+ this.update(seed);
+ }
+ randomBytes(length) {
+ return this.xof(length);
+ }
+ clean() {
+ if (this.rate < 1600 / 2 + 1)
+ throw new Error('rate is too low to use .forget()');
+ this.keccak();
+ for (let i = 0; i < this.blockLen; i++)
+ this.state[i] = 0;
+ this.pos = this.blockLen;
+ this.keccak();
+ this.posOut = this.blockLen;
+ }
+ _cloneInto(to) {
+ const { rate } = this;
+ to ||= new _KeccakPRG(1600 - rate);
+ super._cloneInto(to);
+ to.rate = rate;
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+}
+/** KeccakPRG: Pseudo-random generator based on Keccak. https://keccak.team/files/CSF-0.1.pdf */
+export const keccakprg = (capacity = 254) => new _KeccakPRG(capacity);
+//# sourceMappingURL=sha3-addons.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3-addons.js.map b/server/node_modules/@noble/hashes/sha3-addons.js.map
new file mode 100644
index 0000000..f31932f
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3-addons.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha3-addons.js","sourceRoot":"","sources":["src/sha3-addons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAkB,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,MAAM,EACN,OAAO,EAGP,YAAY,EAIZ,eAAe,EAEf,GAAG,GACJ,MAAM,YAAY,CAAC;AAEpB,kCAAkC;AAClC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE1C,8FAA8F;AAC9F,4CAA4C;AAC5C,SAAS,UAAU,CAAC,CAAkB;IACpC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACd,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,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CAAC;IAC9B,CAAC;IACD,UAAU,CAAC,EAAe;QACxB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACtB,EAAE,KAAK,IAAI,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QACnC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACrB,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,gGAAgG;AAChG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAQ,GAAG,GAAG,EAAc,EAAE,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3.d.ts b/server/node_modules/@noble/hashes/sha3.d.ts
new file mode 100644
index 0000000..901eba1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3.d.ts
@@ -0,0 +1,58 @@
+import { type CHash, type CHashXOF, type Hash, type HashXOF } from './utils.ts';
+/** `keccakf1600` internal function, additionally allows to adjust round count. */
+export declare function keccakP(s: Uint32Array, rounds?: number): void;
+/** Keccak sponge function. */
+export declare class Keccak implements Hash, HashXOF {
+ protected state: Uint8Array;
+ protected pos: number;
+ protected posOut: number;
+ protected finished: boolean;
+ protected state32: Uint32Array;
+ protected destroyed: boolean;
+ blockLen: number;
+ suffix: number;
+ outputLen: number;
+ protected enableXOF: boolean;
+ protected rounds: number;
+ constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number);
+ clone(): Keccak;
+ protected keccak(): void;
+ update(data: Uint8Array): this;
+ protected finish(): void;
+ protected writeInto(out: Uint8Array): Uint8Array;
+ xofInto(out: Uint8Array): Uint8Array;
+ xof(bytes: number): Uint8Array;
+ digestInto(out: Uint8Array): Uint8Array;
+ digest(): Uint8Array;
+ destroy(): void;
+ _cloneInto(to?: Keccak): Keccak;
+}
+/** SHA3-224 hash function. */
+export declare const sha3_224: CHash;
+/** SHA3-256 hash function. Different from keccak-256. */
+export declare const sha3_256: CHash;
+/** SHA3-384 hash function. */
+export declare const sha3_384: CHash;
+/** SHA3-512 hash function. */
+export declare const sha3_512: CHash;
+/** keccak-224 hash function. */
+export declare const keccak_224: CHash;
+/** keccak-256 hash function. Different from SHA3-256. */
+export declare const keccak_256: CHash;
+/** keccak-384 hash function. */
+export declare const keccak_384: CHash;
+/** keccak-512 hash function. */
+export declare const keccak_512: CHash;
+/** Options for SHAKE XOF. */
+export type ShakeOpts = {
+ dkLen?: number;
+};
+/** SHAKE128 XOF with 128-bit security. */
+export declare const shake128: CHashXOF;
+/** SHAKE256 XOF with 256-bit security. */
+export declare const shake256: CHashXOF;
+/** SHAKE128 XOF with 256-bit output (NIST version). */
+export declare const shake128_32: CHashXOF;
+/** SHAKE256 XOF with 512-bit output (NIST version). */
+export declare const shake256_64: CHashXOF;
+//# sourceMappingURL=sha3.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3.d.ts.map b/server/node_modules/@noble/hashes/sha3.d.ts.map
new file mode 100644
index 0000000..0d85d5e
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["src/sha3.ts"],"names":[],"mappings":"AAaA,OAAO,EAML,KAAK,KAAK,EAAE,KAAK,QAAQ,EACzB,KAAK,IAAI,EAET,KAAK,OAAO,EACb,MAAM,YAAY,CAAC;AAoCpB,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAyCjE;AAED,8BAA8B;AAC9B,qBAAa,MAAO,YAAW,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IAC1D,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC;IAC5B,SAA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,UAAU,EAAE,KAAgD,CAAC;AAC1E,gCAAgC;AAChC,eAAO,MAAM,UAAU,EAAE,KAAgD,CAAC;AAC1E,gCAAgC;AAChC,eAAO,MAAM,UAAU,EAAE,KAA+C,CAAC;AAEzE,6BAA6B;AAC7B,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAS3C,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAEO,CAAC;AACzD,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAEO,CAAC;AAEzD,uDAAuD;AACvD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAEI,CAAC;AACzD,uDAAuD;AACvD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAEI,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3.js b/server/node_modules/@noble/hashes/sha3.js
new file mode 100644
index 0000000..055bd7b
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3.js
@@ -0,0 +1,254 @@
+/**
+ * SHA3 (keccak) hash function, based on a new "Sponge function" design.
+ * Different from older hashes, the internal state is bigger than output size.
+ *
+ * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),
+ * [Website](https://keccak.team/keccak.html),
+ * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).
+ *
+ * Check out `sha3-addons` module for cSHAKE, k12, and others.
+ * @module
+ */
+import { rotlBH, rotlBL, rotlSH, rotlSL, split } from "./_u64.js";
+// prettier-ignore
+import { abytes, aexists, anumber, aoutput, clean, createHasher, oidNist, swap32IfBE, u32 } from "./utils.js";
+// No __PURE__ annotations in sha3 header:
+// EVERYTHING is in fact used on every export.
+// Various per round constants calculations
+const _0n = BigInt(0);
+const _1n = BigInt(1);
+const _2n = BigInt(2);
+const _7n = BigInt(7);
+const _256n = BigInt(256);
+const _0x71n = BigInt(0x71);
+const SHA3_PI = [];
+const SHA3_ROTL = [];
+const _SHA3_IOTA = []; // no pure annotation: var is always used
+for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
+ // Pi
+ [x, y] = [y, (2 * x + 3 * y) % 5];
+ SHA3_PI.push(2 * (5 * y + x));
+ // Rotational
+ SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
+ // Iota
+ let t = _0n;
+ for (let j = 0; j < 7; j++) {
+ R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
+ if (R & _2n)
+ t ^= _1n << ((_1n << BigInt(j)) - _1n);
+ }
+ _SHA3_IOTA.push(t);
+}
+const IOTAS = split(_SHA3_IOTA, true);
+const SHA3_IOTA_H = IOTAS[0];
+const SHA3_IOTA_L = IOTAS[1];
+// Left rotation (without 0, 32, 64)
+const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
+const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
+/** `keccakf1600` internal function, additionally allows to adjust round count. */
+export function keccakP(s, rounds = 24) {
+ const B = new Uint32Array(5 * 2);
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
+ for (let round = 24 - rounds; round < 24; round++) {
+ // Theta θ
+ for (let x = 0; x < 10; x++)
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
+ for (let x = 0; x < 10; x += 2) {
+ const idx1 = (x + 8) % 10;
+ const idx0 = (x + 2) % 10;
+ const B0 = B[idx0];
+ const B1 = B[idx0 + 1];
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
+ for (let y = 0; y < 50; y += 10) {
+ s[x + y] ^= Th;
+ s[x + y + 1] ^= Tl;
+ }
+ }
+ // Rho (ρ) and Pi (π)
+ let curH = s[2];
+ let curL = s[3];
+ for (let t = 0; t < 24; t++) {
+ const shift = SHA3_ROTL[t];
+ const Th = rotlH(curH, curL, shift);
+ const Tl = rotlL(curH, curL, shift);
+ const PI = SHA3_PI[t];
+ curH = s[PI];
+ curL = s[PI + 1];
+ s[PI] = Th;
+ s[PI + 1] = Tl;
+ }
+ // Chi (χ)
+ for (let y = 0; y < 50; y += 10) {
+ for (let x = 0; x < 10; x++)
+ B[x] = s[y + x];
+ for (let x = 0; x < 10; x++)
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
+ }
+ // Iota (ι)
+ s[0] ^= SHA3_IOTA_H[round];
+ s[1] ^= SHA3_IOTA_L[round];
+ }
+ clean(B);
+}
+/** Keccak sponge function. */
+export class Keccak {
+ state;
+ pos = 0;
+ posOut = 0;
+ finished = false;
+ state32;
+ destroyed = false;
+ blockLen;
+ suffix;
+ outputLen;
+ enableXOF = false;
+ rounds;
+ // NOTE: we accept arguments in bytes instead of bits here.
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
+ this.blockLen = blockLen;
+ this.suffix = suffix;
+ this.outputLen = outputLen;
+ this.enableXOF = enableXOF;
+ this.rounds = rounds;
+ // Can be passed from user as dkLen
+ anumber(outputLen, 'outputLen');
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
+ // 0 < blockLen < 200
+ if (!(0 < blockLen && blockLen < 200))
+ throw new Error('only keccak-f1600 function is supported');
+ this.state = new Uint8Array(200);
+ this.state32 = u32(this.state);
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ keccak() {
+ swap32IfBE(this.state32);
+ keccakP(this.state32, this.rounds);
+ swap32IfBE(this.state32);
+ this.posOut = 0;
+ this.pos = 0;
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { blockLen, state } = this;
+ const len = data.length;
+ for (let pos = 0; pos < len;) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ for (let i = 0; i < take; i++)
+ state[this.pos++] ^= data[pos++];
+ if (this.pos === blockLen)
+ this.keccak();
+ }
+ return this;
+ }
+ finish() {
+ if (this.finished)
+ return;
+ this.finished = true;
+ const { state, suffix, pos, blockLen } = this;
+ // Do the padding
+ state[pos] ^= suffix;
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1)
+ this.keccak();
+ state[blockLen - 1] ^= 0x80;
+ this.keccak();
+ }
+ writeInto(out) {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const bufferOut = this.state;
+ const { blockLen } = this;
+ for (let pos = 0, len = out.length; pos < len;) {
+ if (this.posOut >= blockLen)
+ this.keccak();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out) {
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
+ if (!this.enableXOF)
+ throw new Error('XOF is not possible for this instance');
+ return this.writeInto(out);
+ }
+ xof(bytes) {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out) {
+ aoutput(out, this);
+ if (this.finished)
+ throw new Error('digest() was already called');
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest() {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.state);
+ }
+ _cloneInto(to) {
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
+ to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
+ to.state32.set(this.state32);
+ to.pos = this.pos;
+ to.posOut = this.posOut;
+ to.finished = this.finished;
+ to.rounds = rounds;
+ // Suffix can change in cSHAKE
+ to.suffix = suffix;
+ to.outputLen = outputLen;
+ to.enableXOF = enableXOF;
+ to.destroyed = this.destroyed;
+ return to;
+ }
+}
+const genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);
+/** SHA3-224 hash function. */
+export const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28,
+/* @__PURE__ */ oidNist(0x07));
+/** SHA3-256 hash function. Different from keccak-256. */
+export const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32,
+/* @__PURE__ */ oidNist(0x08));
+/** SHA3-384 hash function. */
+export const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48,
+/* @__PURE__ */ oidNist(0x09));
+/** SHA3-512 hash function. */
+export const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64,
+/* @__PURE__ */ oidNist(0x0a));
+/** keccak-224 hash function. */
+export const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28);
+/** keccak-256 hash function. Different from SHA3-256. */
+export const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32);
+/** keccak-384 hash function. */
+export const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48);
+/** keccak-512 hash function. */
+export const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64);
+const genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), info);
+/** SHAKE128 XOF with 128-bit security. */
+export const shake128 =
+/* @__PURE__ */
+genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));
+/** SHAKE256 XOF with 256-bit security. */
+export const shake256 =
+/* @__PURE__ */
+genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));
+/** SHAKE128 XOF with 256-bit output (NIST version). */
+export const shake128_32 =
+/* @__PURE__ */
+genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));
+/** SHAKE256 XOF with 512-bit output (NIST version). */
+export const shake256_64 =
+/* @__PURE__ */
+genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));
+//# sourceMappingURL=sha3.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/sha3.js.map b/server/node_modules/@noble/hashes/sha3.js.map
new file mode 100644
index 0000000..2a8e80f
--- /dev/null
+++ b/server/node_modules/@noble/hashes/sha3.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sha3.js","sourceRoot":"","sources":["src/sha3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClE,kBAAkB;AAClB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,UAAU,EACV,GAAG,EAKJ,MAAM,YAAY,CAAC;AAEpB,0CAA0C;AAC1C,8CAA8C;AAC9C,2CAA2C;AAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACtB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,MAAM,OAAO,GAAa,EAAE,CAAC;AAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;AAC/B,MAAM,UAAU,GAAa,EAAE,CAAC,CAAC,yCAAyC;AAC1E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;IAC/D,KAAK;IACL,CAAC,CAAC,EAAE,CAAC,CAAC,G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AAC,CAAC;AACzD,0CAA0C;AAC1C,MAAM,CAAC,MAAM,QAAQ;AACnB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAEzD,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW;AACtB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW;AACtB,eAAe;AACf,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/src/_blake.ts b/server/node_modules/@noble/hashes/src/_blake.ts
new file mode 100644
index 0000000..2df27be
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/_blake.ts
@@ -0,0 +1,50 @@
+/**
+ * Internal helpers for blake hash.
+ * @module
+ */
+import { rotr } from './utils.ts';
+
+/**
+ * Internal blake variable.
+ * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
+ */
+// prettier-ignore
+export const BSIGMA: Uint8Array = /* @__PURE__ */ Uint8Array.from([
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
+ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
+ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
+ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
+ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
+ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,
+ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,
+ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,
+ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
+ // Blake1, unused in others
+ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
+ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
+ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
+ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
+]);
+
+// prettier-ignore
+export type Num4 = { a: number; b: number; c: number; d: number; };
+
+// Mixing function G splitted in two halfs
+export function G1s(a: number, b: number, c: number, d: number, x: number): Num4 {
+ a = (a + b + x) | 0;
+ d = rotr(d ^ a, 16);
+ c = (c + d) | 0;
+ b = rotr(b ^ c, 12);
+ return { a, b, c, d };
+}
+
+export function G2s(a: number, b: number, c: number, d: number, x: number): Num4 {
+ a = (a + b + x) | 0;
+ d = rotr(d ^ a, 8);
+ c = (c + d) | 0;
+ b = rotr(b ^ c, 7);
+ return { a, b, c, d };
+}
diff --git a/server/node_modules/@noble/hashes/src/_md.ts b/server/node_modules/@noble/hashes/src/_md.ts
new file mode 100644
index 0000000..59474b1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/_md.ts
@@ -0,0 +1,156 @@
+/**
+ * Internal Merkle-Damgard hash utils.
+ * @module
+ */
+import { abytes, aexists, aoutput, clean, createView, type Hash } from './utils.ts';
+
+/** Choice: a ? b : c */
+export function Chi(a: number, b: number, c: number): number {
+ return (a & b) ^ (~a & c);
+}
+
+/** Majority function, true if any two inputs is true. */
+export function Maj(a: number, b: number, c: number): number {
+ return (a & b) ^ (a & c) ^ (b & c);
+}
+
+/**
+ * Merkle-Damgard hash construction base class.
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
+ */
+export abstract class HashMD> implements Hash {
+ protected abstract process(buf: DataView, offset: number): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+ abstract destroy(): void;
+ protected abstract roundClean(): void;
+
+ readonly blockLen: number;
+ readonly outputLen: number;
+ readonly padOffset: number;
+ readonly isLE: boolean;
+
+ // For partial updates less than block size
+ protected buffer: Uint8Array;
+ protected view: DataView;
+ protected finished = false;
+ protected length = 0;
+ protected pos = 0;
+ protected destroyed = false;
+
+ constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) {
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.padOffset = padOffset;
+ this.isLE = isLE;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ }
+ update(data: Uint8Array): this {
+ aexists(this);
+ abytes(data);
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ for (let pos = 0; pos < len; ) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ const dataView = createView(data);
+ for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.process(view, 0);
+ this.pos = 0;
+ }
+ }
+ this.length += data.length;
+ this.roundClean();
+ return this;
+ }
+ digestInto(out: Uint8Array): void {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ // We can avoid allocation of buffer for padding completely if it
+ // was previously not allocated here. But it won't change performance.
+ const { buffer, view, blockLen, isLE } = this;
+ let { pos } = this;
+ // append the bit '1' to the message
+ buffer[pos++] = 0b10000000;
+ clean(this.buffer.subarray(pos));
+ // we have less than padOffset left in buffer, so we cannot put length in
+ // current block, need process it and pad again
+ if (this.padOffset > blockLen - pos) {
+ this.process(view, 0);
+ pos = 0;
+ }
+ // Pad until full block byte with zeros
+ for (let i = pos; i < blockLen; i++) buffer[i] = 0;
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
+ // So we just write lowest 64 bits of that value.
+ view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
+ this.process(view, 0);
+ const oview = createView(out);
+ const len = this.outputLen;
+ // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
+ if (len % 4) throw new Error('_sha2: outputLen must be aligned to 32bit');
+ const outLen = len / 4;
+ const state = this.get();
+ if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');
+ for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
+ }
+ digest(): Uint8Array {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to?: T): T {
+ to ||= new (this.constructor as any)() as T;
+ to.set(...this.get());
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ if (length % blockLen) to.buffer.set(buffer);
+ return to as unknown as any;
+ }
+ clone(): T {
+ return this._cloneInto();
+ }
+}
+
+/**
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
+ */
+
+/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
+export const SHA256_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
+]);
+
+/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */
+export const SHA224_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,
+]);
+
+/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */
+export const SHA384_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([
+ 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,
+ 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,
+]);
+
+/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */
+export const SHA512_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,
+ 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,
+]);
diff --git a/server/node_modules/@noble/hashes/src/_u64.ts b/server/node_modules/@noble/hashes/src/_u64.ts
new file mode 100644
index 0000000..703c7da
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/_u64.ts
@@ -0,0 +1,91 @@
+/**
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
+ * @todo re-check https://issues.chromium.org/issues/42212588
+ * @module
+ */
+const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
+const _32n = /* @__PURE__ */ BigInt(32);
+
+function fromBig(
+ n: bigint,
+ le = false
+): {
+ h: number;
+ l: number;
+} {
+ if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
+ return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
+}
+
+function split(lst: bigint[], le = false): Uint32Array[] {
+ const len = lst.length;
+ let Ah = new Uint32Array(len);
+ let Al = new Uint32Array(len);
+ for (let i = 0; i < len; i++) {
+ const { h, l } = fromBig(lst[i], le);
+ [Ah[i], Al[i]] = [h, l];
+ }
+ return [Ah, Al];
+}
+
+const toBig = (h: number, l: number): bigint => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
+// for Shift in [0, 32)
+const shrSH = (h: number, _l: number, s: number): number => h >>> s;
+const shrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s);
+// Right rotate for Shift in [1, 32)
+const rotrSH = (h: number, l: number, s: number): number => (h >>> s) | (l << (32 - s));
+const rotrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s);
+// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotrBH = (h: number, l: number, s: number): number => (h << (64 - s)) | (l >>> (s - 32));
+const rotrBL = (h: number, l: number, s: number): number => (h >>> (s - 32)) | (l << (64 - s));
+// Right rotate for shift===32 (just swaps l&h)
+const rotr32H = (_h: number, l: number): number => l;
+const rotr32L = (h: number, _l: number): number => h;
+// Left rotate for Shift in [1, 32)
+const rotlSH = (h: number, l: number, s: number): number => (h << s) | (l >>> (32 - s));
+const rotlSL = (h: number, l: number, s: number): number => (l << s) | (h >>> (32 - s));
+// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotlBH = (h: number, l: number, s: number): number => (l << (s - 32)) | (h >>> (64 - s));
+const rotlBL = (h: number, l: number, s: number): number => (h << (s - 32)) | (l >>> (64 - s));
+
+// JS uses 32-bit signed integers for bitwise operations which means we cannot
+// simple take carry out of low bit sum by shift, we need to use division.
+function add(
+ Ah: number,
+ Al: number,
+ Bh: number,
+ Bl: number
+): {
+ h: number;
+ l: number;
+} {
+ const l = (Al >>> 0) + (Bl >>> 0);
+ return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
+}
+// Addition with more than 2 elements
+const add3L = (Al: number, Bl: number, Cl: number): number => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
+const add3H = (low: number, Ah: number, Bh: number, Ch: number): number =>
+ (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
+const add4L = (Al: number, Bl: number, Cl: number, Dl: number): number =>
+ (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
+const add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number): number =>
+ (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
+const add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number): number =>
+ (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
+const add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number): number =>
+ (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
+
+// prettier-ignore
+export {
+ add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig
+};
+// prettier-ignore
+const u64: { fromBig: typeof fromBig; split: typeof split; toBig: (h: number, l: number) => bigint; shrSH: (h: number, _l: number, s: number) => number; shrSL: (h: number, l: number, s: number) => number; rotrSH: (h: number, l: number, s: number) => number; rotrSL: (h: number, l: number, s: number) => number; rotrBH: (h: number, l: number, s: number) => number; rotrBL: (h: number, l: number, s: number) => number; rotr32H: (_h: number, l: number) => number; rotr32L: (h: number, _l: number) => number; rotlSH: (h: number, l: number, s: number) => number; rotlSL: (h: number, l: number, s: number) => number; rotlBH: (h: number, l: number, s: number) => number; rotlBL: (h: number, l: number, s: number) => number; add: typeof add; add3L: (Al: number, Bl: number, Cl: number) => number; add3H: (low: number, Ah: number, Bh: number, Ch: number) => number; add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number; add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number; add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number; add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number; } = {
+ fromBig, split, toBig,
+ shrSH, shrSL,
+ rotrSH, rotrSL, rotrBH, rotrBL,
+ rotr32H, rotr32L,
+ rotlSH, rotlSL, rotlBH, rotlBL,
+ add, add3L, add3H, add4L, add4H, add5H, add5L,
+};
+export default u64;
diff --git a/server/node_modules/@noble/hashes/src/argon2.ts b/server/node_modules/@noble/hashes/src/argon2.ts
new file mode 100644
index 0000000..d08e625
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/argon2.ts
@@ -0,0 +1,493 @@
+/**
+ * Argon2 KDF from RFC 9106. Can be used to create a key from password and salt.
+ * We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness:
+ * * argon uses uint64, but JS doesn't have fast uint64array
+ * * uint64 multiplication is 1/3 of time
+ * * `P` function would be very nice with u64, because most of value will be in registers,
+ * hovewer with u32 it will require 32 registers, which is too much.
+ * * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down
+ * @module
+ */
+import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from './_u64.ts';
+import { blake2b } from './blake2.ts';
+import { anumber, clean, kdfInputToBytes, nextTick, u32, u8, type KDFInput } from './utils.ts';
+
+const AT = { Argond2d: 0, Argon2i: 1, Argon2id: 2 } as const;
+type Types = (typeof AT)[keyof typeof AT];
+
+const ARGON2_SYNC_POINTS = 4;
+const abytesOrZero = (buf?: KDFInput, errorTitle = '') => {
+ if (buf === undefined) return Uint8Array.of();
+ return kdfInputToBytes(buf, errorTitle);
+};
+
+// u32 * u32 = u64
+function mul(a: number, b: number) {
+ const aL = a & 0xffff;
+ const aH = a >>> 16;
+ const bL = b & 0xffff;
+ const bH = b >>> 16;
+ const ll = Math.imul(aL, bL);
+ const hl = Math.imul(aH, bL);
+ const lh = Math.imul(aL, bH);
+ const hh = Math.imul(aH, bH);
+ const carry = (ll >>> 16) + (hl & 0xffff) + lh;
+ const high = (hh + (hl >>> 16) + (carry >>> 16)) | 0;
+ const low = (carry << 16) | (ll & 0xffff);
+ return { h: high, l: low };
+}
+
+function mul2(a: number, b: number) {
+ // 2 * a * b (via shifts)
+ const { h, l } = mul(a, b);
+ return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff };
+}
+
+// BlaMka permutation for Argon2
+// A + B + (2 * u32(A) * u32(B))
+function blamka(Ah: number, Al: number, Bh: number, Bl: number) {
+ const { h: Ch, l: Cl } = mul2(Al, Bl);
+ // A + B + (2 * A * B)
+ const Rll = add3L(Al, Bl, Cl);
+ return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 };
+}
+
+// Temporary block buffer
+const A2_BUF = new Uint32Array(256); // 1024 bytes (matrix 16x16)
+
+function G(a: number, b: number, c: number, d: number) {
+ let Al = A2_BUF[2*a], Ah = A2_BUF[2*a + 1]; // prettier-ignore
+ let Bl = A2_BUF[2*b], Bh = A2_BUF[2*b + 1]; // prettier-ignore
+ let Cl = A2_BUF[2*c], Ch = A2_BUF[2*c + 1]; // prettier-ignore
+ let Dl = A2_BUF[2*d], Dh = A2_BUF[2*d + 1]; // prettier-ignore
+
+ ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
+
+ ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
+
+ ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
+
+ ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
+
+ ((A2_BUF[2 * a] = Al), (A2_BUF[2 * a + 1] = Ah));
+ ((A2_BUF[2 * b] = Bl), (A2_BUF[2 * b + 1] = Bh));
+ ((A2_BUF[2 * c] = Cl), (A2_BUF[2 * c + 1] = Ch));
+ ((A2_BUF[2 * d] = Dl), (A2_BUF[2 * d + 1] = Dh));
+}
+
+// prettier-ignore
+function P(
+ v00: number, v01: number, v02: number, v03: number, v04: number, v05: number, v06: number, v07: number,
+ v08: number, v09: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number,
+) {
+ G(v00, v04, v08, v12);
+ G(v01, v05, v09, v13);
+ G(v02, v06, v10, v14);
+ G(v03, v07, v11, v15);
+ G(v00, v05, v10, v15);
+ G(v01, v06, v11, v12);
+ G(v02, v07, v08, v13);
+ G(v03, v04, v09, v14);
+}
+
+function block(x: Uint32Array, xPos: number, yPos: number, outPos: number, needXor: boolean) {
+ for (let i = 0; i < 256; i++) A2_BUF[i] = x[xPos + i] ^ x[yPos + i];
+ // columns (8)
+ for (let i = 0; i < 128; i += 16) {
+ // prettier-ignore
+ P(
+ i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7,
+ i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15
+ );
+ }
+ // rows (8)
+ for (let i = 0; i < 16; i += 2) {
+ // prettier-ignore
+ P(
+ i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49,
+ i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113
+ );
+ }
+
+ if (needXor) for (let i = 0; i < 256; i++) x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
+ else for (let i = 0; i < 256; i++) x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
+ clean(A2_BUF);
+}
+
+// Variable-Length Hash Function H'
+function Hp(A: Uint32Array, dkLen: number) {
+ const A8 = u8(A);
+ const T = new Uint32Array(1);
+ const T8 = u8(T);
+ T[0] = dkLen;
+ // Fast path
+ if (dkLen <= 64) return blake2b.create({ dkLen }).update(T8).update(A8).digest();
+ const out = new Uint8Array(dkLen);
+ let V = blake2b.create({}).update(T8).update(A8).digest();
+ let pos = 0;
+ // First block
+ out.set(V.subarray(0, 32));
+ pos += 32;
+ // Rest blocks
+ for (; dkLen - pos > 64; pos += 32) {
+ const Vh = blake2b.create({}).update(V);
+ Vh.digestInto(V);
+ Vh.destroy();
+ out.set(V.subarray(0, 32), pos);
+ }
+ // Last block
+ out.set(blake2b(V, { dkLen: dkLen - pos }), pos);
+ clean(V, T);
+ return u32(out);
+}
+
+// Used only inside process block!
+function indexAlpha(
+ r: number,
+ s: number,
+ laneLen: number,
+ segmentLen: number,
+ index: number,
+ randL: number,
+ sameLane: boolean = false
+) {
+ // This is ugly, but close enough to reference implementation.
+ let area: number;
+ if (r === 0) {
+ if (s === 0) area = index - 1;
+ else if (sameLane) area = s * segmentLen + index - 1;
+ else area = s * segmentLen + (index == 0 ? -1 : 0);
+ } else if (sameLane) area = laneLen - segmentLen + index - 1;
+ else area = laneLen - segmentLen + (index == 0 ? -1 : 0);
+ const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0;
+ const rel = area - 1 - mul(area, mul(randL, randL).h).h;
+ return (startPos + rel) % laneLen;
+}
+
+/**
+ * Argon2 options.
+ * * t: time cost, m: mem cost in kb, p: parallelization.
+ * * key: optional key. personalization: arbitrary extra data.
+ * * dkLen: desired number of output bytes.
+ */
+export type ArgonOpts = {
+ t: number; // Time cost, iterations count
+ m: number; // Memory cost (in KB)
+ p: number; // Parallelization parameter
+ version?: number; // Default: 0x13 (19)
+ key?: KDFInput; // Optional key
+ personalization?: KDFInput; // Optional arbitrary extra data
+ dkLen?: number; // Desired number of returned bytes
+ asyncTick?: number; // Maximum time in ms for which async function can block execution
+ maxmem?: number;
+ onProgress?: (progress: number) => void;
+};
+
+const maxUint32 = Math.pow(2, 32);
+function isU32(num: number) {
+ return Number.isSafeInteger(num) && num >= 0 && num < maxUint32;
+}
+
+function argon2Opts(opts: ArgonOpts) {
+ const merged: any = {
+ version: 0x13,
+ dkLen: 32,
+ maxmem: maxUint32 - 1,
+ asyncTick: 10,
+ };
+ for (let [k, v] of Object.entries(opts)) if (v !== undefined) merged[k] = v;
+
+ const { dkLen, p, m, t, version, onProgress, asyncTick } = merged;
+ if (!isU32(dkLen) || dkLen < 4) throw new Error('"dkLen" must be 4..');
+ if (!isU32(p) || p < 1 || p >= Math.pow(2, 24)) throw new Error('"p" must be 1..2^24');
+ if (!isU32(m)) throw new Error('"m" must be 0..2^32');
+ if (!isU32(t) || t < 1) throw new Error('"t" (iterations) must be 1..2^32');
+ if (onProgress !== undefined && typeof onProgress !== 'function')
+ throw new Error('"progressCb" must be a function');
+ anumber(asyncTick, 'asyncTick');
+ /*
+ Memory size m MUST be an integer number of kibibytes from 8*p to 2^(32)-1. The actual number of blocks is m', which is m rounded down to the nearest multiple of 4*p.
+ */
+ if (!isU32(m) || m < 8 * p) throw new Error('"m" (memory) must be at least 8*p bytes');
+ if (version !== 0x10 && version !== 0x13)
+ throw new Error('"version" must be 0x10 or 0x13, got ' + version);
+ return merged;
+}
+
+function argon2Init(password: KDFInput, salt: KDFInput, type: Types, opts: ArgonOpts) {
+ password = kdfInputToBytes(password, 'password');
+ salt = kdfInputToBytes(salt, 'salt');
+ if (!isU32(password.length)) throw new Error('"password" must be less of length 1..4Gb');
+ if (!isU32(salt.length) || salt.length < 8) throw new Error('"salt" must be of length 8..4Gb');
+ if (!Object.values(AT).includes(type)) throw new Error('"type" was invalid');
+ let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } =
+ argon2Opts(opts);
+ // Validation
+ key = abytesOrZero(key, 'key');
+ personalization = abytesOrZero(personalization, 'personalization');
+ // H_0 = H^(64)(LE32(p) || LE32(T) || LE32(m) || LE32(t) ||
+ // LE32(v) || LE32(y) || LE32(length(P)) || P ||
+ // LE32(length(S)) || S || LE32(length(K)) || K ||
+ // LE32(length(X)) || X)
+ const h = blake2b.create();
+ const BUF = new Uint32Array(1);
+ const BUF8 = u8(BUF);
+ for (let item of [p, dkLen, m, t, version, type]) {
+ BUF[0] = item;
+ h.update(BUF8);
+ }
+ for (let i of [password, salt, key, personalization]) {
+ BUF[0] = i.length; // BUF is u32 array, this is valid
+ h.update(BUF8).update(i);
+ }
+ const H0 = new Uint32Array(18);
+ const H0_8 = u8(H0);
+ h.digestInto(H0_8);
+ // 256 u32 = 1024 (BLOCK_SIZE), fills A2_BUF on processing
+
+ // Params
+ const lanes = p;
+ // m' = 4 * p * floor (m / 4p)
+ const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p));
+ //q = m' / p columns
+ const laneLen = Math.floor(mP / p);
+ const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS);
+ const memUsed = mP * 256;
+ if (!isU32(maxmem) || memUsed > maxmem)
+ throw new Error('"maxmem" expected <2**32, got: maxmem=' + maxmem + ', memused=' + memUsed);
+ const B = new Uint32Array(memUsed);
+ // Fill first blocks
+ for (let l = 0; l < p; l++) {
+ const i = 256 * laneLen * l;
+ // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))
+ H0[17] = l;
+ H0[16] = 0;
+ B.set(Hp(H0, 1024), i);
+ // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))
+ H0[16] = 1;
+ B.set(Hp(H0, 1024), i + 256);
+ }
+ let perBlock = () => {};
+ if (onProgress) {
+ const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen;
+ // Invoke callback if progress changes from 10.01 to 10.02
+ // Allows to draw smooth progress bar on up to 8K screen
+ const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1);
+ let blockCnt = 0;
+ perBlock = () => {
+ blockCnt++;
+ if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock))
+ onProgress(blockCnt / totalBlock);
+ };
+ }
+ clean(BUF, H0);
+ return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick };
+}
+
+function argon2Output(B: Uint32Array, p: number, laneLen: number, dkLen: number) {
+ const B_final = new Uint32Array(256);
+ for (let l = 0; l < p; l++)
+ for (let j = 0; j < 256; j++) B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j];
+ const res = u8(Hp(B_final, dkLen));
+ clean(B_final);
+ return res;
+}
+
+function processBlock(
+ B: Uint32Array,
+ address: Uint32Array,
+ l: number,
+ r: number,
+ s: number,
+ index: number,
+ laneLen: number,
+ segmentLen: number,
+ lanes: number,
+ offset: number,
+ prev: number,
+ dataIndependent: boolean,
+ needXor: boolean
+) {
+ if (offset % laneLen) prev = offset - 1;
+ let randL, randH;
+ if (dataIndependent) {
+ let i128 = index % 128;
+ if (i128 === 0) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ randL = address[2 * i128];
+ randH = address[2 * i128 + 1];
+ } else {
+ const T = 256 * prev;
+ randL = B[T];
+ randH = B[T + 1];
+ }
+ // address block
+ const refLane = r === 0 && s === 0 ? l : randH % lanes;
+ const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l);
+ const refBlock = laneLen * refLane + refPos;
+ // B[i][j] = G(B[i][j-1], B[l][z])
+ block(B, 256 * prev, 256 * refBlock, offset * 256, needXor);
+}
+
+function argon2(type: Types, password: KDFInput, salt: KDFInput, opts: ArgonOpts) {
+ const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(
+ password,
+ salt,
+ type,
+ opts
+ );
+ // Pre-loop setup
+ // [address, input, zero_block] format so we can pass single U32 to block function
+ const address = new Uint32Array(3 * 256);
+ address[256 + 6] = mP;
+ address[256 + 8] = t;
+ address[256 + 10] = type;
+ for (let r = 0; r < t; r++) {
+ const needXor = r !== 0 && version === 0x13;
+ address[256 + 0] = r;
+ for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
+ address[256 + 4] = s;
+ const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
+ for (let l = 0; l < p; l++) {
+ address[256 + 2] = l;
+ address[256 + 12] = 0;
+ let startPos = 0;
+ if (r === 0 && s === 0) {
+ startPos = 2;
+ if (dataIndependent) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ }
+ // current block postion
+ let offset = l * laneLen + s * segmentLen + startPos;
+ // previous block position
+ let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
+ for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
+ perBlock();
+ processBlock(
+ B,
+ address,
+ l,
+ r,
+ s,
+ index,
+ laneLen,
+ segmentLen,
+ lanes,
+ offset,
+ prev,
+ dataIndependent,
+ needXor
+ );
+ }
+ }
+ }
+ }
+ clean(address);
+ return argon2Output(B, p, laneLen, dkLen);
+}
+
+/** argon2d GPU-resistant version. */
+export const argon2d = (password: KDFInput, salt: KDFInput, opts: ArgonOpts): Uint8Array =>
+ argon2(AT.Argond2d, password, salt, opts);
+/** argon2i side-channel-resistant version. */
+export const argon2i = (password: KDFInput, salt: KDFInput, opts: ArgonOpts): Uint8Array =>
+ argon2(AT.Argon2i, password, salt, opts);
+/** argon2id, combining i+d, the most popular version from RFC 9106 */
+export const argon2id = (password: KDFInput, salt: KDFInput, opts: ArgonOpts): Uint8Array =>
+ argon2(AT.Argon2id, password, salt, opts);
+
+async function argon2Async(type: Types, password: KDFInput, salt: KDFInput, opts: ArgonOpts) {
+ const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } =
+ argon2Init(password, salt, type, opts);
+ // Pre-loop setup
+ // [address, input, zero_block] format so we can pass single U32 to block function
+ const address = new Uint32Array(3 * 256);
+ address[256 + 6] = mP;
+ address[256 + 8] = t;
+ address[256 + 10] = type;
+ let ts = Date.now();
+ for (let r = 0; r < t; r++) {
+ const needXor = r !== 0 && version === 0x13;
+ address[256 + 0] = r;
+ for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
+ address[256 + 4] = s;
+ const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
+ for (let l = 0; l < p; l++) {
+ address[256 + 2] = l;
+ address[256 + 12] = 0;
+ let startPos = 0;
+ if (r === 0 && s === 0) {
+ startPos = 2;
+ if (dataIndependent) {
+ address[256 + 12]++;
+ block(address, 256, 2 * 256, 0, false);
+ block(address, 0, 2 * 256, 0, false);
+ }
+ }
+ // current block postion
+ let offset = l * laneLen + s * segmentLen + startPos;
+ // previous block position
+ let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
+ for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
+ perBlock();
+ processBlock(
+ B,
+ address,
+ l,
+ r,
+ s,
+ index,
+ laneLen,
+ segmentLen,
+ lanes,
+ offset,
+ prev,
+ dataIndependent,
+ needXor
+ );
+ // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
+ const diff = Date.now() - ts;
+ if (!(diff >= 0 && diff < asyncTick)) {
+ await nextTick();
+ ts += diff;
+ }
+ }
+ }
+ }
+ }
+ clean(address);
+ return argon2Output(B, p, laneLen, dkLen);
+}
+
+/** argon2d async GPU-resistant version. */
+export const argon2dAsync = (
+ password: KDFInput,
+ salt: KDFInput,
+ opts: ArgonOpts
+): Promise => argon2Async(AT.Argond2d, password, salt, opts);
+/** argon2i async side-channel-resistant version. */
+export const argon2iAsync = (
+ password: KDFInput,
+ salt: KDFInput,
+ opts: ArgonOpts
+): Promise => argon2Async(AT.Argon2i, password, salt, opts);
+/** argon2id async, combining i+d, the most popular version from RFC 9106 */
+export const argon2idAsync = (
+ password: KDFInput,
+ salt: KDFInput,
+ opts: ArgonOpts
+): Promise => argon2Async(AT.Argon2id, password, salt, opts);
diff --git a/server/node_modules/@noble/hashes/src/blake1.ts b/server/node_modules/@noble/hashes/src/blake1.ts
new file mode 100644
index 0000000..6628a7b
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/blake1.ts
@@ -0,0 +1,536 @@
+/**
+ * Blake1 legacy hash function, one of SHA3 proposals.
+ * Rarely used. Check out blake2 or blake3 instead.
+ * https://www.aumasson.jp/blake/blake.pdf
+ *
+ * In the best case, there are 0 allocations.
+ *
+ * Differences from blake2:
+ *
+ * - BE instead of LE
+ * - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but:
+ * - length flag is located before actual length
+ * - padding block is compressed differently (no lengths)
+ * Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]`
+ * (-1 for g1, g2 without -1)
+ * - Salt is XOR-ed into constants instead of state
+ * - Salt is XOR-ed with output in `compress`
+ * - Additional rows (+64 bytes) in SIGMA for new rounds
+ * - Different round count:
+ * - 14 / 10 rounds in blake256 / blake2s
+ * - 16 / 12 rounds in blake512 / blake2b
+ * - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11
+ * @module
+ */
+import { BSIGMA, G1s, G2s } from './_blake.ts';
+import { SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';
+import * as u64 from './_u64.ts';
+// prettier-ignore
+import {
+ abytes, aexists, aoutput,
+ clean, createHasher,
+ createView,
+ type CHash,
+ type Hash
+} from './utils.ts';
+
+/** Blake1 options. Basically just "salt" */
+export type BlakeOpts = {
+ salt?: Uint8Array;
+};
+
+// Empty zero-filled salt
+const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8);
+
+abstract class BLAKE1> implements Hash {
+ protected finished = false;
+ protected length = 0;
+ protected pos = 0;
+ protected destroyed = false;
+ // For partial updates less than block size
+ protected buffer: Uint8Array;
+ protected view: DataView;
+ protected salt: Uint32Array;
+ abstract compress(view: DataView, offset: number, withLength?: boolean): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+
+ readonly blockLen: number;
+ readonly outputLen: number;
+ private lengthFlag: number;
+ private counterLen: number;
+ protected constants: Uint32Array;
+
+ constructor(
+ blockLen: number,
+ outputLen: number,
+ lengthFlag: number,
+ counterLen: number,
+ saltLen: number,
+ constants: Uint32Array,
+ opts: BlakeOpts = {}
+ ) {
+ const { salt } = opts;
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.lengthFlag = lengthFlag;
+ this.counterLen = counterLen;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ if (salt !== undefined) {
+ let slt = salt;
+ abytes(slt, 4 * saltLen, 'salt');
+ // if (slt.length !== 4 * saltLen) throw new Error('wrong salt length');
+ const salt32 = (this.salt = new Uint32Array(saltLen));
+ const sv = createView(slt);
+ this.constants = constants.slice();
+ for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) {
+ salt32[i] = sv.getUint32(offset, false);
+ this.constants[i] ^= salt32[i];
+ }
+ } else {
+ this.salt = EMPTY_SALT;
+ this.constants = constants;
+ }
+ }
+ update(data: Uint8Array): this {
+ aexists(this);
+ abytes(data);
+ // From _md, but update length before each compress
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ let dataView;
+ for (let pos = 0; pos < len; ) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ if (!dataView) dataView = createView(data);
+ for (; blockLen <= len - pos; pos += blockLen) {
+ this.length += blockLen;
+ this.compress(dataView, pos);
+ }
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.length += blockLen;
+ this.compress(view, 0, true);
+ this.pos = 0;
+ }
+ }
+ return this;
+ }
+ destroy(): void {
+ this.destroyed = true;
+ if (this.salt !== EMPTY_SALT) {
+ clean(this.salt, this.constants);
+ }
+ }
+ _cloneInto(to?: T): T {
+ to ||= new (this.constructor as any)() as T;
+ to.set(...this.get());
+ const { buffer, length, finished, destroyed, constants, salt, pos } = this;
+ to.buffer.set(buffer);
+ to.constants = constants.slice();
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ to.salt = salt.slice();
+ return to;
+ }
+ clone(): T {
+ return this._cloneInto();
+ }
+ digestInto(out: Uint8Array): void {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ const { buffer, blockLen, counterLen, lengthFlag, view } = this;
+ clean(buffer.subarray(this.pos)); // clean buf
+ const counter = BigInt((this.length + this.pos) * 8);
+ const counterPos = blockLen - counterLen - 1;
+ buffer[this.pos] |= 0b1000_0000; // End block flag
+ this.length += this.pos; // add unwritten length
+ // Not enough in buffer for length: write what we have.
+ if (this.pos > counterPos) {
+ this.compress(view, 0);
+ clean(buffer);
+ this.pos = 0;
+ }
+ // Difference with md: here we have lengthFlag!
+ buffer[counterPos] |= lengthFlag; // Length flag
+ // We always set 8 byte length flag. Because length will overflow significantly sooner.
+ view.setBigUint64(blockLen - 8, counter, false);
+ this.compress(view, 0, this.pos !== 0); // don't add length if length is not empty block?
+ // Write output
+ clean(buffer);
+ const v = createView(out);
+ const state = this.get();
+ for (let i = 0; i < this.outputLen / 4; ++i) v.setUint32(i * 4, state[i]);
+ }
+ digest(): Uint8Array {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+}
+
+// Constants
+const B64C = /* @__PURE__ */ Uint32Array.from([
+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
+ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
+ 0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
+ 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69,
+]);
+// first half of C512
+const B32C = B64C.slice(0, 16);
+
+const B256_IV = /* @__PURE__ */ SHA256_IV.slice();
+const B224_IV = /* @__PURE__ */ SHA224_IV.slice();
+const B384_IV = /* @__PURE__ */ SHA384_IV.slice();
+const B512_IV = /* @__PURE__ */ SHA512_IV.slice();
+
+function generateTBL256() {
+ const TBL = [];
+ for (let i = 0, j = 0; i < 14; i++, j += 16) {
+ for (let offset = 1; offset < 16; offset += 2) {
+ TBL.push(B32C[BSIGMA[j + offset]]);
+ TBL.push(B32C[BSIGMA[j + offset - 1]]);
+ }
+ }
+ return new Uint32Array(TBL);
+}
+const TBL256 = /* @__PURE__ */ generateTBL256(); // C256[SIGMA[X]] precompute
+
+// Reusable temporary buffer
+const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16);
+
+class BLAKE1_32B extends BLAKE1 {
+ private v0: number;
+ private v1: number;
+ private v2: number;
+ private v3: number;
+ private v4: number;
+ private v5: number;
+ private v6: number;
+ private v7: number;
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) {
+ super(64, outputLen, lengthFlag, 8, 4, B32C, opts);
+ this.v0 = IV[0] | 0;
+ this.v1 = IV[1] | 0;
+ this.v2 = IV[2] | 0;
+ this.v3 = IV[3] | 0;
+ this.v4 = IV[4] | 0;
+ this.v5 = IV[5] | 0;
+ this.v6 = IV[6] | 0;
+ this.v7 = IV[7] | 0;
+ }
+ protected get(): [number, number, number, number, number, number, number, number] {
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
+ }
+ // prettier-ignore
+ protected set(
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number
+ ): void {
+ this.v0 = v0 | 0;
+ this.v1 = v1 | 0;
+ this.v2 = v2 | 0;
+ this.v3 = v3 | 0;
+ this.v4 = v4 | 0;
+ this.v5 = v5 | 0;
+ this.v6 = v6 | 0;
+ this.v7 = v7 | 0;
+ }
+ destroy(): void {
+ super.destroy();
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ compress(view: DataView, offset: number, withLength = true): void {
+ for (let i = 0; i < 16; i++, offset += 4) BLAKE256_W[i] = view.getUint32(offset, false);
+ // NOTE: we cannot re-use compress from blake2s, since there is additional xor over u256[SIGMA[e]]
+ let v00 = this.v0 | 0;
+ let v01 = this.v1 | 0;
+ let v02 = this.v2 | 0;
+ let v03 = this.v3 | 0;
+ let v04 = this.v4 | 0;
+ let v05 = this.v5 | 0;
+ let v06 = this.v6 | 0;
+ let v07 = this.v7 | 0;
+ let v08 = this.constants[0] | 0;
+ let v09 = this.constants[1] | 0;
+ let v10 = this.constants[2] | 0;
+ let v11 = this.constants[3] | 0;
+ const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0));
+ let v12 = (this.constants[4] ^ l) >>> 0;
+ let v13 = (this.constants[5] ^ l) >>> 0;
+ let v14 = (this.constants[6] ^ h) >>> 0;
+ let v15 = (this.constants[7] ^ h) >>> 0;
+ // prettier-ignore
+ for (let i = 0, k = 0, j = 0; i < 14; i++) {
+ ({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ ({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
+ }
+ this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0;
+ this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0;
+ this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0;
+ this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0;
+ this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0;
+ this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0;
+ this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0;
+ this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0;
+ clean(BLAKE256_W);
+ }
+}
+
+const BBUF = /* @__PURE__ */ new Uint32Array(32);
+const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32);
+
+function generateTBL512() {
+ const TBL = [];
+ for (let r = 0, k = 0; r < 16; r++, k += 16) {
+ for (let offset = 1; offset < 16; offset += 2) {
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]);
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]);
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]);
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]);
+ }
+ }
+ return new Uint32Array(TBL);
+}
+const TBL512 = /* @__PURE__ */ generateTBL512(); // C512[SIGMA[X]] precompute
+
+// Mixing function G splitted in two halfs
+function G1b(a: number, b: number, c: number, d: number, msg: Uint32Array, k: number) {
+ const Xpos = 2 * BSIGMA[k];
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0;
+ Al = (ll | 0) >>> 0;
+ // v[d] = rotr(v[d] ^ v[a], 32)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 25)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) });
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
+}
+
+function G2b(a: number, b: number, c: number, d: number, msg: Uint32Array, k: number) {
+ const Xpos = 2 * BSIGMA[k];
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 16)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 11)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) });
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
+}
+
+class BLAKE1_64B extends BLAKE1 {
+ private v0l: number;
+ private v0h: number;
+ private v1l: number;
+ private v1h: number;
+ private v2l: number;
+ private v2h: number;
+ private v3l: number;
+ private v3h: number;
+ private v4l: number;
+ private v4h: number;
+ private v5l: number;
+ private v5h: number;
+ private v6l: number;
+ private v6h: number;
+ private v7l: number;
+ private v7h: number;
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) {
+ super(128, outputLen, lengthFlag, 16, 8, B64C, opts);
+ this.v0l = IV[0] | 0;
+ this.v0h = IV[1] | 0;
+ this.v1l = IV[2] | 0;
+ this.v1h = IV[3] | 0;
+ this.v2l = IV[4] | 0;
+ this.v2h = IV[5] | 0;
+ this.v3l = IV[6] | 0;
+ this.v3h = IV[7] | 0;
+ this.v4l = IV[8] | 0;
+ this.v4h = IV[9] | 0;
+ this.v5l = IV[10] | 0;
+ this.v5h = IV[11] | 0;
+ this.v6l = IV[12] | 0;
+ this.v6h = IV[13] | 0;
+ this.v7l = IV[14] | 0;
+ this.v7h = IV[15] | 0;
+ }
+ // prettier-ignore
+ protected get(): [
+ number, number, number, number, number, number, number, number,
+ number, number, number, number, number, number, number, number
+ ] {
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
+ }
+ // prettier-ignore
+ protected set(
+ v0l: number, v0h: number, v1l: number, v1h: number,
+ v2l: number, v2h: number, v3l: number, v3h: number,
+ v4l: number, v4h: number, v5l: number, v5h: number,
+ v6l: number, v6h: number, v7l: number, v7h: number
+ ): void {
+ this.v0l = v0l | 0;
+ this.v0h = v0h | 0;
+ this.v1l = v1l | 0;
+ this.v1h = v1h | 0;
+ this.v2l = v2l | 0;
+ this.v2h = v2h | 0;
+ this.v3l = v3l | 0;
+ this.v3h = v3h | 0;
+ this.v4l = v4l | 0;
+ this.v4h = v4h | 0;
+ this.v5l = v5l | 0;
+ this.v5h = v5h | 0;
+ this.v6l = v6l | 0;
+ this.v6h = v6h | 0;
+ this.v7l = v7l | 0;
+ this.v7h = v7h | 0;
+ }
+ destroy(): void {
+ super.destroy();
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ compress(view: DataView, offset: number, withLength = true): void {
+ for (let i = 0; i < 32; i++, offset += 4) BLAKE512_W[i] = view.getUint32(offset, false);
+
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
+ BBUF.set(this.constants.subarray(0, 16), 16);
+ if (withLength) {
+ const { h, l } = u64.fromBig(BigInt(this.length * 8));
+ BBUF[24] = (BBUF[24] ^ h) >>> 0;
+ BBUF[25] = (BBUF[25] ^ l) >>> 0;
+ BBUF[26] = (BBUF[26] ^ h) >>> 0;
+ BBUF[27] = (BBUF[27] ^ l) >>> 0;
+ }
+ for (let i = 0, k = 0; i < 16; i++) {
+ G1b(0, 4, 8, 12, BLAKE512_W, k++);
+ G2b(0, 4, 8, 12, BLAKE512_W, k++);
+ G1b(1, 5, 9, 13, BLAKE512_W, k++);
+ G2b(1, 5, 9, 13, BLAKE512_W, k++);
+ G1b(2, 6, 10, 14, BLAKE512_W, k++);
+ G2b(2, 6, 10, 14, BLAKE512_W, k++);
+ G1b(3, 7, 11, 15, BLAKE512_W, k++);
+ G2b(3, 7, 11, 15, BLAKE512_W, k++);
+
+ G1b(0, 5, 10, 15, BLAKE512_W, k++);
+ G2b(0, 5, 10, 15, BLAKE512_W, k++);
+ G1b(1, 6, 11, 12, BLAKE512_W, k++);
+ G2b(1, 6, 11, 12, BLAKE512_W, k++);
+ G1b(2, 7, 8, 13, BLAKE512_W, k++);
+ G2b(2, 7, 8, 13, BLAKE512_W, k++);
+ G1b(3, 4, 9, 14, BLAKE512_W, k++);
+ G2b(3, 4, 9, 14, BLAKE512_W, k++);
+ }
+ this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0];
+ this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1];
+ this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2];
+ this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3];
+ this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4];
+ this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5];
+ this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6];
+ this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7];
+ this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0];
+ this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1];
+ this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2];
+ this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3];
+ this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4];
+ this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5];
+ this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6];
+ this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7];
+ clean(BBUF, BLAKE512_W);
+ }
+}
+
+/** Internal blake1-224 hash class. */
+export class _BLAKE224 extends BLAKE1_32B {
+ constructor(opts: BlakeOpts = {}) {
+ super(28, B224_IV, 0b0000_0000, opts);
+ }
+}
+/** Internal blake1-256 hash class. */
+export class _BLAKE256 extends BLAKE1_32B {
+ constructor(opts: BlakeOpts = {}) {
+ super(32, B256_IV, 0b0000_0001, opts);
+ }
+}
+/** Internal blake1-384 hash class. */
+export class _BLAKE384 extends BLAKE1_64B {
+ constructor(opts: BlakeOpts = {}) {
+ super(48, B384_IV, 0b0000_0000, opts);
+ }
+}
+/** Internal blake1-512 hash class. */
+export class _BLAKE512 extends BLAKE1_64B {
+ constructor(opts: BlakeOpts = {}) {
+ super(64, B512_IV, 0b0000_0001, opts);
+ }
+}
+/** blake1-224 hash function */
+export const blake224: CHash<_BLAKE224, BlakeOpts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE224(opts)
+);
+/** blake1-256 hash function */
+export const blake256: CHash<_BLAKE256, BlakeOpts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE256(opts)
+);
+/** blake1-384 hash function */
+export const blake384: CHash<_BLAKE384, BlakeOpts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE384(opts)
+);
+/** blake1-512 hash function */
+export const blake512: CHash<_BLAKE512, BlakeOpts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE512(opts)
+);
diff --git a/server/node_modules/@noble/hashes/src/blake2.ts b/server/node_modules/@noble/hashes/src/blake2.ts
new file mode 100644
index 0000000..acdb18a
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/blake2.ts
@@ -0,0 +1,489 @@
+/**
+ * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
+ * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
+ * @module
+ */
+import { BSIGMA, G1s, G2s } from './_blake.ts';
+import { SHA256_IV } from './_md.ts';
+import * as u64 from './_u64.ts';
+// prettier-ignore
+import {
+ abytes, aexists, anumber, aoutput,
+ clean, createHasher,
+ swap32IfBE, swap8IfBE,
+ u32,
+ type CHash,
+ type Hash
+} from './utils.ts';
+
+/** Blake hash options. dkLen is output length. key is used in MAC mode. salt is used in KDF mode. */
+export type Blake2Opts = {
+ dkLen?: number;
+ key?: Uint8Array;
+ salt?: Uint8Array;
+ personalization?: Uint8Array;
+};
+
+// Same as SHA512_IV, but swapped endianness: LE instead of BE. iv[1] is iv[0], etc.
+const B2B_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
+ 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
+]);
+// Temporary buffer
+const BBUF = /* @__PURE__ */ new Uint32Array(32);
+
+// Mixing function G splitted in two halfs
+function G1b(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) {
+ // NOTE: V is LE here
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 32)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 24)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
+}
+
+function G2b(a: number, b: number, c: number, d: number, msg: Uint32Array, x: number) {
+ // NOTE: V is LE here
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
+ // v[a] = (v[a] + v[b] + x) | 0;
+ let ll = u64.add3L(Al, Bl, Xl);
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
+ Al = ll | 0;
+ // v[d] = rotr(v[d] ^ v[a], 16)
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
+ // v[c] = (v[c] + v[d]) | 0;
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
+ // v[b] = rotr(v[b] ^ v[c], 63)
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
+ ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
+}
+
+function checkBlake2Opts(
+ outputLen: number,
+ opts: Blake2Opts | undefined = {},
+ keyLen: number,
+ saltLen: number,
+ persLen: number
+) {
+ anumber(keyLen);
+ if (outputLen < 0 || outputLen > keyLen) throw new Error('outputLen bigger than keyLen');
+ const { key, salt, personalization } = opts;
+ if (key !== undefined && (key.length < 1 || key.length > keyLen))
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
+ if (salt !== undefined) abytes(salt, saltLen, 'salt');
+ if (personalization !== undefined) abytes(personalization, persLen, 'personalization');
+}
+
+/** Internal base class for BLAKE2. */
+export abstract class _BLAKE2> implements Hash {
+ protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void;
+ protected abstract get(): number[];
+ protected abstract set(...args: number[]): void;
+ abstract destroy(): void;
+ protected buffer: Uint8Array;
+ protected buffer32: Uint32Array;
+ protected finished = false;
+ protected destroyed = false;
+ protected length: number = 0;
+ protected pos: number = 0;
+ readonly blockLen: number;
+ readonly outputLen: number;
+
+ constructor(blockLen: number, outputLen: number) {
+ anumber(blockLen);
+ anumber(outputLen);
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.buffer = new Uint8Array(blockLen);
+ this.buffer32 = u32(this.buffer);
+ }
+ update(data: Uint8Array): this {
+ aexists(this);
+ abytes(data);
+ // Main difference with other hashes: there is flag for last block,
+ // so we cannot process current block before we know that there
+ // is the next one. This significantly complicates logic and reduces ability
+ // to do zero-copy processing
+ const { blockLen, buffer, buffer32 } = this;
+ const len = data.length;
+ const offset = data.byteOffset;
+ const buf = data.buffer;
+ for (let pos = 0; pos < len; ) {
+ // If buffer is full and we still have input (don't process last block, same as blake2s)
+ if (this.pos === blockLen) {
+ swap32IfBE(buffer32);
+ this.compress(buffer32, 0, false);
+ swap32IfBE(buffer32);
+ this.pos = 0;
+ }
+ const take = Math.min(blockLen - this.pos, len - pos);
+ const dataOffset = offset + pos;
+ // full block && aligned to 4 bytes && not last in input
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
+ swap32IfBE(data32);
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
+ this.length += blockLen;
+ this.compress(data32, pos32, false);
+ }
+ swap32IfBE(data32);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ this.length += take;
+ pos += take;
+ }
+ return this;
+ }
+ digestInto(out: Uint8Array): void {
+ aexists(this);
+ aoutput(out, this);
+ const { pos, buffer32 } = this;
+ this.finished = true;
+ // Padding
+ clean(this.buffer.subarray(pos));
+ swap32IfBE(buffer32);
+ this.compress(buffer32, 0, true);
+ swap32IfBE(buffer32);
+ const out32 = u32(out);
+ this.get().forEach((v, i) => (out32[i] = swap8IfBE(v)));
+ }
+ digest(): Uint8Array {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to?: T): T {
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
+ to ||= new (this.constructor as any)({ dkLen: outputLen }) as T;
+ to.set(...this.get());
+ to.buffer.set(buffer);
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ // @ts-ignore
+ to.outputLen = outputLen;
+ return to;
+ }
+ clone(): T {
+ return this._cloneInto();
+ }
+}
+
+/** Internal blake2b hash class. */
+export class _BLAKE2b extends _BLAKE2<_BLAKE2b> {
+ // Same as SHA-512, but LE
+ private v0l = B2B_IV[0] | 0;
+ private v0h = B2B_IV[1] | 0;
+ private v1l = B2B_IV[2] | 0;
+ private v1h = B2B_IV[3] | 0;
+ private v2l = B2B_IV[4] | 0;
+ private v2h = B2B_IV[5] | 0;
+ private v3l = B2B_IV[6] | 0;
+ private v3h = B2B_IV[7] | 0;
+ private v4l = B2B_IV[8] | 0;
+ private v4h = B2B_IV[9] | 0;
+ private v5l = B2B_IV[10] | 0;
+ private v5h = B2B_IV[11] | 0;
+ private v6l = B2B_IV[12] | 0;
+ private v6h = B2B_IV[13] | 0;
+ private v7l = B2B_IV[14] | 0;
+ private v7h = B2B_IV[15] | 0;
+
+ constructor(opts: Blake2Opts = {}) {
+ const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
+ super(128, olen);
+ checkBlake2Opts(olen, opts, 64, 16, 16);
+ let { key, personalization, salt } = opts;
+ let keyLength = 0;
+ if (key !== undefined) {
+ abytes(key, undefined, 'key');
+ keyLength = key.length;
+ }
+ this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
+ if (salt !== undefined) {
+ abytes(salt, undefined, 'salt');
+ const slt = u32(salt);
+ this.v4l ^= swap8IfBE(slt[0]);
+ this.v4h ^= swap8IfBE(slt[1]);
+ this.v5l ^= swap8IfBE(slt[2]);
+ this.v5h ^= swap8IfBE(slt[3]);
+ }
+ if (personalization !== undefined) {
+ abytes(personalization, undefined, 'personalization');
+ const pers = u32(personalization);
+ this.v6l ^= swap8IfBE(pers[0]);
+ this.v6h ^= swap8IfBE(pers[1]);
+ this.v7l ^= swap8IfBE(pers[2]);
+ this.v7h ^= swap8IfBE(pers[3]);
+ }
+ if (key !== undefined) {
+ // Pad to blockLen and update
+ const tmp = new Uint8Array(this.blockLen);
+ tmp.set(key);
+ this.update(tmp);
+ }
+ }
+ // prettier-ignore
+ protected get(): [
+ number, number, number, number, number, number, number, number,
+ number, number, number, number, number, number, number, number
+ ] {
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
+ }
+ // prettier-ignore
+ protected set(
+ v0l: number, v0h: number, v1l: number, v1h: number,
+ v2l: number, v2h: number, v3l: number, v3h: number,
+ v4l: number, v4h: number, v5l: number, v5h: number,
+ v6l: number, v6h: number, v7l: number, v7h: number
+ ): void {
+ this.v0l = v0l | 0;
+ this.v0h = v0h | 0;
+ this.v1l = v1l | 0;
+ this.v1h = v1h | 0;
+ this.v2l = v2l | 0;
+ this.v2h = v2h | 0;
+ this.v3l = v3l | 0;
+ this.v3h = v3h | 0;
+ this.v4l = v4l | 0;
+ this.v4h = v4h | 0;
+ this.v5l = v5l | 0;
+ this.v5h = v5h | 0;
+ this.v6l = v6l | 0;
+ this.v6h = v6h | 0;
+ this.v7l = v7l | 0;
+ this.v7h = v7h | 0;
+ }
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void {
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
+ BBUF.set(B2B_IV, 16); // Second half from IV.
+ let { h, l } = u64.fromBig(BigInt(this.length));
+ BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
+ BBUF[25] = B2B_IV[9] ^ h; // High word.
+ // Invert all bits for last block
+ if (isLast) {
+ BBUF[28] = ~BBUF[28];
+ BBUF[29] = ~BBUF[29];
+ }
+ let j = 0;
+ const s = BSIGMA;
+ for (let i = 0; i < 12; i++) {
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
+
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
+ }
+ this.v0l ^= BBUF[0] ^ BBUF[16];
+ this.v0h ^= BBUF[1] ^ BBUF[17];
+ this.v1l ^= BBUF[2] ^ BBUF[18];
+ this.v1h ^= BBUF[3] ^ BBUF[19];
+ this.v2l ^= BBUF[4] ^ BBUF[20];
+ this.v2h ^= BBUF[5] ^ BBUF[21];
+ this.v3l ^= BBUF[6] ^ BBUF[22];
+ this.v3h ^= BBUF[7] ^ BBUF[23];
+ this.v4l ^= BBUF[8] ^ BBUF[24];
+ this.v4h ^= BBUF[9] ^ BBUF[25];
+ this.v5l ^= BBUF[10] ^ BBUF[26];
+ this.v5h ^= BBUF[11] ^ BBUF[27];
+ this.v6l ^= BBUF[12] ^ BBUF[28];
+ this.v6h ^= BBUF[13] ^ BBUF[29];
+ this.v7l ^= BBUF[14] ^ BBUF[30];
+ this.v7h ^= BBUF[15] ^ BBUF[31];
+ clean(BBUF);
+ }
+ destroy(): void {
+ this.destroyed = true;
+ clean(this.buffer32);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
+/**
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export const blake2b: CHash<_BLAKE2b, Blake2Opts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE2b(opts)
+);
+
+// =================
+// Blake2S
+// =================
+
+/** Internal type, 16 numbers. */
+// prettier-ignore
+export type Num16 = {
+ v0: number; v1: number; v2: number; v3: number;
+ v4: number; v5: number; v6: number; v7: number;
+ v8: number; v9: number; v10: number; v11: number;
+ v12: number; v13: number; v14: number; v15: number;
+};
+
+/** BLAKE2-compress core method. */
+// prettier-ignore
+export function compress(s: Uint8Array, offset: number, msg: Uint32Array, rounds: number,
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number,
+ v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number,
+): Num16 {
+ let j = 0;
+ for (let i = 0; i < rounds; i++) {
+ ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
+ ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
+ ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
+ ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]]));
+ ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]]));
+ ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]]));
+ ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]]));
+ ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]]));
+
+ ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]]));
+ ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]]));
+ ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]]));
+ ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]]));
+ ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]]));
+ ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]]));
+ ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
+ ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
+ }
+ return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
+}
+
+const B2S_IV = /* @__PURE__ */ SHA256_IV.slice();
+
+/** Internal blake2s hash class. */
+export class _BLAKE2s extends _BLAKE2<_BLAKE2s> {
+ // Internal state, same as SHA-256
+ private v0 = B2S_IV[0] | 0;
+ private v1 = B2S_IV[1] | 0;
+ private v2 = B2S_IV[2] | 0;
+ private v3 = B2S_IV[3] | 0;
+ private v4 = B2S_IV[4] | 0;
+ private v5 = B2S_IV[5] | 0;
+ private v6 = B2S_IV[6] | 0;
+ private v7 = B2S_IV[7] | 0;
+
+ constructor(opts: Blake2Opts = {}) {
+ const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
+ super(64, olen);
+ checkBlake2Opts(olen, opts, 32, 8, 8);
+ let { key, personalization, salt } = opts;
+ let keyLength = 0;
+ if (key !== undefined) {
+ abytes(key, undefined, 'key');
+ keyLength = key.length;
+ }
+ this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
+ if (salt !== undefined) {
+ abytes(salt, undefined, 'salt');
+ const slt = u32(salt as Uint8Array);
+ this.v4 ^= swap8IfBE(slt[0]);
+ this.v5 ^= swap8IfBE(slt[1]);
+ }
+ if (personalization !== undefined) {
+ abytes(personalization, undefined, 'personalization');
+ const pers = u32(personalization as Uint8Array);
+ this.v6 ^= swap8IfBE(pers[0]);
+ this.v7 ^= swap8IfBE(pers[1]);
+ }
+ if (key !== undefined) {
+ // Pad to blockLen and update
+ const tmp = new Uint8Array(this.blockLen);
+ tmp.set(key);
+ this.update(tmp);
+ }
+ }
+ protected get(): [number, number, number, number, number, number, number, number] {
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
+ }
+ // prettier-ignore
+ protected set(
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number
+ ): void {
+ this.v0 = v0 | 0;
+ this.v1 = v1 | 0;
+ this.v2 = v2 | 0;
+ this.v3 = v3 | 0;
+ this.v4 = v4 | 0;
+ this.v5 = v5 | 0;
+ this.v6 = v6 | 0;
+ this.v7 = v7 | 0;
+ }
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void {
+ const { h, l } = u64.fromBig(BigInt(this.length));
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } =
+ compress(
+ BSIGMA, offset, msg, 10,
+ this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7,
+ B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]
+ );
+ this.v0 ^= v0 ^ v8;
+ this.v1 ^= v1 ^ v9;
+ this.v2 ^= v2 ^ v10;
+ this.v3 ^= v3 ^ v11;
+ this.v4 ^= v4 ^ v12;
+ this.v5 ^= v5 ^ v13;
+ this.v6 ^= v6 ^ v14;
+ this.v7 ^= v7 ^ v15;
+ }
+ destroy(): void {
+ this.destroyed = true;
+ clean(this.buffer32);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
+/**
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
+ * @param msg - message that would be hashed
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
+ */
+export const blake2s: CHash<_BLAKE2s, Blake2Opts> = /* @__PURE__ */ createHasher(
+ (opts) => new _BLAKE2s(opts)
+);
diff --git a/server/node_modules/@noble/hashes/src/blake3.ts b/server/node_modules/@noble/hashes/src/blake3.ts
new file mode 100644
index 0000000..1286f49
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/blake3.ts
@@ -0,0 +1,275 @@
+/**
+ * Blake3 fast hash is Blake2 with reduced security (round count). Can also be used as MAC & KDF.
+ *
+ * It is advertised as "the fastest cryptographic hash". However, it isn't true in JS.
+ * Why is this so slow? While it must be 6x faster than blake2b, perf diff is only 20%:
+ *
+ * * There is only 30% reduction in number of rounds from blake2s
+ * * Speed-up comes from tree structure, which is parallelized using SIMD & threading.
+ * These features are not present in JS, so we only get overhead from trees.
+ * * Parallelization only happens on 1024-byte chunks: there is no benefit for small inputs.
+ * * It is still possible to make it faster using: a) loop unrolling b) web workers c) wasm
+ * @module
+ */
+import { SHA256_IV } from './_md.ts';
+import { fromBig } from './_u64.ts';
+import { _BLAKE2, compress } from './blake2.ts';
+// prettier-ignore
+import {
+ abytes, aexists, anumber, aoutput,
+ clean, createHasher, swap32IfBE,
+ u32, u8,
+ type CHashXOF,
+ type HashXOF
+} from './utils.ts';
+
+// Flag bitset
+const B3_Flags = {
+ CHUNK_START: 0b1,
+ CHUNK_END: 0b10,
+ PARENT: 0b100,
+ ROOT: 0b1000,
+ KEYED_HASH: 0b10000,
+ DERIVE_KEY_CONTEXT: 0b100000,
+ DERIVE_KEY_MATERIAL: 0b1000000,
+} as const;
+
+const B3_IV = /* @__PURE__ */ SHA256_IV.slice();
+
+const B3_SIGMA: Uint8Array = /* @__PURE__ */ (() => {
+ const Id = Array.from({ length: 16 }, (_, i) => i);
+ const permute = (arr: number[]) =>
+ [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]);
+ const res: number[] = [];
+ for (let i = 0, v = Id; i < 7; i++, v = permute(v)) res.push(...v);
+ return Uint8Array.from(res);
+})();
+
+/**
+ * Ensure to use EITHER `key` OR `context`, not both.
+ *
+ * * `key`: 32-byte MAC key.
+ * * `context`: string for KDF. must be hardcoded, globally unique, and application - specific.
+ * A good default format for the context string is "[application] [commit timestamp] [purpose]".
+ */
+export type Blake3Opts = { dkLen?: number; key?: Uint8Array; context?: Uint8Array };
+
+/** Blake3 hash. Can be used as MAC and KDF. */
+export class _BLAKE3 extends _BLAKE2<_BLAKE3> implements HashXOF<_BLAKE3> {
+ private chunkPos = 0; // Position of current block in chunk
+ private chunksDone = 0; // How many chunks we already have
+ private flags = 0 | 0;
+ private IV: Uint32Array;
+ private state: Uint32Array;
+ private stack: Uint32Array[] = [];
+ // Output
+ private posOut = 0;
+ private bufferOut32 = new Uint32Array(16);
+ private bufferOut: Uint8Array;
+ private chunkOut = 0; // index of output chunk
+ private enableXOF = true;
+
+ constructor(opts: Blake3Opts = {}, flags = 0) {
+ super(64, opts.dkLen === undefined ? 32 : opts.dkLen);
+ const { key, context } = opts;
+ const hasContext = context !== undefined;
+ if (key !== undefined) {
+ if (hasContext) throw new Error('Only "key" or "context" can be specified at same time');
+ abytes(key, 32, 'key');
+ const k = key.slice();
+ this.IV = u32(k);
+ swap32IfBE(this.IV);
+ this.flags = flags | B3_Flags.KEYED_HASH;
+ } else if (hasContext) {
+ abytes(context, undefined, 'context');
+ const ctx = context;
+ const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT)
+ .update(ctx)
+ .digest();
+ this.IV = u32(contextKey);
+ swap32IfBE(this.IV);
+ this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL;
+ } else {
+ this.IV = B3_IV.slice();
+ this.flags = flags;
+ }
+ this.state = this.IV.slice();
+ this.bufferOut = u8(this.bufferOut32);
+ }
+ // Unused
+ protected get(): [] {
+ return [];
+ }
+ protected set(): void {}
+ private b2Compress(counter: number, flags: number, buf: Uint32Array, bufPos: number = 0) {
+ const { state: s, pos } = this;
+ const { h, l } = fromBig(BigInt(counter), true);
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } =
+ compress(
+ B3_SIGMA, bufPos, buf, 7,
+ s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7],
+ B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], h, l, pos, flags
+ );
+ s[0] = v0 ^ v8;
+ s[1] = v1 ^ v9;
+ s[2] = v2 ^ v10;
+ s[3] = v3 ^ v11;
+ s[4] = v4 ^ v12;
+ s[5] = v5 ^ v13;
+ s[6] = v6 ^ v14;
+ s[7] = v7 ^ v15;
+ }
+ protected compress(buf: Uint32Array, bufPos: number = 0, isLast: boolean = false): void {
+ // Compress last block
+ let flags = this.flags;
+ if (!this.chunkPos) flags |= B3_Flags.CHUNK_START;
+ if (this.chunkPos === 15 || isLast) flags |= B3_Flags.CHUNK_END;
+ if (!isLast) this.pos = this.blockLen;
+ this.b2Compress(this.chunksDone, flags, buf, bufPos);
+ this.chunkPos += 1;
+ // If current block is last in chunk (16 blocks), then compress chunks
+ if (this.chunkPos === 16 || isLast) {
+ let chunk = this.state;
+ this.state = this.IV.slice();
+ // If not the last one, compress only when there are trailing zeros in chunk counter
+ // chunks used as binary tree where current stack is path. Zero means current leaf is finished and can be compressed.
+ // 1 (001) - leaf not finished (just push current chunk to stack)
+ // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back)
+ // 3 (011) - last leaf not finished
+ // 4 (100) - leafs finished at depth=1 and depth=2
+ for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) {
+ if (!(last = this.stack.pop())) break;
+ this.buffer32.set(last, 0);
+ this.buffer32.set(chunk, 8);
+ this.pos = this.blockLen;
+ this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0);
+ chunk = this.state;
+ this.state = this.IV.slice();
+ }
+ this.chunksDone++;
+ this.chunkPos = 0;
+ this.stack.push(chunk);
+ }
+ this.pos = 0;
+ }
+ _cloneInto(to?: _BLAKE3): _BLAKE3 {
+ to = super._cloneInto(to) as _BLAKE3;
+ const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this;
+ to.state.set(state.slice());
+ to.stack = stack.map((i) => Uint32Array.from(i));
+ to.IV.set(IV);
+ to.flags = flags;
+ to.chunkPos = chunkPos;
+ to.chunksDone = chunksDone;
+ to.posOut = posOut;
+ to.chunkOut = chunkOut;
+ to.enableXOF = this.enableXOF;
+ to.bufferOut32.set(this.bufferOut32);
+ return to;
+ }
+ destroy(): void {
+ this.destroyed = true;
+ clean(this.state, this.buffer32, this.IV, this.bufferOut32);
+ clean(...this.stack);
+ }
+ // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8)
+ private b2CompressOut() {
+ const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this;
+ const { h, l } = fromBig(BigInt(this.chunkOut++));
+ swap32IfBE(buffer32);
+ // prettier-ignore
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } =
+ compress(
+ B3_SIGMA, 0, buffer32, 7,
+ s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7],
+ B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], l, h, pos, flags
+ );
+ out32[0] = v0 ^ v8;
+ out32[1] = v1 ^ v9;
+ out32[2] = v2 ^ v10;
+ out32[3] = v3 ^ v11;
+ out32[4] = v4 ^ v12;
+ out32[5] = v5 ^ v13;
+ out32[6] = v6 ^ v14;
+ out32[7] = v7 ^ v15;
+ out32[8] = s[0] ^ v8;
+ out32[9] = s[1] ^ v9;
+ out32[10] = s[2] ^ v10;
+ out32[11] = s[3] ^ v11;
+ out32[12] = s[4] ^ v12;
+ out32[13] = s[5] ^ v13;
+ out32[14] = s[6] ^ v14;
+ out32[15] = s[7] ^ v15;
+ swap32IfBE(buffer32);
+ swap32IfBE(out32);
+ this.posOut = 0;
+ }
+ protected finish(): void {
+ if (this.finished) return;
+ this.finished = true;
+ // Padding
+ clean(this.buffer.subarray(this.pos));
+ // Process last chunk
+ let flags = this.flags | B3_Flags.ROOT;
+ if (this.stack.length) {
+ flags |= B3_Flags.PARENT;
+ swap32IfBE(this.buffer32);
+ this.compress(this.buffer32, 0, true);
+ swap32IfBE(this.buffer32);
+ this.chunksDone = 0;
+ this.pos = this.blockLen;
+ } else {
+ flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END;
+ }
+ this.flags = flags;
+ this.b2CompressOut();
+ }
+ private writeInto(out: Uint8Array) {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const { blockLen, bufferOut } = this;
+ for (let pos = 0, len = out.length; pos < len; ) {
+ if (this.posOut >= blockLen) this.b2CompressOut();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out: Uint8Array): Uint8Array {
+ if (!this.enableXOF) throw new Error('XOF is not possible after digest call');
+ return this.writeInto(out);
+ }
+ xof(bytes: number): Uint8Array {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out: Uint8Array): Uint8Array {
+ aoutput(out, this);
+ if (this.finished) throw new Error('digest() was already called');
+ this.enableXOF = false;
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest(): Uint8Array {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+}
+
+/**
+ * BLAKE3 hash function. Can be used as MAC and KDF.
+ * @param msg - message that would be hashed
+ * @param opts - `dkLen` for output length, `key` for MAC mode, `context` for KDF mode
+ * @example
+ * const data = new Uint8Array(32);
+ * const hash = blake3(data);
+ * const mac = blake3(data, { key: new Uint8Array(32) });
+ * const kdf = blake3(data, { context: 'application name' });
+ */
+export const blake3: CHashXOF<_BLAKE3, Blake3Opts> = /* @__PURE__ */ createHasher(
+ (opts = {}) => new _BLAKE3(opts)
+);
diff --git a/server/node_modules/@noble/hashes/src/eskdf.ts b/server/node_modules/@noble/hashes/src/eskdf.ts
new file mode 100644
index 0000000..6d2ad27
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/eskdf.ts
@@ -0,0 +1,188 @@
+/**
+ * Experimental KDF for AES.
+ * @module
+ */
+import { hkdf } from './hkdf.ts';
+import { pbkdf2 as _pbkdf2 } from './pbkdf2.ts';
+import { scrypt as _scrypt } from './scrypt.ts';
+import { sha256 } from './sha2.ts';
+import { abytes, bytesToHex, clean, createView, hexToBytes, kdfInputToBytes } from './utils.ts';
+
+// A tiny KDF for various applications like AES key-gen.
+// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure".
+// Which is good enough: assume sha2-256 retained preimage resistance.
+
+const SCRYPT_FACTOR = 2 ** 19;
+const PBKDF2_FACTOR = 2 ** 17;
+
+/** Scrypt KDF */
+export function scrypt(password: string, salt: string): Uint8Array {
+ return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 });
+}
+
+/** PBKDF2-HMAC-SHA256 */
+export function pbkdf2(password: string, salt: string): Uint8Array {
+ return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 });
+}
+
+// Combines two 32-byte byte arrays
+function xor32(a: Uint8Array, b: Uint8Array): Uint8Array {
+ abytes(a, 32);
+ abytes(b, 32);
+ const arr = new Uint8Array(32);
+ for (let i = 0; i < 32; i++) {
+ arr[i] = a[i] ^ b[i];
+ }
+ return arr;
+}
+
+function strHasLength(str: string, min: number, max: number): boolean {
+ return typeof str === 'string' && str.length >= min && str.length <= max;
+}
+
+/**
+ * Derives main seed. Takes a lot of time. Prefer `eskdf` method instead.
+ */
+export function deriveMainSeed(username: string, password: string): Uint8Array {
+ if (!strHasLength(username, 8, 255)) throw new Error('invalid username');
+ if (!strHasLength(password, 8, 255)) throw new Error('invalid password');
+ // Declared like this to throw off minifiers which auto-convert .fromCharCode(1) to actual string.
+ // String with non-ascii may be problematic in some envs
+ const codes = { _1: 1, _2: 2 };
+ const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) };
+ const scr = scrypt(password + sep.s, username + sep.s);
+ const pbk = pbkdf2(password + sep.p, username + sep.p);
+ const res = xor32(scr, pbk);
+ clean(scr, pbk);
+ return res;
+}
+
+type AccountID = number | string;
+
+/**
+ * Converts protocol & accountId pair to HKDF salt & info params.
+ */
+function getSaltInfo(protocol: string, accountId: AccountID = 0) {
+ // Note that length here also repeats two lines below
+ // We do an additional length check here to reduce the scope of DoS attacks
+ if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) {
+ throw new Error('invalid protocol');
+ }
+
+ // Allow string account ids for some protocols
+ const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol);
+ let salt: Uint8Array; // Extract salt. Default is undefined.
+ if (typeof accountId === 'string') {
+ if (!allowsStr) throw new Error('accountId must be a number');
+ if (!strHasLength(accountId, 1, 255))
+ throw new Error('accountId must be string of length 1..255');
+ salt = kdfInputToBytes(accountId);
+ } else if (Number.isSafeInteger(accountId)) {
+ if (accountId < 0 || accountId > Math.pow(2, 32) - 1) throw new Error('invalid accountId');
+ // Convert to Big Endian Uint32
+ salt = new Uint8Array(4);
+ createView(salt).setUint32(0, accountId, false);
+ } else {
+ throw new Error('accountId must be a number' + (allowsStr ? ' or string' : ''));
+ }
+ const info = kdfInputToBytes(protocol);
+ return { salt, info };
+}
+
+type OptsLength = { keyLength: number };
+type OptsMod = { modulus: bigint };
+type KeyOpts = undefined | OptsLength | OptsMod;
+
+function countBytes(num: bigint): number {
+ if (typeof num !== 'bigint' || num <= BigInt(128)) throw new Error('invalid number');
+ return Math.ceil(num.toString(2).length / 8);
+}
+
+/**
+ * Parses keyLength and modulus options to extract length of result key.
+ * If modulus is used, adds 64 bits to it as per FIPS 186 B.4.1 to combat modulo bias.
+ */
+function getKeyLength(options: KeyOpts): number {
+ if (!options || typeof options !== 'object') return 32;
+ const hasLen = 'keyLength' in options;
+ const hasMod = 'modulus' in options;
+ if (hasLen && hasMod) throw new Error('cannot combine keyLength and modulus options');
+ if (!hasLen && !hasMod) throw new Error('must have either keyLength or modulus option');
+ // FIPS 186 B.4.1 requires at least 64 more bits
+ const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength;
+ if (!(typeof l === 'number' && l >= 16 && l <= 8192)) throw new Error('invalid keyLength');
+ return l;
+}
+
+/**
+ * Converts key to bigint and divides it by modulus. Big Endian.
+ * Implements FIPS 186 B.4.1, which removes 0 and modulo bias from output.
+ */
+function modReduceKey(key: Uint8Array, modulus: bigint): Uint8Array {
+ const _1 = BigInt(1);
+ const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber()
+ const res = (num % (modulus - _1)) + _1; // Remove 0 from output
+ if (res < _1) throw new Error('expected positive number'); // Guard against bad values
+ const len = key.length - 8; // FIPS requires 64 more bits = 8 bytes
+ const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex()
+ const bytes = hexToBytes(hex);
+ if (bytes.length !== len) throw new Error('invalid length of result key');
+ return bytes;
+}
+
+/** Not using classes because constructor cannot be async */
+export interface ESKDF {
+ /**
+ * Derives a child key. Child key will not be associated with any
+ * other child key because of properties of underlying KDF.
+ *
+ * @param protocol - 3-15 character protocol name
+ * @param accountId - numeric identifier of account
+ * @param options - `keyLength: 64` or `modulus: 41920438n`
+ * @example deriveChildKey('aes', 0)
+ */
+ deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => Uint8Array;
+ /**
+ * Deletes the main seed from eskdf instance
+ */
+ expire: () => void;
+ /**
+ * Account fingerprint
+ */
+ fingerprint: string;
+}
+
+/**
+ * ESKDF
+ * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
+ * @param password - password, min: 8 characters, should have enough entropy
+ * @example
+ * const kdf = await eskdf('example-university', 'beginning-new-example');
+ * const key = kdf.deriveChildKey('aes', 0);
+ * console.log(kdf.fingerprint);
+ * kdf.expire();
+ */
+export async function eskdf(username: string, password: string): Promise {
+ // We are using closure + object instead of class because
+ // we want to make `seed` non-accessible for any external function.
+ let seed: Uint8Array | undefined = deriveMainSeed(username, password);
+
+ function deriveCK(protocol: string, accountId: AccountID = 0, options?: KeyOpts): Uint8Array {
+ abytes(seed!, 32);
+ const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId
+ const keyLength = getKeyLength(options); // validate options
+ const key = hkdf(sha256, seed!, salt, info, keyLength);
+ // Modulus has already been validated
+ return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key;
+ }
+ function expire() {
+ if (seed) seed.fill(1);
+ seed = undefined;
+ }
+ // prettier-ignore
+ const fingerprint = Array.from(deriveCK('fingerprint', 0))
+ .slice(0, 6)
+ .map((char) => char.toString(16).padStart(2, '0').toUpperCase())
+ .join(':');
+ return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint });
+}
diff --git a/server/node_modules/@noble/hashes/src/hkdf.ts b/server/node_modules/@noble/hashes/src/hkdf.ts
new file mode 100644
index 0000000..5601d76
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/hkdf.ts
@@ -0,0 +1,94 @@
+/**
+ * HKDF (RFC 5869): extract + expand in one step.
+ * See https://soatok.blog/2021/11/17/understanding-hkdf/.
+ * @module
+ */
+import { hmac } from './hmac.ts';
+import { abytes, ahash, anumber, type CHash, clean } from './utils.ts';
+
+/**
+ * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK`
+ * Arguments position differs from spec (IKM is first one, since it is not optional)
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ */
+export function extract(hash: CHash, ikm: Uint8Array, salt?: Uint8Array): Uint8Array {
+ ahash(hash);
+ // NOTE: some libraries treat zero-length array as 'not provided';
+ // we don't, since we have undefined as 'not provided'
+ // https://github.com/RustCrypto/KDFs/issues/15
+ if (salt === undefined) salt = new Uint8Array(hash.outputLen);
+ return hmac(hash, salt, ikm);
+}
+
+const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
+const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
+
+/**
+ * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ */
+export function expand(
+ hash: CHash,
+ prk: Uint8Array,
+ info?: Uint8Array,
+ length: number = 32
+): Uint8Array {
+ ahash(hash);
+ anumber(length, 'length');
+ const olen = hash.outputLen;
+ if (length > 255 * olen) throw new Error('Length must be <= 255*HashLen');
+ const blocks = Math.ceil(length / olen);
+ if (info === undefined) info = EMPTY_BUFFER;
+ else abytes(info, undefined, 'info');
+ // first L(ength) octets of T
+ const okm = new Uint8Array(blocks * olen);
+ // Re-use HMAC instance between blocks
+ const HMAC = hmac.create(hash, prk);
+ const HMACTmp = HMAC._cloneInto();
+ const T = new Uint8Array(HMAC.outputLen);
+ for (let counter = 0; counter < blocks; counter++) {
+ HKDF_COUNTER[0] = counter + 1;
+ // T(0) = empty string (zero length)
+ // T(N) = HMAC-Hash(PRK, T(N-1) | info | N)
+ HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T)
+ .update(info)
+ .update(HKDF_COUNTER)
+ .digestInto(T);
+ okm.set(T, olen * counter);
+ HMAC._cloneInto(HMACTmp);
+ }
+ HMAC.destroy();
+ HMACTmp.destroy();
+ clean(T, HKDF_COUNTER);
+ return okm.slice(0, length);
+}
+
+/**
+ * HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256)
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * import { hkdf } from '@noble/hashes/hkdf';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * import { randomBytes } from '@noble/hashes/utils';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1 = hkdf(sha256, inputKey, salt, info, 32);
+ */
+export const hkdf = (
+ hash: CHash,
+ ikm: Uint8Array,
+ salt: Uint8Array | undefined,
+ info: Uint8Array | undefined,
+ length: number
+): Uint8Array => expand(hash, extract(hash, ikm, salt), info, length);
diff --git a/server/node_modules/@noble/hashes/src/hmac.ts b/server/node_modules/@noble/hashes/src/hmac.ts
new file mode 100644
index 0000000..6fdebdb
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/hmac.ts
@@ -0,0 +1,94 @@
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @module
+ */
+import { abytes, aexists, ahash, clean, type CHash, type Hash } from './utils.ts';
+
+/** Internal class for HMAC. */
+export class _HMAC> implements Hash<_HMAC> {
+ oHash: T;
+ iHash: T;
+ blockLen: number;
+ outputLen: number;
+ private finished = false;
+ private destroyed = false;
+
+ constructor(hash: CHash, key: Uint8Array) {
+ ahash(hash);
+ abytes(key, undefined, 'key');
+ this.iHash = hash.create() as T;
+ if (typeof this.iHash.update !== 'function')
+ throw new Error('Expected instance of class which extends utils.Hash');
+ this.blockLen = this.iHash.blockLen;
+ this.outputLen = this.iHash.outputLen;
+ const blockLen = this.blockLen;
+ const pad = new Uint8Array(blockLen);
+ // blockLen can be bigger than outputLen
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36;
+ this.iHash.update(pad);
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
+ this.oHash = hash.create() as T;
+ // Undo internal XOR && apply outer XOR
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36 ^ 0x5c;
+ this.oHash.update(pad);
+ clean(pad);
+ }
+ update(buf: Uint8Array): this {
+ aexists(this);
+ this.iHash.update(buf);
+ return this;
+ }
+ digestInto(out: Uint8Array): void {
+ aexists(this);
+ abytes(out, this.outputLen, 'output');
+ this.finished = true;
+ this.iHash.digestInto(out);
+ this.oHash.update(out);
+ this.oHash.digestInto(out);
+ this.destroy();
+ }
+ digest(): Uint8Array {
+ const out = new Uint8Array(this.oHash.outputLen);
+ this.digestInto(out);
+ return out;
+ }
+ _cloneInto(to?: _HMAC): _HMAC {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ to ||= Object.create(Object.getPrototypeOf(this), {});
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
+ to = to as this;
+ to.finished = finished;
+ to.destroyed = destroyed;
+ to.blockLen = blockLen;
+ to.outputLen = outputLen;
+ to.oHash = oHash._cloneInto(to.oHash);
+ to.iHash = iHash._cloneInto(to.iHash);
+ return to;
+ }
+ clone(): _HMAC {
+ return this._cloneInto();
+ }
+ destroy(): void {
+ this.destroyed = true;
+ this.oHash.destroy();
+ this.iHash.destroy();
+ }
+}
+
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256
+ * @param key - message key
+ * @param message - message data
+ * @example
+ * import { hmac } from '@noble/hashes/hmac';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * const mac1 = hmac(sha256, 'key', 'message');
+ */
+export const hmac: {
+ (hash: CHash, key: Uint8Array, message: Uint8Array): Uint8Array;
+ create(hash: CHash, key: Uint8Array): _HMAC;
+} = (hash: CHash, key: Uint8Array, message: Uint8Array): Uint8Array =>
+ new _HMAC(hash, key).update(message).digest();
+hmac.create = (hash: CHash, key: Uint8Array) => new _HMAC(hash, key);
diff --git a/server/node_modules/@noble/hashes/src/index.ts b/server/node_modules/@noble/hashes/src/index.ts
new file mode 100644
index 0000000..d128012
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/index.ts
@@ -0,0 +1,32 @@
+/**
+ * Audited & minimal JS implementation of hash functions, MACs and KDFs. Check out individual modules.
+ * @module
+ * @example
+```js
+import {
+ sha256, sha384, sha512, sha224, sha512_224, sha512_256
+} from '@noble/hashes/sha2.js';
+import {
+ sha3_224, sha3_256, sha3_384, sha3_512,
+ keccak_224, keccak_256, keccak_384, keccak_512,
+ shake128, shake256
+} from '@noble/hashes/sha3.js';
+import {
+ cshake128, cshake256,
+ turboshake128, turboshake256,
+ kt128, kt256,
+ kmac128, kmac256,
+ tuplehash256, parallelhash256,
+ keccakprg
+} from '@noble/hashes/sha3-addons.js';
+import { blake3 } from '@noble/hashes/blake3.js';
+import { blake2b, blake2s } from '@noble/hashes/blake2.js';
+import { hmac } from '@noble/hashes/hmac.js';
+import { hkdf } from '@noble/hashes/hkdf.js';
+import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
+import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
+import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';
+import * as utils from '@noble/hashes/utils.js';
+```
+ */
+throw new Error('root module cannot be imported: import submodules instead. Check out README');
diff --git a/server/node_modules/@noble/hashes/src/legacy.ts b/server/node_modules/@noble/hashes/src/legacy.ts
new file mode 100644
index 0000000..d3bb1a7
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/legacy.ts
@@ -0,0 +1,293 @@
+/**
+
+SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.
+Don't use them in a new protocol. What "weak" means:
+
+- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
+- No practical pre-image attacks (only theoretical, 2^123.4)
+- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151
+ * @module
+ */
+import { Chi, HashMD, Maj } from './_md.ts';
+import { type CHash, clean, createHasher, rotl } from './utils.ts';
+
+/** Initial SHA1 state */
+const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,
+]);
+
+// Reusable temporary buffer
+const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
+
+/** Internal SHA1 legacy hash class. */
+export class _SHA1 extends HashMD<_SHA1> {
+ private A = SHA1_IV[0] | 0;
+ private B = SHA1_IV[1] | 0;
+ private C = SHA1_IV[2] | 0;
+ private D = SHA1_IV[3] | 0;
+ private E = SHA1_IV[4] | 0;
+
+ constructor() {
+ super(64, 20, 8, false);
+ }
+ protected get(): [number, number, number, number, number] {
+ const { A, B, C, D, E } = this;
+ return [A, B, C, D, E];
+ }
+ protected set(A: number, B: number, C: number, D: number, E: number): void {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ }
+ protected process(view: DataView, offset: number): void {
+ for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false);
+ for (let i = 16; i < 80; i++)
+ SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
+ // Compression function main loop, 80 rounds
+ let { A, B, C, D, E } = this;
+ for (let i = 0; i < 80; i++) {
+ let F, K;
+ if (i < 20) {
+ F = Chi(B, C, D);
+ K = 0x5a827999;
+ } else if (i < 40) {
+ F = B ^ C ^ D;
+ K = 0x6ed9eba1;
+ } else if (i < 60) {
+ F = Maj(B, C, D);
+ K = 0x8f1bbcdc;
+ } else {
+ F = B ^ C ^ D;
+ K = 0xca62c1d6;
+ }
+ const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
+ E = D;
+ D = C;
+ C = rotl(B, 30);
+ B = A;
+ A = T;
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ E = (E + this.E) | 0;
+ this.set(A, B, C, D, E);
+ }
+ protected roundClean(): void {
+ clean(SHA1_W);
+ }
+ destroy(): void {
+ this.set(0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+
+/** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+export const sha1: CHash = /* @__PURE__ */ createHasher(() => new _SHA1());
+
+/** Per-round constants */
+const p32 = /* @__PURE__ */ Math.pow(2, 32);
+const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) =>
+ Math.floor(p32 * Math.abs(Math.sin(i + 1)))
+);
+
+/** md5 initial state: same as sha1, but 4 u32 instead of 5. */
+const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4);
+
+// Reusable temporary buffer
+const MD5_W = /* @__PURE__ */ new Uint32Array(16);
+/** Internal MD5 legacy hash class. */
+export class _MD5 extends HashMD<_MD5> {
+ private A = MD5_IV[0] | 0;
+ private B = MD5_IV[1] | 0;
+ private C = MD5_IV[2] | 0;
+ private D = MD5_IV[3] | 0;
+
+ constructor() {
+ super(64, 16, 8, true);
+ }
+ protected get(): [number, number, number, number] {
+ const { A, B, C, D } = this;
+ return [A, B, C, D];
+ }
+ protected set(A: number, B: number, C: number, D: number): void {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ }
+ protected process(view: DataView, offset: number): void {
+ for (let i = 0; i < 16; i++, offset += 4) MD5_W[i] = view.getUint32(offset, true);
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D } = this;
+ for (let i = 0; i < 64; i++) {
+ let F, g, s;
+ if (i < 16) {
+ F = Chi(B, C, D);
+ g = i;
+ s = [7, 12, 17, 22];
+ } else if (i < 32) {
+ F = Chi(D, B, C);
+ g = (5 * i + 1) % 16;
+ s = [5, 9, 14, 20];
+ } else if (i < 48) {
+ F = B ^ C ^ D;
+ g = (3 * i + 5) % 16;
+ s = [4, 11, 16, 23];
+ } else {
+ F = C ^ (B | ~D);
+ g = (7 * i) % 16;
+ s = [6, 10, 15, 21];
+ }
+ F = F + A + K[i] + MD5_W[g];
+ A = D;
+ D = C;
+ C = B;
+ B = B + rotl(F, s[i % 4]);
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ this.set(A, B, C, D);
+ }
+ protected roundClean(): void {
+ clean(MD5_W);
+ }
+ destroy(): void {
+ this.set(0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+
+/**
+ * MD5 (RFC 1321) legacy hash function. It was cryptographically broken.
+ * MD5 architecture is similar to SHA1, with some differences:
+ * - Reduced output length: 16 bytes (128 bit) instead of 20
+ * - 64 rounds, instead of 80
+ * - Little-endian: could be faster, but will require more code
+ * - Non-linear index selection: huge speed-up for unroll
+ * - Per round constants: more memory accesses, additional speed-up for unroll
+ */
+export const md5: CHash = /* @__PURE__ */ createHasher(() => new _MD5());
+
+// RIPEMD-160
+
+const Rho160 = /* @__PURE__ */ Uint8Array.from([
+ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
+]);
+const Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
+const Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
+const idxLR = /* @__PURE__ */ (() => {
+ const L = [Id160];
+ const R = [Pi160];
+ const res = [L, R];
+ for (let i = 0; i < 4; i++) for (let j of res) j.push(j[i].map((k) => Rho160[k]));
+ return res;
+})();
+const idxL = /* @__PURE__ */ (() => idxLR[0])();
+const idxR = /* @__PURE__ */ (() => idxLR[1])();
+// const [idxL, idxR] = idxLR;
+
+const shifts160 = /* @__PURE__ */ [
+ [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
+ [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
+ [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
+ [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
+ [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],
+].map((i) => Uint8Array.from(i));
+const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
+const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
+const Kl160 = /* @__PURE__ */ Uint32Array.from([
+ 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,
+]);
+const Kr160 = /* @__PURE__ */ Uint32Array.from([
+ 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,
+]);
+// It's called f() in spec.
+function ripemd_f(group: number, x: number, y: number, z: number): number {
+ if (group === 0) return x ^ y ^ z;
+ if (group === 1) return (x & y) | (~x & z);
+ if (group === 2) return (x | ~y) ^ z;
+ if (group === 3) return (x & z) | (y & ~z);
+ return x ^ (y | ~z);
+}
+// Reusable temporary buffer
+const BUF_160 = /* @__PURE__ */ new Uint32Array(16);
+export class _RIPEMD160 extends HashMD<_RIPEMD160> {
+ private h0 = 0x67452301 | 0;
+ private h1 = 0xefcdab89 | 0;
+ private h2 = 0x98badcfe | 0;
+ private h3 = 0x10325476 | 0;
+ private h4 = 0xc3d2e1f0 | 0;
+
+ constructor() {
+ super(64, 20, 8, true);
+ }
+ protected get(): [number, number, number, number, number] {
+ const { h0, h1, h2, h3, h4 } = this;
+ return [h0, h1, h2, h3, h4];
+ }
+ protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void {
+ this.h0 = h0 | 0;
+ this.h1 = h1 | 0;
+ this.h2 = h2 | 0;
+ this.h3 = h3 | 0;
+ this.h4 = h4 | 0;
+ }
+ protected process(view: DataView, offset: number): void {
+ for (let i = 0; i < 16; i++, offset += 4) BUF_160[i] = view.getUint32(offset, true);
+ // prettier-ignore
+ let al = this.h0 | 0, ar = al,
+ bl = this.h1 | 0, br = bl,
+ cl = this.h2 | 0, cr = cl,
+ dl = this.h3 | 0, dr = dl,
+ el = this.h4 | 0, er = el;
+
+ // Instead of iterating 0 to 80, we split it into 5 groups
+ // And use the groups in constants, functions, etc. Much simpler
+ for (let group = 0; group < 5; group++) {
+ const rGroup = 4 - group;
+ const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore
+ const rl = idxL[group], rr = idxR[group]; // prettier-ignore
+ const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore
+ for (let i = 0; i < 16; i++) {
+ const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0;
+ al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore
+ }
+ // 2 loops are 10% faster
+ for (let i = 0; i < 16; i++) {
+ const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0;
+ ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore
+ }
+ }
+ // Add the compressed chunk to the current hash value
+ this.set(
+ (this.h1 + cl + dr) | 0,
+ (this.h2 + dl + er) | 0,
+ (this.h3 + el + ar) | 0,
+ (this.h4 + al + br) | 0,
+ (this.h0 + bl + cr) | 0
+ );
+ }
+ protected roundClean(): void {
+ clean(BUF_160);
+ }
+ destroy(): void {
+ this.destroyed = true;
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0);
+ }
+}
+
+/**
+ * RIPEMD-160 - a legacy hash function from 1990s.
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
+ */
+export const ripemd160: CHash = /* @__PURE__ */ createHasher(() => new _RIPEMD160());
diff --git a/server/node_modules/@noble/hashes/src/pbkdf2.ts b/server/node_modules/@noble/hashes/src/pbkdf2.ts
new file mode 100644
index 0000000..2d2e90b
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/pbkdf2.ts
@@ -0,0 +1,129 @@
+/**
+ * PBKDF (RFC 2898). Can be used to create a key from password and salt.
+ * @module
+ */
+import { hmac } from './hmac.ts';
+// prettier-ignore
+import {
+ ahash, anumber,
+ asyncLoop, checkOpts, clean, createView, kdfInputToBytes,
+ type CHash,
+ type Hash,
+ type KDFInput
+} from './utils.ts';
+
+/**
+ * PBKDF2 options:
+ * * c: iterations, should probably be higher than 100_000
+ * * dkLen: desired length of derived key in bytes
+ * * asyncTick: max time in ms for which async function can block execution
+ */
+export type Pbkdf2Opt = {
+ c: number;
+ dkLen?: number;
+ asyncTick?: number;
+};
+// Common start and end for sync/async functions
+function pbkdf2Init(hash: CHash, _password: KDFInput, _salt: KDFInput, _opts: Pbkdf2Opt) {
+ ahash(hash);
+ const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
+ const { c, dkLen, asyncTick } = opts;
+ anumber(c, 'c');
+ anumber(dkLen, 'dkLen');
+ anumber(asyncTick, 'asyncTick');
+ if (c < 1) throw new Error('iterations (c) must be >= 1');
+ const password = kdfInputToBytes(_password, 'password');
+ const salt = kdfInputToBytes(_salt, 'salt');
+ // DK = PBKDF2(PRF, Password, Salt, c, dkLen);
+ const DK = new Uint8Array(dkLen);
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ const PRF = hmac.create(hash, password);
+ const PRFSalt = PRF._cloneInto().update(salt);
+ return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
+}
+
+function pbkdf2Output>(
+ PRF: Hash,
+ PRFSalt: Hash,
+ DK: Uint8Array,
+ prfW: Hash,
+ u: Uint8Array
+) {
+ PRF.destroy();
+ PRFSalt.destroy();
+ if (prfW) prfW.destroy();
+ clean(u);
+ return DK;
+}
+
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ */
+export function pbkdf2(
+ hash: CHash,
+ password: KDFInput,
+ salt: KDFInput,
+ opts: Pbkdf2Opt
+): Uint8Array {
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
+ let prfW: any; // Working copy
+ const arr = new Uint8Array(4);
+ const view = createView(arr);
+ const u = new Uint8Array(PRF.outputLen);
+ // DK = T1 + T2 + ⋯ + Tdklen/hlen
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
+ // Ti = F(Password, Salt, c, i)
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
+ view.setInt32(0, ti, false);
+ // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
+ Ti.set(u.subarray(0, Ti.length));
+ for (let ui = 1; ui < c; ui++) {
+ // Uc = PRF(Password, Uc−1)
+ PRF._cloneInto(prfW).update(u).digestInto(u);
+ for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];
+ }
+ }
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
+}
+
+/**
+ * PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
+ * @example
+ * await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
+ */
+export async function pbkdf2Async(
+ hash: CHash,
+ password: KDFInput,
+ salt: KDFInput,
+ opts: Pbkdf2Opt
+): Promise {
+ const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
+ let prfW: any; // Working copy
+ const arr = new Uint8Array(4);
+ const view = createView(arr);
+ const u = new Uint8Array(PRF.outputLen);
+ // DK = T1 + T2 + ⋯ + Tdklen/hlen
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
+ // Ti = F(Password, Salt, c, i)
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
+ view.setInt32(0, ti, false);
+ // F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc
+ // U1 = PRF(Password, Salt + INT_32_BE(i))
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
+ Ti.set(u.subarray(0, Ti.length));
+ await asyncLoop(c - 1, asyncTick, () => {
+ // Uc = PRF(Password, Uc−1)
+ PRF._cloneInto(prfW).update(u).digestInto(u);
+ for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];
+ });
+ }
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
+}
diff --git a/server/node_modules/@noble/hashes/src/scrypt.ts b/server/node_modules/@noble/hashes/src/scrypt.ts
new file mode 100644
index 0000000..619de53
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/scrypt.ts
@@ -0,0 +1,249 @@
+/**
+ * RFC 7914 Scrypt KDF. Can be used to create a key from password and salt.
+ * @module
+ */
+import { pbkdf2 } from './pbkdf2.ts';
+import { sha256 } from './sha2.ts';
+// prettier-ignore
+import {
+ anumber, asyncLoop,
+ checkOpts, clean,
+ type KDFInput, rotl,
+ swap32IfBE,
+ u32
+} from './utils.ts';
+
+// The main Scrypt loop: uses Salsa extensively.
+// Six versions of the function were tried, this is the fastest one.
+// prettier-ignore
+function XorAndSalsa(
+ prev: Uint32Array,
+ pi: number,
+ input: Uint32Array,
+ ii: number,
+ out: Uint32Array,
+ oi: number
+) {
+ // Based on https://cr.yp.to/salsa20.html
+ // Xor blocks
+ let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
+ let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
+ let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];
+ let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];
+ let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];
+ let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];
+ let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];
+ let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];
+ // Save state to temporary variables (salsa)
+ let x00 = y00, x01 = y01, x02 = y02, x03 = y03,
+ x04 = y04, x05 = y05, x06 = y06, x07 = y07,
+ x08 = y08, x09 = y09, x10 = y10, x11 = y11,
+ x12 = y12, x13 = y13, x14 = y14, x15 = y15;
+ // Main loop (salsa)
+ for (let i = 0; i < 8; i += 2) {
+ x04 ^= rotl(x00 + x12 | 0, 7); x08 ^= rotl(x04 + x00 | 0, 9);
+ x12 ^= rotl(x08 + x04 | 0, 13); x00 ^= rotl(x12 + x08 | 0, 18);
+ x09 ^= rotl(x05 + x01 | 0, 7); x13 ^= rotl(x09 + x05 | 0, 9);
+ x01 ^= rotl(x13 + x09 | 0, 13); x05 ^= rotl(x01 + x13 | 0, 18);
+ x14 ^= rotl(x10 + x06 | 0, 7); x02 ^= rotl(x14 + x10 | 0, 9);
+ x06 ^= rotl(x02 + x14 | 0, 13); x10 ^= rotl(x06 + x02 | 0, 18);
+ x03 ^= rotl(x15 + x11 | 0, 7); x07 ^= rotl(x03 + x15 | 0, 9);
+ x11 ^= rotl(x07 + x03 | 0, 13); x15 ^= rotl(x11 + x07 | 0, 18);
+ x01 ^= rotl(x00 + x03 | 0, 7); x02 ^= rotl(x01 + x00 | 0, 9);
+ x03 ^= rotl(x02 + x01 | 0, 13); x00 ^= rotl(x03 + x02 | 0, 18);
+ x06 ^= rotl(x05 + x04 | 0, 7); x07 ^= rotl(x06 + x05 | 0, 9);
+ x04 ^= rotl(x07 + x06 | 0, 13); x05 ^= rotl(x04 + x07 | 0, 18);
+ x11 ^= rotl(x10 + x09 | 0, 7); x08 ^= rotl(x11 + x10 | 0, 9);
+ x09 ^= rotl(x08 + x11 | 0, 13); x10 ^= rotl(x09 + x08 | 0, 18);
+ x12 ^= rotl(x15 + x14 | 0, 7); x13 ^= rotl(x12 + x15 | 0, 9);
+ x14 ^= rotl(x13 + x12 | 0, 13); x15 ^= rotl(x14 + x13 | 0, 18);
+ }
+ // Write output (salsa)
+ out[oi++] = (y00 + x00) | 0; out[oi++] = (y01 + x01) | 0;
+ out[oi++] = (y02 + x02) | 0; out[oi++] = (y03 + x03) | 0;
+ out[oi++] = (y04 + x04) | 0; out[oi++] = (y05 + x05) | 0;
+ out[oi++] = (y06 + x06) | 0; out[oi++] = (y07 + x07) | 0;
+ out[oi++] = (y08 + x08) | 0; out[oi++] = (y09 + x09) | 0;
+ out[oi++] = (y10 + x10) | 0; out[oi++] = (y11 + x11) | 0;
+ out[oi++] = (y12 + x12) | 0; out[oi++] = (y13 + x13) | 0;
+ out[oi++] = (y14 + x14) | 0; out[oi++] = (y15 + x15) | 0;
+}
+
+function BlockMix(input: Uint32Array, ii: number, out: Uint32Array, oi: number, r: number) {
+ // The block B is r 128-byte chunks (which is equivalent of 2r 64-byte chunks)
+ let head = oi + 0;
+ let tail = oi + 16 * r;
+ for (let i = 0; i < 16; i++) out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; // X ← B[2r−1]
+ for (let i = 0; i < r; i++, head += 16, ii += 16) {
+ // We write odd & even Yi at same time. Even: 0bXXXXX0 Odd: 0bXXXXX1
+ XorAndSalsa(out, tail, input, ii, out, head); // head[i] = Salsa(blockIn[2*i] ^ tail[i-1])
+ if (i > 0) tail += 16; // First iteration overwrites tmp value in tail
+ XorAndSalsa(out, head, input, (ii += 16), out, tail); // tail[i] = Salsa(blockIn[2*i+1] ^ head[i])
+ }
+}
+
+/**
+ * Scrypt options:
+ * - `N` is cpu/mem work factor (power of 2 e.g. `2**18`)
+ * - `r` is block size (8 is common), fine-tunes sequential memory read size and performance
+ * - `p` is parallelization factor (1 is common)
+ * - `dkLen` is output key length in bytes e.g. 32.
+ * - `asyncTick` - (default: 10) max time in ms for which async function can block execution
+ * - `maxmem` - (default: `1024 ** 3 + 1024` aka 1GB+1KB). A limit that the app could use for scrypt
+ * - `onProgress` - callback function that would be executed for progress report
+ */
+export type ScryptOpts = {
+ N: number; // cost factor
+ r: number; // block size
+ p: number; // parallelization
+ dkLen?: number; // key length
+ asyncTick?: number; // block execution max time
+ maxmem?: number;
+ onProgress?: (progress: number) => void;
+};
+
+// Common prologue and epilogue for sync/async functions
+function scryptInit(password: KDFInput, salt: KDFInput, _opts?: ScryptOpts) {
+ // Maxmem - 1GB+1KB by default
+ const opts = checkOpts(
+ {
+ dkLen: 32,
+ asyncTick: 10,
+ maxmem: 1024 ** 3 + 1024,
+ },
+ _opts
+ );
+ const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;
+ anumber(N, 'N');
+ anumber(r, 'r');
+ anumber(p, 'p');
+ anumber(dkLen, 'dkLen');
+ anumber(asyncTick, 'asyncTick');
+ anumber(maxmem, 'maxmem');
+ if (onProgress !== undefined && typeof onProgress !== 'function')
+ throw new Error('progressCb must be a function');
+ const blockSize = 128 * r;
+ const blockSize32 = blockSize / 4;
+
+ // Max N is 2^32 (Integrify is 32-bit).
+ // Real limit can be 2^22: some JS engines limit Uint8Array to 4GB.
+ // Spec check `N >= 2^(blockSize / 8)` is not done for compat with popular libs,
+ // which used incorrect r: 1, p: 8. Also, the check seems to be a spec error:
+ // https://www.rfc-editor.org/errata_search.php?rfc=7914
+ const pow32 = Math.pow(2, 32);
+ if (N <= 1 || (N & (N - 1)) !== 0 || N > pow32)
+ throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');
+ if (p < 1 || p > ((pow32 - 1) * 32) / blockSize)
+ throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');
+ if (dkLen < 1 || dkLen > (pow32 - 1) * 32)
+ throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');
+ const memUsed = blockSize * (N + p);
+ if (memUsed > maxmem)
+ throw new Error('"maxmem" limit was hit, expected 128*r*(N+p) <= "maxmem"=' + maxmem);
+ // [B0...Bp−1] ← PBKDF2HMAC-SHA256(Passphrase, Salt, 1, blockSize*ParallelizationFactor)
+ // Since it has only one iteration there is no reason to use async variant
+ const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });
+ const B32 = u32(B);
+ // Re-used between parallel iterations. Array(iterations) of B
+ const V = u32(new Uint8Array(blockSize * N));
+ const tmp = u32(new Uint8Array(blockSize));
+ let blockMixCb = () => {};
+ if (onProgress) {
+ const totalBlockMix = 2 * N * p;
+ // Invoke callback if progress changes from 10.01 to 10.02
+ // Allows to draw smooth progress bar on up to 8K screen
+ const callbackPer = Math.max(Math.floor(totalBlockMix / 10000), 1);
+ let blockMixCnt = 0;
+ blockMixCb = () => {
+ blockMixCnt++;
+ if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))
+ onProgress(blockMixCnt / totalBlockMix);
+ };
+ }
+ return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
+}
+
+function scryptOutput(
+ password: KDFInput,
+ dkLen: number,
+ B: Uint8Array,
+ V: Uint32Array,
+ tmp: Uint32Array
+) {
+ const res = pbkdf2(sha256, password, B, { c: 1, dkLen });
+ clean(B, V, tmp);
+ return res;
+}
+
+/**
+ * Scrypt KDF from RFC 7914. See {@link ScryptOpts}.
+ * @example
+ * scrypt('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export function scrypt(password: KDFInput, salt: KDFInput, opts: ScryptOpts): Uint8Array {
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(
+ password,
+ salt,
+ opts
+ );
+ swap32IfBE(B32);
+ for (let pi = 0; pi < p; pi++) {
+ const Pi = blockSize32 * pi;
+ for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i]
+ for (let i = 0, pos = 0; i < N - 1; i++) {
+ BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);
+ blockMixCb();
+ }
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element
+ blockMixCb();
+ for (let i = 0; i < N; i++) {
+ // First u32 of the last 64-byte block (u32 is LE)
+ // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked above; >>> 0 for unsigned, input fits in u32
+ const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations
+ for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]
+ BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])
+ blockMixCb();
+ }
+ }
+ swap32IfBE(B32);
+ return scryptOutput(password, dkLen, B, V, tmp);
+}
+
+/**
+ * Scrypt KDF from RFC 7914. Async version. See {@link ScryptOpts}.
+ * @example
+ * await scryptAsync('password', 'salt', { N: 2**18, r: 8, p: 1, dkLen: 32 });
+ */
+export async function scryptAsync(
+ password: KDFInput,
+ salt: KDFInput,
+ opts: ScryptOpts
+): Promise {
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(
+ password,
+ salt,
+ opts
+ );
+ swap32IfBE(B32);
+ for (let pi = 0; pi < p; pi++) {
+ const Pi = blockSize32 * pi;
+ for (let i = 0; i < blockSize32; i++) V[i] = B32[Pi + i]; // V[0] = B[i]
+ let pos = 0;
+ await asyncLoop(N - 1, asyncTick, () => {
+ BlockMix(V, pos, V, (pos += blockSize32), r); // V[i] = BlockMix(V[i-1]);
+ blockMixCb();
+ });
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r); // Process last element
+ blockMixCb();
+ await asyncLoop(N, asyncTick, () => {
+ // First u32 of the last 64-byte block (u32 is LE)
+ // & (N - 1) is % N as N is a power of 2, N & (N - 1) = 0 is checked above; >>> 0 for unsigned, input fits in u32
+ const j = (B32[Pi + blockSize32 - 16] & (N - 1)) >>> 0; // j = Integrify(X) % iterations
+ for (let k = 0; k < blockSize32; k++) tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k]; // tmp = B ^ V[j]
+ BlockMix(tmp, 0, B32, Pi, r); // B = BlockMix(B ^ V[j])
+ blockMixCb();
+ });
+ }
+ swap32IfBE(B32);
+ return scryptOutput(password, dkLen, B, V, tmp);
+}
diff --git a/server/node_modules/@noble/hashes/src/sha2.ts b/server/node_modules/@noble/hashes/src/sha2.ts
new file mode 100644
index 0000000..73f8d17
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/sha2.ts
@@ -0,0 +1,469 @@
+/**
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
+ * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
+ * @module
+ */
+import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';
+import * as u64 from './_u64.ts';
+import { type CHash, clean, createHasher, oidNist, rotr } from './utils.ts';
+
+/**
+ * Round constants:
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
+ */
+// prettier-ignore
+const SHA256_K = /* @__PURE__ */ Uint32Array.from([
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+]);
+
+/** Reusable temporary buffer. "W" comes straight from spec. */
+const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
+
+/** Internal 32-byte base SHA2 hash class. */
+abstract class SHA2_32B> extends HashMD {
+ // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ protected abstract A: number;
+ protected abstract B: number;
+ protected abstract C: number;
+ protected abstract D: number;
+ protected abstract E: number;
+ protected abstract F: number;
+ protected abstract G: number;
+ protected abstract H: number;
+
+ constructor(outputLen: number) {
+ super(64, outputLen, 8, false);
+ }
+ protected get(): [number, number, number, number, number, number, number, number] {
+ const { A, B, C, D, E, F, G, H } = this;
+ return [A, B, C, D, E, F, G, H];
+ }
+ // prettier-ignore
+ protected set(
+ A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number
+ ): void {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ this.F = F | 0;
+ this.G = G | 0;
+ this.H = H | 0;
+ }
+ protected process(view: DataView, offset: number): void {
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
+ for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
+ for (let i = 16; i < 64; i++) {
+ const W15 = SHA256_W[i - 15];
+ const W2 = SHA256_W[i - 2];
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
+ SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
+ }
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D, E, F, G, H } = this;
+ for (let i = 0; i < 64; i++) {
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
+ const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
+ const T2 = (sigma0 + Maj(A, B, C)) | 0;
+ H = G;
+ G = F;
+ F = E;
+ E = (D + T1) | 0;
+ D = C;
+ C = B;
+ B = A;
+ A = (T1 + T2) | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ A = (A + this.A) | 0;
+ B = (B + this.B) | 0;
+ C = (C + this.C) | 0;
+ D = (D + this.D) | 0;
+ E = (E + this.E) | 0;
+ F = (F + this.F) | 0;
+ G = (G + this.G) | 0;
+ H = (H + this.H) | 0;
+ this.set(A, B, C, D, E, F, G, H);
+ }
+ protected roundClean(): void {
+ clean(SHA256_W);
+ }
+ destroy(): void {
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+}
+
+/** Internal SHA2-256 hash class. */
+export class _SHA256 extends SHA2_32B<_SHA256> {
+ // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ protected A: number = SHA256_IV[0] | 0;
+ protected B: number = SHA256_IV[1] | 0;
+ protected C: number = SHA256_IV[2] | 0;
+ protected D: number = SHA256_IV[3] | 0;
+ protected E: number = SHA256_IV[4] | 0;
+ protected F: number = SHA256_IV[5] | 0;
+ protected G: number = SHA256_IV[6] | 0;
+ protected H: number = SHA256_IV[7] | 0;
+ constructor() {
+ super(32);
+ }
+}
+
+/** Internal SHA2-224 hash class. */
+export class _SHA224 extends SHA2_32B<_SHA224> {
+ protected A: number = SHA224_IV[0] | 0;
+ protected B: number = SHA224_IV[1] | 0;
+ protected C: number = SHA224_IV[2] | 0;
+ protected D: number = SHA224_IV[3] | 0;
+ protected E: number = SHA224_IV[4] | 0;
+ protected F: number = SHA224_IV[5] | 0;
+ protected G: number = SHA224_IV[6] | 0;
+ protected H: number = SHA224_IV[7] | 0;
+ constructor() {
+ super(28);
+ }
+}
+
+// SHA2-512 is slower than sha256 in js because u64 operations are slow.
+
+// Round contants
+// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409
+// prettier-ignore
+const K512 = /* @__PURE__ */ (() => u64.split([
+ '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
+ '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
+ '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
+ '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
+ '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
+ '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
+ '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
+ '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
+ '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
+ '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
+ '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
+ '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
+ '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
+ '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
+ '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
+ '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
+ '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
+ '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
+ '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
+ '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
+].map(n => BigInt(n))))();
+const SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
+const SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
+
+// Reusable temporary buffers
+const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
+const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
+
+/** Internal 64-byte base SHA2 hash class. */
+abstract class SHA2_64B> extends HashMD {
+ // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ // h -- high 32 bits, l -- low 32 bits
+ protected abstract Ah: number;
+ protected abstract Al: number;
+ protected abstract Bh: number;
+ protected abstract Bl: number;
+ protected abstract Ch: number;
+ protected abstract Cl: number;
+ protected abstract Dh: number;
+ protected abstract Dl: number;
+ protected abstract Eh: number;
+ protected abstract El: number;
+ protected abstract Fh: number;
+ protected abstract Fl: number;
+ protected abstract Gh: number;
+ protected abstract Gl: number;
+ protected abstract Hh: number;
+ protected abstract Hl: number;
+
+ constructor(outputLen: number) {
+ super(128, outputLen, 16, false);
+ }
+ // prettier-ignore
+ protected get(): [
+ number, number, number, number, number, number, number, number,
+ number, number, number, number, number, number, number, number
+ ] {
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
+ }
+ // prettier-ignore
+ protected set(
+ Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,
+ Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number
+ ): void {
+ this.Ah = Ah | 0;
+ this.Al = Al | 0;
+ this.Bh = Bh | 0;
+ this.Bl = Bl | 0;
+ this.Ch = Ch | 0;
+ this.Cl = Cl | 0;
+ this.Dh = Dh | 0;
+ this.Dl = Dl | 0;
+ this.Eh = Eh | 0;
+ this.El = El | 0;
+ this.Fh = Fh | 0;
+ this.Fl = Fl | 0;
+ this.Gh = Gh | 0;
+ this.Gl = Gl | 0;
+ this.Hh = Hh | 0;
+ this.Hl = Hl | 0;
+ }
+ protected process(view: DataView, offset: number): void {
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
+ for (let i = 0; i < 16; i++, offset += 4) {
+ SHA512_W_H[i] = view.getUint32(offset);
+ SHA512_W_L[i] = view.getUint32((offset += 4));
+ }
+ for (let i = 16; i < 80; i++) {
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
+ const W15h = SHA512_W_H[i - 15] | 0;
+ const W15l = SHA512_W_L[i - 15] | 0;
+ const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
+ const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
+ const W2h = SHA512_W_H[i - 2] | 0;
+ const W2l = SHA512_W_L[i - 2] | 0;
+ const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
+ const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
+ const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
+ const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
+ SHA512_W_H[i] = SUMh | 0;
+ SHA512_W_L[i] = SUMl | 0;
+ }
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ // Compression function main loop, 80 rounds
+ for (let i = 0; i < 80; i++) {
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
+ const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
+ const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const CHIh = (Eh & Fh) ^ (~Eh & Gh);
+ const CHIl = (El & Fl) ^ (~El & Gl);
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
+ // prettier-ignore
+ const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
+ const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
+ const T1l = T1ll | 0;
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
+ const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
+ const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
+ const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
+ const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
+ Hh = Gh | 0;
+ Hl = Gl | 0;
+ Gh = Fh | 0;
+ Gl = Fl | 0;
+ Fh = Eh | 0;
+ Fl = El | 0;
+ ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
+ Dh = Ch | 0;
+ Dl = Cl | 0;
+ Ch = Bh | 0;
+ Cl = Bl | 0;
+ Bh = Ah | 0;
+ Bl = Al | 0;
+ const All = u64.add3L(T1l, sigma0l, MAJl);
+ Ah = u64.add3H(All, T1h, sigma0h, MAJh);
+ Al = All | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
+ ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
+ ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
+ ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
+ ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
+ ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
+ ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
+ ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
+ }
+ protected roundClean(): void {
+ clean(SHA512_W_H, SHA512_W_L);
+ }
+ destroy(): void {
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
+/** Internal SHA2-512 hash class. */
+export class _SHA512 extends SHA2_64B<_SHA512> {
+ protected Ah: number = SHA512_IV[0] | 0;
+ protected Al: number = SHA512_IV[1] | 0;
+ protected Bh: number = SHA512_IV[2] | 0;
+ protected Bl: number = SHA512_IV[3] | 0;
+ protected Ch: number = SHA512_IV[4] | 0;
+ protected Cl: number = SHA512_IV[5] | 0;
+ protected Dh: number = SHA512_IV[6] | 0;
+ protected Dl: number = SHA512_IV[7] | 0;
+ protected Eh: number = SHA512_IV[8] | 0;
+ protected El: number = SHA512_IV[9] | 0;
+ protected Fh: number = SHA512_IV[10] | 0;
+ protected Fl: number = SHA512_IV[11] | 0;
+ protected Gh: number = SHA512_IV[12] | 0;
+ protected Gl: number = SHA512_IV[13] | 0;
+ protected Hh: number = SHA512_IV[14] | 0;
+ protected Hl: number = SHA512_IV[15] | 0;
+
+ constructor() {
+ super(64);
+ }
+}
+
+/** Internal SHA2-384 hash class. */
+export class _SHA384 extends SHA2_64B<_SHA384> {
+ protected Ah: number = SHA384_IV[0] | 0;
+ protected Al: number = SHA384_IV[1] | 0;
+ protected Bh: number = SHA384_IV[2] | 0;
+ protected Bl: number = SHA384_IV[3] | 0;
+ protected Ch: number = SHA384_IV[4] | 0;
+ protected Cl: number = SHA384_IV[5] | 0;
+ protected Dh: number = SHA384_IV[6] | 0;
+ protected Dl: number = SHA384_IV[7] | 0;
+ protected Eh: number = SHA384_IV[8] | 0;
+ protected El: number = SHA384_IV[9] | 0;
+ protected Fh: number = SHA384_IV[10] | 0;
+ protected Fl: number = SHA384_IV[11] | 0;
+ protected Gh: number = SHA384_IV[12] | 0;
+ protected Gl: number = SHA384_IV[13] | 0;
+ protected Hh: number = SHA384_IV[14] | 0;
+ protected Hl: number = SHA384_IV[15] | 0;
+
+ constructor() {
+ super(48);
+ }
+}
+
+/**
+ * Truncated SHA512/256 and SHA512/224.
+ * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
+ * Then t hashes string to produce result IV.
+ * See `test/misc/sha2-gen-iv.js`.
+ */
+
+/** SHA512/224 IV */
+const T224_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,
+ 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,
+]);
+
+/** SHA512/256 IV */
+const T256_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,
+ 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,
+]);
+
+/** Internal SHA2-512/224 hash class. */
+export class _SHA512_224 extends SHA2_64B<_SHA512_224> {
+ protected Ah: number = T224_IV[0] | 0;
+ protected Al: number = T224_IV[1] | 0;
+ protected Bh: number = T224_IV[2] | 0;
+ protected Bl: number = T224_IV[3] | 0;
+ protected Ch: number = T224_IV[4] | 0;
+ protected Cl: number = T224_IV[5] | 0;
+ protected Dh: number = T224_IV[6] | 0;
+ protected Dl: number = T224_IV[7] | 0;
+ protected Eh: number = T224_IV[8] | 0;
+ protected El: number = T224_IV[9] | 0;
+ protected Fh: number = T224_IV[10] | 0;
+ protected Fl: number = T224_IV[11] | 0;
+ protected Gh: number = T224_IV[12] | 0;
+ protected Gl: number = T224_IV[13] | 0;
+ protected Hh: number = T224_IV[14] | 0;
+ protected Hl: number = T224_IV[15] | 0;
+
+ constructor() {
+ super(28);
+ }
+}
+
+/** Internal SHA2-512/256 hash class. */
+export class _SHA512_256 extends SHA2_64B<_SHA512_256> {
+ protected Ah: number = T256_IV[0] | 0;
+ protected Al: number = T256_IV[1] | 0;
+ protected Bh: number = T256_IV[2] | 0;
+ protected Bl: number = T256_IV[3] | 0;
+ protected Ch: number = T256_IV[4] | 0;
+ protected Cl: number = T256_IV[5] | 0;
+ protected Dh: number = T256_IV[6] | 0;
+ protected Dl: number = T256_IV[7] | 0;
+ protected Eh: number = T256_IV[8] | 0;
+ protected El: number = T256_IV[9] | 0;
+ protected Fh: number = T256_IV[10] | 0;
+ protected Fl: number = T256_IV[11] | 0;
+ protected Gh: number = T256_IV[12] | 0;
+ protected Gl: number = T256_IV[13] | 0;
+ protected Hh: number = T256_IV[14] | 0;
+ protected Hl: number = T256_IV[15] | 0;
+
+ constructor() {
+ super(32);
+ }
+}
+
+/**
+ * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
+ *
+ * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
+ * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
+ * - Each sha256 hash is executing 2^18 bit operations.
+ * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
+ */
+export const sha256: CHash<_SHA256> = /* @__PURE__ */ createHasher(
+ () => new _SHA256(),
+ /* @__PURE__ */ oidNist(0x01)
+);
+/** SHA2-224 hash function from RFC 4634 */
+export const sha224: CHash<_SHA224> = /* @__PURE__ */ createHasher(
+ () => new _SHA224(),
+ /* @__PURE__ */ oidNist(0x04)
+);
+
+/** SHA2-512 hash function from RFC 4634. */
+export const sha512: CHash<_SHA512> = /* @__PURE__ */ createHasher(
+ () => new _SHA512(),
+ /* @__PURE__ */ oidNist(0x03)
+);
+/** SHA2-384 hash function from RFC 4634. */
+export const sha384: CHash<_SHA384> = /* @__PURE__ */ createHasher(
+ () => new _SHA384(),
+ /* @__PURE__ */ oidNist(0x02)
+);
+
+/**
+ * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export const sha512_256: CHash<_SHA512_256> = /* @__PURE__ */ createHasher(
+ () => new _SHA512_256(),
+ /* @__PURE__ */ oidNist(0x06)
+);
+/**
+ * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
+ */
+export const sha512_224: CHash<_SHA512_224> = /* @__PURE__ */ createHasher(
+ () => new _SHA512_224(),
+ /* @__PURE__ */ oidNist(0x05)
+);
diff --git a/server/node_modules/@noble/hashes/src/sha3-addons.ts b/server/node_modules/@noble/hashes/src/sha3-addons.ts
new file mode 100644
index 0000000..88dfa60
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/sha3-addons.ts
@@ -0,0 +1,530 @@
+/**
+ * SHA3 (keccak) addons.
+ *
+ * * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from
+ * [NIST SP 800-185](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf)
+ * * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from
+ * [k12-draft-17](https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/17/)
+ * * KeccakPRG: Pseudo-random generator based on Keccak [(pdf)](https://keccak.team/files/CSF-0.1.pdf)
+ * @module
+ */
+import { Keccak, type ShakeOpts } from './sha3.ts';
+import {
+ abytes,
+ anumber,
+ type CHash,
+ type CHashXOF,
+ createHasher,
+ type Hash,
+ type HashXOF,
+ type KDFInput,
+ kdfInputToBytes,
+ type PRG,
+ u32,
+} from './utils.ts';
+
+// cSHAKE && KMAC (NIST SP800-185)
+const _8n = /* @__PURE__ */ BigInt(8);
+const _ffn = /* @__PURE__ */ BigInt(0xff);
+
+// It is safe to use bigints here, since they used only for length encoding (not actual data).
+// We use bigints in sha256 for lengths too.
+function leftEncode(n: number | bigint): Uint8Array {
+ n = BigInt(n);
+ const res = [Number(n & _ffn)];
+ n >>= _8n;
+ for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
+ res.unshift(res.length);
+ return new Uint8Array(res);
+}
+
+function rightEncode(n: number | bigint): Uint8Array {
+ n = BigInt(n);
+ const res = [Number(n & _ffn)];
+ n >>= _8n;
+ for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
+ res.push(res.length);
+ return new Uint8Array(res);
+}
+
+function chooseLen(opts: ShakeOpts, outputLen: number): number {
+ return opts.dkLen === undefined ? outputLen : opts.dkLen;
+}
+
+const abytesOrZero = (buf?: Uint8Array, title = '') => {
+ if (buf === undefined) return EMPTY_BUFFER;
+ abytes(buf, undefined, title);
+ return buf;
+};
+// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block
+const getPadding = (len: number, block: number) => new Uint8Array((block - (len % block)) % block);
+export type cShakeOpts = ShakeOpts & { personalization?: Uint8Array; NISTfn?: KDFInput };
+
+// Personalization
+function cshakePers(hash: Keccak, opts: cShakeOpts = {}): Keccak {
+ if (!opts || (opts.personalization === undefined && opts.NISTfn === undefined)) return hash;
+ // Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later)
+ // bytepad(encode_string(N) || encode_string(S), 168)
+ const blockLenBytes = leftEncode(hash.blockLen);
+ const fn = opts.NISTfn === undefined ? EMPTY_BUFFER : kdfInputToBytes(opts.NISTfn);
+ const fnLen = leftEncode(_8n * BigInt(fn.length)); // length in bits
+ const pers = abytesOrZero(opts.personalization, 'personalization');
+ const persLen = leftEncode(_8n * BigInt(pers.length)); // length in bits
+ if (!fn.length && !pers.length) return hash;
+ hash.suffix = 0x04;
+ hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers);
+ let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length;
+ hash.update(getPadding(totalLen, hash.blockLen));
+ return hash;
+}
+
+const gencShake = (suffix: number, blockLen: number, outputLen: number) =>
+ createHasher((opts: cShakeOpts = {}) =>
+ cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts)
+ );
+
+export type ITupleHash = {
+ (messages: Uint8Array[], opts?: cShakeOpts): Uint8Array;
+ create(opts?: cShakeOpts): _TupleHash;
+};
+/** 128-bit NIST cSHAKE XOF. */
+export const cshake128: CHashXOF = /* @__PURE__ */ gencShake(0x1f, 168, 16);
+/** 256-bit NIST cSHAKE XOF. */
+export const cshake256: CHashXOF = /* @__PURE__ */ gencShake(0x1f, 136, 32);
+
+/** Internal KMAC mac class. */
+export class _KMAC extends Keccak implements HashXOF<_KMAC> {
+ constructor(
+ blockLen: number,
+ outputLen: number,
+ enableXOF: boolean,
+ key: Uint8Array,
+ opts: cShakeOpts = {}
+ ) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization });
+ abytes(key, undefined, 'key');
+ // 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L).
+ const blockLenBytes = leftEncode(this.blockLen);
+ const keyLen = leftEncode(_8n * BigInt(key.length));
+ this.update(blockLenBytes).update(keyLen).update(key);
+ const totalLen = blockLenBytes.length + keyLen.length + key.length;
+ this.update(getPadding(totalLen, this.blockLen));
+ }
+ protected finish(): void {
+ if (!this.finished) this.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to?: _KMAC): _KMAC {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ // Force "to" to be instance of KMAC instead of Sha3.
+ if (!to) {
+ to = Object.create(Object.getPrototypeOf(this), {}) as _KMAC;
+ to.state = this.state.slice();
+ to.blockLen = this.blockLen;
+ to.state32 = u32(to.state);
+ }
+ return super._cloneInto(to) as _KMAC;
+ }
+ clone(): _KMAC {
+ return this._cloneInto();
+ }
+}
+
+function genKmac(blockLen: number, outputLen: number, xof = false) {
+ const kmac = (key: Uint8Array, message: Uint8Array, opts?: cShakeOpts): Uint8Array =>
+ kmac.create(key, opts).update(message).digest();
+ kmac.create = (key: Uint8Array, opts: cShakeOpts = {}) =>
+ new _KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts);
+ return kmac;
+}
+
+export type IKMAC = {
+ (key: Uint8Array, message: Uint8Array, opts?: KangarooOpts): Uint8Array;
+ create(key: Uint8Array, opts?: cShakeOpts): _KMAC;
+};
+/** 128-bit Keccak MAC. */
+export const kmac128: IKMAC = /* @__PURE__ */ genKmac(168, 16);
+/** 256-bit Keccak MAC. */
+export const kmac256: IKMAC = /* @__PURE__ */ genKmac(136, 32);
+/** 128-bit Keccak-MAC XOF. */
+export const kmac128xof: IKMAC = /* @__PURE__ */ genKmac(168, 16, true);
+/** 256-bit Keccak-MAC XOF. */
+export const kmac256xof: IKMAC = /* @__PURE__ */ genKmac(136, 32, true);
+
+/** Internal TupleHash class. */
+export class _TupleHash extends Keccak implements HashXOF<_TupleHash> {
+ constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts: cShakeOpts = {}) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization });
+ // Change update after cshake processed
+ this.update = (data: Uint8Array) => {
+ abytes(data);
+ super.update(leftEncode(_8n * BigInt(data.length)));
+ super.update(data);
+ return this;
+ };
+ }
+ protected finish(): void {
+ if (!this.finished)
+ super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to?: _TupleHash): _TupleHash {
+ to ||= new _TupleHash(this.blockLen, this.outputLen, this.enableXOF);
+ return super._cloneInto(to) as _TupleHash;
+ }
+ clone(): _TupleHash {
+ return this._cloneInto();
+ }
+}
+
+function genTuple(blockLen: number, outputLen: number, xof = false) {
+ const tuple = (messages: Uint8Array[], opts?: cShakeOpts): Uint8Array => {
+ const h = tuple.create(opts);
+ if (!Array.isArray(messages)) throw new Error('expected array of messages');
+ for (const msg of messages) h.update(msg);
+ return h.digest();
+ };
+ tuple.create = (opts: cShakeOpts = {}) =>
+ new _TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts);
+ return tuple;
+}
+
+/** 128-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export const tuplehash128: ITupleHash = /* @__PURE__ */ genTuple(168, 16);
+/** 256-bit TupleHASH. tuple(['ab', 'cd']) != tuple(['a', 'bcd']) */
+export const tuplehash256: ITupleHash = /* @__PURE__ */ genTuple(136, 32);
+/** 128-bit TupleHASH XOF. */
+export const tuplehash128xof: ITupleHash = /* @__PURE__ */ genTuple(168, 16, true);
+/** 256-bit TupleHASH XOF. */
+export const tuplehash256xof: ITupleHash = /* @__PURE__ */ genTuple(136, 32, true);
+
+// Same as K12/M14, but without speedup for inputs less 8kb,
+// reduced number of rounds and simpler.
+type ParallelOpts = KangarooOpts & { blockLen?: number };
+
+/** Internal Parallel Keccak Hash class. */
+export class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> {
+ private leafHash?: Hash;
+ protected leafCons: () => Hash;
+ private chunkPos = 0; // Position of current block in chunk
+ private chunksDone = 0; // How many chunks we already have
+ private chunkLen: number;
+ constructor(
+ blockLen: number,
+ outputLen: number,
+ leafCons: () => Hash,
+ enableXOF: boolean,
+ opts: ParallelOpts = {}
+ ) {
+ super(blockLen, 0x1f, outputLen, enableXOF);
+ cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization });
+ this.leafCons = leafCons;
+ let { blockLen: B = 8 } = opts;
+ anumber(B);
+ this.chunkLen = B;
+ super.update(leftEncode(B));
+ // Change update after cshake processed
+ this.update = (data: Uint8Array) => {
+ abytes(data);
+ const { chunkLen, leafCons } = this;
+ for (let pos = 0, len = data.length; pos < len; ) {
+ if (this.chunkPos == chunkLen || !this.leafHash) {
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ this.chunksDone++;
+ }
+ this.leafHash = leafCons();
+ this.chunkPos = 0;
+ }
+ const take = Math.min(chunkLen - this.chunkPos, len - pos);
+ this.leafHash.update(data.subarray(pos, pos + take));
+ this.chunkPos += take;
+ pos += take;
+ }
+ return this;
+ };
+ }
+ protected finish(): void {
+ if (this.finished) return;
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ this.chunksDone++;
+ }
+ super.update(rightEncode(this.chunksDone));
+ super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen))); // outputLen in bits
+ super.finish();
+ }
+ _cloneInto(to?: _ParallelHash): _ParallelHash {
+ to ||= new _ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF);
+ if (this.leafHash) to.leafHash = this.leafHash._cloneInto(to.leafHash as Keccak);
+ to.chunkPos = this.chunkPos;
+ to.chunkLen = this.chunkLen;
+ to.chunksDone = this.chunksDone;
+ return super._cloneInto(to) as _ParallelHash;
+ }
+ destroy(): void {
+ super.destroy.call(this);
+ if (this.leafHash) this.leafHash.destroy();
+ }
+ clone(): _ParallelHash {
+ return this._cloneInto();
+ }
+}
+
+function genPrl(
+ blockLen: number,
+ outputLen: number,
+ leaf: ReturnType,
+ xof = false
+) {
+ const parallel = (message: Uint8Array, opts?: ParallelOpts): Uint8Array =>
+ parallel.create(opts).update(message).digest();
+ parallel.create = (opts: ParallelOpts = {}) =>
+ new _ParallelHash(
+ blockLen,
+ chooseLen(opts, outputLen),
+ () => leaf.create({ dkLen: 2 * outputLen }),
+ xof,
+ opts
+ );
+ parallel.outputLen = outputLen;
+ parallel.blockLen = blockLen;
+ return parallel;
+}
+
+/** 128-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash128: CHash = /* @__PURE__ */ genPrl(
+ 168,
+ 16,
+ cshake128
+);
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash256: CHash = /* @__PURE__ */ genPrl(
+ 136,
+ 32,
+ cshake256
+);
+/** 128-bit ParallelHash XOF. In JS, it is not parallel. */
+export const parallelhash128xof: CHashXOF = /* @__PURE__ */ genPrl(
+ 168,
+ 16,
+ cshake128,
+ true
+);
+/** 256-bit ParallelHash. In JS, it is not parallel. */
+export const parallelhash256xof: CHashXOF = /* @__PURE__ */ genPrl(
+ 136,
+ 32,
+ cshake256,
+ true
+);
+
+/** D means Domain separation byte */
+export type TurboshakeOpts = ShakeOpts & {
+ D?: number;
+};
+
+const genTurbo = (blockLen: number, outputLen: number) =>
+ createHasher((opts: TurboshakeOpts = {}) => {
+ const D = opts.D === undefined ? 0x1f : opts.D;
+ // Section 2.1 of https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/17/
+ if (!Number.isSafeInteger(D) || D < 0x01 || D > 0x7f)
+ throw new Error('"D" (domain separation byte) must be 0x01..0x7f, got: ' + D);
+ return new Keccak(blockLen, D, opts.dkLen === undefined ? outputLen : opts.dkLen, true, 12);
+ });
+
+/**
+ * TurboSHAKE 128-bit: reduced 12-round keccak.
+ * Should've been a simple "shake with 12 rounds", but we got a whole new spec about Turbo SHAKE Pro MAX.
+ */
+export const turboshake128: CHashXOF = /* @__PURE__ */ genTurbo(168, 32);
+/** TurboSHAKE 256-bit: reduced 12-round keccak. */
+export const turboshake256: CHashXOF = /* @__PURE__ */ genTurbo(136, 64);
+
+// Same as NIST rightEncode, but returns [0] for zero string
+function rightEncodeK12(n: number | bigint): Uint8Array {
+ n = BigInt(n);
+ const res: number[] = [];
+ for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
+ res.push(res.length);
+ return Uint8Array.from(res);
+}
+
+/** K12 options. */
+export type KangarooOpts = { dkLen?: number; personalization?: Uint8Array };
+const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
+
+/** Internal K12 hash class. */
+export class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> {
+ readonly chunkLen = 8192;
+ private leafHash?: Keccak;
+ protected leafLen: number;
+ private personalization: Uint8Array;
+ private chunkPos = 0; // Position of current block in chunk
+ private chunksDone = 0; // How many chunks we already have
+ constructor(
+ blockLen: number,
+ leafLen: number,
+ outputLen: number,
+ rounds: number,
+ opts: KangarooOpts
+ ) {
+ super(blockLen, 0x07, outputLen, true, rounds);
+ this.leafLen = leafLen;
+ this.personalization = abytesOrZero(opts.personalization, 'personalization');
+ }
+ update(data: Uint8Array): this {
+ abytes(data);
+ const { chunkLen, blockLen, leafLen, rounds } = this;
+ for (let pos = 0, len = data.length; pos < len; ) {
+ if (this.chunkPos == chunkLen) {
+ if (this.leafHash) super.update(this.leafHash.digest());
+ else {
+ this.suffix = 0x06; // Its safe to change suffix here since its used only in digest()
+ super.update(Uint8Array.from([3, 0, 0, 0, 0, 0, 0, 0]));
+ }
+ this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds);
+ this.chunksDone++;
+ this.chunkPos = 0;
+ }
+ const take = Math.min(chunkLen - this.chunkPos, len - pos);
+ const chunk = data.subarray(pos, pos + take);
+ if (this.leafHash) this.leafHash.update(chunk);
+ else super.update(chunk);
+ this.chunkPos += take;
+ pos += take;
+ }
+ return this;
+ }
+ protected finish(): void {
+ if (this.finished) return;
+ const { personalization } = this;
+ this.update(personalization).update(rightEncodeK12(personalization.length));
+ // Leaf hash
+ if (this.leafHash) {
+ super.update(this.leafHash.digest());
+ super.update(rightEncodeK12(this.chunksDone));
+ super.update(Uint8Array.from([0xff, 0xff]));
+ }
+ super.finish.call(this);
+ }
+ destroy(): void {
+ super.destroy.call(this);
+ if (this.leafHash) this.leafHash.destroy();
+ // We cannot zero personalization buffer since it is user provided and we don't want to mutate user input
+ this.personalization = EMPTY_BUFFER;
+ }
+ _cloneInto(to?: _KangarooTwelve): _KangarooTwelve {
+ const { blockLen, leafLen, leafHash, outputLen, rounds } = this;
+ to ||= new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, {});
+ super._cloneInto(to);
+ if (leafHash) to.leafHash = leafHash._cloneInto(to.leafHash);
+ to.personalization.set(this.personalization);
+ to.leafLen = this.leafLen;
+ to.chunkPos = this.chunkPos;
+ to.chunksDone = this.chunksDone;
+ return to;
+ }
+ clone(): _KangarooTwelve {
+ return this._cloneInto();
+ }
+}
+
+/** 128-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export const kt128: CHash<_KangarooTwelve, KangarooOpts> = /* @__PURE__ */ createHasher(
+ (opts: KangarooOpts = {}) => new _KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)
+);
+/** 256-bit KangarooTwelve (k12): reduced 12-round keccak. */
+export const kt256: CHash<_KangarooTwelve, KangarooOpts> = /* @__PURE__ */ createHasher(
+ (opts: KangarooOpts = {}) => new _KangarooTwelve(136, 64, chooseLen(opts, 64), 12, opts)
+);
+
+// MarsupilamiFourteen (14-rounds) can be defined as:
+// `new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)`
+
+/** KangarooTwelve-based MAC options. */
+export type HopMAC = (
+ key: Uint8Array,
+ message: Uint8Array,
+ personalization: Uint8Array,
+ dkLen?: number
+) => Uint8Array;
+const genHopMAC =
+ (hash: CHash<_KangarooTwelve, KangarooOpts>) =>
+ (key: Uint8Array, message: Uint8Array, personalization: Uint8Array, dkLen?: number): Uint8Array =>
+ hash(key, { personalization: hash(message, { personalization }), dkLen });
+
+/**
+ * 128-bit KangarooTwelve-based MAC.
+ *
+ * These untested (there is no test vectors or implementation available). Use at your own risk.
+ * HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L)
+ * HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L)
+ */
+export const HopMAC128: HopMAC = /* @__PURE__ */ genHopMAC(kt128);
+/** 256-bit KangarooTwelve-based MAC. */
+export const HopMAC256: HopMAC = /* @__PURE__ */ genHopMAC(kt256);
+
+/**
+ * More at https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG.
+ */
+export class _KeccakPRG extends Keccak implements PRG {
+ protected rate: number;
+ constructor(capacity: number) {
+ anumber(capacity);
+ const rate = 1600 - capacity;
+ const rho = rate - 2;
+ // Rho must be full bytes
+ if (capacity < 0 || capacity > 1600 - 10 || rho % 8) throw new Error('invalid capacity');
+ // blockLen = rho in bytes
+ super(rho / 8, 0, 0, true);
+ this.rate = rate;
+ this.posOut = Math.floor((rate + 7) / 8);
+ }
+ protected keccak(): void {
+ // Duplex padding
+ this.state[this.pos] ^= 0x01;
+ this.state[this.blockLen] ^= 0x02; // Rho is full bytes
+ super.keccak();
+ this.pos = 0;
+ this.posOut = 0;
+ }
+ update(data: Uint8Array): this {
+ super.update(data);
+ this.posOut = this.blockLen;
+ return this;
+ }
+ protected finish(): void {}
+ digestInto(_out: Uint8Array): Uint8Array {
+ throw new Error('digest is not allowed, use .fetch instead');
+ }
+ addEntropy(seed: Uint8Array): void {
+ this.update(seed);
+ }
+ randomBytes(length: number): Uint8Array {
+ return this.xof(length);
+ }
+ clean(): void {
+ if (this.rate < 1600 / 2 + 1) throw new Error('rate is too low to use .forget()');
+ this.keccak();
+ for (let i = 0; i < this.blockLen; i++) this.state[i] = 0;
+ this.pos = this.blockLen;
+ this.keccak();
+ this.posOut = this.blockLen;
+ }
+ _cloneInto(to?: _KeccakPRG): _KeccakPRG {
+ const { rate } = this;
+ to ||= new _KeccakPRG(1600 - rate);
+ super._cloneInto(to);
+ to.rate = rate;
+ return to;
+ }
+ clone(): _KeccakPRG {
+ return this._cloneInto();
+ }
+}
+
+/** KeccakPRG: Pseudo-random generator based on Keccak. https://keccak.team/files/CSF-0.1.pdf */
+export const keccakprg = (capacity = 254): _KeccakPRG => new _KeccakPRG(capacity);
diff --git a/server/node_modules/@noble/hashes/src/sha3.ts b/server/node_modules/@noble/hashes/src/sha3.ts
new file mode 100644
index 0000000..cf257fc
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/sha3.ts
@@ -0,0 +1,295 @@
+/**
+ * SHA3 (keccak) hash function, based on a new "Sponge function" design.
+ * Different from older hashes, the internal state is bigger than output size.
+ *
+ * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),
+ * [Website](https://keccak.team/keccak.html),
+ * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).
+ *
+ * Check out `sha3-addons` module for cSHAKE, k12, and others.
+ * @module
+ */
+import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.ts';
+// prettier-ignore
+import {
+ abytes, aexists, anumber, aoutput,
+ clean, createHasher,
+ oidNist,
+ swap32IfBE,
+ u32,
+ type CHash, type CHashXOF,
+ type Hash,
+ type HashInfo,
+ type HashXOF
+} from './utils.ts';
+
+// No __PURE__ annotations in sha3 header:
+// EVERYTHING is in fact used on every export.
+// Various per round constants calculations
+const _0n = BigInt(0);
+const _1n = BigInt(1);
+const _2n = BigInt(2);
+const _7n = BigInt(7);
+const _256n = BigInt(256);
+const _0x71n = BigInt(0x71);
+const SHA3_PI: number[] = [];
+const SHA3_ROTL: number[] = [];
+const _SHA3_IOTA: bigint[] = []; // no pure annotation: var is always used
+for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
+ // Pi
+ [x, y] = [y, (2 * x + 3 * y) % 5];
+ SHA3_PI.push(2 * (5 * y + x));
+ // Rotational
+ SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
+ // Iota
+ let t = _0n;
+ for (let j = 0; j < 7; j++) {
+ R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
+ if (R & _2n) t ^= _1n << ((_1n << BigInt(j)) - _1n);
+ }
+ _SHA3_IOTA.push(t);
+}
+const IOTAS = split(_SHA3_IOTA, true);
+const SHA3_IOTA_H = IOTAS[0];
+const SHA3_IOTA_L = IOTAS[1];
+
+// Left rotation (without 0, 32, 64)
+const rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
+const rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
+
+/** `keccakf1600` internal function, additionally allows to adjust round count. */
+export function keccakP(s: Uint32Array, rounds: number = 24): void {
+ const B = new Uint32Array(5 * 2);
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
+ for (let round = 24 - rounds; round < 24; round++) {
+ // Theta θ
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
+ for (let x = 0; x < 10; x += 2) {
+ const idx1 = (x + 8) % 10;
+ const idx0 = (x + 2) % 10;
+ const B0 = B[idx0];
+ const B1 = B[idx0 + 1];
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
+ for (let y = 0; y < 50; y += 10) {
+ s[x + y] ^= Th;
+ s[x + y + 1] ^= Tl;
+ }
+ }
+ // Rho (ρ) and Pi (π)
+ let curH = s[2];
+ let curL = s[3];
+ for (let t = 0; t < 24; t++) {
+ const shift = SHA3_ROTL[t];
+ const Th = rotlH(curH, curL, shift);
+ const Tl = rotlL(curH, curL, shift);
+ const PI = SHA3_PI[t];
+ curH = s[PI];
+ curL = s[PI + 1];
+ s[PI] = Th;
+ s[PI + 1] = Tl;
+ }
+ // Chi (χ)
+ for (let y = 0; y < 50; y += 10) {
+ for (let x = 0; x < 10; x++) B[x] = s[y + x];
+ for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
+ }
+ // Iota (ι)
+ s[0] ^= SHA3_IOTA_H[round];
+ s[1] ^= SHA3_IOTA_L[round];
+ }
+ clean(B);
+}
+
+/** Keccak sponge function. */
+export class Keccak implements Hash, HashXOF {
+ protected state: Uint8Array;
+ protected pos = 0;
+ protected posOut = 0;
+ protected finished = false;
+ protected state32: Uint32Array;
+ protected destroyed = false;
+
+ public blockLen: number;
+ public suffix: number;
+ public outputLen: number;
+ protected enableXOF = false;
+ protected rounds: number;
+
+ // NOTE: we accept arguments in bytes instead of bits here.
+ constructor(
+ blockLen: number,
+ suffix: number,
+ outputLen: number,
+ enableXOF = false,
+ rounds: number = 24
+ ) {
+ this.blockLen = blockLen;
+ this.suffix = suffix;
+ this.outputLen = outputLen;
+ this.enableXOF = enableXOF;
+ this.rounds = rounds;
+ // Can be passed from user as dkLen
+ anumber(outputLen, 'outputLen');
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
+ // 0 < blockLen < 200
+ if (!(0 < blockLen && blockLen < 200))
+ throw new Error('only keccak-f1600 function is supported');
+ this.state = new Uint8Array(200);
+ this.state32 = u32(this.state);
+ }
+ clone(): Keccak {
+ return this._cloneInto();
+ }
+ protected keccak(): void {
+ swap32IfBE(this.state32);
+ keccakP(this.state32, this.rounds);
+ swap32IfBE(this.state32);
+ this.posOut = 0;
+ this.pos = 0;
+ }
+ update(data: Uint8Array): this {
+ aexists(this);
+ abytes(data);
+ const { blockLen, state } = this;
+ const len = data.length;
+ for (let pos = 0; pos < len; ) {
+ const take = Math.min(blockLen - this.pos, len - pos);
+ for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
+ if (this.pos === blockLen) this.keccak();
+ }
+ return this;
+ }
+ protected finish(): void {
+ if (this.finished) return;
+ this.finished = true;
+ const { state, suffix, pos, blockLen } = this;
+ // Do the padding
+ state[pos] ^= suffix;
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
+ state[blockLen - 1] ^= 0x80;
+ this.keccak();
+ }
+ protected writeInto(out: Uint8Array): Uint8Array {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const bufferOut = this.state;
+ const { blockLen } = this;
+ for (let pos = 0, len = out.length; pos < len; ) {
+ if (this.posOut >= blockLen) this.keccak();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out: Uint8Array): Uint8Array {
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
+ if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
+ return this.writeInto(out);
+ }
+ xof(bytes: number): Uint8Array {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out: Uint8Array): Uint8Array {
+ aoutput(out, this);
+ if (this.finished) throw new Error('digest() was already called');
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest(): Uint8Array {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+ destroy(): void {
+ this.destroyed = true;
+ clean(this.state);
+ }
+ _cloneInto(to?: Keccak): Keccak {
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
+ to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
+ to.state32.set(this.state32);
+ to.pos = this.pos;
+ to.posOut = this.posOut;
+ to.finished = this.finished;
+ to.rounds = rounds;
+ // Suffix can change in cSHAKE
+ to.suffix = suffix;
+ to.outputLen = outputLen;
+ to.enableXOF = enableXOF;
+ to.destroyed = this.destroyed;
+ return to;
+ }
+}
+
+const genKeccak = (suffix: number, blockLen: number, outputLen: number, info: HashInfo = {}) =>
+ createHasher(() => new Keccak(blockLen, suffix, outputLen), info);
+
+/** SHA3-224 hash function. */
+export const sha3_224: CHash = /* @__PURE__ */ genKeccak(
+ 0x06,
+ 144,
+ 28,
+ /* @__PURE__ */ oidNist(0x07)
+);
+/** SHA3-256 hash function. Different from keccak-256. */
+export const sha3_256: CHash = /* @__PURE__ */ genKeccak(
+ 0x06,
+ 136,
+ 32,
+ /* @__PURE__ */ oidNist(0x08)
+);
+/** SHA3-384 hash function. */
+export const sha3_384: CHash = /* @__PURE__ */ genKeccak(
+ 0x06,
+ 104,
+ 48,
+ /* @__PURE__ */ oidNist(0x09)
+);
+/** SHA3-512 hash function. */
+export const sha3_512: CHash = /* @__PURE__ */ genKeccak(
+ 0x06,
+ 72,
+ 64,
+ /* @__PURE__ */ oidNist(0x0a)
+);
+
+/** keccak-224 hash function. */
+export const keccak_224: CHash = /* @__PURE__ */ genKeccak(0x01, 144, 28);
+/** keccak-256 hash function. Different from SHA3-256. */
+export const keccak_256: CHash = /* @__PURE__ */ genKeccak(0x01, 136, 32);
+/** keccak-384 hash function. */
+export const keccak_384: CHash = /* @__PURE__ */ genKeccak(0x01, 104, 48);
+/** keccak-512 hash function. */
+export const keccak_512: CHash = /* @__PURE__ */ genKeccak(0x01, 72, 64);
+
+/** Options for SHAKE XOF. */
+export type ShakeOpts = { dkLen?: number };
+
+const genShake = (suffix: number, blockLen: number, outputLen: number, info: HashInfo = {}) =>
+ createHasher(
+ (opts: ShakeOpts = {}) =>
+ new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true),
+ info
+ );
+
+/** SHAKE128 XOF with 128-bit security. */
+export const shake128: CHashXOF =
+ /* @__PURE__ */
+ genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));
+/** SHAKE256 XOF with 256-bit security. */
+export const shake256: CHashXOF =
+ /* @__PURE__ */
+ genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));
+
+/** SHAKE128 XOF with 256-bit output (NIST version). */
+export const shake128_32: CHashXOF =
+ /* @__PURE__ */
+ genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));
+/** SHAKE256 XOF with 512-bit output (NIST version). */
+export const shake256_64: CHashXOF =
+ /* @__PURE__ */
+ genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));
diff --git a/server/node_modules/@noble/hashes/src/utils.ts b/server/node_modules/@noble/hashes/src/utils.ts
new file mode 100644
index 0000000..8b3b1a9
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/utils.ts
@@ -0,0 +1,338 @@
+/**
+ * Utilities for hex, bytes, CSPRNG.
+ * @module
+ */
+/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
+/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
+export function isBytes(a: unknown): a is Uint8Array {
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
+}
+
+/** Asserts something is positive integer. */
+export function anumber(n: number, title: string = ''): void {
+ if (!Number.isSafeInteger(n) || n < 0) {
+ const prefix = title && `"${title}" `;
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
+ }
+}
+
+/** Asserts something is Uint8Array. */
+export function abytes(value: Uint8Array, length?: number, title: string = ''): Uint8Array {
+ const bytes = isBytes(value);
+ const len = value?.length;
+ const needsLen = length !== undefined;
+ if (!bytes || (needsLen && len !== length)) {
+ const prefix = title && `"${title}" `;
+ const ofLen = needsLen ? ` of length ${length}` : '';
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
+ throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
+ }
+ return value;
+}
+
+/** Asserts something is hash */
+export function ahash(h: CHash): void {
+ if (typeof h !== 'function' || typeof h.create !== 'function')
+ throw new Error('Hash must wrapped by utils.createHasher');
+ anumber(h.outputLen);
+ anumber(h.blockLen);
+}
+
+/** Asserts a hash instance has not been destroyed / finished */
+export function aexists(instance: any, checkFinished = true): void {
+ if (instance.destroyed) throw new Error('Hash instance has been destroyed');
+ if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');
+}
+
+/** Asserts output is properly-sized byte array */
+export function aoutput(out: any, instance: any): void {
+ abytes(out, undefined, 'digestInto() output');
+ const min = instance.outputLen;
+ if (out.length < min) {
+ throw new Error('"digestInto() output" expected to be of length >=' + min);
+ }
+}
+
+/** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */
+// prettier-ignore
+export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |
+ Uint16Array | Int16Array | Uint32Array | Int32Array;
+
+/** Cast u8 / u16 / u32 to u8. */
+export function u8(arr: TypedArray): Uint8Array {
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+
+/** Cast u8 / u16 / u32 to u32. */
+export function u32(arr: TypedArray): Uint32Array {
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
+}
+
+/** Zeroize a byte array. Warning: JS provides no guarantees. */
+export function clean(...arrays: TypedArray[]): void {
+ for (let i = 0; i < arrays.length; i++) {
+ arrays[i].fill(0);
+ }
+}
+
+/** Create DataView of an array for easy byte-level manipulation. */
+export function createView(arr: TypedArray): DataView {
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+
+/** The rotate right (circular right shift) operation for uint32 */
+export function rotr(word: number, shift: number): number {
+ return (word << (32 - shift)) | (word >>> shift);
+}
+
+/** The rotate left (circular left shift) operation for uint32 */
+export function rotl(word: number, shift: number): number {
+ return (word << shift) | ((word >>> (32 - shift)) >>> 0);
+}
+
+/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
+export const isLE: boolean = /* @__PURE__ */ (() =>
+ new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
+
+/** The byte swap operation for uint32 */
+export function byteSwap(word: number): number {
+ return (
+ ((word << 24) & 0xff000000) |
+ ((word << 8) & 0xff0000) |
+ ((word >>> 8) & 0xff00) |
+ ((word >>> 24) & 0xff)
+ );
+}
+/** Conditionally byte swap if on a big-endian platform */
+export const swap8IfBE: (n: number) => number = isLE
+ ? (n: number) => n
+ : (n: number) => byteSwap(n);
+
+/** In place byte swap for Uint32Array */
+export function byteSwap32(arr: Uint32Array): Uint32Array {
+ for (let i = 0; i < arr.length; i++) {
+ arr[i] = byteSwap(arr[i]);
+ }
+ return arr;
+}
+
+export const swap32IfBE: (u: Uint32Array) => Uint32Array = isLE
+ ? (u: Uint32Array) => u
+ : byteSwap32;
+
+// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
+const hasHexBuiltin: boolean = /* @__PURE__ */ (() =>
+ // @ts-ignore
+ typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
+
+// Array where index 0xf0 (240) is mapped to string 'f0'
+const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>
+ i.toString(16).padStart(2, '0')
+);
+
+/**
+ * Convert byte array to hex string. Uses built-in function, when available.
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
+ */
+export function bytesToHex(bytes: Uint8Array): string {
+ abytes(bytes);
+ // @ts-ignore
+ if (hasHexBuiltin) return bytes.toHex();
+ // pre-caching improves the speed 6x
+ let hex = '';
+ for (let i = 0; i < bytes.length; i++) {
+ hex += hexes[bytes[i]];
+ }
+ return hex;
+}
+
+// We use optimized technique to convert hex string to byte array
+const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;
+function asciiToBase16(ch: number): number | undefined {
+ if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48
+ if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)
+ if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)
+ return;
+}
+
+/**
+ * Convert hex string to byte array. Uses built-in function, when available.
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
+ */
+export function hexToBytes(hex: string): Uint8Array {
+ if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);
+ // @ts-ignore
+ if (hasHexBuiltin) return Uint8Array.fromHex(hex);
+ const hl = hex.length;
+ const al = hl / 2;
+ if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);
+ const array = new Uint8Array(al);
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
+ if (n1 === undefined || n2 === undefined) {
+ const char = hex[hi] + hex[hi + 1];
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
+ }
+ array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
+ }
+ return array;
+}
+
+/**
+ * There is no setImmediate in browser and setTimeout is slow.
+ * Call of async fn will return Promise, which will be fullfiled only on
+ * next scheduler queue processing step and this is exactly what we need.
+ */
+export const nextTick = async (): Promise => {};
+
+/** Returns control to thread each 'tick' ms to avoid blocking. */
+export async function asyncLoop(
+ iters: number,
+ tick: number,
+ cb: (i: number) => void
+): Promise {
+ let ts = Date.now();
+ for (let i = 0; i < iters; i++) {
+ cb(i);
+ // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
+ const diff = Date.now() - ts;
+ if (diff >= 0 && diff < tick) continue;
+ await nextTick();
+ ts += diff;
+ }
+}
+
+// Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535
+declare const TextEncoder: any;
+
+/**
+ * Converts string to bytes using UTF8 encoding.
+ * Built-in doesn't validate input to be string: we do the check.
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
+ */
+export function utf8ToBytes(str: string): Uint8Array {
+ if (typeof str !== 'string') throw new Error('string expected');
+ return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
+}
+
+/** KDFs can accept string or Uint8Array for user convenience. */
+export type KDFInput = string | Uint8Array;
+
+/**
+ * Helper for KDFs: consumes uint8array or string.
+ * When string is passed, does utf8 decoding, using TextDecoder.
+ */
+export function kdfInputToBytes(data: KDFInput, errorTitle = ''): Uint8Array {
+ if (typeof data === 'string') return utf8ToBytes(data);
+ return abytes(data, undefined, errorTitle);
+}
+
+/** Copies several Uint8Arrays into one. */
+export function concatBytes(...arrays: Uint8Array[]): Uint8Array {
+ let sum = 0;
+ for (let i = 0; i < arrays.length; i++) {
+ const a = arrays[i];
+ abytes(a);
+ sum += a.length;
+ }
+ const res = new Uint8Array(sum);
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
+ const a = arrays[i];
+ res.set(a, pad);
+ pad += a.length;
+ }
+ return res;
+}
+
+type EmptyObj = {};
+/** Merges default options and passed options. */
+export function checkOpts(
+ defaults: T1,
+ opts?: T2
+): T1 & T2 {
+ if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
+ throw new Error('options must be object or undefined');
+ const merged = Object.assign(defaults, opts);
+ return merged as T1 & T2;
+}
+
+/** Common interface for all hashes. */
+export interface Hash {
+ blockLen: number; // Bytes per block
+ outputLen: number; // Bytes in output
+ update(buf: Uint8Array): this;
+ digestInto(buf: Uint8Array): void;
+ digest(): Uint8Array;
+ destroy(): void;
+ _cloneInto(to?: T): T;
+ clone(): T;
+}
+
+/** PseudoRandom (number) Generator */
+export interface PRG {
+ addEntropy(seed: Uint8Array): void;
+ randomBytes(length: number): Uint8Array;
+ clean(): void;
+}
+
+/**
+ * XOF: streaming API to read digest in chunks.
+ * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.
+ * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot
+ * destroy state, next call can require more bytes.
+ */
+export type HashXOF> = Hash & {
+ xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream
+ xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf
+};
+
+/** Hash constructor */
+export type HasherCons = Opts extends undefined ? () => T : (opts?: Opts) => T;
+/** Optional hash params. */
+export type HashInfo = {
+ oid?: Uint8Array; // DER encoded OID in bytes
+};
+/** Hash function */
+export type CHash = Hash, Opts = undefined> = {
+ outputLen: number;
+ blockLen: number;
+} & HashInfo &
+ (Opts extends undefined
+ ? {
+ (msg: Uint8Array): Uint8Array;
+ create(): T;
+ }
+ : {
+ (msg: Uint8Array, opts?: Opts): Uint8Array;
+ create(opts?: Opts): T;
+ });
+/** XOF with output */
+export type CHashXOF = HashXOF, Opts = undefined> = CHash;
+
+/** Creates function with outputLen, blockLen, create properties from a class constructor. */
+export function createHasher, Opts = undefined>(
+ hashCons: HasherCons,
+ info: HashInfo = {}
+): CHash {
+ const hashC: any = (msg: Uint8Array, opts?: Opts) => hashCons(opts).update(msg).digest();
+ const tmp = hashCons(undefined);
+ hashC.outputLen = tmp.outputLen;
+ hashC.blockLen = tmp.blockLen;
+ hashC.create = (opts?: Opts) => hashCons(opts);
+ Object.assign(hashC, info);
+ return Object.freeze(hashC);
+}
+
+/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
+export function randomBytes(bytesLength = 32): Uint8Array {
+ const cr = typeof globalThis === 'object' ? (globalThis as any).crypto : null;
+ if (typeof cr?.getRandomValues !== 'function')
+ throw new Error('crypto.getRandomValues must be defined');
+ return cr.getRandomValues(new Uint8Array(bytesLength));
+}
+
+/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */
+export const oidNist = (suffix: number): Required => ({
+ oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),
+});
diff --git a/server/node_modules/@noble/hashes/src/webcrypto.ts b/server/node_modules/@noble/hashes/src/webcrypto.ts
new file mode 100644
index 0000000..939554c
--- /dev/null
+++ b/server/node_modules/@noble/hashes/src/webcrypto.ts
@@ -0,0 +1,168 @@
+import { type Pbkdf2Opt } from './pbkdf2.ts';
+import {
+ abytes,
+ ahash,
+ anumber,
+ checkOpts,
+ kdfInputToBytes,
+ type CHash,
+ type KDFInput,
+} from './utils.ts';
+
+function _subtle(): typeof crypto.subtle {
+ const cr = typeof globalThis === 'object' ? (globalThis as any).crypto : null;
+ const sb = cr?.subtle;
+ if (typeof sb === 'object' && sb != null) return sb;
+ throw new Error('crypto.subtle must be defined');
+}
+
+export type WebHash = {
+ (msg: Uint8Array): Promise;
+ webCryptoName: string;
+ outputLen: number;
+ blockLen: number;
+};
+
+function createWebHash(name: string, blockLen: number, outputLen: number): WebHash {
+ const hashC: any = async (msg: Uint8Array) => {
+ abytes(msg);
+ const crypto = _subtle();
+ return new Uint8Array(await crypto.digest(name, msg as BufferSource));
+ };
+ hashC.webCryptoName = name; // make sure it won't interfere with function name
+ hashC.outputLen = outputLen;
+ hashC.blockLen = blockLen;
+ hashC.create = () => {
+ throw new Error('not implemented');
+ };
+ return hashC;
+}
+
+function ahashWeb(hash: WebHash) {
+ ahash(hash as any as CHash);
+ if (typeof hash.webCryptoName !== 'string') throw new Error('non-web hash');
+}
+
+/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+// export const sha1: WebHash = createHash('SHA-1', 64, 20);
+
+/** WebCrypto SHA2-256 hash function from RFC 4634. */
+export const sha256: WebHash = /* @__PURE__ */ createWebHash('SHA-256', 64, 32);
+/** WebCrypto SHA2-384 hash function from RFC 4634. */
+export const sha384: WebHash = /* @__PURE__ */ createWebHash('SHA-384', 128, 48);
+/** WebCrypto SHA2-512 hash function from RFC 4634. */
+export const sha512: WebHash = /* @__PURE__ */ createWebHash('SHA-512', 128, 64);
+
+/**
+ * WebCrypto HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256. Webcrypto version.
+ * @param key - key which would be used to authenticate message
+ * @param message - message
+ * @example
+ * ```js
+ * import { hmac, sha256 } from '@noble/hashes/webcrypto.js';
+ * const mac1 = await hmac(sha256, 'key', 'message');
+ * ```
+ */
+export const hmac: {
+ (hash: WebHash, key: Uint8Array, message: Uint8Array): Promise;
+ create(hash: WebHash, key: Uint8Array): any;
+} = /* @__PURE__ */ (() => {
+ const hmac_ = async (
+ hash: WebHash,
+ key: Uint8Array,
+ message: Uint8Array
+ ): Promise => {
+ const crypto = _subtle();
+ abytes(key, undefined, 'key');
+ abytes(message, undefined, 'message');
+ ahashWeb(hash);
+ // WebCrypto keys can't be zeroized
+ // prettier-ignore
+ const wkey = await crypto.importKey(
+ 'raw',
+ key as BufferSource,
+ { name: 'HMAC', hash: hash.webCryptoName },
+ false,
+ ['sign']
+ );
+ return new Uint8Array(await crypto.sign('HMAC', wkey, message as BufferSource));
+ };
+ hmac_.create = (_hash: WebHash, _key: Uint8Array) => {
+ throw new Error('not implemented');
+ };
+ return hmac_;
+})();
+
+/**
+ * WebCrypto HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256). Webcrypto version.
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * ```js
+ * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js';
+ * import { randomBytes } from '@noble/hashes/utils.js';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1w = await hkdf(sha256, inputKey, salt, info, 32);
+ * ```
+ */
+export async function hkdf(
+ hash: WebHash,
+ ikm: Uint8Array,
+ salt: Uint8Array | undefined,
+ info: Uint8Array | undefined,
+ length: number
+): Promise {
+ const crypto = _subtle();
+ ahashWeb(hash);
+ abytes(ikm, undefined, 'ikm');
+ anumber(length, 'length');
+ if (salt !== undefined) abytes(salt, undefined, 'salt');
+ if (info !== undefined) abytes(info, undefined, 'info');
+ const wkey = await crypto.importKey('raw', ikm as BufferSource, 'HKDF', false, ['deriveBits']);
+ const opts = {
+ name: 'HKDF',
+ hash: hash.webCryptoName,
+ salt: salt === undefined ? new Uint8Array(0) : salt,
+ info: info === undefined ? new Uint8Array(0) : info,
+ };
+ return new Uint8Array(await crypto.deriveBits(opts, wkey, 8 * length));
+}
+
+/**
+ * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256. Webcrypto version.
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * ```js
+ * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ * ```
+ */
+export async function pbkdf2(
+ hash: WebHash,
+ password: KDFInput,
+ salt: KDFInput,
+ opts: Pbkdf2Opt
+): Promise {
+ const crypto = _subtle();
+ ahashWeb(hash);
+ const _opts = checkOpts({ dkLen: 32 }, opts);
+ const { c, dkLen } = _opts;
+ anumber(c, 'c');
+ anumber(dkLen, 'dkLen');
+ const _password = kdfInputToBytes(password, 'password');
+ const _salt = kdfInputToBytes(salt, 'salt');
+ const key = await crypto.importKey('raw', _password as BufferSource, 'PBKDF2', false, [
+ 'deriveBits',
+ ]);
+ const deriveOpts = { name: 'PBKDF2', salt: _salt, iterations: c, hash: hash.webCryptoName };
+ return new Uint8Array(await crypto.deriveBits(deriveOpts, key, 8 * dkLen));
+}
diff --git a/server/node_modules/@noble/hashes/utils.d.ts b/server/node_modules/@noble/hashes/utils.d.ts
new file mode 100644
index 0000000..be4af4f
--- /dev/null
+++ b/server/node_modules/@noble/hashes/utils.d.ts
@@ -0,0 +1,130 @@
+/**
+ * Utilities for hex, bytes, CSPRNG.
+ * @module
+ */
+/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
+/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
+export declare function isBytes(a: unknown): a is Uint8Array;
+/** Asserts something is positive integer. */
+export declare function anumber(n: number, title?: string): void;
+/** Asserts something is Uint8Array. */
+export declare function abytes(value: Uint8Array, length?: number, title?: string): Uint8Array;
+/** Asserts something is hash */
+export declare function ahash(h: CHash): void;
+/** Asserts a hash instance has not been destroyed / finished */
+export declare function aexists(instance: any, checkFinished?: boolean): void;
+/** Asserts output is properly-sized byte array */
+export declare function aoutput(out: any, instance: any): void;
+/** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */
+export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array | Uint16Array | Int16Array | Uint32Array | Int32Array;
+/** Cast u8 / u16 / u32 to u8. */
+export declare function u8(arr: TypedArray): Uint8Array;
+/** Cast u8 / u16 / u32 to u32. */
+export declare function u32(arr: TypedArray): Uint32Array;
+/** Zeroize a byte array. Warning: JS provides no guarantees. */
+export declare function clean(...arrays: TypedArray[]): void;
+/** Create DataView of an array for easy byte-level manipulation. */
+export declare function createView(arr: TypedArray): DataView;
+/** The rotate right (circular right shift) operation for uint32 */
+export declare function rotr(word: number, shift: number): number;
+/** The rotate left (circular left shift) operation for uint32 */
+export declare function rotl(word: number, shift: number): number;
+/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
+export declare const isLE: boolean;
+/** The byte swap operation for uint32 */
+export declare function byteSwap(word: number): number;
+/** Conditionally byte swap if on a big-endian platform */
+export declare const swap8IfBE: (n: number) => number;
+/** In place byte swap for Uint32Array */
+export declare function byteSwap32(arr: Uint32Array): Uint32Array;
+export declare const swap32IfBE: (u: Uint32Array) => Uint32Array;
+/**
+ * Convert byte array to hex string. Uses built-in function, when available.
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
+ */
+export declare function bytesToHex(bytes: Uint8Array): string;
+/**
+ * Convert hex string to byte array. Uses built-in function, when available.
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
+ */
+export declare function hexToBytes(hex: string): Uint8Array;
+/**
+ * There is no setImmediate in browser and setTimeout is slow.
+ * Call of async fn will return Promise, which will be fullfiled only on
+ * next scheduler queue processing step and this is exactly what we need.
+ */
+export declare const nextTick: () => Promise;
+/** Returns control to thread each 'tick' ms to avoid blocking. */
+export declare function asyncLoop(iters: number, tick: number, cb: (i: number) => void): Promise;
+/**
+ * Converts string to bytes using UTF8 encoding.
+ * Built-in doesn't validate input to be string: we do the check.
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
+ */
+export declare function utf8ToBytes(str: string): Uint8Array;
+/** KDFs can accept string or Uint8Array for user convenience. */
+export type KDFInput = string | Uint8Array;
+/**
+ * Helper for KDFs: consumes uint8array or string.
+ * When string is passed, does utf8 decoding, using TextDecoder.
+ */
+export declare function kdfInputToBytes(data: KDFInput, errorTitle?: string): Uint8Array;
+/** Copies several Uint8Arrays into one. */
+export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
+type EmptyObj = {};
+/** Merges default options and passed options. */
+export declare function checkOpts(defaults: T1, opts?: T2): T1 & T2;
+/** Common interface for all hashes. */
+export interface Hash {
+ blockLen: number;
+ outputLen: number;
+ update(buf: Uint8Array): this;
+ digestInto(buf: Uint8Array): void;
+ digest(): Uint8Array;
+ destroy(): void;
+ _cloneInto(to?: T): T;
+ clone(): T;
+}
+/** PseudoRandom (number) Generator */
+export interface PRG {
+ addEntropy(seed: Uint8Array): void;
+ randomBytes(length: number): Uint8Array;
+ clean(): void;
+}
+/**
+ * XOF: streaming API to read digest in chunks.
+ * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.
+ * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot
+ * destroy state, next call can require more bytes.
+ */
+export type HashXOF> = Hash & {
+ xof(bytes: number): Uint8Array;
+ xofInto(buf: Uint8Array): Uint8Array;
+};
+/** Hash constructor */
+export type HasherCons = Opts extends undefined ? () => T : (opts?: Opts) => T;
+/** Optional hash params. */
+export type HashInfo = {
+ oid?: Uint8Array;
+};
+/** Hash function */
+export type CHash = Hash, Opts = undefined> = {
+ outputLen: number;
+ blockLen: number;
+} & HashInfo & (Opts extends undefined ? {
+ (msg: Uint8Array): Uint8Array;
+ create(): T;
+} : {
+ (msg: Uint8Array, opts?: Opts): Uint8Array;
+ create(opts?: Opts): T;
+});
+/** XOF with output */
+export type CHashXOF = HashXOF, Opts = undefined> = CHash;
+/** Creates function with outputLen, blockLen, create properties from a class constructor. */
+export declare function createHasher, Opts = undefined>(hashCons: HasherCons, info?: HashInfo): CHash;
+/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
+export declare function randomBytes(bytesLength?: number): Uint8Array;
+/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */
+export declare const oidNist: (suffix: number) => Required;
+export {};
+//# sourceMappingURL=utils.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/utils.d.ts.map b/server/node_modules/@noble/hashes/utils.d.ts.map
new file mode 100644
index 0000000..40bbb0c
--- /dev/null
+++ b/server/node_modules/@noble/hashes/utils.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["src/utils.ts"],"names":[],"m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KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,IAAI;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,QAAQ,GACV,CAAC,IAAI,SAAS,SAAS,GACnB;IACE,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,MAAM,IAAI,CAAC,CAAC;CACb,GACD;IACE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC;CACxB,CAAC,CAAC;AACT,sBAAsB;AACtB,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAE7F,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,EAC9D,QAAQ,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,EAC7B,IAAI,GAAE,QAAa,GAClB,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAQhB;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,WAAW,SAAK,GAAG,UAAU,CAKxD;AAED,mFAAmF;AACnF,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,KAAG,QAAQ,CAAC,QAAQ,CAExD,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/utils.js b/server/node_modules/@noble/hashes/utils.js
new file mode 100644
index 0000000..f8b81c1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/utils.js
@@ -0,0 +1,242 @@
+/**
+ * Utilities for hex, bytes, CSPRNG.
+ * @module
+ */
+/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
+/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
+export function isBytes(a) {
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
+}
+/** Asserts something is positive integer. */
+export function anumber(n, title = '') {
+ if (!Number.isSafeInteger(n) || n < 0) {
+ const prefix = title && `"${title}" `;
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
+ }
+}
+/** Asserts something is Uint8Array. */
+export function abytes(value, length, title = '') {
+ const bytes = isBytes(value);
+ const len = value?.length;
+ const needsLen = length !== undefined;
+ if (!bytes || (needsLen && len !== length)) {
+ const prefix = title && `"${title}" `;
+ const ofLen = needsLen ? ` of length ${length}` : '';
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
+ throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
+ }
+ return value;
+}
+/** Asserts something is hash */
+export function ahash(h) {
+ if (typeof h !== 'function' || typeof h.create !== 'function')
+ throw new Error('Hash must wrapped by utils.createHasher');
+ anumber(h.outputLen);
+ anumber(h.blockLen);
+}
+/** Asserts a hash instance has not been destroyed / finished */
+export function aexists(instance, checkFinished = true) {
+ if (instance.destroyed)
+ throw new Error('Hash instance has been destroyed');
+ if (checkFinished && instance.finished)
+ throw new Error('Hash#digest() has already been called');
+}
+/** Asserts output is properly-sized byte array */
+export function aoutput(out, instance) {
+ abytes(out, undefined, 'digestInto() output');
+ const min = instance.outputLen;
+ if (out.length < min) {
+ throw new Error('"digestInto() output" expected to be of length >=' + min);
+ }
+}
+/** Cast u8 / u16 / u32 to u8. */
+export function u8(arr) {
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+/** Cast u8 / u16 / u32 to u32. */
+export function u32(arr) {
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
+}
+/** Zeroize a byte array. Warning: JS provides no guarantees. */
+export function clean(...arrays) {
+ for (let i = 0; i < arrays.length; i++) {
+ arrays[i].fill(0);
+ }
+}
+/** Create DataView of an array for easy byte-level manipulation. */
+export function createView(arr) {
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+/** The rotate right (circular right shift) operation for uint32 */
+export function rotr(word, shift) {
+ return (word << (32 - shift)) | (word >>> shift);
+}
+/** The rotate left (circular left shift) operation for uint32 */
+export function rotl(word, shift) {
+ return (word << shift) | ((word >>> (32 - shift)) >>> 0);
+}
+/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
+export const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
+/** The byte swap operation for uint32 */
+export function byteSwap(word) {
+ return (((word << 24) & 0xff000000) |
+ ((word << 8) & 0xff0000) |
+ ((word >>> 8) & 0xff00) |
+ ((word >>> 24) & 0xff));
+}
+/** Conditionally byte swap if on a big-endian platform */
+export const swap8IfBE = isLE
+ ? (n) => n
+ : (n) => byteSwap(n);
+/** In place byte swap for Uint32Array */
+export function byteSwap32(arr) {
+ for (let i = 0; i < arr.length; i++) {
+ arr[i] = byteSwap(arr[i]);
+ }
+ return arr;
+}
+export const swap32IfBE = isLE
+ ? (u) => u
+ : byteSwap32;
+// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
+const hasHexBuiltin = /* @__PURE__ */ (() =>
+// @ts-ignore
+typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
+// Array where index 0xf0 (240) is mapped to string 'f0'
+const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
+/**
+ * Convert byte array to hex string. Uses built-in function, when available.
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
+ */
+export function bytesToHex(bytes) {
+ abytes(bytes);
+ // @ts-ignore
+ if (hasHexBuiltin)
+ return bytes.toHex();
+ // pre-caching improves the speed 6x
+ let hex = '';
+ for (let i = 0; i < bytes.length; i++) {
+ hex += hexes[bytes[i]];
+ }
+ return hex;
+}
+// We use optimized technique to convert hex string to byte array
+const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
+function asciiToBase16(ch) {
+ if (ch >= asciis._0 && ch <= asciis._9)
+ return ch - asciis._0; // '2' => 50-48
+ if (ch >= asciis.A && ch <= asciis.F)
+ return ch - (asciis.A - 10); // 'B' => 66-(65-10)
+ if (ch >= asciis.a && ch <= asciis.f)
+ return ch - (asciis.a - 10); // 'b' => 98-(97-10)
+ return;
+}
+/**
+ * Convert hex string to byte array. Uses built-in function, when available.
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
+ */
+export function hexToBytes(hex) {
+ if (typeof hex !== 'string')
+ throw new Error('hex string expected, got ' + typeof hex);
+ // @ts-ignore
+ if (hasHexBuiltin)
+ return Uint8Array.fromHex(hex);
+ const hl = hex.length;
+ const al = hl / 2;
+ if (hl % 2)
+ throw new Error('hex string expected, got unpadded hex of length ' + hl);
+ const array = new Uint8Array(al);
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
+ if (n1 === undefined || n2 === undefined) {
+ const char = hex[hi] + hex[hi + 1];
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
+ }
+ array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
+ }
+ return array;
+}
+/**
+ * There is no setImmediate in browser and setTimeout is slow.
+ * Call of async fn will return Promise, which will be fullfiled only on
+ * next scheduler queue processing step and this is exactly what we need.
+ */
+export const nextTick = async () => { };
+/** Returns control to thread each 'tick' ms to avoid blocking. */
+export async function asyncLoop(iters, tick, cb) {
+ let ts = Date.now();
+ for (let i = 0; i < iters; i++) {
+ cb(i);
+ // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
+ const diff = Date.now() - ts;
+ if (diff >= 0 && diff < tick)
+ continue;
+ await nextTick();
+ ts += diff;
+ }
+}
+/**
+ * Converts string to bytes using UTF8 encoding.
+ * Built-in doesn't validate input to be string: we do the check.
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
+ */
+export function utf8ToBytes(str) {
+ if (typeof str !== 'string')
+ throw new Error('string expected');
+ return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
+}
+/**
+ * Helper for KDFs: consumes uint8array or string.
+ * When string is passed, does utf8 decoding, using TextDecoder.
+ */
+export function kdfInputToBytes(data, errorTitle = '') {
+ if (typeof data === 'string')
+ return utf8ToBytes(data);
+ return abytes(data, undefined, errorTitle);
+}
+/** Copies several Uint8Arrays into one. */
+export function concatBytes(...arrays) {
+ let sum = 0;
+ for (let i = 0; i < arrays.length; i++) {
+ const a = arrays[i];
+ abytes(a);
+ sum += a.length;
+ }
+ const res = new Uint8Array(sum);
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
+ const a = arrays[i];
+ res.set(a, pad);
+ pad += a.length;
+ }
+ return res;
+}
+/** Merges default options and passed options. */
+export function checkOpts(defaults, opts) {
+ if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
+ throw new Error('options must be object or undefined');
+ const merged = Object.assign(defaults, opts);
+ return merged;
+}
+/** Creates function with outputLen, blockLen, create properties from a class constructor. */
+export function createHasher(hashCons, info = {}) {
+ const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
+ const tmp = hashCons(undefined);
+ hashC.outputLen = tmp.outputLen;
+ hashC.blockLen = tmp.blockLen;
+ hashC.create = (opts) => hashCons(opts);
+ Object.assign(hashC, info);
+ return Object.freeze(hashC);
+}
+/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
+export function randomBytes(bytesLength = 32) {
+ const cr = typeof globalThis === 'object' ? globalThis.crypto : null;
+ if (typeof cr?.getRandomValues !== 'function')
+ throw new Error('crypto.getRandomValues must be defined');
+ return cr.getRandomValues(new Uint8Array(bytesLength));
+}
+/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */
+export const oidNist = (suffix) => ({
+ oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),
+});
+//# sourceMappingURL=utils.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/utils.js.map b/server/node_modules/@noble/hashes/utils.js.map
new file mode 100644
index 0000000..de76cb1
--- /dev/null
+++ b/server/node_modules/@noble/hashes/utils.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,qFAAqF;AACrF,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,OAAO,CAAC,YAAY,UAAU,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;AACnG,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,QAAgB,EAAE;IACnD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,8BAA8B,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,MAAM,CAAC,KAAiB,EAAE,MAAe,EAAE,QAAgB,EAAE;IAC3E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,KAAK,EAAE,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,MAAM,KAAK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AI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;CAC3F,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/webcrypto.d.ts b/server/node_modules/@noble/hashes/webcrypto.d.ts
new file mode 100644
index 0000000..5936373
--- /dev/null
+++ b/server/node_modules/@noble/hashes/webcrypto.d.ts
@@ -0,0 +1,62 @@
+import { type Pbkdf2Opt } from './pbkdf2.ts';
+import { type KDFInput } from './utils.ts';
+export type WebHash = {
+ (msg: Uint8Array): Promise;
+ webCryptoName: string;
+ outputLen: number;
+ blockLen: number;
+};
+/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+/** WebCrypto SHA2-256 hash function from RFC 4634. */
+export declare const sha256: WebHash;
+/** WebCrypto SHA2-384 hash function from RFC 4634. */
+export declare const sha384: WebHash;
+/** WebCrypto SHA2-512 hash function from RFC 4634. */
+export declare const sha512: WebHash;
+/**
+ * WebCrypto HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256. Webcrypto version.
+ * @param key - key which would be used to authenticate message
+ * @param message - message
+ * @example
+ * ```js
+ * import { hmac, sha256 } from '@noble/hashes/webcrypto.js';
+ * const mac1 = await hmac(sha256, 'key', 'message');
+ * ```
+ */
+export declare const hmac: {
+ (hash: WebHash, key: Uint8Array, message: Uint8Array): Promise;
+ create(hash: WebHash, key: Uint8Array): any;
+};
+/**
+ * WebCrypto HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256). Webcrypto version.
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * ```js
+ * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js';
+ * import { randomBytes } from '@noble/hashes/utils.js';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1w = await hkdf(sha256, inputKey, salt, info, 32);
+ * ```
+ */
+export declare function hkdf(hash: WebHash, ikm: Uint8Array, salt: Uint8Array | undefined, info: Uint8Array | undefined, length: number): Promise;
+/**
+ * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256. Webcrypto version.
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * ```js
+ * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ * ```
+ */
+export declare function pbkdf2(hash: WebHash, password: KDFInput, salt: KDFInput, opts: Pbkdf2Opt): Promise;
+//# sourceMappingURL=webcrypto.d.ts.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/webcrypto.d.ts.map b/server/node_modules/@noble/hashes/webcrypto.d.ts.map
new file mode 100644
index 0000000..f9fe0b0
--- /dev/null
+++ b/server/node_modules/@noble/hashes/webcrypto.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AASpB,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAsBF,uFAAuF;AAGvF,sDAAsD;AACtD,eAAO,MAAM,MAAM,EAAE,OAA0D,CAAC;AAChF,sDAAsD;AACtD,eAAO,MAAM,MAAM,EAAE,OAA2D,CAAC;AACjF,sDAAsD;AACtD,eAAO,MAAM,MAAM,EAAE,OAA2D,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,EAAE;IACjB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3E,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,GAAG,CAAC;CA0B1C,CAAC;AAEL;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAerB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,CAAC,CAcrB"}
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/webcrypto.js b/server/node_modules/@noble/hashes/webcrypto.js
new file mode 100644
index 0000000..df96f36
--- /dev/null
+++ b/server/node_modules/@noble/hashes/webcrypto.js
@@ -0,0 +1,126 @@
+import {} from "./pbkdf2.js";
+import { abytes, ahash, anumber, checkOpts, kdfInputToBytes, } from "./utils.js";
+function _subtle() {
+ const cr = typeof globalThis === 'object' ? globalThis.crypto : null;
+ const sb = cr?.subtle;
+ if (typeof sb === 'object' && sb != null)
+ return sb;
+ throw new Error('crypto.subtle must be defined');
+}
+function createWebHash(name, blockLen, outputLen) {
+ const hashC = async (msg) => {
+ abytes(msg);
+ const crypto = _subtle();
+ return new Uint8Array(await crypto.digest(name, msg));
+ };
+ hashC.webCryptoName = name; // make sure it won't interfere with function name
+ hashC.outputLen = outputLen;
+ hashC.blockLen = blockLen;
+ hashC.create = () => {
+ throw new Error('not implemented');
+ };
+ return hashC;
+}
+function ahashWeb(hash) {
+ ahash(hash);
+ if (typeof hash.webCryptoName !== 'string')
+ throw new Error('non-web hash');
+}
+/** WebCrypto SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
+// export const sha1: WebHash = createHash('SHA-1', 64, 20);
+/** WebCrypto SHA2-256 hash function from RFC 4634. */
+export const sha256 = /* @__PURE__ */ createWebHash('SHA-256', 64, 32);
+/** WebCrypto SHA2-384 hash function from RFC 4634. */
+export const sha384 = /* @__PURE__ */ createWebHash('SHA-384', 128, 48);
+/** WebCrypto SHA2-512 hash function from RFC 4634. */
+export const sha512 = /* @__PURE__ */ createWebHash('SHA-512', 128, 64);
+/**
+ * WebCrypto HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256. Webcrypto version.
+ * @param key - key which would be used to authenticate message
+ * @param message - message
+ * @example
+ * ```js
+ * import { hmac, sha256 } from '@noble/hashes/webcrypto.js';
+ * const mac1 = await hmac(sha256, 'key', 'message');
+ * ```
+ */
+export const hmac = /* @__PURE__ */ (() => {
+ const hmac_ = async (hash, key, message) => {
+ const crypto = _subtle();
+ abytes(key, undefined, 'key');
+ abytes(message, undefined, 'message');
+ ahashWeb(hash);
+ // WebCrypto keys can't be zeroized
+ // prettier-ignore
+ const wkey = await crypto.importKey('raw', key, { name: 'HMAC', hash: hash.webCryptoName }, false, ['sign']);
+ return new Uint8Array(await crypto.sign('HMAC', wkey, message));
+ };
+ hmac_.create = (_hash, _key) => {
+ throw new Error('not implemented');
+ };
+ return hmac_;
+})();
+/**
+ * WebCrypto HKDF (RFC 5869): derive keys from an initial input.
+ * Combines hkdf_extract + hkdf_expand in one step
+ * @param hash - hash function that would be used (e.g. sha256). Webcrypto version.
+ * @param ikm - input keying material, the initial key
+ * @param salt - optional salt value (a non-secret random value)
+ * @param info - optional context and application specific information (can be a zero-length string)
+ * @param length - length of output keying material in bytes
+ * @example
+ * ```js
+ * import { hkdf, sha256 } from '@noble/hashes/webcrypto.js';
+ * import { randomBytes } from '@noble/hashes/utils.js';
+ * const inputKey = randomBytes(32);
+ * const salt = randomBytes(32);
+ * const info = 'application-key';
+ * const hk1w = await hkdf(sha256, inputKey, salt, info, 32);
+ * ```
+ */
+export async function hkdf(hash, ikm, salt, info, length) {
+ const crypto = _subtle();
+ ahashWeb(hash);
+ abytes(ikm, undefined, 'ikm');
+ anumber(length, 'length');
+ if (salt !== undefined)
+ abytes(salt, undefined, 'salt');
+ if (info !== undefined)
+ abytes(info, undefined, 'info');
+ const wkey = await crypto.importKey('raw', ikm, 'HKDF', false, ['deriveBits']);
+ const opts = {
+ name: 'HKDF',
+ hash: hash.webCryptoName,
+ salt: salt === undefined ? new Uint8Array(0) : salt,
+ info: info === undefined ? new Uint8Array(0) : info,
+ };
+ return new Uint8Array(await crypto.deriveBits(opts, wkey, 8 * length));
+}
+/**
+ * WebCrypto PBKDF2-HMAC: RFC 2898 key derivation function
+ * @param hash - hash function that would be used e.g. sha256. Webcrypto version.
+ * @param password - password from which a derived key is generated
+ * @param salt - cryptographic salt
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
+ * @example
+ * ```js
+ * const key = await pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
+ * ```
+ */
+export async function pbkdf2(hash, password, salt, opts) {
+ const crypto = _subtle();
+ ahashWeb(hash);
+ const _opts = checkOpts({ dkLen: 32 }, opts);
+ const { c, dkLen } = _opts;
+ anumber(c, 'c');
+ anumber(dkLen, 'dkLen');
+ const _password = kdfInputToBytes(password, 'password');
+ const _salt = kdfInputToBytes(salt, 'salt');
+ const key = await crypto.importKey('raw', _password, 'PBKDF2', false, [
+ 'deriveBits',
+ ]);
+ const deriveOpts = { name: 'PBKDF2', salt: _salt, iterations: c, hash: hash.webCryptoName };
+ return new Uint8Array(await crypto.deriveBits(deriveOpts, key, 8 * dkLen));
+}
+//# sourceMappingURL=webcrypto.js.map
\ No newline at end of file
diff --git a/server/node_modules/@noble/hashes/webcrypto.js.map b/server/node_modules/@noble/hashes/webcrypto.js.map
new file mode 100644
index 0000000..53fa3ef
--- /dev/null
+++ b/server/node_modules/@noble/hashes/webcrypto.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"webcrypto.js","sourceRoot":"","sources":["src/webcrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,GAGhB,MAAM,YAAY,CAAC;AAEpB,SAAS,OAAO;IACd,MAAM,EAAE,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAE,UAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,MAAM,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC;IACtB,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,IAAI,IAAI;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACnD,CAAC;AASD,SAAS,aAAa,CAAC,IAAY,EAAE,QAAgB,EAAE,SAAiB;IACtE,MAAM,KAAK,GAAQ,KAAK,EAAE,GAAe,EAAE,EAAE;QAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;QACZ,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QACzB,OAAO,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAmB,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;IACF,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,kDAAkD;IAC9E,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CA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;IACF,OAAO,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAAa,EACb,QAAkB,EAClB,IAAc,EACd,IAAe;IAEf,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,CAAC;IACf,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxB,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE;QACpF,YAAY;KACb,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5F,OAAO,IAAI,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC7E,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/ansi-regex/index.d.ts b/server/node_modules/ansi-regex/index.d.ts
new file mode 100644
index 0000000..2dbf6af
--- /dev/null
+++ b/server/node_modules/ansi-regex/index.d.ts
@@ -0,0 +1,37 @@
+declare namespace ansiRegex {
+ interface Options {
+ /**
+ Match only the first ANSI escape.
+
+ @default false
+ */
+ onlyFirst: boolean;
+ }
+}
+
+/**
+Regular expression for matching ANSI escape codes.
+
+@example
+```
+import ansiRegex = require('ansi-regex');
+
+ansiRegex().test('\u001B[4mcake\u001B[0m');
+//=> true
+
+ansiRegex().test('cake');
+//=> false
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex());
+//=> ['\u001B[4m', '\u001B[0m']
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
+//=> ['\u001B[4m']
+
+'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
+//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
+```
+*/
+declare function ansiRegex(options?: ansiRegex.Options): RegExp;
+
+export = ansiRegex;
diff --git a/server/node_modules/ansi-regex/index.js b/server/node_modules/ansi-regex/index.js
new file mode 100644
index 0000000..616ff83
--- /dev/null
+++ b/server/node_modules/ansi-regex/index.js
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = ({onlyFirst = false} = {}) => {
+ const pattern = [
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
+ ].join('|');
+
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
+};
diff --git a/server/node_modules/ansi-regex/license b/server/node_modules/ansi-regex/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/ansi-regex/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/ansi-regex/package.json b/server/node_modules/ansi-regex/package.json
new file mode 100644
index 0000000..017f531
--- /dev/null
+++ b/server/node_modules/ansi-regex/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "ansi-regex",
+ "version": "5.0.1",
+ "description": "Regular expression for matching ANSI escape codes",
+ "license": "MIT",
+ "repository": "chalk/ansi-regex",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd",
+ "view-supported": "node fixtures/view-codes.js"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "command-line",
+ "text",
+ "regex",
+ "regexp",
+ "re",
+ "match",
+ "test",
+ "find",
+ "pattern"
+ ],
+ "devDependencies": {
+ "ava": "^2.4.0",
+ "tsd": "^0.9.0",
+ "xo": "^0.25.3"
+ }
+}
diff --git a/server/node_modules/ansi-regex/readme.md b/server/node_modules/ansi-regex/readme.md
new file mode 100644
index 0000000..4d848bc
--- /dev/null
+++ b/server/node_modules/ansi-regex/readme.md
@@ -0,0 +1,78 @@
+# ansi-regex
+
+> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
+
+
+## Install
+
+```
+$ npm install ansi-regex
+```
+
+
+## Usage
+
+```js
+const ansiRegex = require('ansi-regex');
+
+ansiRegex().test('\u001B[4mcake\u001B[0m');
+//=> true
+
+ansiRegex().test('cake');
+//=> false
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex());
+//=> ['\u001B[4m', '\u001B[0m']
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
+//=> ['\u001B[4m']
+
+'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
+//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
+```
+
+
+## API
+
+### ansiRegex(options?)
+
+Returns a regex for matching ANSI escape codes.
+
+#### options
+
+Type: `object`
+
+##### onlyFirst
+
+Type: `boolean`
+Default: `false` *(Matches any ANSI escape codes in a string)*
+
+Match only the first ANSI escape.
+
+
+## FAQ
+
+### Why do you test for codes not in the ECMA 48 standard?
+
+Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
+
+On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
+
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+
+---
+
+
diff --git a/server/node_modules/ansi-styles/index.d.ts b/server/node_modules/ansi-styles/index.d.ts
new file mode 100644
index 0000000..44a907e
--- /dev/null
+++ b/server/node_modules/ansi-styles/index.d.ts
@@ -0,0 +1,345 @@
+declare type CSSColor =
+ | 'aliceblue'
+ | 'antiquewhite'
+ | 'aqua'
+ | 'aquamarine'
+ | 'azure'
+ | 'beige'
+ | 'bisque'
+ | 'black'
+ | 'blanchedalmond'
+ | 'blue'
+ | 'blueviolet'
+ | 'brown'
+ | 'burlywood'
+ | 'cadetblue'
+ | 'chartreuse'
+ | 'chocolate'
+ | 'coral'
+ | 'cornflowerblue'
+ | 'cornsilk'
+ | 'crimson'
+ | 'cyan'
+ | 'darkblue'
+ | 'darkcyan'
+ | 'darkgoldenrod'
+ | 'darkgray'
+ | 'darkgreen'
+ | 'darkgrey'
+ | 'darkkhaki'
+ | 'darkmagenta'
+ | 'darkolivegreen'
+ | 'darkorange'
+ | 'darkorchid'
+ | 'darkred'
+ | 'darksalmon'
+ | 'darkseagreen'
+ | 'darkslateblue'
+ | 'darkslategray'
+ | 'darkslategrey'
+ | 'darkturquoise'
+ | 'darkviolet'
+ | 'deeppink'
+ | 'deepskyblue'
+ | 'dimgray'
+ | 'dimgrey'
+ | 'dodgerblue'
+ | 'firebrick'
+ | 'floralwhite'
+ | 'forestgreen'
+ | 'fuchsia'
+ | 'gainsboro'
+ | 'ghostwhite'
+ | 'gold'
+ | 'goldenrod'
+ | 'gray'
+ | 'green'
+ | 'greenyellow'
+ | 'grey'
+ | 'honeydew'
+ | 'hotpink'
+ | 'indianred'
+ | 'indigo'
+ | 'ivory'
+ | 'khaki'
+ | 'lavender'
+ | 'lavenderblush'
+ | 'lawngreen'
+ | 'lemonchiffon'
+ | 'lightblue'
+ | 'lightcoral'
+ | 'lightcyan'
+ | 'lightgoldenrodyellow'
+ | 'lightgray'
+ | 'lightgreen'
+ | 'lightgrey'
+ | 'lightpink'
+ | 'lightsalmon'
+ | 'lightseagreen'
+ | 'lightskyblue'
+ | 'lightslategray'
+ | 'lightslategrey'
+ | 'lightsteelblue'
+ | 'lightyellow'
+ | 'lime'
+ | 'limegreen'
+ | 'linen'
+ | 'magenta'
+ | 'maroon'
+ | 'mediumaquamarine'
+ | 'mediumblue'
+ | 'mediumorchid'
+ | 'mediumpurple'
+ | 'mediumseagreen'
+ | 'mediumslateblue'
+ | 'mediumspringgreen'
+ | 'mediumturquoise'
+ | 'mediumvioletred'
+ | 'midnightblue'
+ | 'mintcream'
+ | 'mistyrose'
+ | 'moccasin'
+ | 'navajowhite'
+ | 'navy'
+ | 'oldlace'
+ | 'olive'
+ | 'olivedrab'
+ | 'orange'
+ | 'orangered'
+ | 'orchid'
+ | 'palegoldenrod'
+ | 'palegreen'
+ | 'paleturquoise'
+ | 'palevioletred'
+ | 'papayawhip'
+ | 'peachpuff'
+ | 'peru'
+ | 'pink'
+ | 'plum'
+ | 'powderblue'
+ | 'purple'
+ | 'rebeccapurple'
+ | 'red'
+ | 'rosybrown'
+ | 'royalblue'
+ | 'saddlebrown'
+ | 'salmon'
+ | 'sandybrown'
+ | 'seagreen'
+ | 'seashell'
+ | 'sienna'
+ | 'silver'
+ | 'skyblue'
+ | 'slateblue'
+ | 'slategray'
+ | 'slategrey'
+ | 'snow'
+ | 'springgreen'
+ | 'steelblue'
+ | 'tan'
+ | 'teal'
+ | 'thistle'
+ | 'tomato'
+ | 'turquoise'
+ | 'violet'
+ | 'wheat'
+ | 'white'
+ | 'whitesmoke'
+ | 'yellow'
+ | 'yellowgreen';
+
+declare namespace ansiStyles {
+ interface ColorConvert {
+ /**
+ The RGB color space.
+
+ @param red - (`0`-`255`)
+ @param green - (`0`-`255`)
+ @param blue - (`0`-`255`)
+ */
+ rgb(red: number, green: number, blue: number): string;
+
+ /**
+ The RGB HEX color space.
+
+ @param hex - A hexadecimal string containing RGB data.
+ */
+ hex(hex: string): string;
+
+ /**
+ @param keyword - A CSS color name.
+ */
+ keyword(keyword: CSSColor): string;
+
+ /**
+ The HSL color space.
+
+ @param hue - (`0`-`360`)
+ @param saturation - (`0`-`100`)
+ @param lightness - (`0`-`100`)
+ */
+ hsl(hue: number, saturation: number, lightness: number): string;
+
+ /**
+ The HSV color space.
+
+ @param hue - (`0`-`360`)
+ @param saturation - (`0`-`100`)
+ @param value - (`0`-`100`)
+ */
+ hsv(hue: number, saturation: number, value: number): string;
+
+ /**
+ The HSV color space.
+
+ @param hue - (`0`-`360`)
+ @param whiteness - (`0`-`100`)
+ @param blackness - (`0`-`100`)
+ */
+ hwb(hue: number, whiteness: number, blackness: number): string;
+
+ /**
+ Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
+ */
+ ansi(ansi: number): string;
+
+ /**
+ Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
+ */
+ ansi256(ansi: number): string;
+ }
+
+ interface CSPair {
+ /**
+ The ANSI terminal control sequence for starting this style.
+ */
+ readonly open: string;
+
+ /**
+ The ANSI terminal control sequence for ending this style.
+ */
+ readonly close: string;
+ }
+
+ interface ColorBase {
+ readonly ansi: ColorConvert;
+ readonly ansi256: ColorConvert;
+ readonly ansi16m: ColorConvert;
+
+ /**
+ The ANSI terminal control sequence for ending this color.
+ */
+ readonly close: string;
+ }
+
+ interface Modifier {
+ /**
+ Resets the current color chain.
+ */
+ readonly reset: CSPair;
+
+ /**
+ Make text bold.
+ */
+ readonly bold: CSPair;
+
+ /**
+ Emitting only a small amount of light.
+ */
+ readonly dim: CSPair;
+
+ /**
+ Make text italic. (Not widely supported)
+ */
+ readonly italic: CSPair;
+
+ /**
+ Make text underline. (Not widely supported)
+ */
+ readonly underline: CSPair;
+
+ /**
+ Inverse background and foreground colors.
+ */
+ readonly inverse: CSPair;
+
+ /**
+ Prints the text, but makes it invisible.
+ */
+ readonly hidden: CSPair;
+
+ /**
+ Puts a horizontal line through the center of the text. (Not widely supported)
+ */
+ readonly strikethrough: CSPair;
+ }
+
+ interface ForegroundColor {
+ readonly black: CSPair;
+ readonly red: CSPair;
+ readonly green: CSPair;
+ readonly yellow: CSPair;
+ readonly blue: CSPair;
+ readonly cyan: CSPair;
+ readonly magenta: CSPair;
+ readonly white: CSPair;
+
+ /**
+ Alias for `blackBright`.
+ */
+ readonly gray: CSPair;
+
+ /**
+ Alias for `blackBright`.
+ */
+ readonly grey: CSPair;
+
+ readonly blackBright: CSPair;
+ readonly redBright: CSPair;
+ readonly greenBright: CSPair;
+ readonly yellowBright: CSPair;
+ readonly blueBright: CSPair;
+ readonly cyanBright: CSPair;
+ readonly magentaBright: CSPair;
+ readonly whiteBright: CSPair;
+ }
+
+ interface BackgroundColor {
+ readonly bgBlack: CSPair;
+ readonly bgRed: CSPair;
+ readonly bgGreen: CSPair;
+ readonly bgYellow: CSPair;
+ readonly bgBlue: CSPair;
+ readonly bgCyan: CSPair;
+ readonly bgMagenta: CSPair;
+ readonly bgWhite: CSPair;
+
+ /**
+ Alias for `bgBlackBright`.
+ */
+ readonly bgGray: CSPair;
+
+ /**
+ Alias for `bgBlackBright`.
+ */
+ readonly bgGrey: CSPair;
+
+ readonly bgBlackBright: CSPair;
+ readonly bgRedBright: CSPair;
+ readonly bgGreenBright: CSPair;
+ readonly bgYellowBright: CSPair;
+ readonly bgBlueBright: CSPair;
+ readonly bgCyanBright: CSPair;
+ readonly bgMagentaBright: CSPair;
+ readonly bgWhiteBright: CSPair;
+ }
+}
+
+declare const ansiStyles: {
+ readonly modifier: ansiStyles.Modifier;
+ readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
+ readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
+ readonly codes: ReadonlyMap;
+} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
+
+export = ansiStyles;
diff --git a/server/node_modules/ansi-styles/index.js b/server/node_modules/ansi-styles/index.js
new file mode 100644
index 0000000..5d82581
--- /dev/null
+++ b/server/node_modules/ansi-styles/index.js
@@ -0,0 +1,163 @@
+'use strict';
+
+const wrapAnsi16 = (fn, offset) => (...args) => {
+ const code = fn(...args);
+ return `\u001B[${code + offset}m`;
+};
+
+const wrapAnsi256 = (fn, offset) => (...args) => {
+ const code = fn(...args);
+ return `\u001B[${38 + offset};5;${code}m`;
+};
+
+const wrapAnsi16m = (fn, offset) => (...args) => {
+ const rgb = fn(...args);
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
+};
+
+const ansi2ansi = n => n;
+const rgb2rgb = (r, g, b) => [r, g, b];
+
+const setLazyProperty = (object, property, get) => {
+ Object.defineProperty(object, property, {
+ get: () => {
+ const value = get();
+
+ Object.defineProperty(object, property, {
+ value,
+ enumerable: true,
+ configurable: true
+ });
+
+ return value;
+ },
+ enumerable: true,
+ configurable: true
+ });
+};
+
+/** @type {typeof import('color-convert')} */
+let colorConvert;
+const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
+ if (colorConvert === undefined) {
+ colorConvert = require('color-convert');
+ }
+
+ const offset = isBackground ? 10 : 0;
+ const styles = {};
+
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
+ const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
+ if (sourceSpace === targetSpace) {
+ styles[name] = wrap(identity, offset);
+ } else if (typeof suite === 'object') {
+ styles[name] = wrap(suite[targetSpace], offset);
+ }
+ }
+
+ return styles;
+};
+
+function assembleStyles() {
+ const codes = new Map();
+ const styles = {
+ modifier: {
+ reset: [0, 0],
+ // 21 isn't widely supported and 22 does the same thing
+ bold: [1, 22],
+ dim: [2, 22],
+ italic: [3, 23],
+ underline: [4, 24],
+ inverse: [7, 27],
+ hidden: [8, 28],
+ strikethrough: [9, 29]
+ },
+ color: {
+ black: [30, 39],
+ red: [31, 39],
+ green: [32, 39],
+ yellow: [33, 39],
+ blue: [34, 39],
+ magenta: [35, 39],
+ cyan: [36, 39],
+ white: [37, 39],
+
+ // Bright color
+ blackBright: [90, 39],
+ redBright: [91, 39],
+ greenBright: [92, 39],
+ yellowBright: [93, 39],
+ blueBright: [94, 39],
+ magentaBright: [95, 39],
+ cyanBright: [96, 39],
+ whiteBright: [97, 39]
+ },
+ bgColor: {
+ bgBlack: [40, 49],
+ bgRed: [41, 49],
+ bgGreen: [42, 49],
+ bgYellow: [43, 49],
+ bgBlue: [44, 49],
+ bgMagenta: [45, 49],
+ bgCyan: [46, 49],
+ bgWhite: [47, 49],
+
+ // Bright color
+ bgBlackBright: [100, 49],
+ bgRedBright: [101, 49],
+ bgGreenBright: [102, 49],
+ bgYellowBright: [103, 49],
+ bgBlueBright: [104, 49],
+ bgMagentaBright: [105, 49],
+ bgCyanBright: [106, 49],
+ bgWhiteBright: [107, 49]
+ }
+ };
+
+ // Alias bright black as gray (and grey)
+ styles.color.gray = styles.color.blackBright;
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
+ styles.color.grey = styles.color.blackBright;
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
+
+ for (const [groupName, group] of Object.entries(styles)) {
+ for (const [styleName, style] of Object.entries(group)) {
+ styles[styleName] = {
+ open: `\u001B[${style[0]}m`,
+ close: `\u001B[${style[1]}m`
+ };
+
+ group[styleName] = styles[styleName];
+
+ codes.set(style[0], style[1]);
+ }
+
+ Object.defineProperty(styles, groupName, {
+ value: group,
+ enumerable: false
+ });
+ }
+
+ Object.defineProperty(styles, 'codes', {
+ value: codes,
+ enumerable: false
+ });
+
+ styles.color.close = '\u001B[39m';
+ styles.bgColor.close = '\u001B[49m';
+
+ setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
+ setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
+ setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
+ setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
+ setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
+ setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
+
+ return styles;
+}
+
+// Make the export immutable
+Object.defineProperty(module, 'exports', {
+ enumerable: true,
+ get: assembleStyles
+});
diff --git a/server/node_modules/ansi-styles/license b/server/node_modules/ansi-styles/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/ansi-styles/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/ansi-styles/package.json b/server/node_modules/ansi-styles/package.json
new file mode 100644
index 0000000..7539328
--- /dev/null
+++ b/server/node_modules/ansi-styles/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "ansi-styles",
+ "version": "4.3.0",
+ "description": "ANSI escape codes for styling strings in the terminal",
+ "license": "MIT",
+ "repository": "chalk/ansi-styles",
+ "funding": "https://github.com/chalk/ansi-styles?sponsor=1",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd",
+ "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "devDependencies": {
+ "@types/color-convert": "^1.9.0",
+ "ava": "^2.3.0",
+ "svg-term-cli": "^2.1.1",
+ "tsd": "^0.11.0",
+ "xo": "^0.25.3"
+ }
+}
diff --git a/server/node_modules/ansi-styles/readme.md b/server/node_modules/ansi-styles/readme.md
new file mode 100644
index 0000000..24883de
--- /dev/null
+++ b/server/node_modules/ansi-styles/readme.md
@@ -0,0 +1,152 @@
+# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
+
+> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
+
+You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
+
+
+
+## Install
+
+```
+$ npm install ansi-styles
+```
+
+## Usage
+
+```js
+const style = require('ansi-styles');
+
+console.log(`${style.green.open}Hello world!${style.green.close}`);
+
+
+// Color conversion between 16/256/truecolor
+// NOTE: If conversion goes to 16 colors or 256 colors, the original color
+// may be degraded to fit that color palette. This means terminals
+// that do not support 16 million colors will best-match the
+// original color.
+console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
+console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
+console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
+```
+
+## API
+
+Each style has an `open` and `close` property.
+
+## Styles
+
+### Modifiers
+
+- `reset`
+- `bold`
+- `dim`
+- `italic` *(Not widely supported)*
+- `underline`
+- `inverse`
+- `hidden`
+- `strikethrough` *(Not widely supported)*
+
+### Colors
+
+- `black`
+- `red`
+- `green`
+- `yellow`
+- `blue`
+- `magenta`
+- `cyan`
+- `white`
+- `blackBright` (alias: `gray`, `grey`)
+- `redBright`
+- `greenBright`
+- `yellowBright`
+- `blueBright`
+- `magentaBright`
+- `cyanBright`
+- `whiteBright`
+
+### Background colors
+
+- `bgBlack`
+- `bgRed`
+- `bgGreen`
+- `bgYellow`
+- `bgBlue`
+- `bgMagenta`
+- `bgCyan`
+- `bgWhite`
+- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
+- `bgRedBright`
+- `bgGreenBright`
+- `bgYellowBright`
+- `bgBlueBright`
+- `bgMagentaBright`
+- `bgCyanBright`
+- `bgWhiteBright`
+
+## Advanced usage
+
+By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
+
+- `style.modifier`
+- `style.color`
+- `style.bgColor`
+
+###### Example
+
+```js
+console.log(style.color.green.open);
+```
+
+Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
+
+###### Example
+
+```js
+console.log(style.codes.get(36));
+//=> 39
+```
+
+## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
+
+`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
+
+The following color spaces from `color-convert` are supported:
+
+- `rgb`
+- `hex`
+- `keyword`
+- `hsl`
+- `hsv`
+- `hwb`
+- `ansi`
+- `ansi256`
+
+To use these, call the associated conversion function with the intended output, for example:
+
+```js
+style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
+style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
+
+style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+
+style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
+style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
+```
+
+## Related
+
+- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+## For enterprise
+
+Available as part of the Tidelift Subscription.
+
+The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
diff --git a/server/node_modules/camelcase/index.d.ts b/server/node_modules/camelcase/index.d.ts
new file mode 100644
index 0000000..58f2069
--- /dev/null
+++ b/server/node_modules/camelcase/index.d.ts
@@ -0,0 +1,63 @@
+declare namespace camelcase {
+ interface Options {
+ /**
+ Uppercase the first character: `foo-bar` → `FooBar`.
+
+ @default false
+ */
+ readonly pascalCase?: boolean;
+ }
+}
+
+declare const camelcase: {
+ /**
+ Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
+
+ @param input - String to convert to camel case.
+
+ @example
+ ```
+ import camelCase = require('camelcase');
+
+ camelCase('foo-bar');
+ //=> 'fooBar'
+
+ camelCase('foo_bar');
+ //=> 'fooBar'
+
+ camelCase('Foo-Bar');
+ //=> 'fooBar'
+
+ camelCase('Foo-Bar', {pascalCase: true});
+ //=> 'FooBar'
+
+ camelCase('--foo.bar', {pascalCase: false});
+ //=> 'fooBar'
+
+ camelCase('foo bar');
+ //=> 'fooBar'
+
+ console.log(process.argv[3]);
+ //=> '--foo-bar'
+ camelCase(process.argv[3]);
+ //=> 'fooBar'
+
+ camelCase(['foo', 'bar']);
+ //=> 'fooBar'
+
+ camelCase(['__foo__', '--bar'], {pascalCase: true});
+ //=> 'FooBar'
+ ```
+ */
+ (input: string | ReadonlyArray, options?: camelcase.Options): string;
+
+ // TODO: Remove this for the next major release, refactor the whole definition to:
+ // declare function camelcase(
+ // input: string | ReadonlyArray,
+ // options?: camelcase.Options
+ // ): string;
+ // export = camelcase;
+ default: typeof camelcase;
+};
+
+export = camelcase;
diff --git a/server/node_modules/camelcase/index.js b/server/node_modules/camelcase/index.js
new file mode 100644
index 0000000..579f99b
--- /dev/null
+++ b/server/node_modules/camelcase/index.js
@@ -0,0 +1,76 @@
+'use strict';
+
+const preserveCamelCase = string => {
+ let isLastCharLower = false;
+ let isLastCharUpper = false;
+ let isLastLastCharUpper = false;
+
+ for (let i = 0; i < string.length; i++) {
+ const character = string[i];
+
+ if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
+ string = string.slice(0, i) + '-' + string.slice(i);
+ isLastCharLower = false;
+ isLastLastCharUpper = isLastCharUpper;
+ isLastCharUpper = true;
+ i++;
+ } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
+ string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
+ isLastLastCharUpper = isLastCharUpper;
+ isLastCharUpper = false;
+ isLastCharLower = true;
+ } else {
+ isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
+ isLastLastCharUpper = isLastCharUpper;
+ isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
+ }
+ }
+
+ return string;
+};
+
+const camelCase = (input, options) => {
+ if (!(typeof input === 'string' || Array.isArray(input))) {
+ throw new TypeError('Expected the input to be `string | string[]`');
+ }
+
+ options = Object.assign({
+ pascalCase: false
+ }, options);
+
+ const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
+
+ if (Array.isArray(input)) {
+ input = input.map(x => x.trim())
+ .filter(x => x.length)
+ .join('-');
+ } else {
+ input = input.trim();
+ }
+
+ if (input.length === 0) {
+ return '';
+ }
+
+ if (input.length === 1) {
+ return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
+ }
+
+ const hasUpperCase = input !== input.toLowerCase();
+
+ if (hasUpperCase) {
+ input = preserveCamelCase(input);
+ }
+
+ input = input
+ .replace(/^[_.\- ]+/, '')
+ .toLowerCase()
+ .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
+ .replace(/\d+(\w|$)/g, m => m.toUpperCase());
+
+ return postProcess(input);
+};
+
+module.exports = camelCase;
+// TODO: Remove this for the next major release
+module.exports.default = camelCase;
diff --git a/server/node_modules/camelcase/license b/server/node_modules/camelcase/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/camelcase/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/camelcase/package.json b/server/node_modules/camelcase/package.json
new file mode 100644
index 0000000..fbdbaaa
--- /dev/null
+++ b/server/node_modules/camelcase/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "camelcase",
+ "version": "5.3.1",
+ "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
+ "license": "MIT",
+ "repository": "sindresorhus/camelcase",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "camelcase",
+ "camel-case",
+ "camel",
+ "case",
+ "dash",
+ "hyphen",
+ "dot",
+ "underscore",
+ "separator",
+ "string",
+ "text",
+ "convert",
+ "pascalcase",
+ "pascal-case"
+ ],
+ "devDependencies": {
+ "ava": "^1.4.1",
+ "tsd": "^0.7.1",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/server/node_modules/camelcase/readme.md b/server/node_modules/camelcase/readme.md
new file mode 100644
index 0000000..fde2726
--- /dev/null
+++ b/server/node_modules/camelcase/readme.md
@@ -0,0 +1,99 @@
+# camelcase [](https://travis-ci.org/sindresorhus/camelcase)
+
+> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
+
+---
+
+
+
+---
+
+## Install
+
+```
+$ npm install camelcase
+```
+
+
+## Usage
+
+```js
+const camelCase = require('camelcase');
+
+camelCase('foo-bar');
+//=> 'fooBar'
+
+camelCase('foo_bar');
+//=> 'fooBar'
+
+camelCase('Foo-Bar');
+//=> 'fooBar'
+
+camelCase('Foo-Bar', {pascalCase: true});
+//=> 'FooBar'
+
+camelCase('--foo.bar', {pascalCase: false});
+//=> 'fooBar'
+
+camelCase('foo bar');
+//=> 'fooBar'
+
+console.log(process.argv[3]);
+//=> '--foo-bar'
+camelCase(process.argv[3]);
+//=> 'fooBar'
+
+camelCase(['foo', 'bar']);
+//=> 'fooBar'
+
+camelCase(['__foo__', '--bar'], {pascalCase: true});
+//=> 'FooBar'
+```
+
+
+## API
+
+### camelCase(input, [options])
+
+#### input
+
+Type: `string` `string[]`
+
+String to convert to camel case.
+
+#### options
+
+Type: `Object`
+
+##### pascalCase
+
+Type: `boolean`
+Default: `false`
+
+Uppercase the first character: `foo-bar` → `FooBar`
+
+
+## Security
+
+To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
+
+
+## Related
+
+- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
+- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
+- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
+- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/server/node_modules/cliui/CHANGELOG.md b/server/node_modules/cliui/CHANGELOG.md
new file mode 100644
index 0000000..6a77f8f
--- /dev/null
+++ b/server/node_modules/cliui/CHANGELOG.md
@@ -0,0 +1,76 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
+
+
+### ⚠ BREAKING CHANGES
+
+* update deps, drop Node 6
+
+### Code Refactoring
+
+* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
+
+## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
+
+
+### Bug Fixes
+
+* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
+
+
+### BREAKING CHANGES
+
+* Drop support for node < 6.
+
+
+
+
+## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
+
+
+### Features
+
+* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
+
+
+
+
+## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
+
+
+### Bug Fixes
+
+* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
+* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
+
+
+### Chores
+
+* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
+
+
+### Features
+
+* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
+
+
+### BREAKING CHANGES
+
+* officially drop support for Node < 4
+
+
+
+
+## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
+
+
+### Bug Fixes
+
+* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
+
+### Features
+
+* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
diff --git a/server/node_modules/cliui/LICENSE.txt b/server/node_modules/cliui/LICENSE.txt
new file mode 100644
index 0000000..c7e2747
--- /dev/null
+++ b/server/node_modules/cliui/LICENSE.txt
@@ -0,0 +1,14 @@
+Copyright (c) 2015, Contributors
+
+Permission to use, copy, modify, and/or distribute this software
+for any purpose with or without fee is hereby granted, provided
+that the above copyright notice and this permission notice
+appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/server/node_modules/cliui/README.md b/server/node_modules/cliui/README.md
new file mode 100644
index 0000000..deacfa0
--- /dev/null
+++ b/server/node_modules/cliui/README.md
@@ -0,0 +1,115 @@
+# cliui
+
+[](https://travis-ci.org/yargs/cliui)
+[](https://coveralls.io/r/yargs/cliui?branch=)
+[](https://www.npmjs.com/package/cliui)
+[](https://github.com/conventional-changelog/standard-version)
+
+easily create complex multi-column command-line-interfaces.
+
+## Example
+
+```js
+var ui = require('cliui')()
+
+ui.div('Usage: $0 [command] [options]')
+
+ui.div({
+ text: 'Options:',
+ padding: [2, 0, 2, 0]
+})
+
+ui.div(
+ {
+ text: "-f, --file",
+ width: 20,
+ padding: [0, 4, 0, 4]
+ },
+ {
+ text: "the file to load." +
+ chalk.green("(if this description is long it wraps).")
+ ,
+ width: 20
+ },
+ {
+ text: chalk.red("[required]"),
+ align: 'right'
+ }
+)
+
+console.log(ui.toString())
+```
+
+
+
+## Layout DSL
+
+cliui exposes a simple layout DSL:
+
+If you create a single `ui.div`, passing a string rather than an
+object:
+
+* `\n`: characters will be interpreted as new rows.
+* `\t`: characters will be interpreted as new columns.
+* `\s`: characters will be interpreted as padding.
+
+**as an example...**
+
+```js
+var ui = require('./')({
+ width: 60
+})
+
+ui.div(
+ 'Usage: node ./bin/foo.js\n' +
+ ' \t provide a regex\n' +
+ ' \t provide a glob\t [required]'
+)
+
+console.log(ui.toString())
+```
+
+**will output:**
+
+```shell
+Usage: node ./bin/foo.js
+ provide a regex
+ provide a glob [required]
+```
+
+## Methods
+
+```js
+cliui = require('cliui')
+```
+
+### cliui({width: integer})
+
+Specify the maximum width of the UI being generated.
+If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
+
+### cliui({wrap: boolean})
+
+Enable or disable the wrapping of text in a column.
+
+### cliui.div(column, column, column)
+
+Create a row with any number of columns, a column
+can either be a string, or an object with the following
+options:
+
+* **text:** some text to place in the column.
+* **width:** the width of a column.
+* **align:** alignment, `right` or `center`.
+* **padding:** `[top, right, bottom, left]`.
+* **border:** should a border be placed around the div?
+
+### cliui.span(column, column, column)
+
+Similar to `div`, except the next row will be appended without
+a new line being created.
+
+### cliui.resetOutput()
+
+Resets the UI elements of the current cliui instance, maintaining the values
+set for `width` and `wrap`.
diff --git a/server/node_modules/cliui/index.js b/server/node_modules/cliui/index.js
new file mode 100644
index 0000000..e917b00
--- /dev/null
+++ b/server/node_modules/cliui/index.js
@@ -0,0 +1,354 @@
+'use strict'
+
+const stringWidth = require('string-width')
+const stripAnsi = require('strip-ansi')
+const wrap = require('wrap-ansi')
+
+const align = {
+ right: alignRight,
+ center: alignCenter
+}
+const top = 0
+const right = 1
+const bottom = 2
+const left = 3
+
+class UI {
+ constructor (opts) {
+ this.width = opts.width
+ this.wrap = opts.wrap
+ this.rows = []
+ }
+
+ span (...args) {
+ const cols = this.div(...args)
+ cols.span = true
+ }
+
+ resetOutput () {
+ this.rows = []
+ }
+
+ div (...args) {
+ if (args.length === 0) {
+ this.div('')
+ }
+
+ if (this.wrap && this._shouldApplyLayoutDSL(...args)) {
+ return this._applyLayoutDSL(args[0])
+ }
+
+ const cols = args.map(arg => {
+ if (typeof arg === 'string') {
+ return this._colFromString(arg)
+ }
+
+ return arg
+ })
+
+ this.rows.push(cols)
+ return cols
+ }
+
+ _shouldApplyLayoutDSL (...args) {
+ return args.length === 1 && typeof args[0] === 'string' &&
+ /[\t\n]/.test(args[0])
+ }
+
+ _applyLayoutDSL (str) {
+ const rows = str.split('\n').map(row => row.split('\t'))
+ let leftColumnWidth = 0
+
+ // simple heuristic for layout, make sure the
+ // second column lines up along the left-hand.
+ // don't allow the first column to take up more
+ // than 50% of the screen.
+ rows.forEach(columns => {
+ if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
+ leftColumnWidth = Math.min(
+ Math.floor(this.width * 0.5),
+ stringWidth(columns[0])
+ )
+ }
+ })
+
+ // generate a table:
+ // replacing ' ' with padding calculations.
+ // using the algorithmically generated width.
+ rows.forEach(columns => {
+ this.div(...columns.map((r, i) => {
+ return {
+ text: r.trim(),
+ padding: this._measurePadding(r),
+ width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
+ }
+ }))
+ })
+
+ return this.rows[this.rows.length - 1]
+ }
+
+ _colFromString (text) {
+ return {
+ text,
+ padding: this._measurePadding(text)
+ }
+ }
+
+ _measurePadding (str) {
+ // measure padding without ansi escape codes
+ const noAnsi = stripAnsi(str)
+ return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
+ }
+
+ toString () {
+ const lines = []
+
+ this.rows.forEach(row => {
+ this.rowToString(row, lines)
+ })
+
+ // don't display any lines with the
+ // hidden flag set.
+ return lines
+ .filter(line => !line.hidden)
+ .map(line => line.text)
+ .join('\n')
+ }
+
+ rowToString (row, lines) {
+ this._rasterize(row).forEach((rrow, r) => {
+ let str = ''
+ rrow.forEach((col, c) => {
+ const { width } = row[c] // the width with padding.
+ const wrapWidth = this._negatePadding(row[c]) // the width without padding.
+
+ let ts = col // temporary string used during alignment/padding.
+
+ if (wrapWidth > stringWidth(col)) {
+ ts += ' '.repeat(wrapWidth - stringWidth(col))
+ }
+
+ // align the string within its column.
+ if (row[c].align && row[c].align !== 'left' && this.wrap) {
+ ts = align[row[c].align](ts, wrapWidth)
+ if (stringWidth(ts) < wrapWidth) {
+ ts += ' '.repeat(width - stringWidth(ts) - 1)
+ }
+ }
+
+ // apply border and padding to string.
+ const padding = row[c].padding || [0, 0, 0, 0]
+ if (padding[left]) {
+ str += ' '.repeat(padding[left])
+ }
+
+ str += addBorder(row[c], ts, '| ')
+ str += ts
+ str += addBorder(row[c], ts, ' |')
+ if (padding[right]) {
+ str += ' '.repeat(padding[right])
+ }
+
+ // if prior row is span, try to render the
+ // current row on the prior line.
+ if (r === 0 && lines.length > 0) {
+ str = this._renderInline(str, lines[lines.length - 1])
+ }
+ })
+
+ // remove trailing whitespace.
+ lines.push({
+ text: str.replace(/ +$/, ''),
+ span: row.span
+ })
+ })
+
+ return lines
+ }
+
+ // if the full 'source' can render in
+ // the target line, do so.
+ _renderInline (source, previousLine) {
+ const leadingWhitespace = source.match(/^ */)[0].length
+ const target = previousLine.text
+ const targetTextWidth = stringWidth(target.trimRight())
+
+ if (!previousLine.span) {
+ return source
+ }
+
+ // if we're not applying wrapping logic,
+ // just always append to the span.
+ if (!this.wrap) {
+ previousLine.hidden = true
+ return target + source
+ }
+
+ if (leadingWhitespace < targetTextWidth) {
+ return source
+ }
+
+ previousLine.hidden = true
+
+ return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft()
+ }
+
+ _rasterize (row) {
+ const rrows = []
+ const widths = this._columnWidths(row)
+ let wrapped
+
+ // word wrap all columns, and create
+ // a data-structure that is easy to rasterize.
+ row.forEach((col, c) => {
+ // leave room for left and right padding.
+ col.width = widths[c]
+ if (this.wrap) {
+ wrapped = wrap(col.text, this._negatePadding(col), { hard: true }).split('\n')
+ } else {
+ wrapped = col.text.split('\n')
+ }
+
+ if (col.border) {
+ wrapped.unshift('.' + '-'.repeat(this._negatePadding(col) + 2) + '.')
+ wrapped.push("'" + '-'.repeat(this._negatePadding(col) + 2) + "'")
+ }
+
+ // add top and bottom padding.
+ if (col.padding) {
+ wrapped.unshift(...new Array(col.padding[top] || 0).fill(''))
+ wrapped.push(...new Array(col.padding[bottom] || 0).fill(''))
+ }
+
+ wrapped.forEach((str, r) => {
+ if (!rrows[r]) {
+ rrows.push([])
+ }
+
+ const rrow = rrows[r]
+
+ for (let i = 0; i < c; i++) {
+ if (rrow[i] === undefined) {
+ rrow.push('')
+ }
+ }
+
+ rrow.push(str)
+ })
+ })
+
+ return rrows
+ }
+
+ _negatePadding (col) {
+ let wrapWidth = col.width
+ if (col.padding) {
+ wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
+ }
+
+ if (col.border) {
+ wrapWidth -= 4
+ }
+
+ return wrapWidth
+ }
+
+ _columnWidths (row) {
+ if (!this.wrap) {
+ return row.map(col => {
+ return col.width || stringWidth(col.text)
+ })
+ }
+
+ let unset = row.length
+ let remainingWidth = this.width
+
+ // column widths can be set in config.
+ const widths = row.map(col => {
+ if (col.width) {
+ unset--
+ remainingWidth -= col.width
+ return col.width
+ }
+
+ return undefined
+ })
+
+ // any unset widths should be calculated.
+ const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0
+
+ return widths.map((w, i) => {
+ if (w === undefined) {
+ return Math.max(unsetWidth, _minWidth(row[i]))
+ }
+
+ return w
+ })
+ }
+}
+
+function addBorder (col, ts, style) {
+ if (col.border) {
+ if (/[.']-+[.']/.test(ts)) {
+ return ''
+ }
+
+ if (ts.trim().length !== 0) {
+ return style
+ }
+
+ return ' '
+ }
+
+ return ''
+}
+
+// calculates the minimum width of
+// a column, based on padding preferences.
+function _minWidth (col) {
+ const padding = col.padding || []
+ const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
+ if (col.border) {
+ return minWidth + 4
+ }
+
+ return minWidth
+}
+
+function getWindowWidth () {
+ /* istanbul ignore next: depends on terminal */
+ if (typeof process === 'object' && process.stdout && process.stdout.columns) {
+ return process.stdout.columns
+ }
+}
+
+function alignRight (str, width) {
+ str = str.trim()
+ const strWidth = stringWidth(str)
+
+ if (strWidth < width) {
+ return ' '.repeat(width - strWidth) + str
+ }
+
+ return str
+}
+
+function alignCenter (str, width) {
+ str = str.trim()
+ const strWidth = stringWidth(str)
+
+ /* istanbul ignore next */
+ if (strWidth >= width) {
+ return str
+ }
+
+ return ' '.repeat((width - strWidth) >> 1) + str
+}
+
+module.exports = function (opts = {}) {
+ return new UI({
+ width: opts.width || getWindowWidth() || /* istanbul ignore next */ 80,
+ wrap: opts.wrap !== false
+ })
+}
diff --git a/server/node_modules/cliui/package.json b/server/node_modules/cliui/package.json
new file mode 100644
index 0000000..f92fd10
--- /dev/null
+++ b/server/node_modules/cliui/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "cliui",
+ "version": "6.0.0",
+ "description": "easily create complex multi-column command-line-interfaces",
+ "main": "index.js",
+ "scripts": {
+ "pretest": "standard",
+ "test": "nyc mocha",
+ "coverage": "nyc --reporter=text-lcov mocha | coveralls"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/yargs/cliui.git"
+ },
+ "config": {
+ "blanket": {
+ "pattern": [
+ "index.js"
+ ],
+ "data-cover-never": [
+ "node_modules",
+ "test"
+ ],
+ "output-reporter": "spec"
+ }
+ },
+ "standard": {
+ "ignore": [
+ "**/example/**"
+ ],
+ "globals": [
+ "it"
+ ]
+ },
+ "keywords": [
+ "cli",
+ "command-line",
+ "layout",
+ "design",
+ "console",
+ "wrap",
+ "table"
+ ],
+ "author": "Ben Coe ",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ },
+ "devDependencies": {
+ "chai": "^4.2.0",
+ "chalk": "^3.0.0",
+ "coveralls": "^3.0.3",
+ "mocha": "^6.2.2",
+ "nyc": "^14.1.1",
+ "standard": "^12.0.1"
+ },
+ "files": [
+ "index.js"
+ ],
+ "engine": {
+ "node": ">=8"
+ }
+}
diff --git a/server/node_modules/color-convert/CHANGELOG.md b/server/node_modules/color-convert/CHANGELOG.md
new file mode 100644
index 0000000..0a7bce4
--- /dev/null
+++ b/server/node_modules/color-convert/CHANGELOG.md
@@ -0,0 +1,54 @@
+# 1.0.0 - 2016-01-07
+
+- Removed: unused speed test
+- Added: Automatic routing between previously unsupported conversions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `convert()` class
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: all functions to lookup dictionary
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: `ansi` to `ansi256`
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Fixed: argument grouping for functions requiring only one argument
+([#27](https://github.com/Qix-/color-convert/pull/27))
+
+# 0.6.0 - 2015-07-23
+
+- Added: methods to handle
+[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
+ - rgb2ansi16
+ - rgb2ansi
+ - hsl2ansi16
+ - hsl2ansi
+ - hsv2ansi16
+ - hsv2ansi
+ - hwb2ansi16
+ - hwb2ansi
+ - cmyk2ansi16
+ - cmyk2ansi
+ - keyword2ansi16
+ - keyword2ansi
+ - ansi162rgb
+ - ansi162hsl
+ - ansi162hsv
+ - ansi162hwb
+ - ansi162cmyk
+ - ansi162keyword
+ - ansi2rgb
+ - ansi2hsl
+ - ansi2hsv
+ - ansi2hwb
+ - ansi2cmyk
+ - ansi2keyword
+([#18](https://github.com/harthur/color-convert/pull/18))
+
+# 0.5.3 - 2015-06-02
+
+- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
+([#15](https://github.com/harthur/color-convert/issues/15))
+
+---
+
+Check out commit logs for older releases
diff --git a/server/node_modules/color-convert/LICENSE b/server/node_modules/color-convert/LICENSE
new file mode 100644
index 0000000..5b4c386
--- /dev/null
+++ b/server/node_modules/color-convert/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2011-2016 Heather Arthur
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/server/node_modules/color-convert/README.md b/server/node_modules/color-convert/README.md
new file mode 100644
index 0000000..d4b08fc
--- /dev/null
+++ b/server/node_modules/color-convert/README.md
@@ -0,0 +1,68 @@
+# color-convert
+
+[](https://travis-ci.org/Qix-/color-convert)
+
+Color-convert is a color conversion library for JavaScript and node.
+It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
+convert.keyword.rgb('blue'); // [0, 0, 255]
+
+var rgbChannels = convert.rgb.channels; // 3
+var cmykChannels = convert.cmyk.channels; // 4
+var ansiChannels = convert.ansi16.channels; // 1
+```
+
+# Install
+
+```console
+$ npm install color-convert
+```
+
+# API
+
+Simply get the property of the _from_ and _to_ conversion that you're looking for.
+
+All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
+
+All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
+
+```js
+var convert = require('color-convert');
+
+// Hex to LAB
+convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
+convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
+
+// RGB to CMYK
+convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
+convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
+```
+
+### Arrays
+All functions that accept multiple arguments also support passing an array.
+
+Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hex(123, 45, 67); // '7B2D43'
+convert.rgb.hex([123, 45, 67]); // '7B2D43'
+```
+
+## Routing
+
+Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
+
+Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
+
+# Contribute
+
+If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
+
+# License
+Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
diff --git a/server/node_modules/color-convert/conversions.js b/server/node_modules/color-convert/conversions.js
new file mode 100644
index 0000000..2657f26
--- /dev/null
+++ b/server/node_modules/color-convert/conversions.js
@@ -0,0 +1,839 @@
+/* MIT license */
+/* eslint-disable no-mixed-operators */
+const cssKeywords = require('color-name');
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+const reverseKeywords = {};
+for (const key of Object.keys(cssKeywords)) {
+ reverseKeywords[cssKeywords[key]] = key;
+}
+
+const convert = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+module.exports = convert;
+
+// Hide .channels and .labels properties
+for (const model of Object.keys(convert)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ const {channels, labels} = convert[model];
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+}
+
+convert.rgb.hsl = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const min = Math.min(r, g, b);
+ const max = Math.max(r, g, b);
+ const delta = max - min;
+ let h;
+ let s;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ const l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ let rdif;
+ let gdif;
+ let bdif;
+ let h;
+ let s;
+
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const v = Math.max(r, g, b);
+ const diff = v - Math.min(r, g, b);
+ const diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = 0;
+ s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ const r = rgb[0];
+ const g = rgb[1];
+ let b = rgb[2];
+ const h = convert.rgb.hsl(rgb)[0];
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+
+ const k = Math.min(1 - r, 1 - g, 1 - b);
+ const c = (1 - r - k) / (1 - k) || 0;
+ const m = (1 - g - k) / (1 - k) || 0;
+ const y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+function comparativeDistance(x, y) {
+ /*
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ */
+ return (
+ ((x[0] - y[0]) ** 2) +
+ ((x[1] - y[1]) ** 2) +
+ ((x[2] - y[2]) ** 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ const reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ let currentClosestDistance = Infinity;
+ let currentClosestKeyword;
+
+ for (const keyword of Object.keys(cssKeywords)) {
+ const value = cssKeywords[keyword];
+
+ // Compute comparative distance
+ const distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return cssKeywords[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ let r = rgb[0] / 255;
+ let g = rgb[1] / 255;
+ let b = rgb[2] / 255;
+
+ // Assume sRGB
+ r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
+ g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
+ b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
+
+ const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ const xyz = convert.rgb.xyz(rgb);
+ let x = xyz[0];
+ let y = xyz[1];
+ let z = xyz[2];
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
+
+ const l = (116 * y) - 16;
+ const a = 500 * (x - y);
+ const b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ const h = hsl[0] / 360;
+ const s = hsl[1] / 100;
+ const l = hsl[2] / 100;
+ let t2;
+ let t3;
+ let val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ const t1 = 2 * l - t2;
+
+ const rgb = [0, 0, 0];
+ for (let i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ const h = hsl[0];
+ let s = hsl[1] / 100;
+ let l = hsl[2] / 100;
+ let smin = s;
+ const lmin = Math.max(l, 0.01);
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ const v = (l + s) / 2;
+ const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ const h = hsv[0] / 60;
+ const s = hsv[1] / 100;
+ let v = hsv[2] / 100;
+ const hi = Math.floor(h) % 6;
+
+ const f = h - Math.floor(h);
+ const p = 255 * v * (1 - s);
+ const q = 255 * v * (1 - (s * f));
+ const t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ const h = hsv[0];
+ const s = hsv[1] / 100;
+ const v = hsv[2] / 100;
+ const vmin = Math.max(v, 0.01);
+ let sl;
+ let l;
+
+ l = (2 - s) * v;
+ const lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ const h = hwb[0] / 360;
+ let wh = hwb[1] / 100;
+ let bl = hwb[2] / 100;
+ const ratio = wh + bl;
+ let f;
+
+ // Wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ const i = Math.floor(6 * h);
+ const v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ const n = wh + f * (v - wh); // Linear interpolation
+
+ let r;
+ let g;
+ let b;
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ const c = cmyk[0] / 100;
+ const m = cmyk[1] / 100;
+ const y = cmyk[2] / 100;
+ const k = cmyk[3] / 100;
+
+ const r = 1 - Math.min(1, c * (1 - k) + k);
+ const g = 1 - Math.min(1, m * (1 - k) + k);
+ const b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ const x = xyz[0] / 100;
+ const y = xyz[1] / 100;
+ const z = xyz[2] / 100;
+ let r;
+ let g;
+ let b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // Assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ let x = xyz[0];
+ let y = xyz[1];
+ let z = xyz[2];
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
+
+ const l = (116 * y) - 16;
+ const a = 500 * (x - y);
+ const b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ const l = lab[0];
+ const a = lab[1];
+ const b = lab[2];
+ let x;
+ let y;
+ let z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ const y2 = y ** 3;
+ const x2 = x ** 3;
+ const z2 = z ** 3;
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ const l = lab[0];
+ const a = lab[1];
+ const b = lab[2];
+ let h;
+
+ const hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ const c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ const l = lch[0];
+ const c = lch[1];
+ const h = lch[2];
+
+ const hr = h / 360 * 2 * Math.PI;
+ const a = c * Math.cos(hr);
+ const b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args, saturation = null) {
+ const [r, g, b] = args;
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ let ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // Optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ const r = args[0];
+ const g = args[1];
+ const b = args[2];
+
+ // We use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ const ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ let color = args % 10;
+
+ // Handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ const mult = (~~(args > 50) + 1) * 0.5;
+ const r = ((color & 1) * mult) * 255;
+ const g = (((color >> 1) & 1) * mult) * 255;
+ const b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // Handle greyscale
+ if (args >= 232) {
+ const c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ let rem;
+ const r = Math.floor(args / 36) / 5 * 255;
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ const b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ const integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ const string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ let colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(char => {
+ return char + char;
+ }).join('');
+ }
+
+ const integer = parseInt(colorString, 16);
+ const r = (integer >> 16) & 0xFF;
+ const g = (integer >> 8) & 0xFF;
+ const b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const max = Math.max(Math.max(r, g), b);
+ const min = Math.min(Math.min(r, g), b);
+ const chroma = (max - min);
+ let grayscale;
+ let hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ const s = hsl[1] / 100;
+ const l = hsl[2] / 100;
+
+ const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
+
+ let f = 0;
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ const s = hsv[1] / 100;
+ const v = hsv[2] / 100;
+
+ const c = s * v;
+ let f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ const h = hcg[0] / 360;
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ const pure = [0, 0, 0];
+ const hi = (h % 1) * 6;
+ const v = hi % 1;
+ const w = 1 - v;
+ let mg = 0;
+
+ /* eslint-disable max-statements-per-line */
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+ /* eslint-enable max-statements-per-line */
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ const v = c + g * (1.0 - c);
+ let f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ const l = g * (1.0 - c) + 0.5 * c;
+ let s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+ const v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ const w = hwb[1] / 100;
+ const b = hwb[2] / 100;
+ const v = 1 - b;
+ const c = v - w;
+ let g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hsv = convert.gray.hsl;
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ const val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ const integer = (val << 16) + (val << 8) + val;
+
+ const string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
diff --git a/server/node_modules/color-convert/index.js b/server/node_modules/color-convert/index.js
new file mode 100644
index 0000000..b648e57
--- /dev/null
+++ b/server/node_modules/color-convert/index.js
@@ -0,0 +1,81 @@
+const conversions = require('./conversions');
+const route = require('./route');
+
+const convert = {};
+
+const models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ const wrappedFn = function (...args) {
+ const arg0 = args[0];
+ if (arg0 === undefined || arg0 === null) {
+ return arg0;
+ }
+
+ if (arg0.length > 1) {
+ args = arg0;
+ }
+
+ return fn(args);
+ };
+
+ // Preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ const wrappedFn = function (...args) {
+ const arg0 = args[0];
+
+ if (arg0 === undefined || arg0 === null) {
+ return arg0;
+ }
+
+ if (arg0.length > 1) {
+ args = arg0;
+ }
+
+ const result = fn(args);
+
+ // We're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (let len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // Preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(fromModel => {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ const routes = route(fromModel);
+ const routeModels = Object.keys(routes);
+
+ routeModels.forEach(toModel => {
+ const fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+module.exports = convert;
diff --git a/server/node_modules/color-convert/package.json b/server/node_modules/color-convert/package.json
new file mode 100644
index 0000000..6e48000
--- /dev/null
+++ b/server/node_modules/color-convert/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "color-convert",
+ "description": "Plain color conversion functions",
+ "version": "2.0.1",
+ "author": "Heather Arthur ",
+ "license": "MIT",
+ "repository": "Qix-/color-convert",
+ "scripts": {
+ "pretest": "xo",
+ "test": "node test/basic.js"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ },
+ "keywords": [
+ "color",
+ "colour",
+ "convert",
+ "converter",
+ "conversion",
+ "rgb",
+ "hsl",
+ "hsv",
+ "hwb",
+ "cmyk",
+ "ansi",
+ "ansi16"
+ ],
+ "files": [
+ "index.js",
+ "conversions.js",
+ "route.js"
+ ],
+ "xo": {
+ "rules": {
+ "default-case": 0,
+ "no-inline-comments": 0,
+ "operator-linebreak": 0
+ }
+ },
+ "devDependencies": {
+ "chalk": "^2.4.2",
+ "xo": "^0.24.0"
+ },
+ "dependencies": {
+ "color-name": "~1.1.4"
+ }
+}
diff --git a/server/node_modules/color-convert/route.js b/server/node_modules/color-convert/route.js
new file mode 100644
index 0000000..1a08521
--- /dev/null
+++ b/server/node_modules/color-convert/route.js
@@ -0,0 +1,97 @@
+const conversions = require('./conversions');
+
+/*
+ This function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ const graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ const models = Object.keys(conversions);
+
+ for (let len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ const graph = buildGraph();
+ const queue = [fromModel]; // Unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ const current = queue.pop();
+ const adjacents = Object.keys(conversions[current]);
+
+ for (let len = adjacents.length, i = 0; i < len; i++) {
+ const adjacent = adjacents[i];
+ const node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ const path = [graph[toModel].parent, toModel];
+ let fn = conversions[graph[toModel].parent][toModel];
+
+ let cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+module.exports = function (fromModel) {
+ const graph = deriveBFS(fromModel);
+ const conversion = {};
+
+ const models = Object.keys(graph);
+ for (let len = models.length, i = 0; i < len; i++) {
+ const toModel = models[i];
+ const node = graph[toModel];
+
+ if (node.parent === null) {
+ // No possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
diff --git a/server/node_modules/color-name/LICENSE b/server/node_modules/color-name/LICENSE
new file mode 100644
index 0000000..c6b1001
--- /dev/null
+++ b/server/node_modules/color-name/LICENSE
@@ -0,0 +1,8 @@
+The MIT License (MIT)
+Copyright (c) 2015 Dmitry Ivanov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/server/node_modules/color-name/README.md b/server/node_modules/color-name/README.md
new file mode 100644
index 0000000..932b979
--- /dev/null
+++ b/server/node_modules/color-name/README.md
@@ -0,0 +1,11 @@
+A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
+
+[](https://nodei.co/npm/color-name/)
+
+
+```js
+var colors = require('color-name');
+colors.red //[255,0,0]
+```
+
+
diff --git a/server/node_modules/color-name/index.js b/server/node_modules/color-name/index.js
new file mode 100644
index 0000000..b7c198a
--- /dev/null
+++ b/server/node_modules/color-name/index.js
@@ -0,0 +1,152 @@
+'use strict'
+
+module.exports = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
diff --git a/server/node_modules/color-name/package.json b/server/node_modules/color-name/package.json
new file mode 100644
index 0000000..782dd82
--- /dev/null
+++ b/server/node_modules/color-name/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "color-name",
+ "version": "1.1.4",
+ "description": "A list of color names and its values",
+ "main": "index.js",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:colorjs/color-name.git"
+ },
+ "keywords": [
+ "color-name",
+ "color",
+ "color-keyword",
+ "keyword"
+ ],
+ "author": "DY ",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/colorjs/color-name/issues"
+ },
+ "homepage": "https://github.com/colorjs/color-name"
+}
diff --git a/server/node_modules/decamelize/index.js b/server/node_modules/decamelize/index.js
new file mode 100644
index 0000000..8d5bab7
--- /dev/null
+++ b/server/node_modules/decamelize/index.js
@@ -0,0 +1,13 @@
+'use strict';
+module.exports = function (str, sep) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ sep = typeof sep === 'undefined' ? '_' : sep;
+
+ return str
+ .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
+ .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
+ .toLowerCase();
+};
diff --git a/server/node_modules/decamelize/license b/server/node_modules/decamelize/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/server/node_modules/decamelize/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/server/node_modules/decamelize/package.json b/server/node_modules/decamelize/package.json
new file mode 100644
index 0000000..ca35790
--- /dev/null
+++ b/server/node_modules/decamelize/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "decamelize",
+ "version": "1.2.0",
+ "description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow",
+ "license": "MIT",
+ "repository": "sindresorhus/decamelize",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "decamelize",
+ "decamelcase",
+ "camelcase",
+ "lowercase",
+ "case",
+ "dash",
+ "hyphen",
+ "string",
+ "str",
+ "text",
+ "convert"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/server/node_modules/decamelize/readme.md b/server/node_modules/decamelize/readme.md
new file mode 100644
index 0000000..624c7ee
--- /dev/null
+++ b/server/node_modules/decamelize/readme.md
@@ -0,0 +1,48 @@
+# decamelize [](https://travis-ci.org/sindresorhus/decamelize)
+
+> Convert a camelized string into a lowercased one with a custom separator
+> Example: `unicornRainbow` → `unicorn_rainbow`
+
+
+## Install
+
+```
+$ npm install --save decamelize
+```
+
+
+## Usage
+
+```js
+const decamelize = require('decamelize');
+
+decamelize('unicornRainbow');
+//=> 'unicorn_rainbow'
+
+decamelize('unicornRainbow', '-');
+//=> 'unicorn-rainbow'
+```
+
+
+## API
+
+### decamelize(input, [separator])
+
+#### input
+
+Type: `string`
+
+#### separator
+
+Type: `string`
+Default: `_`
+
+
+## Related
+
+See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/server/node_modules/dijkstrajs/.travis.yml b/server/node_modules/dijkstrajs/.travis.yml
new file mode 100644
index 0000000..2d63faf
--- /dev/null
+++ b/server/node_modules/dijkstrajs/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "stable"
+sudo: false
diff --git a/server/node_modules/dijkstrajs/CONTRIBUTING.md b/server/node_modules/dijkstrajs/CONTRIBUTING.md
new file mode 100644
index 0000000..5f25961
--- /dev/null
+++ b/server/node_modules/dijkstrajs/CONTRIBUTING.md
@@ -0,0 +1,8 @@
+Contributing
+============
+
+1. Fork it
+2. Create your feature branch (`git checkout -b my-new-feature`)
+3. Commit your changes (`git commit -am 'Add some feature'`)
+4. Push to the branch (`git push origin my-new-feature`)
+5. Create new Pull Request
diff --git a/server/node_modules/dijkstrajs/LICENSE.md b/server/node_modules/dijkstrajs/LICENSE.md
new file mode 100644
index 0000000..b662d80
--- /dev/null
+++ b/server/node_modules/dijkstrajs/LICENSE.md
@@ -0,0 +1,19 @@
+```
+Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
+
+Copyright (C) 2008
+ Wyatt Baldwin
+ All rights reserved
+
+Licensed under the MIT license.
+
+ http://www.opensource.org/licenses/mit-license.php
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+```
diff --git a/server/node_modules/dijkstrajs/README.md b/server/node_modules/dijkstrajs/README.md
new file mode 100644
index 0000000..77deac7
--- /dev/null
+++ b/server/node_modules/dijkstrajs/README.md
@@ -0,0 +1,18 @@
+# dijkstrajs.js
+
+dijkstrajs is a simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
+
+The code was originally written by Wyatt Baldwin and turned into a node module by Thomas Cort.
+
+## Requirements
+
+* [nodejs](http://nodejs.org/)
+
+## Installation
+
+ npm install dijkstrajs
+
+## Examples
+
+See `test/dijkstra.test.js` in the sources for some example code.
+
diff --git a/server/node_modules/dijkstrajs/dijkstra.js b/server/node_modules/dijkstrajs/dijkstra.js
new file mode 100644
index 0000000..4f83f1f
--- /dev/null
+++ b/server/node_modules/dijkstrajs/dijkstra.js
@@ -0,0 +1,165 @@
+'use strict';
+
+/******************************************************************************
+ * Created 2008-08-19.
+ *
+ * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
+ *
+ * Copyright (C) 2008
+ * Wyatt Baldwin
+ * All rights reserved
+ *
+ * Licensed under the MIT license.
+ *
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *****************************************************************************/
+var dijkstra = {
+ single_source_shortest_paths: function(graph, s, d) {
+ // Predecessor map for each node that has been encountered.
+ // node ID => predecessor node ID
+ var predecessors = {};
+
+ // Costs of shortest paths from s to all nodes encountered.
+ // node ID => cost
+ var costs = {};
+ costs[s] = 0;
+
+ // Costs of shortest paths from s to all nodes encountered; differs from
+ // `costs` in that it provides easy access to the node that currently has
+ // the known shortest path from s.
+ // XXX: Do we actually need both `costs` and `open`?
+ var open = dijkstra.PriorityQueue.make();
+ open.push(s, 0);
+
+ var closest,
+ u, v,
+ cost_of_s_to_u,
+ adjacent_nodes,
+ cost_of_e,
+ cost_of_s_to_u_plus_cost_of_e,
+ cost_of_s_to_v,
+ first_visit;
+ while (!open.empty()) {
+ // In the nodes remaining in graph that have a known cost from s,
+ // find the node, u, that currently has the shortest path from s.
+ closest = open.pop();
+ u = closest.value;
+ cost_of_s_to_u = closest.cost;
+
+ // Get nodes adjacent to u...
+ adjacent_nodes = graph[u] || {};
+
+ // ...and explore the edges that connect u to those nodes, updating
+ // the cost of the shortest paths to any or all of those nodes as
+ // necessary. v is the node across the current edge from u.
+ for (v in adjacent_nodes) {
+ if (adjacent_nodes.hasOwnProperty(v)) {
+ // Get the cost of the edge running from u to v.
+ cost_of_e = adjacent_nodes[v];
+
+ // Cost of s to u plus the cost of u to v across e--this is *a*
+ // cost from s to v that may or may not be less than the current
+ // known cost to v.
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
+
+ // If we haven't visited v yet OR if the current known cost from s to
+ // v is greater than the new cost we just found (cost of s to u plus
+ // cost of u to v across e), update v's cost in the cost list and
+ // update v's predecessor in the predecessor list (it's now u).
+ cost_of_s_to_v = costs[v];
+ first_visit = (typeof costs[v] === 'undefined');
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
+ predecessors[v] = u;
+ }
+ }
+ }
+ }
+
+ if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
+ var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
+ throw new Error(msg);
+ }
+
+ return predecessors;
+ },
+
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
+ var nodes = [];
+ var u = d;
+ var predecessor;
+ while (u) {
+ nodes.push(u);
+ predecessor = predecessors[u];
+ u = predecessors[u];
+ }
+ nodes.reverse();
+ return nodes;
+ },
+
+ find_path: function(graph, s, d) {
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
+ return dijkstra.extract_shortest_path_from_predecessor_list(
+ predecessors, d);
+ },
+
+ /**
+ * A very naive priority queue implementation.
+ */
+ PriorityQueue: {
+ make: function (opts) {
+ var T = dijkstra.PriorityQueue,
+ t = {},
+ key;
+ opts = opts || {};
+ for (key in T) {
+ if (T.hasOwnProperty(key)) {
+ t[key] = T[key];
+ }
+ }
+ t.queue = [];
+ t.sorter = opts.sorter || T.default_sorter;
+ return t;
+ },
+
+ default_sorter: function (a, b) {
+ return a.cost - b.cost;
+ },
+
+ /**
+ * Add a new item to the queue and ensure the highest priority element
+ * is at the front of the queue.
+ */
+ push: function (value, cost) {
+ var item = {value: value, cost: cost};
+ this.queue.push(item);
+ this.queue.sort(this.sorter);
+ },
+
+ /**
+ * Return the highest priority element in the queue.
+ */
+ pop: function () {
+ return this.queue.shift();
+ },
+
+ empty: function () {
+ return this.queue.length === 0;
+ }
+ }
+};
+
+
+// node.js module exports
+if (typeof module !== 'undefined') {
+ module.exports = dijkstra;
+}
diff --git a/server/node_modules/dijkstrajs/package.json b/server/node_modules/dijkstrajs/package.json
new file mode 100644
index 0000000..67cd76d
--- /dev/null
+++ b/server/node_modules/dijkstrajs/package.json
@@ -0,0 +1,60 @@
+{
+ "name": "dijkstrajs",
+ "version": "1.0.3",
+ "description": "A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.",
+ "main": "dijkstra.js",
+ "scripts": {
+ "pretest": "jshint dijkstra.js",
+ "test": "mocha -R spec"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/tcort/dijkstrajs"
+ },
+ "keywords": [
+ "dijkstra",
+ "shortest",
+ "path",
+ "search",
+ "graph"
+ ],
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/tcort/dijkstrajs/issues"
+ },
+ "homepage": "https://github.com/tcort/dijkstrajs",
+ "devDependencies": {
+ "expect.js": "^0.3.1",
+ "jshint": "^2.13.6",
+ "mocha": "^10.2.0"
+ },
+ "jshintConfig": {
+ "bitwise": true,
+ "curly": true,
+ "eqeqeq": true,
+ "forin": true,
+ "freeze": true,
+ "globalstrict": true,
+ "immed": true,
+ "indent": 4,
+ "moz": true,
+ "newcap": true,
+ "noarg": true,
+ "node": true,
+ "noempty": true,
+ "nonew": true,
+ "trailing": true,
+ "undef": true,
+ "smarttabs": true,
+ "strict": true,
+ "validthis": true,
+ "globals": {
+ "describe": false,
+ "it": false,
+ "before": false,
+ "beforeEach": false,
+ "after": false,
+ "afterEach": false
+ }
+ }
+}
diff --git a/server/node_modules/dijkstrajs/test/dijkstra.test.js b/server/node_modules/dijkstrajs/test/dijkstra.test.js
new file mode 100644
index 0000000..865c5a0
--- /dev/null
+++ b/server/node_modules/dijkstrajs/test/dijkstra.test.js
@@ -0,0 +1,96 @@
+'use strict';
+
+var expect = require('expect.js');
+var dijkstra = require('../dijkstra.js');
+var find_path = dijkstra.find_path;
+
+describe('dijkstra.js', function () {
+
+ describe('.find_path()', function () {
+
+ it('should find the path between two points, all edges have weight 1', function () {
+ // A B C
+ // D E F
+ // G H I
+ var graph = {
+ a: {b: 10, d: 1},
+ b: {a: 1, c: 1, e: 1},
+ c: {b: 1, f: 1},
+ d: {a: 1, e: 1, g: 1},
+ e: {b: 1, d: 1, f: 1, h: 1},
+ f: {c: 1, e: 1, i: 1},
+ g: {d: 1, h: 1},
+ h: {e: 1, g: 1, i: 1},
+ i: {f: 1, h: 1}
+ };
+ var path = find_path(graph, 'a', 'i');
+ expect(path).to.eql(['a', 'd', 'e', 'f', 'i']);
+ });
+
+ it('should find the path between two points, weighted edges', function () {
+ var graph = {
+ a: {b: 10, c: 100, d: 1},
+ b: {c: 10},
+ d: {b: 1, e: 1},
+ e: {f: 1},
+ f: {c: 1},
+ g: {b: 1}
+ };
+
+ var path = find_path(graph, 'a', 'c');
+ expect(path).to.eql(['a', 'd', 'e', 'f', 'c']);
+ path = find_path(graph, 'd', 'b');
+ expect(path).to.eql(['d', 'b']);
+ });
+
+ it('should throw on unreachable destination', function () {
+ var graph = {
+ a: {b: 10, c: 100, d: 1},
+ b: {c: 10},
+ d: {b: 1, e: 1},
+ e: {f: 1},
+ f: {c: 1},
+ g: {b: 1}
+ };
+
+ expect(function () { find_path(graph, 'c', 'a'); }).to.throwException();
+ expect(function () { find_path(graph, 'a', 'g'); }).to.throwException();
+ });
+
+ it('should throw on non-existent destination', function () {
+ var graph = {
+ a: {b: 10, c: 100, d: 1},
+ b: {c: 10},
+ d: {b: 1, e: 1},
+ e: {f: 1},
+ f: {c: 1},
+ g: {b: 1}
+ };
+
+ expect(function () { find_path(graph, 'a', 'z'); }).to.throwException();
+ });
+ });
+
+ describe('.single_source_shortest_paths()', function () {
+ it('should find all paths from a node', function () {
+ var graph = {
+ a: {b: 10, c: 100, d: 1},
+ b: {c: 10},
+ d: {b: 1, e: 1},
+ e: {f: 1},
+ f: {c: 1},
+ g: {b: 1}
+ };
+
+ // All paths from 'a'
+ var paths = dijkstra.single_source_shortest_paths(graph, 'a');
+ expect(paths).to.eql({
+ d: 'a',
+ b: 'd',
+ e: 'd',
+ f: 'e',
+ c: 'f'
+ });
+ });
+ });
+});
diff --git a/server/node_modules/emoji-regex/LICENSE-MIT.txt b/server/node_modules/emoji-regex/LICENSE-MIT.txt
new file mode 100644
index 0000000..a41e0a7
--- /dev/null
+++ b/server/node_modules/emoji-regex/LICENSE-MIT.txt
@@ -0,0 +1,20 @@
+Copyright Mathias Bynens
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/emoji-regex/README.md b/server/node_modules/emoji-regex/README.md
new file mode 100644
index 0000000..f10e173
--- /dev/null
+++ b/server/node_modules/emoji-regex/README.md
@@ -0,0 +1,73 @@
+# emoji-regex [](https://travis-ci.org/mathiasbynens/emoji-regex)
+
+_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard.
+
+This repository contains a script that generates this regular expression based on [the data from Unicode v12](https://github.com/mathiasbynens/unicode-12.0.0). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard.
+
+## Installation
+
+Via [npm](https://www.npmjs.com/):
+
+```bash
+npm install emoji-regex
+```
+
+In [Node.js](https://nodejs.org/):
+
+```js
+const emojiRegex = require('emoji-regex');
+// Note: because the regular expression has the global flag set, this module
+// exports a function that returns the regex rather than exporting the regular
+// expression itself, to make it impossible to (accidentally) mutate the
+// original regular expression.
+
+const text = `
+\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
+\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
+\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
+\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
+`;
+
+const regex = emojiRegex();
+let match;
+while (match = regex.exec(text)) {
+ const emoji = match[0];
+ console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
+}
+```
+
+Console output:
+
+```
+Matched sequence ⌚ — code points: 1
+Matched sequence ⌚ — code points: 1
+Matched sequence ↔️ — code points: 2
+Matched sequence ↔️ — code points: 2
+Matched sequence 👩 — code points: 1
+Matched sequence 👩 — code points: 1
+Matched sequence 👩🏿 — code points: 2
+Matched sequence 👩🏿 — code points: 2
+```
+
+To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex:
+
+```js
+const emojiRegex = require('emoji-regex/text.js');
+```
+
+Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes:
+
+```js
+const emojiRegex = require('emoji-regex/es2015/index.js');
+const emojiRegexText = require('emoji-regex/es2015/text.js');
+```
+
+## Author
+
+| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
+|---|
+| [Mathias Bynens](https://mathiasbynens.be/) |
+
+## License
+
+_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
diff --git a/server/node_modules/emoji-regex/es2015/index.js b/server/node_modules/emoji-regex/es2015/index.js
new file mode 100644
index 0000000..b4cf3dc
--- /dev/null
+++ b/server/node_modules/emoji-regex/es2015/index.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = () => {
+ // https://mths.be/emoji
+ return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B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1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu;
+};
diff --git a/server/node_modules/emoji-regex/es2015/text.js b/server/node_modules/emoji-regex/es2015/text.js
new file mode 100644
index 0000000..780309d
--- /dev/null
+++ b/server/node_modules/emoji-regex/es2015/text.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = () => {
+ // https://mths.be/emoji
+ return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}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}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu;
+};
diff --git a/server/node_modules/emoji-regex/index.d.ts b/server/node_modules/emoji-regex/index.d.ts
new file mode 100644
index 0000000..1955b47
--- /dev/null
+++ b/server/node_modules/emoji-regex/index.d.ts
@@ -0,0 +1,23 @@
+declare module 'emoji-regex' {
+ function emojiRegex(): RegExp;
+
+ export default emojiRegex;
+}
+
+declare module 'emoji-regex/text' {
+ function emojiRegex(): RegExp;
+
+ export default emojiRegex;
+}
+
+declare module 'emoji-regex/es2015' {
+ function emojiRegex(): RegExp;
+
+ export default emojiRegex;
+}
+
+declare module 'emoji-regex/es2015/text' {
+ function emojiRegex(): RegExp;
+
+ export default emojiRegex;
+}
diff --git a/server/node_modules/emoji-regex/index.js b/server/node_modules/emoji-regex/index.js
new file mode 100644
index 0000000..d993a3a
--- /dev/null
+++ b/server/node_modules/emoji-regex/index.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = function () {
+ // https://mths.be/emoji
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83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uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
+};
diff --git a/server/node_modules/emoji-regex/package.json b/server/node_modules/emoji-regex/package.json
new file mode 100644
index 0000000..6d32352
--- /dev/null
+++ b/server/node_modules/emoji-regex/package.json
@@ -0,0 +1,50 @@
+{
+ "name": "emoji-regex",
+ "version": "8.0.0",
+ "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
+ "homepage": "https://mths.be/emoji-regex",
+ "main": "index.js",
+ "types": "index.d.ts",
+ "keywords": [
+ "unicode",
+ "regex",
+ "regexp",
+ "regular expressions",
+ "code points",
+ "symbols",
+ "characters",
+ "emoji"
+ ],
+ "license": "MIT",
+ "author": {
+ "name": "Mathias Bynens",
+ "url": "https://mathiasbynens.be/"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mathiasbynens/emoji-regex.git"
+ },
+ "bugs": "https://github.com/mathiasbynens/emoji-regex/issues",
+ "files": [
+ "LICENSE-MIT.txt",
+ "index.js",
+ "index.d.ts",
+ "text.js",
+ "es2015/index.js",
+ "es2015/text.js"
+ ],
+ "scripts": {
+ "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js",
+ "test": "mocha",
+ "test:watch": "npm run test -- --watch"
+ },
+ "devDependencies": {
+ "@babel/cli": "^7.2.3",
+ "@babel/core": "^7.3.4",
+ "@babel/plugin-proposal-unicode-property-regex": "^7.2.0",
+ "@babel/preset-env": "^7.3.4",
+ "mocha": "^6.0.2",
+ "regexgen": "^1.3.0",
+ "unicode-12.0.0": "^0.7.9"
+ }
+}
diff --git a/server/node_modules/emoji-regex/text.js b/server/node_modules/emoji-regex/text.js
new file mode 100644
index 0000000..0a55ce2
--- /dev/null
+++ b/server/node_modules/emoji-regex/text.js
@@ -0,0 +1,6 @@
+"use strict";
+
+module.exports = function () {
+ // https://mths.be/emoji
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE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D83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
+};
diff --git a/server/node_modules/find-up/index.d.ts b/server/node_modules/find-up/index.d.ts
new file mode 100644
index 0000000..41e3192
--- /dev/null
+++ b/server/node_modules/find-up/index.d.ts
@@ -0,0 +1,137 @@
+import {Options as LocatePathOptions} from 'locate-path';
+
+declare const stop: unique symbol;
+
+declare namespace findUp {
+ interface Options extends LocatePathOptions {}
+
+ type StopSymbol = typeof stop;
+
+ type Match = string | StopSymbol | undefined;
+}
+
+declare const findUp: {
+ /**
+ Find a file or directory by walking up parent directories.
+
+ @param name - Name of the file or directory to find. Can be multiple.
+ @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
+
+ @example
+ ```
+ // /
+ // └── Users
+ // └── sindresorhus
+ // ├── unicorn.png
+ // └── foo
+ // └── bar
+ // ├── baz
+ // └── example.js
+
+ // example.js
+ import findUp = require('find-up');
+
+ (async () => {
+ console.log(await findUp('unicorn.png'));
+ //=> '/Users/sindresorhus/unicorn.png'
+
+ console.log(await findUp(['rainbow.png', 'unicorn.png']));
+ //=> '/Users/sindresorhus/unicorn.png'
+ })();
+ ```
+ */
+ (name: string | string[], options?: findUp.Options): Promise;
+
+ /**
+ Find a file or directory by walking up parent directories.
+
+ @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
+ @returns The first path found or `undefined` if none could be found.
+
+ @example
+ ```
+ import path = require('path');
+ import findUp = require('find-up');
+
+ (async () => {
+ console.log(await findUp(async directory => {
+ const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
+ return hasUnicorns && directory;
+ }, {type: 'directory'}));
+ //=> '/Users/sindresorhus'
+ })();
+ ```
+ */
+ (matcher: (directory: string) => (findUp.Match | Promise), options?: findUp.Options): Promise;
+
+ sync: {
+ /**
+ Synchronously find a file or directory by walking up parent directories.
+
+ @param name - Name of the file or directory to find. Can be multiple.
+ @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
+ */
+ (name: string | string[], options?: findUp.Options): string | undefined;
+
+ /**
+ Synchronously find a file or directory by walking up parent directories.
+
+ @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
+ @returns The first path found or `undefined` if none could be found.
+
+ @example
+ ```
+ import path = require('path');
+ import findUp = require('find-up');
+
+ console.log(findUp.sync(directory => {
+ const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));
+ return hasUnicorns && directory;
+ }, {type: 'directory'}));
+ //=> '/Users/sindresorhus'
+ ```
+ */
+ (matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
+
+ /**
+ Synchronously check if a path exists.
+
+ @param path - Path to the file or directory.
+ @returns Whether the path exists.
+
+ @example
+ ```
+ import findUp = require('find-up');
+
+ console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));
+ //=> true
+ ```
+ */
+ exists(path: string): boolean;
+ }
+
+ /**
+ Check if a path exists.
+
+ @param path - Path to a file or directory.
+ @returns Whether the path exists.
+
+ @example
+ ```
+ import findUp = require('find-up');
+
+ (async () => {
+ console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));
+ //=> true
+ })();
+ ```
+ */
+ exists(path: string): Promise;
+
+ /**
+ Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
+ */
+ readonly stop: findUp.StopSymbol;
+};
+
+export = findUp;
diff --git a/server/node_modules/find-up/index.js b/server/node_modules/find-up/index.js
new file mode 100644
index 0000000..ce564e5
--- /dev/null
+++ b/server/node_modules/find-up/index.js
@@ -0,0 +1,89 @@
+'use strict';
+const path = require('path');
+const locatePath = require('locate-path');
+const pathExists = require('path-exists');
+
+const stop = Symbol('findUp.stop');
+
+module.exports = async (name, options = {}) => {
+ let directory = path.resolve(options.cwd || '');
+ const {root} = path.parse(directory);
+ const paths = [].concat(name);
+
+ const runMatcher = async locateOptions => {
+ if (typeof name !== 'function') {
+ return locatePath(paths, locateOptions);
+ }
+
+ const foundPath = await name(locateOptions.cwd);
+ if (typeof foundPath === 'string') {
+ return locatePath([foundPath], locateOptions);
+ }
+
+ return foundPath;
+ };
+
+ // eslint-disable-next-line no-constant-condition
+ while (true) {
+ // eslint-disable-next-line no-await-in-loop
+ const foundPath = await runMatcher({...options, cwd: directory});
+
+ if (foundPath === stop) {
+ return;
+ }
+
+ if (foundPath) {
+ return path.resolve(directory, foundPath);
+ }
+
+ if (directory === root) {
+ return;
+ }
+
+ directory = path.dirname(directory);
+ }
+};
+
+module.exports.sync = (name, options = {}) => {
+ let directory = path.resolve(options.cwd || '');
+ const {root} = path.parse(directory);
+ const paths = [].concat(name);
+
+ const runMatcher = locateOptions => {
+ if (typeof name !== 'function') {
+ return locatePath.sync(paths, locateOptions);
+ }
+
+ const foundPath = name(locateOptions.cwd);
+ if (typeof foundPath === 'string') {
+ return locatePath.sync([foundPath], locateOptions);
+ }
+
+ return foundPath;
+ };
+
+ // eslint-disable-next-line no-constant-condition
+ while (true) {
+ const foundPath = runMatcher({...options, cwd: directory});
+
+ if (foundPath === stop) {
+ return;
+ }
+
+ if (foundPath) {
+ return path.resolve(directory, foundPath);
+ }
+
+ if (directory === root) {
+ return;
+ }
+
+ directory = path.dirname(directory);
+ }
+};
+
+module.exports.exists = pathExists;
+
+module.exports.sync.exists = pathExists.sync;
+
+module.exports.stop = stop;
diff --git a/server/node_modules/find-up/license b/server/node_modules/find-up/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/find-up/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/find-up/package.json b/server/node_modules/find-up/package.json
new file mode 100644
index 0000000..cd50281
--- /dev/null
+++ b/server/node_modules/find-up/package.json
@@ -0,0 +1,53 @@
+{
+ "name": "find-up",
+ "version": "4.1.0",
+ "description": "Find a file or directory by walking up parent directories",
+ "license": "MIT",
+ "repository": "sindresorhus/find-up",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "find",
+ "up",
+ "find-up",
+ "findup",
+ "look-up",
+ "look",
+ "file",
+ "search",
+ "match",
+ "package",
+ "resolve",
+ "parent",
+ "parents",
+ "folder",
+ "directory",
+ "walk",
+ "walking",
+ "path"
+ ],
+ "dependencies": {
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "devDependencies": {
+ "ava": "^2.1.0",
+ "is-path-inside": "^2.1.0",
+ "tempy": "^0.3.0",
+ "tsd": "^0.7.3",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/server/node_modules/find-up/readme.md b/server/node_modules/find-up/readme.md
new file mode 100644
index 0000000..d6a21e5
--- /dev/null
+++ b/server/node_modules/find-up/readme.md
@@ -0,0 +1,156 @@
+# find-up [](https://travis-ci.org/sindresorhus/find-up)
+
+> Find a file or directory by walking up parent directories
+
+
+## Install
+
+```
+$ npm install find-up
+```
+
+
+## Usage
+
+```
+/
+└── Users
+ └── sindresorhus
+ ├── unicorn.png
+ └── foo
+ └── bar
+ ├── baz
+ └── example.js
+```
+
+`example.js`
+
+```js
+const path = require('path');
+const findUp = require('find-up');
+
+(async () => {
+ console.log(await findUp('unicorn.png'));
+ //=> '/Users/sindresorhus/unicorn.png'
+
+ console.log(await findUp(['rainbow.png', 'unicorn.png']));
+ //=> '/Users/sindresorhus/unicorn.png'
+
+ console.log(await findUp(async directory => {
+ const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
+ return hasUnicorns && directory;
+ }, {type: 'directory'}));
+ //=> '/Users/sindresorhus'
+})();
+```
+
+
+## API
+
+### findUp(name, options?)
+### findUp(matcher, options?)
+
+Returns a `Promise` for either the path or `undefined` if it couldn't be found.
+
+### findUp([...name], options?)
+
+Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found.
+
+### findUp.sync(name, options?)
+### findUp.sync(matcher, options?)
+
+Returns a path or `undefined` if it couldn't be found.
+
+### findUp.sync([...name], options?)
+
+Returns the first path found (by respecting the order of the array) or `undefined` if none could be found.
+
+#### name
+
+Type: `string`
+
+Name of the file or directory to find.
+
+#### matcher
+
+Type: `Function`
+
+A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases.
+
+When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path.
+
+#### options
+
+Type: `object`
+
+##### cwd
+
+Type: `string`
+Default: `process.cwd()`
+
+Directory to start from.
+
+##### type
+
+Type: `string`
+Default: `'file'`
+Values: `'file'` `'directory'`
+
+The type of paths that can match.
+
+##### allowSymlinks
+
+Type: `boolean`
+Default: `true`
+
+Allow symbolic links to match if they point to the chosen path type.
+
+### findUp.exists(path)
+
+Returns a `Promise` of whether the path exists.
+
+### findUp.sync.exists(path)
+
+Returns a `boolean` of whether the path exists.
+
+#### path
+
+Type: `string`
+
+Path to a file or directory.
+
+### findUp.stop
+
+A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
+
+```js
+const path = require('path');
+const findUp = require('find-up');
+
+(async () => {
+ await findUp(directory => {
+ return path.basename(directory) === 'work' ? findUp.stop : 'logo.png';
+ });
+})();
+```
+
+
+## Related
+
+- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
+- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
+- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
+- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
+
+
+---
+
+
diff --git a/server/node_modules/get-caller-file/LICENSE.md b/server/node_modules/get-caller-file/LICENSE.md
new file mode 100644
index 0000000..bf3e1c0
--- /dev/null
+++ b/server/node_modules/get-caller-file/LICENSE.md
@@ -0,0 +1,6 @@
+ISC License (ISC)
+Copyright 2018 Stefan Penner
+
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/server/node_modules/get-caller-file/README.md b/server/node_modules/get-caller-file/README.md
new file mode 100644
index 0000000..a7d8c07
--- /dev/null
+++ b/server/node_modules/get-caller-file/README.md
@@ -0,0 +1,41 @@
+# get-caller-file
+
+[](https://travis-ci.org/stefanpenner/get-caller-file)
+[](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master)
+
+This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked.
+
+Inspired by http://stackoverflow.com/questions/13227489
+
+*note: this relies on Node/V8 specific APIs, as such other runtimes may not work*
+
+## Installation
+
+```bash
+yarn add get-caller-file
+```
+
+## Usage
+
+Given:
+
+```js
+// ./foo.js
+const getCallerFile = require('get-caller-file');
+
+module.exports = function() {
+ return getCallerFile(); // figures out who called it
+};
+```
+
+```js
+// index.js
+const foo = require('./foo');
+
+foo() // => /full/path/to/this/file/index.js
+```
+
+
+## Options:
+
+* `getCallerFile(position = 2)`: where position is stack frame whos fileName we want.
diff --git a/server/node_modules/get-caller-file/index.d.ts b/server/node_modules/get-caller-file/index.d.ts
new file mode 100644
index 0000000..babed69
--- /dev/null
+++ b/server/node_modules/get-caller-file/index.d.ts
@@ -0,0 +1,2 @@
+declare const _default: (position?: number) => any;
+export = _default;
diff --git a/server/node_modules/get-caller-file/index.js b/server/node_modules/get-caller-file/index.js
new file mode 100644
index 0000000..57304f8
--- /dev/null
+++ b/server/node_modules/get-caller-file/index.js
@@ -0,0 +1,22 @@
+"use strict";
+// Call this function in a another function to find out the file from
+// which that function was called from. (Inspects the v8 stack trace)
+//
+// Inspired by http://stackoverflow.com/questions/13227489
+module.exports = function getCallerFile(position) {
+ if (position === void 0) { position = 2; }
+ if (position >= Error.stackTraceLimit) {
+ throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' + position + '` and Error.stackTraceLimit was: `' + Error.stackTraceLimit + '`');
+ }
+ var oldPrepareStackTrace = Error.prepareStackTrace;
+ Error.prepareStackTrace = function (_, stack) { return stack; };
+ var stack = new Error().stack;
+ Error.prepareStackTrace = oldPrepareStackTrace;
+ if (stack !== null && typeof stack === 'object') {
+ // stack[0] holds this file
+ // stack[1] holds where this function was called
+ // stack[2] holds the file we're interested in
+ return stack[position] ? stack[position].getFileName() : undefined;
+ }
+};
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/server/node_modules/get-caller-file/index.js.map b/server/node_modules/get-caller-file/index.js.map
new file mode 100644
index 0000000..89c655c
--- /dev/null
+++ b/server/node_modules/get-caller-file/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE;AACrE,EAAE;AACF,0DAA0D;AAE1D,iBAAS,SAAS,aAAa,CAAC,QAAY;IAAZ,yBAAA,EAAA,YAAY;IAC1C,IAAI,QAAQ,IAAI,KAAK,CAAC,eAAe,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,kGAAkG,GAAG,QAAQ,GAAG,oCAAoC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC;KACzM;IAED,IAAM,oBAAoB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,KAAK,CAAC,iBAAiB,GAAG,UAAC,CAAC,EAAE,KAAK,IAAM,OAAA,KAAK,EAAL,CAAK,CAAC;IAC/C,IAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,KAAK,CAAC,iBAAiB,GAAG,oBAAoB,CAAC;IAG/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC/C,2BAA2B;QAC3B,gDAAgD;QAChD,8CAA8C;QAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,QAAQ,CAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7E;AACH,CAAC,CAAC"}
\ No newline at end of file
diff --git a/server/node_modules/get-caller-file/package.json b/server/node_modules/get-caller-file/package.json
new file mode 100644
index 0000000..b0dd571
--- /dev/null
+++ b/server/node_modules/get-caller-file/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "get-caller-file",
+ "version": "2.0.5",
+ "description": "",
+ "main": "index.js",
+ "directories": {
+ "test": "tests"
+ },
+ "files": [
+ "index.js",
+ "index.js.map",
+ "index.d.ts"
+ ],
+ "scripts": {
+ "prepare": "tsc",
+ "test": "mocha test",
+ "test:debug": "mocha test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/stefanpenner/get-caller-file.git"
+ },
+ "author": "Stefan Penner",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/stefanpenner/get-caller-file/issues"
+ },
+ "homepage": "https://github.com/stefanpenner/get-caller-file#readme",
+ "devDependencies": {
+ "@types/chai": "^4.1.7",
+ "@types/ensure-posix-path": "^1.0.0",
+ "@types/mocha": "^5.2.6",
+ "@types/node": "^11.10.5",
+ "chai": "^4.1.2",
+ "ensure-posix-path": "^1.0.1",
+ "mocha": "^5.2.0",
+ "typescript": "^3.3.3333"
+ },
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+}
diff --git a/server/node_modules/is-fullwidth-code-point/index.d.ts b/server/node_modules/is-fullwidth-code-point/index.d.ts
new file mode 100644
index 0000000..729d202
--- /dev/null
+++ b/server/node_modules/is-fullwidth-code-point/index.d.ts
@@ -0,0 +1,17 @@
+/**
+Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
+
+@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
+
+@example
+```
+import isFullwidthCodePoint from 'is-fullwidth-code-point';
+
+isFullwidthCodePoint('谢'.codePointAt(0));
+//=> true
+
+isFullwidthCodePoint('a'.codePointAt(0));
+//=> false
+```
+*/
+export default function isFullwidthCodePoint(codePoint: number): boolean;
diff --git a/server/node_modules/is-fullwidth-code-point/index.js b/server/node_modules/is-fullwidth-code-point/index.js
new file mode 100644
index 0000000..671f97f
--- /dev/null
+++ b/server/node_modules/is-fullwidth-code-point/index.js
@@ -0,0 +1,50 @@
+/* eslint-disable yoda */
+'use strict';
+
+const isFullwidthCodePoint = codePoint => {
+ if (Number.isNaN(codePoint)) {
+ return false;
+ }
+
+ // Code points are derived from:
+ // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
+ if (
+ codePoint >= 0x1100 && (
+ codePoint <= 0x115F || // Hangul Jamo
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
+ // CJK Unified Ideographs .. Yi Radicals
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
+ // Hangul Jamo Extended-A
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
+ // Hangul Syllables
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
+ // CJK Compatibility Ideographs
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
+ // Vertical Forms
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
+ // CJK Compatibility Forms .. Small Form Variants
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
+ // Halfwidth and Fullwidth Forms
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
+ // Kana Supplement
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
+ // Enclosed Ideographic Supplement
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
+ )
+ ) {
+ return true;
+ }
+
+ return false;
+};
+
+module.exports = isFullwidthCodePoint;
+module.exports.default = isFullwidthCodePoint;
diff --git a/server/node_modules/is-fullwidth-code-point/license b/server/node_modules/is-fullwidth-code-point/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/is-fullwidth-code-point/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/is-fullwidth-code-point/package.json b/server/node_modules/is-fullwidth-code-point/package.json
new file mode 100644
index 0000000..2137e88
--- /dev/null
+++ b/server/node_modules/is-fullwidth-code-point/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "is-fullwidth-code-point",
+ "version": "3.0.0",
+ "description": "Check if the character represented by a given Unicode code point is fullwidth",
+ "license": "MIT",
+ "repository": "sindresorhus/is-fullwidth-code-point",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd-check"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "fullwidth",
+ "full-width",
+ "full",
+ "width",
+ "unicode",
+ "character",
+ "string",
+ "codepoint",
+ "code",
+ "point",
+ "is",
+ "detect",
+ "check"
+ ],
+ "devDependencies": {
+ "ava": "^1.3.1",
+ "tsd-check": "^0.5.0",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/server/node_modules/is-fullwidth-code-point/readme.md b/server/node_modules/is-fullwidth-code-point/readme.md
new file mode 100644
index 0000000..4236bba
--- /dev/null
+++ b/server/node_modules/is-fullwidth-code-point/readme.md
@@ -0,0 +1,39 @@
+# is-fullwidth-code-point [](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
+
+> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
+
+
+## Install
+
+```
+$ npm install is-fullwidth-code-point
+```
+
+
+## Usage
+
+```js
+const isFullwidthCodePoint = require('is-fullwidth-code-point');
+
+isFullwidthCodePoint('谢'.codePointAt(0));
+//=> true
+
+isFullwidthCodePoint('a'.codePointAt(0));
+//=> false
+```
+
+
+## API
+
+### isFullwidthCodePoint(codePoint)
+
+#### codePoint
+
+Type: `number`
+
+The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/server/node_modules/locate-path/index.d.ts b/server/node_modules/locate-path/index.d.ts
new file mode 100644
index 0000000..fbde526
--- /dev/null
+++ b/server/node_modules/locate-path/index.d.ts
@@ -0,0 +1,83 @@
+declare namespace locatePath {
+ interface Options {
+ /**
+ Current working directory.
+
+ @default process.cwd()
+ */
+ readonly cwd?: string;
+
+ /**
+ Type of path to match.
+
+ @default 'file'
+ */
+ readonly type?: 'file' | 'directory';
+
+ /**
+ Allow symbolic links to match if they point to the requested path type.
+
+ @default true
+ */
+ readonly allowSymlinks?: boolean;
+ }
+
+ interface AsyncOptions extends Options {
+ /**
+ Number of concurrently pending promises. Minimum: `1`.
+
+ @default Infinity
+ */
+ readonly concurrency?: number;
+
+ /**
+ Preserve `paths` order when searching.
+
+ Disable this to improve performance if you don't care about the order.
+
+ @default true
+ */
+ readonly preserveOrder?: boolean;
+ }
+}
+
+declare const locatePath: {
+ /**
+ Get the first path that exists on disk of multiple paths.
+
+ @param paths - Paths to check.
+ @returns The first path that exists or `undefined` if none exists.
+
+ @example
+ ```
+ import locatePath = require('locate-path');
+
+ const files = [
+ 'unicorn.png',
+ 'rainbow.png', // Only this one actually exists on disk
+ 'pony.png'
+ ];
+
+ (async () => {
+ console(await locatePath(files));
+ //=> 'rainbow'
+ })();
+ ```
+ */
+ (paths: Iterable, options?: locatePath.AsyncOptions): Promise<
+ string | undefined
+ >;
+
+ /**
+ Synchronously get the first path that exists on disk of multiple paths.
+
+ @param paths - Paths to check.
+ @returns The first path that exists or `undefined` if none exists.
+ */
+ sync(
+ paths: Iterable,
+ options?: locatePath.Options
+ ): string | undefined;
+};
+
+export = locatePath;
diff --git a/server/node_modules/locate-path/index.js b/server/node_modules/locate-path/index.js
new file mode 100644
index 0000000..4604bbf
--- /dev/null
+++ b/server/node_modules/locate-path/index.js
@@ -0,0 +1,65 @@
+'use strict';
+const path = require('path');
+const fs = require('fs');
+const {promisify} = require('util');
+const pLocate = require('p-locate');
+
+const fsStat = promisify(fs.stat);
+const fsLStat = promisify(fs.lstat);
+
+const typeMappings = {
+ directory: 'isDirectory',
+ file: 'isFile'
+};
+
+function checkType({type}) {
+ if (type in typeMappings) {
+ return;
+ }
+
+ throw new Error(`Invalid type specified: ${type}`);
+}
+
+const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
+
+module.exports = async (paths, options) => {
+ options = {
+ cwd: process.cwd(),
+ type: 'file',
+ allowSymlinks: true,
+ ...options
+ };
+ checkType(options);
+ const statFn = options.allowSymlinks ? fsStat : fsLStat;
+
+ return pLocate(paths, async path_ => {
+ try {
+ const stat = await statFn(path.resolve(options.cwd, path_));
+ return matchType(options.type, stat);
+ } catch (_) {
+ return false;
+ }
+ }, options);
+};
+
+module.exports.sync = (paths, options) => {
+ options = {
+ cwd: process.cwd(),
+ allowSymlinks: true,
+ type: 'file',
+ ...options
+ };
+ checkType(options);
+ const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
+
+ for (const path_ of paths) {
+ try {
+ const stat = statFn(path.resolve(options.cwd, path_));
+
+ if (matchType(options.type, stat)) {
+ return path_;
+ }
+ } catch (_) {
+ }
+ }
+};
diff --git a/server/node_modules/locate-path/license b/server/node_modules/locate-path/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/server/node_modules/locate-path/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/node_modules/locate-path/package.json b/server/node_modules/locate-path/package.json
new file mode 100644
index 0000000..063b290
--- /dev/null
+++ b/server/node_modules/locate-path/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "locate-path",
+ "version": "5.0.0",
+ "description": "Get the first path that exists on disk of multiple paths",
+ "license": "MIT",
+ "repository": "sindresorhus/locate-path",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "locate",
+ "path",
+ "paths",
+ "file",
+ "files",
+ "exists",
+ "find",
+ "finder",
+ "search",
+ "searcher",
+ "array",
+ "iterable",
+ "iterator"
+ ],
+ "dependencies": {
+ "p-locate": "^4.1.0"
+ },
+ "devDependencies": {
+ "ava": "^1.4.1",
+ "tsd": "^0.7.2",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/server/node_modules/locate-path/readme.md b/server/node_modules/locate-path/readme.md
new file mode 100644
index 0000000..2184c6f
--- /dev/null
+++ b/server/node_modules/locate-path/readme.md
@@ -0,0 +1,122 @@
+# locate-path [](https://travis-ci.org/sindresorhus/locate-path)
+
+> Get the first path that exists on disk of multiple paths
+
+
+## Install
+
+```
+$ npm install locate-path
+```
+
+
+## Usage
+
+Here we find the first file that exists on disk, in array order.
+
+```js
+const locatePath = require('locate-path');
+
+const files = [
+ 'unicorn.png',
+ 'rainbow.png', // Only this one actually exists on disk
+ 'pony.png'
+];
+
+(async () => {
+ console(await locatePath(files));
+ //=> 'rainbow'
+})();
+```
+
+
+## API
+
+### locatePath(paths, [options])
+
+Returns a `Promise` for the first path that exists or `undefined` if none exists.
+
+#### paths
+
+Type: `Iterable`
+
+Paths to check.
+
+#### options
+
+Type: `Object`
+
+##### concurrency
+
+Type: `number`
+Default: `Infinity`
+Minimum: `1`
+
+Number of concurrently pending promises.
+
+##### preserveOrder
+
+Type: `boolean`
+Default: `true`
+
+Preserve `paths` order when searching.
+
+Disable this to improve performance if you don't care about the order.
+
+##### cwd
+
+Type: `string`
+Default: `process.cwd()`
+
+Current working directory.
+
+##### type
+
+Type: `string`
+Default: `file`
+Values: `file` `directory`
+
+The type of paths that can match.
+
+##### allowSymlinks
+
+Type: `boolean`
+Default: `true`
+
+Allow symbolic links to match if they point to the chosen path type.
+
+### locatePath.sync(paths, [options])
+
+Returns the first path that exists or `undefined` if none exists.
+
+#### paths
+
+Type: `Iterable`
+
+Paths to check.
+
+#### options
+
+Type: `Object`
+
+##### cwd
+
+Same as above.
+
+##### type
+
+Same as above.
+
+##### allowSymlinks
+
+Same as above.
+
+
+## Related
+
+- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/server/node_modules/otpauth/LICENSE.md b/server/node_modules/otpauth/LICENSE.md
new file mode 100644
index 0000000..c53c725
--- /dev/null
+++ b/server/node_modules/otpauth/LICENSE.md
@@ -0,0 +1,21 @@
+# The MIT License (MIT)
+
+Copyright © Héctor Molinero Fernández
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/server/node_modules/otpauth/README.md b/server/node_modules/otpauth/README.md
new file mode 100644
index 0000000..67efc07
--- /dev/null
+++ b/server/node_modules/otpauth/README.md
@@ -0,0 +1,150 @@
+[](https://github.com/hectorm/otpauth/tags)
+[](https://www.npmjs.com/package/otpauth)
+
+
+
+
+
+# OTPAuth
+
+One Time Password library for Node.js, Deno, Bun and browsers.
+
+It supports the generation and validation of
+HMAC-Based One-Time Passwords (HOTP) as specified in [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) and
+Time-Based One-Time Passwords (TOTP) as specified in [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238).
+Frequently used in Multi-Factor Authentication (MFA) / Two-Factor Authentication (2FA) systems.
+
+> [!TIP]
+> You can try the library with the demo application available at [otpauth.molinero.dev](https://otpauth.molinero.dev).
+>
+> If you wish to interact with the library in your browser console, the following snippet can be used:
+>
+> ```javascript
+> const OTPAuth = await import("otpauth");
+> ```
+
+## Usage
+
+This section presents an overview of the most common usage patterns, along with some security recommendations.
+
+### [Node.js / Bun](https://www.npmjs.com/package/otpauth)
+
+```javascript
+import * as OTPAuth from "otpauth";
+// import * as OTPAuth from "otpauth/slim"; // Slim build without bundled dependencies.
+// import * as OTPAuth from "otpauth/bare"; // Bare build with no bundled crypto (requires providing a custom HMAC function).
+
+// Create a new TOTP object.
+let totp = new OTPAuth.TOTP({
+ // Provider or service the account is associated with.
+ issuer: "ACME",
+ // Account identifier.
+ label: "Alice",
+ // Algorithm used for the HMAC function, possible values are:
+ // "SHA1", "SHA224", "SHA256", "SHA384", "SHA512",
+ // "SHA3-224", "SHA3-256", "SHA3-384" and "SHA3-512".
+ algorithm: "SHA1",
+ // Length of the generated tokens.
+ digits: 6,
+ // Interval of time for which a token is valid, in seconds.
+ period: 30,
+ // Arbitrary key encoded in base32 or `OTPAuth.Secret` instance
+ // (if omitted, a cryptographically secure random secret is generated).
+ secret: "US3WHSG7X5KAPV27VANWKQHF3SH3HULL",
+ // or: `OTPAuth.Secret.fromBase32("US3WHSG7X5KAPV27VANWKQHF3SH3HULL")`
+ // or: `new OTPAuth.Secret()`
+ // Custom HMAC function (required for bare build, optional otherwise).
+ // hmac: (algorithm, key, message) => Uint8Array,
+});
+
+// Unless you know what you are doing, it is recommended to use the default
+// values for the algorithm, digits, and period options, as these are the most
+// common values used by most services.
+
+// Generate a cryptographically secure random secret.
+// It is NOT recommended to use less than 128 bits (16 bytes).
+let secret = new OTPAuth.Secret({ size: 20 });
+
+// Generate a token (returns the current token as a string).
+let token = totp.generate();
+
+// Validate a token (returns the token delta or null if it is not found in the
+// search window, in which case it should be considered invalid).
+//
+// A search window is useful to account for clock drift between the client and
+// server; however, it should be kept as small as possible to prevent brute
+// force attacks. In most cases, a value of 1 is sufficient. Furthermore, it is
+// essential to implement a throttling mechanism on the server.
+//
+// For further details on the security considerations, it is advised to refer
+// to Section 7 of RFC 4226 and Section 5 of RFC 6238:
+// https://datatracker.ietf.org/doc/html/rfc4226#section-7
+// https://datatracker.ietf.org/doc/html/rfc6238#section-5
+let delta = totp.validate({ token, window: 1 });
+
+// Get the counter value (number of intervals since the Unix epoch).
+// Useful for implementing techniques against token reuse during the validity
+// period.
+let counter = totp.counter();
+
+// Get the remaining milliseconds until the current token changes.
+let remaining = totp.remaining();
+
+// Convert to Google Authenticator key URI format.
+// Usually the URI is encoded in a QR code that can be scanned by the user.
+// This functionality is outside the scope of the project, but there are many
+// libraries that can be used for this purpose, such as npmjs.com/package/qr
+let uri = totp.toString();
+// or: `OTPAuth.URI.stringify(totp)`
+// returns: `otpauth://totp/ACME:Alice?issuer=ACME&secret=US3WHSG7X5KAPV27VANWKQHF3SH3HULL&algorithm=SHA1&digits=6&period=30`
+
+// Convert from Google Authenticator key URI format.
+totp = OTPAuth.URI.parse(uri);
+```
+
+### [Deno](https://jsr.io/@hectorm/otpauth)
+
+```javascript
+import * as OTPAuth from "jsr:@hectorm/otpauth";
+
+// Same as above.
+```
+
+### [Browsers (ESM)](https://www.jsdelivr.com/package/npm/otpauth)
+
+```html
+
+
+```
+
+### [Browsers (UMD)](https://www.jsdelivr.com/package/npm/otpauth)
+
+```html
+
+
+```
+
+## Documentation
+
+For additional information, please refer to the documentation page at [hectorm.github.io/otpauth/](https://hectorm.github.io/otpauth/).
+
+## License
+
+[MIT License](https://github.com/hectorm/otpauth/blob/master/LICENSE.md)
+© [Héctor Molinero Fernández](https://hector.molinero.dev/).
diff --git a/server/node_modules/otpauth/dist/otpauth.bare.esm.js b/server/node_modules/otpauth/dist/otpauth.bare.esm.js
new file mode 100644
index 0000000..a285ad4
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.bare.esm.js
@@ -0,0 +1,884 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+/**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+};
+
+/**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+})();
+
+/**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+};
+/**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ {
+ throw new Error("Missing HMAC function");
+ }
+};
+
+/**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+/**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+};
+
+/**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+};
+
+/**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+};
+
+/**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+/**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+/**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+};
+/**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+};
+
+/**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+};
+
+/**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+}
+
+/**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+};
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+/**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+/**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+/**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+/**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+/**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
+ const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
+ const pairKey = pairArr[0].toLowerCase();
+ const pairVal = pairArr[1];
+ /** @type {Object.} */ const pairAcc = acc;
+ pairAcc[pairKey] = pairVal;
+ return pairAcc;
+ }, {});
+ // 'OTP' will be instantiated with 'config' argument.
+ let OTP;
+ const config = {};
+ if (uriType === "hotp") {
+ OTP = HOTP;
+ // Counter: required
+ if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
+ config.counter = parseInt(uriParams.counter, 10);
+ } else {
+ throw new TypeError("Missing or invalid 'counter' parameter");
+ }
+ } else if (uriType === "totp") {
+ OTP = TOTP;
+ // Period: optional
+ if (typeof uriParams.period !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
+ config.period = parseInt(uriParams.period, 10);
+ } else {
+ throw new TypeError("Invalid 'period' parameter");
+ }
+ }
+ } else {
+ throw new TypeError("Unknown OTP type");
+ }
+ // Label: required
+ // Issuer: optional
+ if (typeof uriParams.issuer !== "undefined") {
+ config.issuer = uriParams.issuer;
+ }
+ if (uriLabel.length === 2) {
+ config.label = uriLabel[1];
+ if (typeof config.issuer === "undefined" || config.issuer === "") {
+ config.issuer = uriLabel[0];
+ } else if (uriLabel[0] === "") {
+ config.issuerInLabel = false;
+ }
+ } else {
+ config.label = uriLabel[0];
+ if (typeof config.issuer !== "undefined" && config.issuer !== "") {
+ config.issuerInLabel = false;
+ }
+ }
+ // Secret: required
+ if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
+ config.secret = uriParams.secret;
+ } else {
+ throw new TypeError("Missing or invalid 'secret' parameter");
+ }
+ // Algorithm: optional
+ if (typeof uriParams.algorithm !== "undefined") {
+ if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
+ config.algorithm = uriParams.algorithm;
+ } else {
+ throw new TypeError("Invalid 'algorithm' parameter");
+ }
+ }
+ // Digits: optional
+ if (typeof uriParams.digits !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
+ config.digits = parseInt(uriParams.digits, 10);
+ } else {
+ throw new TypeError("Invalid 'digits' parameter");
+ }
+ }
+ // HMAC: optional
+ if (typeof hmac !== "undefined") {
+ config.hmac = hmac;
+ }
+ return new OTP(config);
+ }
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */ static stringify(otp) {
+ if (otp instanceof HOTP || otp instanceof TOTP) {
+ return otp.toString();
+ }
+ throw new TypeError("Invalid 'HOTP/TOTP' object");
+ }
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */ const version = "9.5.0";
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js b/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js
new file mode 100644
index 0000000..79c21e9
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js
@@ -0,0 +1,9 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+const e=(()=>{if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"__GLOBALTHIS__",{get(){return this},configurable:!0});try{if("undefined"!=typeof __GLOBALTHIS__)return __GLOBALTHIS__}finally{delete Object.prototype.__GLOBALTHIS__}return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0})(),t=e=>{switch(!0){case/^(?:SHA-?1|SSL3-SHA1)$/i.test(e):return"SHA1";case/^SHA(?:2?-)?224$/i.test(e):return"SHA224";case/^SHA(?:2?-)?256$/i.test(e):return"SHA256";case/^SHA(?:2?-)?384$/i.test(e):return"SHA384";case/^SHA(?:2?-)?512$/i.test(e):return"SHA512";case/^SHA3-224$/i.test(e):return"SHA3-224";case/^SHA3-256$/i.test(e):return"SHA3-256";case/^SHA3-384$/i.test(e):return"SHA3-384";case/^SHA3-512$/i.test(e):return"SHA3-512";default:throw new TypeError(`Unknown hash algorithm: ${e}`)}},r=(e,t,r)=>{throw new Error("Missing HMAC function")},i="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",s=e=>{let t=(e=e.replace(/ /g,"")).length;for(;"="===e[t-1];)--t;e=(t=8&&(n-=8,s[o++]=a>>>n)}return s},n=e=>{let t=0,r=0,s="";for(let n=0;n=5;)s+=i[r>>>t-5&31],t-=5;return t>0&&(s+=i[r<<5-t&31]),s},a=e=>{e=e.replace(/ /g,"");const t=new ArrayBuffer(e.length/2),r=new Uint8Array(t);for(let t=0;t{let t="";for(let r=0;r{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t{let t="";for(let r=0;r{
+if(!h)throw new Error("Encoding API not available");return h.encode(e)},g=e=>{if(!c)throw new Error("Encoding API not available");return c.decode(e)};class f{static fromLatin1(e){return new f({buffer:l(e).buffer})}static fromUTF8(e){return new f({buffer:d(e).buffer})}static fromBase32(e){return new f({buffer:s(e).buffer})}static fromHex(e){return new f({buffer:a(e).buffer})}get buffer(){return this.bytes.buffer}get latin1(){return Object.defineProperty(this,"latin1",{enumerable:!0,writable:!1,configurable:!1,value:u(this.bytes)}),this.latin1}get utf8(){return Object.defineProperty(this,"utf8",{enumerable:!0,writable:!1,configurable:!1,value:g(this.bytes)}),this.utf8}get base32(){return Object.defineProperty(this,"base32",{enumerable:!0,writable:!1,configurable:!1,value:n(this.bytes)}),this.base32}get hex(){return Object.defineProperty(this,"hex",{enumerable:!0,writable:!1,configurable:!1,value:o(this.bytes)}),this.hex}constructor({buffer:t,size:r=20}={}){this.bytes=void 0===t?(t=>{if(e.crypto?.getRandomValues)return e.crypto.getRandomValues(new Uint8Array(t));throw new Error("Cryptography API not available")})(r):new Uint8Array(t),Object.defineProperty(this,"bytes",{enumerable:!0,writable:!1,configurable:!1,value:this.bytes})}}class m{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,counter:0,window:1}}static generate({secret:e,algorithm:t=m.defaults.algorithm,digits:i=m.defaults.digits,counter:s=m.defaults.counter,hmac:n=r}){const a=(e=>{const t=new ArrayBuffer(8),r=new Uint8Array(t);let i=e;for(let e=7;e>=0&&0!==i;e--)r[e]=255&i,i-=r[e],i/=256;return r})(s),o=n(t,e.bytes,a);if(!o?.byteLength||o.byteLength<19)throw new TypeError("Return value must be at least 19 bytes");const l=15&o[o.byteLength-1];return(((127&o[l])<<24|(255&o[l+1])<<16|(255&o[l+2])<<8|255&o[l+3])%10**i).toString().padStart(i,"0")}generate({counter:e=this.counter++}={}){return m.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,counter:e,hmac:this.hmac})}
+static validate({token:e,secret:t,algorithm:i,digits:s=m.defaults.digits,counter:n=m.defaults.counter,window:a=m.defaults.window,hmac:o=r}){if(e.length!==s)return null;let l=null;const u=r=>{const a=m.generate({secret:t,algorithm:i,digits:s,counter:r,hmac:o});((e,t)=>{{if(e.length!==t.length)throw new TypeError("Input strings must have the same length");let r=-1,i=0;for(;++r0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`counter=${e(this.counter)}`}constructor({issuer:e=m.defaults.issuer,label:r=m.defaults.label,issuerInLabel:i=m.defaults.issuerInLabel,secret:s=new f,algorithm:n=m.defaults.algorithm,digits:a=m.defaults.digits,counter:o=m.defaults.counter,hmac:l}={}){this.issuer=e,this.label=r,this.issuerInLabel=i,this.secret="string"==typeof s?f.fromBase32(s):s,this.algorithm=l?n:t(n),this.digits=a,this.counter=o,this.hmac=l}}class p{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,period:30,window:1}}static counter({period:e=p.defaults.period,timestamp:t=Date.now()}={}){return Math.floor(t/1e3/e)}counter({timestamp:e=Date.now()}={}){return p.counter({period:this.period,timestamp:e})}static remaining({period:e=p.defaults.period,timestamp:t=Date.now()}={}){return 1e3*e-t%(1e3*e)}remaining({timestamp:e=Date.now()}={}){return p.remaining({period:this.period,timestamp:e})}
+static generate({secret:e,algorithm:t,digits:r,period:i=p.defaults.period,timestamp:s=Date.now(),hmac:n}){return m.generate({secret:e,algorithm:t,digits:r,counter:p.counter({period:i,timestamp:s}),hmac:n})}generate({timestamp:e=Date.now()}={}){return p.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:e,hmac:this.hmac})}static validate({token:e,secret:t,algorithm:r,digits:i,period:s=p.defaults.period,timestamp:n=Date.now(),window:a,hmac:o}){return m.validate({token:e,secret:t,algorithm:r,digits:i,counter:p.counter({period:s,timestamp:n}),window:a,hmac:o})}validate({token:e,timestamp:t,window:r}){return p.validate({token:e,secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:t,window:r,hmac:this.hmac})}toString(){const e=encodeURIComponent;return"otpauth://totp/"+(this.issuer.length>0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`period=${e(this.period)}`}constructor({issuer:e=p.defaults.issuer,label:r=p.defaults.label,issuerInLabel:i=p.defaults.issuerInLabel,secret:s=new f,algorithm:n=p.defaults.algorithm,digits:a=p.defaults.digits,period:o=p.defaults.period,hmac:l}={}){this.issuer=e,this.label=r,this.issuerInLabel=i,this.secret="string"==typeof s?f.fromBase32(s):s,this.algorithm=l?n:t(n),this.digits=a,this.period=o,this.hmac=l}}const b=/^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i,w=/^[2-7A-Z]+=*$/i,y=/^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i,A=/^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i,I=/^[+-]?\d+$/,$=/^\+?[1-9]\d*$/;class v{static parse(e,{hmac:t}={}){let r;try{r=e.match(b)}catch(e){}if(!Array.isArray(r))throw new URIError("Invalid URI format");const i=r[1].toLowerCase(),s=r[2].split(/(?::|%3A) *(.+)/i,2).map(decodeURIComponent),n=r[3].split("&").reduce((e,t)=>{
+const r=t.split(/=(.*)/,2).map(decodeURIComponent),i=r[0].toLowerCase(),s=r[1],n=e;return n[i]=s,n},{});let a;const o={};if("hotp"===i){if(a=m,void 0===n.counter||!I.test(n.counter))throw new TypeError("Missing or invalid 'counter' parameter");o.counter=parseInt(n.counter,10)}else{if("totp"!==i)throw new TypeError("Unknown OTP type");if(a=p,void 0!==n.period){if(!$.test(n.period))throw new TypeError("Invalid 'period' parameter");o.period=parseInt(n.period,10)}}if(void 0!==n.issuer&&(o.issuer=n.issuer),2===s.length?(o.label=s[1],void 0===o.issuer||""===o.issuer?o.issuer=s[0]:""===s[0]&&(o.issuerInLabel=!1)):(o.label=s[0],void 0!==o.issuer&&""!==o.issuer&&(o.issuerInLabel=!1)),void 0===n.secret||!w.test(n.secret))throw new TypeError("Missing or invalid 'secret' parameter");if(o.secret=n.secret,void 0!==n.algorithm){if(!(t?A:y).test(n.algorithm))throw new TypeError("Invalid 'algorithm' parameter");o.algorithm=n.algorithm}if(void 0!==n.digits){if(!$.test(n.digits))throw new TypeError("Invalid 'digits' parameter");o.digits=parseInt(n.digits,10)}return void 0!==t&&(o.hmac=t),new a(o)}static stringify(e){if(e instanceof m||e instanceof p)return e.toString();throw new TypeError("Invalid 'HOTP/TOTP' object")}}const S="9.5.0";export{m as HOTP,f as Secret,p as TOTP,v as URI,S as version};
+//# sourceMappingURL=otpauth.bare.esm.min.js.map
diff --git a/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js.map b/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js.map
new file mode 100644
index 0000000..9b8a5d3
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.bare.esm.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"otpauth.bare.esm.min.js","sources":["../src/internal/encoding/uint.js","../src/internal/global-scope.js","../src/internal/crypto/hmac-digest.js","../src/internal/encoding/base32.js","../src/internal/encoding/hex.js","../src/internal/encoding/latin1.js","../src/internal/encoding/utf8.js","../src/secret.js","../src/internal/crypto/random-bytes.js","../src/hotp.js","../src/internal/crypto/timing-safe-equal.js","../src/totp.js","../src/uri.js","../src/version.js"],"sourcesContent":["/**\n * Converts an integer to an Uint8Array.\n * @param {number} num Integer.\n * @returns {Uint8Array} Uint8Array.\n */\nconst uintDecode = (num) => {\n const buf = new ArrayBuffer(8);\n const arr = new Uint8Array(buf);\n let acc = num;\n\n for (let i = 7; i >= 0; i--) {\n if (acc === 0) break;\n arr[i] = acc & 255;\n acc -= arr[i];\n acc /= 256;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to an integer.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {number} Integer.\n */\nconst uintEncode = (arr) => {\n let num = 0;\n\n for (let i = 0; i < arr.length; i++) {\n num *= 256;\n num += arr[i];\n }\n\n return num;\n};\n\nexport { uintDecode, uintEncode };\n","/**\n * \"globalThis\" ponyfill.\n * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)\n * @type {Object.}\n */\nconst globalScope = (() => {\n if (typeof globalThis === \"object\") return globalThis;\n else {\n Object.defineProperty(Object.prototype, \"__GLOBALTHIS__\", {\n get() {\n return this;\n },\n configurable: true,\n });\n try {\n // @ts-expect-error\n // eslint-disable-next-line no-undef\n if (typeof __GLOBALTHIS__ !== \"undefined\") return __GLOBALTHIS__;\n } finally {\n // @ts-expect-error\n delete Object.prototype.__GLOBALTHIS__;\n }\n }\n\n // Still unable to determine \"globalThis\", fall back to a naive method.\n if (typeof self !== \"undefined\") return self;\n else if (typeof window !== \"undefined\") return window;\n else if (typeof global !== \"undefined\") return global;\n\n return undefined;\n})();\n\nexport { globalScope };\n","import * as crypto from \"node:crypto\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha1 } from \"@noble/hashes/legacy.js\";\nimport { sha224, sha256, sha384, sha512 } from \"@noble/hashes/sha2.js\";\nimport { sha3_224, sha3_256, sha3_384, sha3_512 } from \"@noble/hashes/sha3.js\";\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * @noble/hashes hash functions.\n * @type {Object.}\n */\nconst nobleHashes = {\n SHA1: sha1,\n SHA224: sha224,\n SHA256: sha256,\n SHA384: sha384,\n SHA512: sha512,\n \"SHA3-224\": sha3_224,\n \"SHA3-256\": sha3_256,\n \"SHA3-384\": sha3_384,\n \"SHA3-512\": sha3_512,\n};\n\n/**\n * Canonicalizes a hash algorithm name.\n * @param {string} algorithm Hash algorithm name.\n * @returns {\"SHA1\"|\"SHA224\"|\"SHA256\"|\"SHA384\"|\"SHA512\"|\"SHA3-224\"|\"SHA3-256\"|\"SHA3-384\"|\"SHA3-512\"} Canonicalized hash algorithm name.\n */\nconst canonicalizeAlgorithm = (algorithm) => {\n switch (true) {\n case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):\n return \"SHA1\";\n case /^SHA(?:2?-)?224$/i.test(algorithm):\n return \"SHA224\";\n case /^SHA(?:2?-)?256$/i.test(algorithm):\n return \"SHA256\";\n case /^SHA(?:2?-)?384$/i.test(algorithm):\n return \"SHA384\";\n case /^SHA(?:2?-)?512$/i.test(algorithm):\n return \"SHA512\";\n case /^SHA3-224$/i.test(algorithm):\n return \"SHA3-224\";\n case /^SHA3-256$/i.test(algorithm):\n return \"SHA3-256\";\n case /^SHA3-384$/i.test(algorithm):\n return \"SHA3-384\";\n case /^SHA3-512$/i.test(algorithm):\n return \"SHA3-512\";\n default:\n throw new TypeError(`Unknown hash algorithm: ${algorithm}`);\n }\n};\n\n/**\n * Calculates an HMAC digest.\n * @param {string} algorithm Algorithm.\n * @param {Uint8Array} key Key.\n * @param {Uint8Array} message Message.\n * @returns {Uint8Array} Digest.\n */\nconst hmacDigest = (algorithm, key, message) => {\n if (crypto?.createHmac) {\n const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));\n hmac.update(globalScope.Buffer.from(message));\n return hmac.digest();\n } else if (hmac) {\n const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];\n return hmac(hash, key, message);\n } else {\n throw new Error(\"Missing HMAC function\");\n }\n};\n\nexport { canonicalizeAlgorithm, hmacDigest };\n","/**\n * RFC 4648 base32 alphabet without pad.\n * @type {string}\n */\nconst ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\n/**\n * Converts a base32 string to an Uint8Array (RFC 4648).\n * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)\n * @param {string} str Base32 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst base32Decode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n // Canonicalize to all upper case and remove padding if it exists.\n let end = str.length;\n while (str[end - 1] === \"=\") --end;\n str = (end < str.length ? str.substring(0, end) : str).toUpperCase();\n\n const buf = new ArrayBuffer(((str.length * 5) / 8) | 0);\n const arr = new Uint8Array(buf);\n let bits = 0;\n let value = 0;\n let index = 0;\n\n for (let i = 0; i < str.length; i++) {\n const idx = ALPHABET.indexOf(str[i]);\n if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);\n\n value = (value << 5) | idx;\n bits += 5;\n\n if (bits >= 8) {\n bits -= 8;\n arr[index++] = value >>> bits;\n }\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a base32 string (RFC 4648).\n * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Base32 string.\n */\nconst base32Encode = (arr) => {\n let bits = 0;\n let value = 0;\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n value = (value << 8) | arr[i];\n bits += 8;\n\n while (bits >= 5) {\n str += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n str += ALPHABET[(value << (5 - bits)) & 31];\n }\n\n return str;\n};\n\nexport { base32Decode, base32Encode };\n","/**\n * Converts a hexadecimal string to an Uint8Array.\n * @param {string} str Hexadecimal string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst hexDecode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n const buf = new ArrayBuffer(str.length / 2);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i += 2) {\n arr[i / 2] = parseInt(str.substring(i, i + 2), 16);\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a hexadecimal string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Hexadecimal string.\n */\nconst hexEncode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n const hex = arr[i].toString(16);\n if (hex.length === 1) str += \"0\";\n str += hex;\n }\n\n return str.toUpperCase();\n};\n\nexport { hexDecode, hexEncode };\n","/**\n * Converts a Latin-1 string to an Uint8Array.\n * @param {string} str Latin-1 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst latin1Decode = (str) => {\n const buf = new ArrayBuffer(str.length);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i) & 0xff;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a Latin-1 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Latin-1 string.\n */\nconst latin1Encode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n str += String.fromCharCode(arr[i]);\n }\n\n return str;\n};\n\nexport { latin1Decode, latin1Encode };\n","import { globalScope } from \"../global-scope.js\";\n\n/**\n * TextEncoder instance.\n * @type {TextEncoder|null}\n */\nconst ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;\n\n/**\n * TextDecoder instance.\n * @type {TextDecoder|null}\n */\nconst DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;\n\n/**\n * Converts an UTF-8 string to an Uint8Array.\n * @param {string} str String.\n * @returns {Uint8Array} Uint8Array.\n */\nconst utf8Decode = (str) => {\n if (!ENCODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return ENCODER.encode(str);\n};\n\n/**\n * Converts an Uint8Array to an UTF-8 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} String.\n */\nconst utf8Encode = (arr) => {\n if (!DECODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return DECODER.decode(arr);\n};\n\nexport { utf8Decode, utf8Encode };\n","import { base32Decode, base32Encode } from \"./internal/encoding/base32.js\";\nimport { hexDecode, hexEncode } from \"./internal/encoding/hex.js\";\nimport { latin1Decode, latin1Encode } from \"./internal/encoding/latin1.js\";\nimport { utf8Decode, utf8Encode } from \"./internal/encoding/utf8.js\";\nimport { randomBytes } from \"./internal/crypto/random-bytes.js\";\n\n/**\n * OTP secret key.\n */\nclass Secret {\n /**\n * Creates a secret key object.\n * @param {Object} [config] Configuration options.\n * @param {ArrayBufferLike} [config.buffer] Secret key buffer.\n * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.\n */\n constructor({ buffer, size = 20 } = {}) {\n /**\n * Secret key.\n * @type {Uint8Array}\n * @readonly\n */\n this.bytes = typeof buffer === \"undefined\" ? randomBytes(size) : new Uint8Array(buffer);\n\n // Prevent the \"bytes\" property from being modified.\n Object.defineProperty(this, \"bytes\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: this.bytes,\n });\n }\n\n /**\n * Converts a Latin-1 string to a Secret object.\n * @param {string} str Latin-1 string.\n * @returns {Secret} Secret object.\n */\n static fromLatin1(str) {\n return new Secret({ buffer: latin1Decode(str).buffer });\n }\n\n /**\n * Converts an UTF-8 string to a Secret object.\n * @param {string} str UTF-8 string.\n * @returns {Secret} Secret object.\n */\n static fromUTF8(str) {\n return new Secret({ buffer: utf8Decode(str).buffer });\n }\n\n /**\n * Converts a base32 string to a Secret object.\n * @param {string} str Base32 string.\n * @returns {Secret} Secret object.\n */\n static fromBase32(str) {\n return new Secret({ buffer: base32Decode(str).buffer });\n }\n\n /**\n * Converts a hexadecimal string to a Secret object.\n * @param {string} str Hexadecimal string.\n * @returns {Secret} Secret object.\n */\n static fromHex(str) {\n return new Secret({ buffer: hexDecode(str).buffer });\n }\n\n /**\n * Secret key buffer.\n * @deprecated For backward compatibility, the \"bytes\" property should be used instead.\n * @type {ArrayBufferLike}\n */\n get buffer() {\n return this.bytes.buffer;\n }\n\n /**\n * Latin-1 string representation of secret key.\n * @type {string}\n */\n get latin1() {\n Object.defineProperty(this, \"latin1\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: latin1Encode(this.bytes),\n });\n\n return this.latin1;\n }\n\n /**\n * UTF-8 string representation of secret key.\n * @type {string}\n */\n get utf8() {\n Object.defineProperty(this, \"utf8\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: utf8Encode(this.bytes),\n });\n\n return this.utf8;\n }\n\n /**\n * Base32 string representation of secret key.\n * @type {string}\n */\n get base32() {\n Object.defineProperty(this, \"base32\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: base32Encode(this.bytes),\n });\n\n return this.base32;\n }\n\n /**\n * Hexadecimal string representation of secret key.\n * @type {string}\n */\n get hex() {\n Object.defineProperty(this, \"hex\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: hexEncode(this.bytes),\n });\n\n return this.hex;\n }\n}\n\nexport { Secret };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns random bytes.\n * @param {number} size Size.\n * @returns {Uint8Array} Random bytes.\n */\nconst randomBytes = (size) => {\n if (crypto?.randomBytes) {\n return crypto.randomBytes(size);\n } else if (globalScope.crypto?.getRandomValues) {\n return globalScope.crypto.getRandomValues(new Uint8Array(size));\n } else {\n throw new Error(\"Cryptography API not available\");\n }\n};\n\nexport { randomBytes };\n","import { uintDecode } from \"./internal/encoding/uint.js\";\nimport { canonicalizeAlgorithm, hmacDigest } from \"./internal/crypto/hmac-digest.js\";\nimport { Secret } from \"./secret.js\";\nimport { timingSafeEqual } from \"./internal/crypto/timing-safe-equal.js\";\n\n/**\n * HOTP: An HMAC-based One-time Password Algorithm.\n * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)\n */\nclass HOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * counter: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n counter: 0,\n window: 1,\n };\n }\n\n /**\n * Creates an HOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Initial counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = HOTP.defaults.issuer,\n label = HOTP.defaults.label,\n issuerInLabel = HOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Initial counter value.\n * @type {number}\n */\n this.counter = counter;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({\n secret,\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac = hmacDigest,\n }) {\n const message = uintDecode(counter);\n const digest = hmac(algorithm, secret.bytes, message);\n if (!digest?.byteLength || digest.byteLength < 19) {\n throw new TypeError(\"Return value must be at least 19 bytes\");\n }\n const offset = digest[digest.byteLength - 1] & 15;\n const otp =\n (((digest[offset] & 127) << 24) |\n ((digest[offset + 1] & 255) << 16) |\n ((digest[offset + 2] & 255) << 8) |\n (digest[offset + 3] & 255)) %\n 10 ** digits;\n\n return otp.toString().padStart(digits, \"0\");\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.counter=this.counter++] Counter value.\n * @returns {string} Token.\n */\n generate({ counter = this.counter++ } = {}) {\n return HOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n window = HOTP.defaults.window,\n hmac = hmacDigest,\n }) {\n // Return early if the token length does not match the digit number.\n if (token.length !== digits) return null;\n\n let delta = null;\n\n const check = (/** @type {number} */ i) => {\n const generatedToken = HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: i,\n hmac,\n });\n if (timingSafeEqual(token, generatedToken)) {\n delta = i - counter;\n }\n };\n\n check(counter);\n for (let i = 1; i <= window && delta === null; ++i) {\n check(counter - i);\n if (delta !== null) break;\n check(counter + i);\n if (delta !== null) break;\n }\n\n return delta;\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.counter=this.counter] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, counter = this.counter, window }) {\n return HOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://hotp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `counter=${e(this.counter)}`\n );\n }\n}\n\nexport { HOTP };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.\n * @param {string} a String a.\n * @param {string} b String b.\n * @returns {boolean} Equality result.\n */\nconst timingSafeEqual = (a, b) => {\n if (crypto?.timingSafeEqual) {\n return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));\n } else {\n if (a.length !== b.length) {\n throw new TypeError(\"Input strings must have the same length\");\n }\n let i = -1;\n let out = 0;\n while (++i < a.length) {\n out |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return out === 0;\n }\n};\n\nexport { timingSafeEqual };\n","import { canonicalizeAlgorithm } from \"./internal/crypto/hmac-digest.js\";\nimport { HOTP } from \"./hotp.js\";\nimport { Secret } from \"./secret.js\";\n\n/**\n * TOTP: Time-Based One-Time Password Algorithm.\n * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)\n */\nclass TOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * period: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n period: 30,\n window: 1,\n };\n }\n\n /**\n * Creates a TOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = TOTP.defaults.issuer,\n label = TOTP.defaults.label,\n issuerInLabel = TOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = TOTP.defaults.algorithm,\n digits = TOTP.defaults.digits,\n period = TOTP.defaults.period,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Token time-step duration.\n * @type {number}\n */\n this.period = period;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return Math.floor(timestamp / 1000 / period);\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n counter({ timestamp = Date.now() } = {}) {\n return TOTP.counter({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return period * 1000 - (timestamp % (period * 1000));\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n remaining({ timestamp = Date.now() } = {}) {\n return TOTP.remaining({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {\n return HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n hmac,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {string} Token.\n */\n generate({ timestamp = Date.now() } = {}) {\n return TOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits,\n period = TOTP.defaults.period,\n timestamp = Date.now(),\n window,\n hmac,\n }) {\n return HOTP.validate({\n token,\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n window,\n hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, timestamp, window }) {\n return TOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://totp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `period=${e(this.period)}`\n );\n }\n}\n\nexport { TOTP };\n","import { HOTP } from \"./hotp.js\";\nimport { TOTP } from \"./totp.js\";\n\n/**\n * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).\n * @type {RegExp}\n */\nconst OTPURI_REGEX = /^otpauth:\\/\\/([ht]otp)\\/(.+)\\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;\n\n/**\n * RFC 4648 base32 alphabet with pad.\n * @type {RegExp}\n */\nconst SECRET_REGEX = /^[2-7A-Z]+=*$/i;\n\n/**\n * Regex for supported algorithms in built-in HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;\n\n/**\n * Regex for custom algorithms in user-defined HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;\n\n/**\n * Integer regex.\n * @type {RegExp}\n */\nconst INTEGER_REGEX = /^[+-]?\\d+$/;\n\n/**\n * Positive integer regex.\n * @type {RegExp}\n */\nconst POSITIVE_INTEGER_REGEX = /^\\+?[1-9]\\d*$/;\n\n/**\n * HOTP/TOTP object/string conversion.\n * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)\n */\nclass URI {\n /**\n * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.\n * @param {string} uri Google Authenticator Key URI.\n * @param {Object} [config] Configuration options.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {HOTP|TOTP} HOTP/TOTP object.\n */\n static parse(uri, { hmac } = {}) {\n let uriGroups;\n\n try {\n uriGroups = uri.match(OTPURI_REGEX);\n // eslint-disable-next-line no-unused-vars\n } catch (_) {\n /* Handled below */\n }\n\n if (!Array.isArray(uriGroups)) {\n throw new URIError(\"Invalid URI format\");\n }\n\n // Extract URI groups.\n const uriType = uriGroups[1].toLowerCase();\n const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);\n /** @type {Object.} */\n const uriParams = uriGroups[3].split(\"&\").reduce((acc, cur) => {\n const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);\n const pairKey = pairArr[0].toLowerCase();\n const pairVal = pairArr[1];\n /** @type {Object.} */\n const pairAcc = acc;\n\n pairAcc[pairKey] = pairVal;\n return pairAcc;\n }, {});\n\n // 'OTP' will be instantiated with 'config' argument.\n let OTP;\n const config = {};\n\n if (uriType === \"hotp\") {\n OTP = HOTP;\n\n // Counter: required\n if (typeof uriParams.counter !== \"undefined\" && INTEGER_REGEX.test(uriParams.counter)) {\n config.counter = parseInt(uriParams.counter, 10);\n } else {\n throw new TypeError(\"Missing or invalid 'counter' parameter\");\n }\n } else if (uriType === \"totp\") {\n OTP = TOTP;\n\n // Period: optional\n if (typeof uriParams.period !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {\n config.period = parseInt(uriParams.period, 10);\n } else {\n throw new TypeError(\"Invalid 'period' parameter\");\n }\n }\n } else {\n throw new TypeError(\"Unknown OTP type\");\n }\n\n // Label: required\n // Issuer: optional\n if (typeof uriParams.issuer !== \"undefined\") {\n config.issuer = uriParams.issuer;\n }\n if (uriLabel.length === 2) {\n config.label = uriLabel[1];\n if (typeof config.issuer === \"undefined\" || config.issuer === \"\") {\n config.issuer = uriLabel[0];\n } else if (uriLabel[0] === \"\") {\n config.issuerInLabel = false;\n }\n } else {\n config.label = uriLabel[0];\n if (typeof config.issuer !== \"undefined\" && config.issuer !== \"\") {\n config.issuerInLabel = false;\n }\n }\n\n // Secret: required\n if (typeof uriParams.secret !== \"undefined\" && SECRET_REGEX.test(uriParams.secret)) {\n config.secret = uriParams.secret;\n } else {\n throw new TypeError(\"Missing or invalid 'secret' parameter\");\n }\n\n // Algorithm: optional\n if (typeof uriParams.algorithm !== \"undefined\") {\n if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {\n config.algorithm = uriParams.algorithm;\n } else {\n throw new TypeError(\"Invalid 'algorithm' parameter\");\n }\n }\n\n // Digits: optional\n if (typeof uriParams.digits !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {\n config.digits = parseInt(uriParams.digits, 10);\n } else {\n throw new TypeError(\"Invalid 'digits' parameter\");\n }\n }\n\n // HMAC: optional\n if (typeof hmac !== \"undefined\") {\n config.hmac = hmac;\n }\n\n return new OTP(config);\n }\n\n /**\n * Converts an HOTP/TOTP object to a Google Authenticator key URI.\n * @param {HOTP|TOTP} otp HOTP/TOTP object.\n * @returns {string} Google Authenticator Key URI.\n */\n static stringify(otp) {\n if (otp instanceof HOTP || otp instanceof TOTP) {\n return otp.toString();\n }\n\n throw new TypeError(\"Invalid 'HOTP/TOTP' object\");\n }\n}\n\nexport { URI };\n","/**\n * Library version.\n * @type {string}\n */\nconst version = \"__OTPAUTH_VERSION__\";\n\nexport { version };\n"],"names":["globalScope","globalThis","Object","defineProperty","prototype","get","this","configurable","__GLOBALTHIS__","self","window","global","canonicalizeAlgorithm","algorithm","test","TypeError","hmacDigest","key","message","Error","ALPHABET","base32Decode","str","end","replace","length","substring","toUpperCase","buf","ArrayBuffer","arr","Uint8Array","bits","value","index","i","idx","indexOf","base32Encode","hexDecode","parseInt","hexEncode","hex","toString","latin1Decode","charCodeAt","latin1Encode","String","fromCharCode","ENCODER","TextEncoder","DECODER","TextDecoder","utf8Decode","encode","utf8Encode","decode","Secret","fromLatin1","buffer","fromUTF8","fromBase32","fromHex","bytes","latin1","enumerable","writable","utf8","base32","constructor","size","crypto","getRandomValues","randomBytes","HOTP","defaults","issuer","label","issuerInLabel","digits","counter","generate","secret","hmac","num","acc","uintDecode","digest","byteLength","offset","padStart","validate","token","delta","check","generatedToken","a","b","out","timingSafeEqual","e","encodeURIComponent","TOTP","period","timestamp","Date","now","Math","floor","remaining","OTPURI_REGEX","SECRET_REGEX","ALGORITHM_REGEX","ALGORITHM_CUSTOM_REGEX","INTEGER_REGEX","POSITIVE_INTEGER_REGEX","URI","parse","uri","uriGroups","match","_","Array","isArray","URIError","uriType","toLowerCase","uriLabel","split","map","decodeURIComponent","uriParams","reduce","cur","pairArr","pairKey","pairVal","pairAcc","OTP","config","stringify","otp","version"],"mappings":";;;AAKA,MCAMA,EAAe,MACnB,GAA0B,iBAAfC,WAAyB,OAAOA,WAEzCC,OAAOC,eAAeD,OAAOE,UAAW,iBAAkB,CACxDC,GAAAA,GACE,OAAOC,IACT,EACAC,cAAc,IAEhB,IAGE,GAA8B,oBAAnBC,eAAgC,OAAOA,cACpD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zB6D,EAAO9D,MAAQkD,EAAS,QACK,IAAlBY,EAAO/D,QAA4C,KAAlB+D,EAAO/D,SACjD+D,EAAO7D,eAAgB,SAKK,IAArBqD,EAAUjD,SAA0B6B,EAAajG,KAAKqH,EAAUjD,QAGzE,MAAM,IAAInE,UAAU,yCAItB,GANE4H,EAAOzD,OAASiD,EAAUjD,YAMO,IAAxBiD,EAAUtH,UAA2B,CAC9C,KAAKsE,EAAO8B,EAAyBD,GAAiBlG,KAAKqH,EAAUtH,WAGnE,MAAM,IAAIE,UAAU,iCAFpB4H,EAAO9H,UAAYsH,EAAUtH,SAIjC,CAGA,QAAgC,IAArBsH,EAAUpD,OAAwB,CAC3C,IAAIoC,EAAuBrG,KAAKqH,EAAUpD,QAGxC,MAAM,IAAIhE,UAAU,8BAFpB4H,EAAO5D,OAASvC,SAAS2F,EAAUpD,OAAQ,GAI/C,CAOA,YAJoB,IAATI,IACTwD,EAAOxD,KAAOA,GAGT,IAAIuD,EAAIC,EACjB,CAOA,gBAAOC,CAAUC,GACf,GAAIA,aAAenE,GAAQmE,aAAevC,EACxC,OAAOuC,EAAIlG,WAGb,MAAM,IAAI5B,UAAU,6BACtB,QCvKI+H,EAAU"}
\ No newline at end of file
diff --git a/server/node_modules/otpauth/dist/otpauth.d.cts b/server/node_modules/otpauth/dist/otpauth.d.cts
new file mode 100644
index 0000000..594cb89
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.d.cts
@@ -0,0 +1,456 @@
+/**
+ * OTP secret key.
+ */
+declare class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromLatin1(str: string): Secret;
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromUTF8(str: string): Secret;
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromBase32(str: string): Secret;
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */
+ static fromHex(str: string): Secret;
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */
+ constructor({ buffer, size }?: {
+ buffer?: ArrayBufferLike | undefined;
+ size?: number | undefined;
+ });
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */
+ readonly bytes: Uint8Array;
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */
+ get buffer(): ArrayBufferLike;
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */
+ get latin1(): string;
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */
+ get utf8(): string;
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */
+ get base32(): string;
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */
+ get hex(): string;
+}
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */
+declare class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */
+ static get defaults(): {
+ issuer: string;
+ label: string;
+ issuerInLabel: boolean;
+ algorithm: string;
+ digits: number;
+ counter: number;
+ window: number;
+ };
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */
+ static generate({ secret, algorithm, digits, counter, hmac, }: {
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): string;
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ static validate({ token, secret, algorithm, digits, counter, window, hmac, }: {
+ token: string;
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ window?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): number | null;
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */
+ constructor({ issuer, label, issuerInLabel, secret, algorithm, digits, counter, hmac, }?: {
+ issuer?: string | undefined;
+ label?: string | undefined;
+ issuerInLabel?: boolean | undefined;
+ secret?: string | Secret | undefined;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ });
+ /**
+ * Account provider.
+ * @type {string}
+ */
+ issuer: string;
+ /**
+ * Account label.
+ * @type {string}
+ */
+ label: string;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */
+ issuerInLabel: boolean;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */
+ secret: Secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */
+ algorithm: string;
+ /**
+ * Token length.
+ * @type {number}
+ */
+ digits: number;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */
+ counter: number;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */
+ hmac: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */
+ generate({ counter }?: {
+ counter?: number | undefined;
+ }): string;
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ validate({ token, counter, window }: {
+ token: string;
+ counter?: number | undefined;
+ window?: number | undefined;
+ }): number | null;
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */
+ toString(): string;
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */
+declare class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */
+ static get defaults(): {
+ issuer: string;
+ label: string;
+ issuerInLabel: boolean;
+ algorithm: string;
+ digits: number;
+ period: number;
+ window: number;
+ };
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */
+ static counter({ period, timestamp }?: {
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */
+ static remaining({ period, timestamp }?: {
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */
+ static generate({ secret, algorithm, digits, period, timestamp, hmac }: {
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): string;
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ static validate({ token, secret, algorithm, digits, period, timestamp, window, hmac, }: {
+ token: string;
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ window?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): number | null;
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */
+ constructor({ issuer, label, issuerInLabel, secret, algorithm, digits, period, hmac, }?: {
+ issuer?: string | undefined;
+ label?: string | undefined;
+ issuerInLabel?: boolean | undefined;
+ secret?: string | Secret | undefined;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ });
+ /**
+ * Account provider.
+ * @type {string}
+ */
+ issuer: string;
+ /**
+ * Account label.
+ * @type {string}
+ */
+ label: string;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */
+ issuerInLabel: boolean;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */
+ secret: Secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */
+ algorithm: string;
+ /**
+ * Token length.
+ * @type {number}
+ */
+ digits: number;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */
+ period: number;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */
+ hmac: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */
+ counter({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */
+ remaining({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */
+ generate({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): string;
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ validate({ token, timestamp, window }: {
+ token: string;
+ timestamp?: number | undefined;
+ window?: number | undefined;
+ }): number | null;
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */
+ toString(): string;
+}
+
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */
+declare class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */
+ static parse(uri: string, { hmac }?: {
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): HOTP | TOTP;
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */
+ static stringify(otp: HOTP | TOTP): string;
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */
+declare const version: string;
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.d.ts b/server/node_modules/otpauth/dist/otpauth.d.ts
new file mode 100644
index 0000000..594cb89
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.d.ts
@@ -0,0 +1,456 @@
+/**
+ * OTP secret key.
+ */
+declare class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromLatin1(str: string): Secret;
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromUTF8(str: string): Secret;
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */
+ static fromBase32(str: string): Secret;
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */
+ static fromHex(str: string): Secret;
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */
+ constructor({ buffer, size }?: {
+ buffer?: ArrayBufferLike | undefined;
+ size?: number | undefined;
+ });
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */
+ readonly bytes: Uint8Array;
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */
+ get buffer(): ArrayBufferLike;
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */
+ get latin1(): string;
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */
+ get utf8(): string;
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */
+ get base32(): string;
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */
+ get hex(): string;
+}
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */
+declare class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */
+ static get defaults(): {
+ issuer: string;
+ label: string;
+ issuerInLabel: boolean;
+ algorithm: string;
+ digits: number;
+ counter: number;
+ window: number;
+ };
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */
+ static generate({ secret, algorithm, digits, counter, hmac, }: {
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): string;
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ static validate({ token, secret, algorithm, digits, counter, window, hmac, }: {
+ token: string;
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ window?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): number | null;
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */
+ constructor({ issuer, label, issuerInLabel, secret, algorithm, digits, counter, hmac, }?: {
+ issuer?: string | undefined;
+ label?: string | undefined;
+ issuerInLabel?: boolean | undefined;
+ secret?: string | Secret | undefined;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ counter?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ });
+ /**
+ * Account provider.
+ * @type {string}
+ */
+ issuer: string;
+ /**
+ * Account label.
+ * @type {string}
+ */
+ label: string;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */
+ issuerInLabel: boolean;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */
+ secret: Secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */
+ algorithm: string;
+ /**
+ * Token length.
+ * @type {number}
+ */
+ digits: number;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */
+ counter: number;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */
+ hmac: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */
+ generate({ counter }?: {
+ counter?: number | undefined;
+ }): string;
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ validate({ token, counter, window }: {
+ token: string;
+ counter?: number | undefined;
+ window?: number | undefined;
+ }): number | null;
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */
+ toString(): string;
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */
+declare class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */
+ static get defaults(): {
+ issuer: string;
+ label: string;
+ issuerInLabel: boolean;
+ algorithm: string;
+ digits: number;
+ period: number;
+ window: number;
+ };
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */
+ static counter({ period, timestamp }?: {
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */
+ static remaining({ period, timestamp }?: {
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */
+ static generate({ secret, algorithm, digits, period, timestamp, hmac }: {
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): string;
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ static validate({ token, secret, algorithm, digits, period, timestamp, window, hmac, }: {
+ token: string;
+ secret: Secret;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ timestamp?: number | undefined;
+ window?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): number | null;
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */
+ constructor({ issuer, label, issuerInLabel, secret, algorithm, digits, period, hmac, }?: {
+ issuer?: string | undefined;
+ label?: string | undefined;
+ issuerInLabel?: boolean | undefined;
+ secret?: string | Secret | undefined;
+ algorithm?: string | undefined;
+ digits?: number | undefined;
+ period?: number | undefined;
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ });
+ /**
+ * Account provider.
+ * @type {string}
+ */
+ issuer: string;
+ /**
+ * Account label.
+ * @type {string}
+ */
+ label: string;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */
+ issuerInLabel: boolean;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */
+ secret: Secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */
+ algorithm: string;
+ /**
+ * Token length.
+ * @type {number}
+ */
+ digits: number;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */
+ period: number;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */
+ hmac: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */
+ counter({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */
+ remaining({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): number;
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */
+ generate({ timestamp }?: {
+ timestamp?: number | undefined;
+ }): string;
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */
+ validate({ token, timestamp, window }: {
+ token: string;
+ timestamp?: number | undefined;
+ window?: number | undefined;
+ }): number | null;
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */
+ toString(): string;
+}
+
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */
+declare class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */
+ static parse(uri: string, { hmac }?: {
+ hmac?: ((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array) | undefined;
+ }): HOTP | TOTP;
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */
+ static stringify(otp: HOTP | TOTP): string;
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */
+declare const version: string;
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.esm.js b/server/node_modules/otpauth/dist/otpauth.esm.js
new file mode 100644
index 0000000..a17498e
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.esm.js
@@ -0,0 +1,1957 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+//! noble-hashes 2.0.1 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
+///
+// @ts-nocheck
+/**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+};
+
+/**
+ * Utilities for hex, bytes, CSPRNG.
+ * @module
+ */ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */ function isBytes(a) {
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array';
+}
+/** Asserts something is positive integer. */ function anumber(n, title = '') {
+ if (!Number.isSafeInteger(n) || n < 0) {
+ const prefix = title && `"${title}" `;
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
+ }
+}
+/** Asserts something is Uint8Array. */ function abytes(value, length, title = '') {
+ const bytes = isBytes(value);
+ const len = value?.length;
+ const needsLen = length !== undefined;
+ if (!bytes || needsLen && len !== length) {
+ const prefix = title && `"${title}" `;
+ const ofLen = needsLen ? ` of length ${length}` : '';
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
+ throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
+ }
+ return value;
+}
+/** Asserts something is hash */ function ahash(h) {
+ if (typeof h !== 'function' || typeof h.create !== 'function') throw new Error('Hash must wrapped by utils.createHasher');
+ anumber(h.outputLen);
+ anumber(h.blockLen);
+}
+/** Asserts a hash instance has not been destroyed / finished */ function aexists(instance, checkFinished = true) {
+ if (instance.destroyed) throw new Error('Hash instance has been destroyed');
+ if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');
+}
+/** Asserts output is properly-sized byte array */ function aoutput(out, instance) {
+ abytes(out, undefined, 'digestInto() output');
+ const min = instance.outputLen;
+ if (out.length < min) {
+ throw new Error('"digestInto() output" expected to be of length >=' + min);
+ }
+}
+/** Cast u8 / u16 / u32 to u32. */ function u32(arr) {
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
+}
+/** Zeroize a byte array. Warning: JS provides no guarantees. */ function clean(...arrays) {
+ for(let i = 0; i < arrays.length; i++){
+ arrays[i].fill(0);
+ }
+}
+/** Create DataView of an array for easy byte-level manipulation. */ function createView(arr) {
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+/** The rotate right (circular right shift) operation for uint32 */ function rotr(word, shift) {
+ return word << 32 - shift | word >>> shift;
+}
+/** The rotate left (circular left shift) operation for uint32 */ function rotl(word, shift) {
+ return word << shift | word >>> 32 - shift >>> 0;
+}
+/** Is current platform little-endian? Most are. Big-Endian platform: IBM */ const isLE = /* @__PURE__ */ (()=>new Uint8Array(new Uint32Array([
+ 0x11223344
+ ]).buffer)[0] === 0x44)();
+/** The byte swap operation for uint32 */ function byteSwap(word) {
+ return word << 24 & 0xff000000 | word << 8 & 0xff0000 | word >>> 8 & 0xff00 | word >>> 24 & 0xff;
+}
+/** In place byte swap for Uint32Array */ function byteSwap32(arr) {
+ for(let i = 0; i < arr.length; i++){
+ arr[i] = byteSwap(arr[i]);
+ }
+ return arr;
+}
+const swap32IfBE = isLE ? (u)=>u : byteSwap32;
+/** Creates function with outputLen, blockLen, create properties from a class constructor. */ function createHasher(hashCons, info = {}) {
+ const hashC = (msg, opts)=>hashCons(opts).update(msg).digest();
+ const tmp = hashCons(undefined);
+ hashC.outputLen = tmp.outputLen;
+ hashC.blockLen = tmp.blockLen;
+ hashC.create = (opts)=>hashCons(opts);
+ Object.assign(hashC, info);
+ return Object.freeze(hashC);
+}
+/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */ const oidNist = (suffix)=>({
+ oid: Uint8Array.from([
+ 0x06,
+ 0x09,
+ 0x60,
+ 0x86,
+ 0x48,
+ 0x01,
+ 0x65,
+ 0x03,
+ 0x04,
+ 0x02,
+ suffix
+ ])
+ });
+
+/** Internal class for HMAC. */ class _HMAC {
+ update(buf) {
+ aexists(this);
+ this.iHash.update(buf);
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ abytes(out, this.outputLen, 'output');
+ this.finished = true;
+ this.iHash.digestInto(out);
+ this.oHash.update(out);
+ this.oHash.digestInto(out);
+ this.destroy();
+ }
+ digest() {
+ const out = new Uint8Array(this.oHash.outputLen);
+ this.digestInto(out);
+ return out;
+ }
+ _cloneInto(to) {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
+ to = to;
+ to.finished = finished;
+ to.destroyed = destroyed;
+ to.blockLen = blockLen;
+ to.outputLen = outputLen;
+ to.oHash = oHash._cloneInto(to.oHash);
+ to.iHash = iHash._cloneInto(to.iHash);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ destroy() {
+ this.destroyed = true;
+ this.oHash.destroy();
+ this.iHash.destroy();
+ }
+ constructor(hash, key){
+ this.finished = false;
+ this.destroyed = false;
+ ahash(hash);
+ abytes(key, undefined, 'key');
+ this.iHash = hash.create();
+ if (typeof this.iHash.update !== 'function') throw new Error('Expected instance of class which extends utils.Hash');
+ this.blockLen = this.iHash.blockLen;
+ this.outputLen = this.iHash.outputLen;
+ const blockLen = this.blockLen;
+ const pad = new Uint8Array(blockLen);
+ // blockLen can be bigger than outputLen
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36;
+ this.iHash.update(pad);
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
+ this.oHash = hash.create();
+ // Undo internal XOR && apply outer XOR
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36 ^ 0x5c;
+ this.oHash.update(pad);
+ clean(pad);
+ }
+}
+/**
+ * HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256
+ * @param key - message key
+ * @param message - message data
+ * @example
+ * import { hmac } from '@noble/hashes/hmac';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * const mac1 = hmac(sha256, 'key', 'message');
+ */ const hmac = (hash, key, message)=>new _HMAC(hash, key).update(message).digest();
+hmac.create = (hash, key)=>new _HMAC(hash, key);
+
+/** Choice: a ? b : c */ function Chi(a, b, c) {
+ return a & b ^ ~a & c;
+}
+/** Majority function, true if any two inputs is true. */ function Maj(a, b, c) {
+ return a & b ^ a & c ^ b & c;
+}
+/**
+ * Merkle-Damgard hash construction base class.
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
+ */ class HashMD {
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ for(let pos = 0; pos < len;){
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ const dataView = createView(data);
+ for(; blockLen <= len - pos; pos += blockLen)this.process(dataView, pos);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.process(view, 0);
+ this.pos = 0;
+ }
+ }
+ this.length += data.length;
+ this.roundClean();
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ // We can avoid allocation of buffer for padding completely if it
+ // was previously not allocated here. But it won't change performance.
+ const { buffer, view, blockLen, isLE } = this;
+ let { pos } = this;
+ // append the bit '1' to the message
+ buffer[pos++] = 0b10000000;
+ clean(this.buffer.subarray(pos));
+ // we have less than padOffset left in buffer, so we cannot put length in
+ // current block, need process it and pad again
+ if (this.padOffset > blockLen - pos) {
+ this.process(view, 0);
+ pos = 0;
+ }
+ // Pad until full block byte with zeros
+ for(let i = pos; i < blockLen; i++)buffer[i] = 0;
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
+ // So we just write lowest 64 bits of that value.
+ view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
+ this.process(view, 0);
+ const oview = createView(out);
+ const len = this.outputLen;
+ // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
+ if (len % 4) throw new Error('_sha2: outputLen must be aligned to 32bit');
+ const outLen = len / 4;
+ const state = this.get();
+ if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');
+ for(let i = 0; i < outLen; i++)oview.setUint32(4 * i, state[i], isLE);
+ }
+ digest() {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to) {
+ to || (to = new this.constructor());
+ to.set(...this.get());
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ if (length % blockLen) to.buffer.set(buffer);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ constructor(blockLen, outputLen, padOffset, isLE){
+ this.finished = false;
+ this.length = 0;
+ this.pos = 0;
+ this.destroyed = false;
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.padOffset = padOffset;
+ this.isLE = isLE;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ }
+}
+/**
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
+ */ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667,
+ 0xbb67ae85,
+ 0x3c6ef372,
+ 0xa54ff53a,
+ 0x510e527f,
+ 0x9b05688c,
+ 0x1f83d9ab,
+ 0x5be0cd19
+]);
+/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */ const SHA224_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xc1059ed8,
+ 0x367cd507,
+ 0x3070dd17,
+ 0xf70e5939,
+ 0xffc00b31,
+ 0x68581511,
+ 0x64f98fa7,
+ 0xbefa4fa4
+]);
+/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */ const SHA384_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xcbbb9d5d,
+ 0xc1059ed8,
+ 0x629a292a,
+ 0x367cd507,
+ 0x9159015a,
+ 0x3070dd17,
+ 0x152fecd8,
+ 0xf70e5939,
+ 0x67332667,
+ 0xffc00b31,
+ 0x8eb44a87,
+ 0x68581511,
+ 0xdb0c2e0d,
+ 0x64f98fa7,
+ 0x47b5481d,
+ 0xbefa4fa4
+]);
+/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */ const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667,
+ 0xf3bcc908,
+ 0xbb67ae85,
+ 0x84caa73b,
+ 0x3c6ef372,
+ 0xfe94f82b,
+ 0xa54ff53a,
+ 0x5f1d36f1,
+ 0x510e527f,
+ 0xade682d1,
+ 0x9b05688c,
+ 0x2b3e6c1f,
+ 0x1f83d9ab,
+ 0xfb41bd6b,
+ 0x5be0cd19,
+ 0x137e2179
+]);
+
+/** Initial SHA1 state */ const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x67452301,
+ 0xefcdab89,
+ 0x98badcfe,
+ 0x10325476,
+ 0xc3d2e1f0
+]);
+// Reusable temporary buffer
+const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
+/** Internal SHA1 legacy hash class. */ class _SHA1 extends HashMD {
+ get() {
+ const { A, B, C, D, E } = this;
+ return [
+ A,
+ B,
+ C,
+ D,
+ E
+ ];
+ }
+ set(A, B, C, D, E) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ }
+ process(view, offset) {
+ for(let i = 0; i < 16; i++, offset += 4)SHA1_W[i] = view.getUint32(offset, false);
+ for(let i = 16; i < 80; i++)SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
+ // Compression function main loop, 80 rounds
+ let { A, B, C, D, E } = this;
+ for(let i = 0; i < 80; i++){
+ let F, K;
+ if (i < 20) {
+ F = Chi(B, C, D);
+ K = 0x5a827999;
+ } else if (i < 40) {
+ F = B ^ C ^ D;
+ K = 0x6ed9eba1;
+ } else if (i < 60) {
+ F = Maj(B, C, D);
+ K = 0x8f1bbcdc;
+ } else {
+ F = B ^ C ^ D;
+ K = 0xca62c1d6;
+ }
+ const T = rotl(A, 5) + F + E + K + SHA1_W[i] | 0;
+ E = D;
+ D = C;
+ C = rotl(B, 30);
+ B = A;
+ A = T;
+ }
+ // Add the compressed chunk to the current hash value
+ A = A + this.A | 0;
+ B = B + this.B | 0;
+ C = C + this.C | 0;
+ D = D + this.D | 0;
+ E = E + this.E | 0;
+ this.set(A, B, C, D, E);
+ }
+ roundClean() {
+ clean(SHA1_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+ constructor(){
+ super(64, 20, 8, false), this.A = SHA1_IV[0] | 0, this.B = SHA1_IV[1] | 0, this.C = SHA1_IV[2] | 0, this.D = SHA1_IV[3] | 0, this.E = SHA1_IV[4] | 0;
+ }
+}
+/** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */ const sha1 = /* @__PURE__ */ createHasher(()=>new _SHA1());
+
+/**
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
+ * @todo re-check https://issues.chromium.org/issues/42212588
+ * @module
+ */ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
+const _32n = /* @__PURE__ */ BigInt(32);
+function fromBig(n, le = false) {
+ if (le) return {
+ h: Number(n & U32_MASK64),
+ l: Number(n >> _32n & U32_MASK64)
+ };
+ return {
+ h: Number(n >> _32n & U32_MASK64) | 0,
+ l: Number(n & U32_MASK64) | 0
+ };
+}
+function split(lst, le = false) {
+ const len = lst.length;
+ let Ah = new Uint32Array(len);
+ let Al = new Uint32Array(len);
+ for(let i = 0; i < len; i++){
+ const { h, l } = fromBig(lst[i], le);
+ [Ah[i], Al[i]] = [
+ h,
+ l
+ ];
+ }
+ return [
+ Ah,
+ Al
+ ];
+}
+// for Shift in [0, 32)
+const shrSH = (h, _l, s)=>h >>> s;
+const shrSL = (h, l, s)=>h << 32 - s | l >>> s;
+// Right rotate for Shift in [1, 32)
+const rotrSH = (h, l, s)=>h >>> s | l << 32 - s;
+const rotrSL = (h, l, s)=>h << 32 - s | l >>> s;
+// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotrBH = (h, l, s)=>h << 64 - s | l >>> s - 32;
+const rotrBL = (h, l, s)=>h >>> s - 32 | l << 64 - s;
+// Left rotate for Shift in [1, 32)
+const rotlSH = (h, l, s)=>h << s | l >>> 32 - s;
+const rotlSL = (h, l, s)=>l << s | h >>> 32 - s;
+// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
+const rotlBH = (h, l, s)=>l << s - 32 | h >>> 64 - s;
+const rotlBL = (h, l, s)=>h << s - 32 | l >>> 64 - s;
+// JS uses 32-bit signed integers for bitwise operations which means we cannot
+// simple take carry out of low bit sum by shift, we need to use division.
+function add(Ah, Al, Bh, Bl) {
+ const l = (Al >>> 0) + (Bl >>> 0);
+ return {
+ h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
+ l: l | 0
+ };
+}
+// Addition with more than 2 elements
+const add3L = (Al, Bl, Cl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
+const add3H = (low, Ah, Bh, Ch)=>Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
+const add4L = (Al, Bl, Cl, Dl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
+const add4H = (low, Ah, Bh, Ch, Dh)=>Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
+const add5L = (Al, Bl, Cl, Dl, El)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
+const add5H = (low, Ah, Bh, Ch, Dh, Eh)=>Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
+
+/**
+ * Round constants:
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
+ */ // prettier-ignore
+const SHA256_K = /* @__PURE__ */ Uint32Array.from([
+ 0x428a2f98,
+ 0x71374491,
+ 0xb5c0fbcf,
+ 0xe9b5dba5,
+ 0x3956c25b,
+ 0x59f111f1,
+ 0x923f82a4,
+ 0xab1c5ed5,
+ 0xd807aa98,
+ 0x12835b01,
+ 0x243185be,
+ 0x550c7dc3,
+ 0x72be5d74,
+ 0x80deb1fe,
+ 0x9bdc06a7,
+ 0xc19bf174,
+ 0xe49b69c1,
+ 0xefbe4786,
+ 0x0fc19dc6,
+ 0x240ca1cc,
+ 0x2de92c6f,
+ 0x4a7484aa,
+ 0x5cb0a9dc,
+ 0x76f988da,
+ 0x983e5152,
+ 0xa831c66d,
+ 0xb00327c8,
+ 0xbf597fc7,
+ 0xc6e00bf3,
+ 0xd5a79147,
+ 0x06ca6351,
+ 0x14292967,
+ 0x27b70a85,
+ 0x2e1b2138,
+ 0x4d2c6dfc,
+ 0x53380d13,
+ 0x650a7354,
+ 0x766a0abb,
+ 0x81c2c92e,
+ 0x92722c85,
+ 0xa2bfe8a1,
+ 0xa81a664b,
+ 0xc24b8b70,
+ 0xc76c51a3,
+ 0xd192e819,
+ 0xd6990624,
+ 0xf40e3585,
+ 0x106aa070,
+ 0x19a4c116,
+ 0x1e376c08,
+ 0x2748774c,
+ 0x34b0bcb5,
+ 0x391c0cb3,
+ 0x4ed8aa4a,
+ 0x5b9cca4f,
+ 0x682e6ff3,
+ 0x748f82ee,
+ 0x78a5636f,
+ 0x84c87814,
+ 0x8cc70208,
+ 0x90befffa,
+ 0xa4506ceb,
+ 0xbef9a3f7,
+ 0xc67178f2
+]);
+/** Reusable temporary buffer. "W" comes straight from spec. */ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
+/** Internal 32-byte base SHA2 hash class. */ class SHA2_32B extends HashMD {
+ get() {
+ const { A, B, C, D, E, F, G, H } = this;
+ return [
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ G,
+ H
+ ];
+ }
+ // prettier-ignore
+ set(A, B, C, D, E, F, G, H) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ this.F = F | 0;
+ this.G = G | 0;
+ this.H = H | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
+ for(let i = 0; i < 16; i++, offset += 4)SHA256_W[i] = view.getUint32(offset, false);
+ for(let i = 16; i < 64; i++){
+ const W15 = SHA256_W[i - 15];
+ const W2 = SHA256_W[i - 2];
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
+ }
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D, E, F, G, H } = this;
+ for(let i = 0; i < 64; i++){
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
+ const T2 = sigma0 + Maj(A, B, C) | 0;
+ H = G;
+ G = F;
+ F = E;
+ E = D + T1 | 0;
+ D = C;
+ C = B;
+ B = A;
+ A = T1 + T2 | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ A = A + this.A | 0;
+ B = B + this.B | 0;
+ C = C + this.C | 0;
+ D = D + this.D | 0;
+ E = E + this.E | 0;
+ F = F + this.F | 0;
+ G = G + this.G | 0;
+ H = H + this.H | 0;
+ this.set(A, B, C, D, E, F, G, H);
+ }
+ roundClean() {
+ clean(SHA256_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+ constructor(outputLen){
+ super(64, outputLen, 8, false);
+ }
+}
+/** Internal SHA2-256 hash class. */ class _SHA256 extends SHA2_32B {
+ constructor(){
+ super(32), // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ this.A = SHA256_IV[0] | 0, this.B = SHA256_IV[1] | 0, this.C = SHA256_IV[2] | 0, this.D = SHA256_IV[3] | 0, this.E = SHA256_IV[4] | 0, this.F = SHA256_IV[5] | 0, this.G = SHA256_IV[6] | 0, this.H = SHA256_IV[7] | 0;
+ }
+}
+/** Internal SHA2-224 hash class. */ class _SHA224 extends SHA2_32B {
+ constructor(){
+ super(28), this.A = SHA224_IV[0] | 0, this.B = SHA224_IV[1] | 0, this.C = SHA224_IV[2] | 0, this.D = SHA224_IV[3] | 0, this.E = SHA224_IV[4] | 0, this.F = SHA224_IV[5] | 0, this.G = SHA224_IV[6] | 0, this.H = SHA224_IV[7] | 0;
+ }
+}
+// SHA2-512 is slower than sha256 in js because u64 operations are slow.
+// Round contants
+// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409
+// prettier-ignore
+const K512 = /* @__PURE__ */ (()=>split([
+ '0x428a2f98d728ae22',
+ '0x7137449123ef65cd',
+ '0xb5c0fbcfec4d3b2f',
+ '0xe9b5dba58189dbbc',
+ '0x3956c25bf348b538',
+ '0x59f111f1b605d019',
+ '0x923f82a4af194f9b',
+ '0xab1c5ed5da6d8118',
+ '0xd807aa98a3030242',
+ '0x12835b0145706fbe',
+ '0x243185be4ee4b28c',
+ '0x550c7dc3d5ffb4e2',
+ '0x72be5d74f27b896f',
+ '0x80deb1fe3b1696b1',
+ '0x9bdc06a725c71235',
+ '0xc19bf174cf692694',
+ '0xe49b69c19ef14ad2',
+ '0xefbe4786384f25e3',
+ '0x0fc19dc68b8cd5b5',
+ '0x240ca1cc77ac9c65',
+ '0x2de92c6f592b0275',
+ '0x4a7484aa6ea6e483',
+ '0x5cb0a9dcbd41fbd4',
+ '0x76f988da831153b5',
+ '0x983e5152ee66dfab',
+ '0xa831c66d2db43210',
+ '0xb00327c898fb213f',
+ '0xbf597fc7beef0ee4',
+ '0xc6e00bf33da88fc2',
+ '0xd5a79147930aa725',
+ '0x06ca6351e003826f',
+ '0x142929670a0e6e70',
+ '0x27b70a8546d22ffc',
+ '0x2e1b21385c26c926',
+ '0x4d2c6dfc5ac42aed',
+ '0x53380d139d95b3df',
+ '0x650a73548baf63de',
+ '0x766a0abb3c77b2a8',
+ '0x81c2c92e47edaee6',
+ '0x92722c851482353b',
+ '0xa2bfe8a14cf10364',
+ '0xa81a664bbc423001',
+ '0xc24b8b70d0f89791',
+ '0xc76c51a30654be30',
+ '0xd192e819d6ef5218',
+ '0xd69906245565a910',
+ '0xf40e35855771202a',
+ '0x106aa07032bbd1b8',
+ '0x19a4c116b8d2d0c8',
+ '0x1e376c085141ab53',
+ '0x2748774cdf8eeb99',
+ '0x34b0bcb5e19b48a8',
+ '0x391c0cb3c5c95a63',
+ '0x4ed8aa4ae3418acb',
+ '0x5b9cca4f7763e373',
+ '0x682e6ff3d6b2b8a3',
+ '0x748f82ee5defb2fc',
+ '0x78a5636f43172f60',
+ '0x84c87814a1f0ab72',
+ '0x8cc702081a6439ec',
+ '0x90befffa23631e28',
+ '0xa4506cebde82bde9',
+ '0xbef9a3f7b2c67915',
+ '0xc67178f2e372532b',
+ '0xca273eceea26619c',
+ '0xd186b8c721c0c207',
+ '0xeada7dd6cde0eb1e',
+ '0xf57d4f7fee6ed178',
+ '0x06f067aa72176fba',
+ '0x0a637dc5a2c898a6',
+ '0x113f9804bef90dae',
+ '0x1b710b35131c471b',
+ '0x28db77f523047d84',
+ '0x32caab7b40c72493',
+ '0x3c9ebe0a15c9bebc',
+ '0x431d67c49c100d4c',
+ '0x4cc5d4becb3e42b6',
+ '0x597f299cfc657e2a',
+ '0x5fcb6fab3ad6faec',
+ '0x6c44198c4a475817'
+ ].map((n)=>BigInt(n))))();
+const SHA512_Kh = /* @__PURE__ */ (()=>K512[0])();
+const SHA512_Kl = /* @__PURE__ */ (()=>K512[1])();
+// Reusable temporary buffers
+const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
+const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
+/** Internal 64-byte base SHA2 hash class. */ class SHA2_64B extends HashMD {
+ // prettier-ignore
+ get() {
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ return [
+ Ah,
+ Al,
+ Bh,
+ Bl,
+ Ch,
+ Cl,
+ Dh,
+ Dl,
+ Eh,
+ El,
+ Fh,
+ Fl,
+ Gh,
+ Gl,
+ Hh,
+ Hl
+ ];
+ }
+ // prettier-ignore
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
+ this.Ah = Ah | 0;
+ this.Al = Al | 0;
+ this.Bh = Bh | 0;
+ this.Bl = Bl | 0;
+ this.Ch = Ch | 0;
+ this.Cl = Cl | 0;
+ this.Dh = Dh | 0;
+ this.Dl = Dl | 0;
+ this.Eh = Eh | 0;
+ this.El = El | 0;
+ this.Fh = Fh | 0;
+ this.Fl = Fl | 0;
+ this.Gh = Gh | 0;
+ this.Gl = Gl | 0;
+ this.Hh = Hh | 0;
+ this.Hl = Hl | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
+ for(let i = 0; i < 16; i++, offset += 4){
+ SHA512_W_H[i] = view.getUint32(offset);
+ SHA512_W_L[i] = view.getUint32(offset += 4);
+ }
+ for(let i = 16; i < 80; i++){
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
+ const W15h = SHA512_W_H[i - 15] | 0;
+ const W15l = SHA512_W_L[i - 15] | 0;
+ const s0h = rotrSH(W15h, W15l, 1) ^ rotrSH(W15h, W15l, 8) ^ shrSH(W15h, W15l, 7);
+ const s0l = rotrSL(W15h, W15l, 1) ^ rotrSL(W15h, W15l, 8) ^ shrSL(W15h, W15l, 7);
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
+ const W2h = SHA512_W_H[i - 2] | 0;
+ const W2l = SHA512_W_L[i - 2] | 0;
+ const s1h = rotrSH(W2h, W2l, 19) ^ rotrBH(W2h, W2l, 61) ^ shrSH(W2h, W2l, 6);
+ const s1l = rotrSL(W2h, W2l, 19) ^ rotrBL(W2h, W2l, 61) ^ shrSL(W2h, W2l, 6);
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
+ const SUMl = add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
+ const SUMh = add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
+ SHA512_W_H[i] = SUMh | 0;
+ SHA512_W_L[i] = SUMl | 0;
+ }
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ // Compression function main loop, 80 rounds
+ for(let i = 0; i < 80; i++){
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
+ const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
+ const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const CHIh = Eh & Fh ^ ~Eh & Gh;
+ const CHIl = El & Fl ^ ~El & Gl;
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
+ // prettier-ignore
+ const T1ll = add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
+ const T1h = add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
+ const T1l = T1ll | 0;
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
+ const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
+ const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
+ const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
+ const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
+ Hh = Gh | 0;
+ Hl = Gl | 0;
+ Gh = Fh | 0;
+ Gl = Fl | 0;
+ Fh = Eh | 0;
+ Fl = El | 0;
+ ({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
+ Dh = Ch | 0;
+ Dl = Cl | 0;
+ Ch = Bh | 0;
+ Cl = Bl | 0;
+ Bh = Ah | 0;
+ Bl = Al | 0;
+ const All = add3L(T1l, sigma0l, MAJl);
+ Ah = add3H(All, T1h, sigma0h, MAJh);
+ Al = All | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ ({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
+ ({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
+ ({ h: Ch, l: Cl } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
+ ({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
+ ({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
+ ({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
+ ({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
+ ({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
+ }
+ roundClean() {
+ clean(SHA512_W_H, SHA512_W_L);
+ }
+ destroy() {
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ constructor(outputLen){
+ super(128, outputLen, 16, false);
+ }
+}
+/** Internal SHA2-512 hash class. */ class _SHA512 extends SHA2_64B {
+ constructor(){
+ super(64), this.Ah = SHA512_IV[0] | 0, this.Al = SHA512_IV[1] | 0, this.Bh = SHA512_IV[2] | 0, this.Bl = SHA512_IV[3] | 0, this.Ch = SHA512_IV[4] | 0, this.Cl = SHA512_IV[5] | 0, this.Dh = SHA512_IV[6] | 0, this.Dl = SHA512_IV[7] | 0, this.Eh = SHA512_IV[8] | 0, this.El = SHA512_IV[9] | 0, this.Fh = SHA512_IV[10] | 0, this.Fl = SHA512_IV[11] | 0, this.Gh = SHA512_IV[12] | 0, this.Gl = SHA512_IV[13] | 0, this.Hh = SHA512_IV[14] | 0, this.Hl = SHA512_IV[15] | 0;
+ }
+}
+/** Internal SHA2-384 hash class. */ class _SHA384 extends SHA2_64B {
+ constructor(){
+ super(48), this.Ah = SHA384_IV[0] | 0, this.Al = SHA384_IV[1] | 0, this.Bh = SHA384_IV[2] | 0, this.Bl = SHA384_IV[3] | 0, this.Ch = SHA384_IV[4] | 0, this.Cl = SHA384_IV[5] | 0, this.Dh = SHA384_IV[6] | 0, this.Dl = SHA384_IV[7] | 0, this.Eh = SHA384_IV[8] | 0, this.El = SHA384_IV[9] | 0, this.Fh = SHA384_IV[10] | 0, this.Fl = SHA384_IV[11] | 0, this.Gh = SHA384_IV[12] | 0, this.Gl = SHA384_IV[13] | 0, this.Hh = SHA384_IV[14] | 0, this.Hl = SHA384_IV[15] | 0;
+ }
+}
+/**
+ * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
+ *
+ * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
+ * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
+ * - Each sha256 hash is executing 2^18 bit operations.
+ * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
+ */ const sha256 = /* @__PURE__ */ createHasher(()=>new _SHA256(), /* @__PURE__ */ oidNist(0x01));
+/** SHA2-224 hash function from RFC 4634 */ const sha224 = /* @__PURE__ */ createHasher(()=>new _SHA224(), /* @__PURE__ */ oidNist(0x04));
+/** SHA2-512 hash function from RFC 4634. */ const sha512 = /* @__PURE__ */ createHasher(()=>new _SHA512(), /* @__PURE__ */ oidNist(0x03));
+/** SHA2-384 hash function from RFC 4634. */ const sha384 = /* @__PURE__ */ createHasher(()=>new _SHA384(), /* @__PURE__ */ oidNist(0x02));
+
+// No __PURE__ annotations in sha3 header:
+// EVERYTHING is in fact used on every export.
+// Various per round constants calculations
+const _0n = BigInt(0);
+const _1n = BigInt(1);
+const _2n = BigInt(2);
+const _7n = BigInt(7);
+const _256n = BigInt(256);
+const _0x71n = BigInt(0x71);
+const SHA3_PI = [];
+const SHA3_ROTL = [];
+const _SHA3_IOTA = []; // no pure annotation: var is always used
+for(let round = 0, R = _1n, x = 1, y = 0; round < 24; round++){
+ // Pi
+ [x, y] = [
+ y,
+ (2 * x + 3 * y) % 5
+ ];
+ SHA3_PI.push(2 * (5 * y + x));
+ // Rotational
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
+ // Iota
+ let t = _0n;
+ for(let j = 0; j < 7; j++){
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
+ if (R & _2n) t ^= _1n << (_1n << BigInt(j)) - _1n;
+ }
+ _SHA3_IOTA.push(t);
+}
+const IOTAS = split(_SHA3_IOTA, true);
+const SHA3_IOTA_H = IOTAS[0];
+const SHA3_IOTA_L = IOTAS[1];
+// Left rotation (without 0, 32, 64)
+const rotlH = (h, l, s)=>s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
+const rotlL = (h, l, s)=>s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
+/** `keccakf1600` internal function, additionally allows to adjust round count. */ function keccakP(s, rounds = 24) {
+ const B = new Uint32Array(5 * 2);
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
+ for(let round = 24 - rounds; round < 24; round++){
+ // Theta θ
+ for(let x = 0; x < 10; x++)B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
+ for(let x = 0; x < 10; x += 2){
+ const idx1 = (x + 8) % 10;
+ const idx0 = (x + 2) % 10;
+ const B0 = B[idx0];
+ const B1 = B[idx0 + 1];
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
+ for(let y = 0; y < 50; y += 10){
+ s[x + y] ^= Th;
+ s[x + y + 1] ^= Tl;
+ }
+ }
+ // Rho (ρ) and Pi (π)
+ let curH = s[2];
+ let curL = s[3];
+ for(let t = 0; t < 24; t++){
+ const shift = SHA3_ROTL[t];
+ const Th = rotlH(curH, curL, shift);
+ const Tl = rotlL(curH, curL, shift);
+ const PI = SHA3_PI[t];
+ curH = s[PI];
+ curL = s[PI + 1];
+ s[PI] = Th;
+ s[PI + 1] = Tl;
+ }
+ // Chi (χ)
+ for(let y = 0; y < 50; y += 10){
+ for(let x = 0; x < 10; x++)B[x] = s[y + x];
+ for(let x = 0; x < 10; x++)s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
+ }
+ // Iota (ι)
+ s[0] ^= SHA3_IOTA_H[round];
+ s[1] ^= SHA3_IOTA_L[round];
+ }
+ clean(B);
+}
+/** Keccak sponge function. */ class Keccak {
+ clone() {
+ return this._cloneInto();
+ }
+ keccak() {
+ swap32IfBE(this.state32);
+ keccakP(this.state32, this.rounds);
+ swap32IfBE(this.state32);
+ this.posOut = 0;
+ this.pos = 0;
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { blockLen, state } = this;
+ const len = data.length;
+ for(let pos = 0; pos < len;){
+ const take = Math.min(blockLen - this.pos, len - pos);
+ for(let i = 0; i < take; i++)state[this.pos++] ^= data[pos++];
+ if (this.pos === blockLen) this.keccak();
+ }
+ return this;
+ }
+ finish() {
+ if (this.finished) return;
+ this.finished = true;
+ const { state, suffix, pos, blockLen } = this;
+ // Do the padding
+ state[pos] ^= suffix;
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
+ state[blockLen - 1] ^= 0x80;
+ this.keccak();
+ }
+ writeInto(out) {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const bufferOut = this.state;
+ const { blockLen } = this;
+ for(let pos = 0, len = out.length; pos < len;){
+ if (this.posOut >= blockLen) this.keccak();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out) {
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
+ if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
+ return this.writeInto(out);
+ }
+ xof(bytes) {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out) {
+ aoutput(out, this);
+ if (this.finished) throw new Error('digest() was already called');
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest() {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.state);
+ }
+ _cloneInto(to) {
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
+ to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
+ to.state32.set(this.state32);
+ to.pos = this.pos;
+ to.posOut = this.posOut;
+ to.finished = this.finished;
+ to.rounds = rounds;
+ // Suffix can change in cSHAKE
+ to.suffix = suffix;
+ to.outputLen = outputLen;
+ to.enableXOF = enableXOF;
+ to.destroyed = this.destroyed;
+ return to;
+ }
+ // NOTE: we accept arguments in bytes instead of bits here.
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24){
+ this.pos = 0;
+ this.posOut = 0;
+ this.finished = false;
+ this.destroyed = false;
+ this.enableXOF = false;
+ this.blockLen = blockLen;
+ this.suffix = suffix;
+ this.outputLen = outputLen;
+ this.enableXOF = enableXOF;
+ this.rounds = rounds;
+ // Can be passed from user as dkLen
+ anumber(outputLen, 'outputLen');
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
+ // 0 < blockLen < 200
+ if (!(0 < blockLen && blockLen < 200)) throw new Error('only keccak-f1600 function is supported');
+ this.state = new Uint8Array(200);
+ this.state32 = u32(this.state);
+ }
+}
+const genKeccak = (suffix, blockLen, outputLen, info = {})=>createHasher(()=>new Keccak(blockLen, suffix, outputLen), info);
+/** SHA3-224 hash function. */ const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, /* @__PURE__ */ oidNist(0x07));
+/** SHA3-256 hash function. Different from keccak-256. */ const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, /* @__PURE__ */ oidNist(0x08));
+/** SHA3-384 hash function. */ const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, /* @__PURE__ */ oidNist(0x09));
+/** SHA3-512 hash function. */ const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, /* @__PURE__ */ oidNist(0x0a));
+
+/**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+})();
+
+/**
+ * @noble/hashes hash functions.
+ * @type {Object.}
+ */ const nobleHashes = {
+ SHA1: sha1,
+ SHA224: sha224,
+ SHA256: sha256,
+ SHA384: sha384,
+ SHA512: sha512,
+ "SHA3-224": sha3_224,
+ "SHA3-256": sha3_256,
+ "SHA3-384": sha3_384,
+ "SHA3-512": sha3_512
+};
+/**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+};
+/**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ if (hmac) {
+ const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];
+ return hmac(hash, key, message);
+ } else {
+ throw new Error("Missing HMAC function");
+ }
+};
+
+/**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+/**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+};
+
+/**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+};
+
+/**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+};
+
+/**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+/**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+/**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+};
+/**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+};
+
+/**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+};
+
+/**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+}
+
+/**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+};
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+/**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+/**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+/**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+/**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+/**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
+ const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
+ const pairKey = pairArr[0].toLowerCase();
+ const pairVal = pairArr[1];
+ /** @type {Object.} */ const pairAcc = acc;
+ pairAcc[pairKey] = pairVal;
+ return pairAcc;
+ }, {});
+ // 'OTP' will be instantiated with 'config' argument.
+ let OTP;
+ const config = {};
+ if (uriType === "hotp") {
+ OTP = HOTP;
+ // Counter: required
+ if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
+ config.counter = parseInt(uriParams.counter, 10);
+ } else {
+ throw new TypeError("Missing or invalid 'counter' parameter");
+ }
+ } else if (uriType === "totp") {
+ OTP = TOTP;
+ // Period: optional
+ if (typeof uriParams.period !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
+ config.period = parseInt(uriParams.period, 10);
+ } else {
+ throw new TypeError("Invalid 'period' parameter");
+ }
+ }
+ } else {
+ throw new TypeError("Unknown OTP type");
+ }
+ // Label: required
+ // Issuer: optional
+ if (typeof uriParams.issuer !== "undefined") {
+ config.issuer = uriParams.issuer;
+ }
+ if (uriLabel.length === 2) {
+ config.label = uriLabel[1];
+ if (typeof config.issuer === "undefined" || config.issuer === "") {
+ config.issuer = uriLabel[0];
+ } else if (uriLabel[0] === "") {
+ config.issuerInLabel = false;
+ }
+ } else {
+ config.label = uriLabel[0];
+ if (typeof config.issuer !== "undefined" && config.issuer !== "") {
+ config.issuerInLabel = false;
+ }
+ }
+ // Secret: required
+ if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
+ config.secret = uriParams.secret;
+ } else {
+ throw new TypeError("Missing or invalid 'secret' parameter");
+ }
+ // Algorithm: optional
+ if (typeof uriParams.algorithm !== "undefined") {
+ if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
+ config.algorithm = uriParams.algorithm;
+ } else {
+ throw new TypeError("Invalid 'algorithm' parameter");
+ }
+ }
+ // Digits: optional
+ if (typeof uriParams.digits !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
+ config.digits = parseInt(uriParams.digits, 10);
+ } else {
+ throw new TypeError("Invalid 'digits' parameter");
+ }
+ }
+ // HMAC: optional
+ if (typeof hmac !== "undefined") {
+ config.hmac = hmac;
+ }
+ return new OTP(config);
+ }
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */ static stringify(otp) {
+ if (otp instanceof HOTP || otp instanceof TOTP) {
+ return otp.toString();
+ }
+ throw new TypeError("Invalid 'HOTP/TOTP' object");
+ }
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */ const version = "9.5.0";
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.esm.min.js b/server/node_modules/otpauth/dist/otpauth.esm.min.js
new file mode 100644
index 0000000..a79da34
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.esm.min.js
@@ -0,0 +1,19 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+//! noble-hashes 2.0.1 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
+///
+// @ts-nocheck
+function t(t,e=""){if(!Number.isSafeInteger(t)||t<0)throw new Error(`${e&&`"${e}" `}expected integer >= 0, got ${t}`)}function e(t,e,s=""){const i=(r=t)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name;var r;const n=t?.length,o=void 0!==e;if(!i||o&&n!==e)throw new Error((s&&`"${s}" `)+"expected Uint8Array"+(o?` of length ${e}`:"")+", got "+(i?`length=${n}`:"type="+typeof t));return t}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function i(t,s){e(t,void 0,"digestInto() output");const i=s.outputLen;if(t.length='+i)}function r(...t){for(let e=0;e>>e}function h(t,e){return t<>>32-e>>>0}function a(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const c=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])()?t=>t:function(t){for(let e=0;et(s).update(e).digest(),i=t(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=e=>t(e),Object.assign(s,e),Object.freeze(s)}const u=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});class f{update(t){return s(this),this.iHash.update(t),this}digestInto(t){s(this),e(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:s,finished:i,destroyed:r,blockLen:n,outputLen:o}=this;return t.finished=i,t.destroyed=r,t.blockLen=n,t.outputLen=o,t.oHash=e._cloneInto(t.oHash),t.iHash=s._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),
+this.iHash.destroy()}constructor(s,i){if(this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash must wrapped by utils.createHasher");t(e.outputLen),t(e.blockLen)}(s),e(i,void 0,"key"),this.iHash=s.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,o=new Uint8Array(n);o.set(i.length>n?s.create().update(i).digest():i);for(let t=0;tnew f(t,e).update(s).digest();function b(t,e,s){return t&e^~t&s}function g(t,e,s){return t&e^t&s^e&s}d.create=(t,e)=>new f(t,e);class p{update(t){s(this),e(t);const{view:i,buffer:r,blockLen:o}=this,h=t.length;for(let e=0;eh-c&&(this.process(o,0),c=0);for(let t=c;td.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tnew I),E=BigInt(2**32-1),U=BigInt(32);function B(t,e=!1){return e?{h:Number(t&E),l:Number(t>>U&E)}:{h:0|Number(t>>U&E),l:0|Number(t&E)}}function S(t,e=!1){const s=t.length;let i=new Uint32Array(s),r=new Uint32Array(s);for(let n=0;nt>>>s,C=(t,e,s)=>t<<32-s|e>>>s,O=(t,e,s)=>t>>>s|e<<32-s,$=(t,e,s)=>t<<32-s|e>>>s,k=(t,e,s)=>t<<64-s|e>>>s-32,D=(t,e,s)=>t>>>s-32|e<<64-s;function T(t,e,s,i){const r=(e>>>0)+(i>>>0);return{h:t+s+(r/2**32|0)|0,l:0|r}}const _=(t,e,s)=>(t>>>0)+(e>>>0)+(s>>>0),F=(t,e,s,i)=>e+s+i+(t/2**32|0)|0,G=(t,e,s,i)=>(t>>>0)+(e>>>0)+(s>>>0)+(i>>>0),P=(t,e,s,i,r)=>e+s+i+r+(t/2**32|0)|0,j=(t,e,s,i,r)=>(t>>>0)+(e>>>0)+(s>>>0)+(i>>>0)+(r>>>0),M=(t,e,s,i,r,n)=>e+s+i+r+n+(t/2**32|0)|0,R=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),X=new Uint32Array(64);class N extends p{get(){const{A:t,B:e,C:s,D:i,E:r,F:n,G:o,H:h}=this;return[t,e,s,i,r,n,o,h]}set(t,e,s,i,r,n,o,h){this.A=0|t,this.B=0|e,this.C=0|s,this.D=0|i,this.E=0|r,this.F=0|n,this.G=0|o,this.H=0|h}process(t,e){for(let s=0;s<16;s++,e+=4)X[s]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=X[t-15],s=X[t-2],i=o(e,7)^o(e,18)^e>>>3,r=o(s,17)^o(s,19)^s>>>10;X[t]=r+X[t-7]+i+X[t-16]|0}let{A:s,B:i,C:r,D:n,E:h,F:a,G:c,H:l}=this;for(let t=0;t<64;t++){const e=l+(o(h,6)^o(h,11)^o(h,25))+b(h,a,c)+R[t]+X[t]|0,u=(o(s,2)^o(s,13)^o(s,22))+g(s,i,r)|0;l=c,c=a,a=h,h=n+e|0,n=r,r=i,i=s,s=e+u|0}s=s+this.A|0,i=i+this.B|0,r=r+this.C|0,n=n+this.D|0,h=h+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(s,i,r,n,h,a,c,l)}roundClean(){r(X)}destroy(){this.set(0,0,0,0,0,0,0,0),r(this.buffer)}constructor(t){super(64,t,8,!1)}}
+class Z extends N{constructor(){super(32),this.A=0|w[0],this.B=0|w[1],this.C=0|w[2],this.D=0|w[3],this.E=0|w[4],this.F=0|w[5],this.G=0|w[6],this.H=0|w[7]}}class V extends N{constructor(){super(28),this.A=0|m[0],this.B=0|m[1],this.C=0|m[2],this.D=0|m[3],this.E=0|m[4],this.F=0|m[5],this.G=0|m[6],this.H=0|m[7]}}
+const z=(()=>S(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),J=(()=>z[0])(),K=(()=>z[1])(),Q=new Uint32Array(80),W=new Uint32Array(80);class Y extends p{get(){const{Ah:t,Al:e,Bh:s,Bl:i,Ch:r,Cl:n,Dh:o,Dl:h,Eh:a,El:c,Fh:l,Fl:u,Gh:f,Gl:d,Hh:b,Hl:g}=this;return[t,e,s,i,r,n,o,h,a,c,l,u,f,d,b,g]}set(t,e,s,i,r,n,o,h,a,c,l,u,f,d,b,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|s,this.Bl=0|i,this.Ch=0|r,
+this.Cl=0|n,this.Dh=0|o,this.Dl=0|h,this.Eh=0|a,this.El=0|c,this.Fh=0|l,this.Fl=0|u,this.Gh=0|f,this.Gl=0|d,this.Hh=0|b,this.Hl=0|g}process(t,e){for(let s=0;s<16;s++,e+=4)Q[s]=t.getUint32(e),W[s]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Q[t-15],s=0|W[t-15],i=O(e,s,1)^O(e,s,8)^v(e,0,7),r=$(e,s,1)^$(e,s,8)^C(e,s,7),n=0|Q[t-2],o=0|W[t-2],h=O(n,o,19)^k(n,o,61)^v(n,0,6),a=$(n,o,19)^D(n,o,61)^C(n,o,6),c=G(r,a,W[t-7],W[t-16]),l=P(c,i,h,Q[t-7],Q[t-16]);Q[t]=0|l,W[t]=0|c}let{Ah:s,Al:i,Bh:r,Bl:n,Ch:o,Cl:h,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:d,Gh:b,Gl:g,Hh:p,Hl:w}=this;for(let t=0;t<80;t++){const e=O(l,u,14)^O(l,u,18)^k(l,u,41),m=$(l,u,14)^$(l,u,18)^D(l,u,41),y=l&f^~l&b,A=j(w,m,u&d^~u&g,K[t],W[t]),x=M(A,p,e,y,J[t],Q[t]),H=0|A,I=O(s,i,28)^k(s,i,34)^k(s,i,39),L=$(s,i,28)^D(s,i,34)^D(s,i,39),E=s&r^s&o^r&o,U=i&n^i&h^n&h;p=0|b,w=0|g,b=0|f,g=0|d,f=0|l,d=0|u,({h:l,l:u}=T(0|a,0|c,0|x,0|H)),a=0|o,c=0|h,o=0|r,h=0|n,r=0|s,n=0|i;const B=_(H,L,U);s=F(B,x,I,E),i=0|B}({h:s,l:i}=T(0|this.Ah,0|this.Al,0|s,0|i)),({h:r,l:n}=T(0|this.Bh,0|this.Bl,0|r,0|n)),({h:o,l:h}=T(0|this.Ch,0|this.Cl,0|o,0|h)),({h:a,l:c}=T(0|this.Dh,0|this.Dl,0|a,0|c)),({h:l,l:u}=T(0|this.Eh,0|this.El,0|l,0|u)),({h:f,l:d}=T(0|this.Fh,0|this.Fl,0|f,0|d)),({h:b,l:g}=T(0|this.Gh,0|this.Gl,0|b,0|g)),({h:p,l:w}=T(0|this.Hh,0|this.Hl,0|p,0|w)),this.set(s,i,r,n,o,h,a,c,l,u,f,d,b,g,p,w)}roundClean(){r(Q,W)}destroy(){r(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}constructor(t){super(128,t,16,!1)}}class q extends Y{constructor(){super(64),this.Ah=0|A[0],this.Al=0|A[1],this.Bh=0|A[2],this.Bl=0|A[3],this.Ch=0|A[4],this.Cl=0|A[5],this.Dh=0|A[6],this.Dl=0|A[7],this.Eh=0|A[8],this.El=0|A[9],this.Fh=0|A[10],this.Fl=0|A[11],this.Gh=0|A[12],this.Gl=0|A[13],this.Hh=0|A[14],this.Hl=0|A[15]}}class tt extends Y{constructor(){super(48),this.Ah=0|y[0],this.Al=0|y[1],this.Bh=0|y[2],this.Bl=0|y[3],this.Ch=0|y[4],this.Cl=0|y[5],this.Dh=0|y[6],this.Dl=0|y[7],this.Eh=0|y[8],this.El=0|y[9],this.Fh=0|y[10],this.Fl=0|y[11],this.Gh=0|y[12],this.Gl=0|y[13],this.Hh=0|y[14],this.Hl=0|y[15]}}
+const et=l(()=>new Z,u(1)),st=l(()=>new V,u(4)),it=l(()=>new q,u(3)),rt=l(()=>new tt,u(2)),nt=BigInt(0),ot=BigInt(1),ht=BigInt(2),at=BigInt(7),ct=BigInt(256),lt=BigInt(113),ut=[],ft=[],dt=[];for(let t=0,e=ot,s=1,i=0;t<24;t++){[s,i]=[i,(2*s+3*i)%5],ut.push(2*(5*i+s)),ft.push((t+1)*(t+2)/2%64);let r=nt;for(let t=0;t<7;t++)e=(e<>at)*lt)%ct,e&ht&&(r^=ot<<(ot<s>32?((t,e,s)=>e<>>64-s)(t,e,s):((t,e,s)=>t<>>32-s)(t,e,s),mt=(t,e,s)=>s>32?((t,e,s)=>t<>>64-s)(t,e,s):((t,e,s)=>e<>>32-s)(t,e,s);class yt{clone(){return this._cloneInto()}keccak(){c(this.state32),function(t,e=24){const s=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let e=0;e<10;e++)s[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const i=(e+8)%10,r=(e+2)%10,n=s[r],o=s[r+1],h=wt(n,o,1)^s[i],a=mt(n,o,1)^s[i+1];for(let s=0;s<50;s+=10)t[e+s]^=h,t[e+s+1]^=a}let e=t[2],r=t[3];for(let s=0;s<24;s++){const i=ft[s],n=wt(e,r,i),o=mt(e,r,i),h=ut[s];e=t[h],r=t[h+1],t[h]=n,t[h+1]=o}for(let e=0;e<50;e+=10){for(let i=0;i<10;i++)s[i]=t[e+i];for(let i=0;i<10;i++)t[e+i]^=~s[(i+2)%10]&s[(i+4)%10]}t[0]^=gt[i],t[1]^=pt[i]}r(s)}(this.state32,this.rounds),c(this.state32),this.posOut=0,this.pos=0}update(t){s(this),e(t);const{blockLen:i,state:r}=this,n=t.length;for(let e=0;e=r&&this.keccak();const n=Math.min(r-this.posOut,s-e);t.set(i.subarray(this.posOut,this.posOut+n),e),this.posOut+=n,e+=n}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(e){return t(e),this.xofInto(new Uint8Array(e))}
+digestInto(t){if(i(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,r(this.state)}_cloneInto(t){const{blockLen:e,suffix:s,outputLen:i,rounds:r,enableXOF:n}=this;return t||(t=new yt(e,s,i,n,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=s,t.outputLen=i,t.enableXOF=n,t.destroyed=this.destroyed,t}constructor(e,s,i,r=!1,n=24){if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=s,this.outputLen=i,this.enableXOF=r,this.rounds=n,t(i,"outputLen"),!(0l(()=>new yt(e,t,s),i),xt=At(6,144,28,u(7)),Ht=At(6,136,32,u(8)),It=At(6,104,48,u(9)),Lt=At(6,72,64,u(10)),Et=(()=>{if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"__GLOBALTHIS__",{get(){return this},configurable:!0});try{if("undefined"!=typeof __GLOBALTHIS__)return __GLOBALTHIS__}finally{delete Object.prototype.__GLOBALTHIS__}return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0})(),Ut={SHA1:L,SHA224:st,SHA256:et,SHA384:rt,SHA512:it,"SHA3-224":xt,"SHA3-256":Ht,"SHA3-384":It,"SHA3-512":Lt},Bt=t=>{switch(!0){case/^(?:SHA-?1|SSL3-SHA1)$/i.test(t):return"SHA1";case/^SHA(?:2?-)?224$/i.test(t):return"SHA224";case/^SHA(?:2?-)?256$/i.test(t):return"SHA256";case/^SHA(?:2?-)?384$/i.test(t):return"SHA384";case/^SHA(?:2?-)?512$/i.test(t):return"SHA512";case/^SHA3-224$/i.test(t):return"SHA3-224";case/^SHA3-256$/i.test(t):return"SHA3-256";case/^SHA3-384$/i.test(t):return"SHA3-384";case/^SHA3-512$/i.test(t):return"SHA3-512";default:throw new TypeError(`Unknown hash algorithm: ${t}`)}},St=(t,e,s)=>{
+if(d){const i=Ut[t]??Ut[Bt(t)];return d(i,e,s)}throw new Error("Missing HMAC function")},vt="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",Ct=t=>{let e=(t=t.replace(/ /g,"")).length;for(;"="===t[e-1];)--e;t=(e=8&&(r-=8,i[o++]=n>>>r)}return i},Ot=t=>{let e=0,s=0,i="";for(let r=0;r=5;)i+=vt[s>>>e-5&31],e-=5;return e>0&&(i+=vt[s<<5-e&31]),i},$t=t=>{t=t.replace(/ /g,"");const e=new ArrayBuffer(t.length/2),s=new Uint8Array(e);for(let e=0;e{let e="";for(let s=0;s{const e=new ArrayBuffer(t.length),s=new Uint8Array(e);for(let e=0;e{let e="";for(let s=0;s{if(!_t)throw new Error("Encoding API not available");return _t.encode(t)},Pt=t=>{if(!Ft)throw new Error("Encoding API not available");return Ft.decode(t)};class jt{static fromLatin1(t){return new jt({buffer:Dt(t).buffer})}static fromUTF8(t){return new jt({buffer:Gt(t).buffer})}static fromBase32(t){return new jt({buffer:Ct(t).buffer})}static fromHex(t){return new jt({buffer:$t(t).buffer})}get buffer(){return this.bytes.buffer}get latin1(){return Object.defineProperty(this,"latin1",{enumerable:!0,writable:!1,configurable:!1,value:Tt(this.bytes)}),this.latin1}get utf8(){return Object.defineProperty(this,"utf8",{enumerable:!0,writable:!1,configurable:!1,value:Pt(this.bytes)}),this.utf8}get base32(){return Object.defineProperty(this,"base32",{enumerable:!0,writable:!1,configurable:!1,value:Ot(this.bytes)}),this.base32}get hex(){
+return Object.defineProperty(this,"hex",{enumerable:!0,writable:!1,configurable:!1,value:kt(this.bytes)}),this.hex}constructor({buffer:t,size:e=20}={}){this.bytes=void 0===t?(t=>{if(Et.crypto?.getRandomValues)return Et.crypto.getRandomValues(new Uint8Array(t));throw new Error("Cryptography API not available")})(e):new Uint8Array(t),Object.defineProperty(this,"bytes",{enumerable:!0,writable:!1,configurable:!1,value:this.bytes})}}class Mt{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,counter:0,window:1}}static generate({secret:t,algorithm:e=Mt.defaults.algorithm,digits:s=Mt.defaults.digits,counter:i=Mt.defaults.counter,hmac:r=St}){const n=(t=>{const e=new ArrayBuffer(8),s=new Uint8Array(e);let i=t;for(let t=7;t>=0&&0!==i;t--)s[t]=255&i,i-=s[t],i/=256;return s})(i),o=r(e,t.bytes,n);if(!o?.byteLength||o.byteLength<19)throw new TypeError("Return value must be at least 19 bytes");const h=15&o[o.byteLength-1];return(((127&o[h])<<24|(255&o[h+1])<<16|(255&o[h+2])<<8|255&o[h+3])%10**s).toString().padStart(s,"0")}generate({counter:t=this.counter++}={}){return Mt.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,counter:t,hmac:this.hmac})}static validate({token:t,secret:e,algorithm:s,digits:i=Mt.defaults.digits,counter:r=Mt.defaults.counter,window:n=Mt.defaults.window,hmac:o=St}){if(t.length!==i)return null;let h=null;const a=n=>{const a=Mt.generate({secret:e,algorithm:s,digits:i,counter:n,hmac:o});((t,e)=>{{if(t.length!==e.length)throw new TypeError("Input strings must have the same length");let s=-1,i=0;for(;++s0?this.issuerInLabel?`${t(this.issuer)}:${t(this.label)}?issuer=${t(this.issuer)}&`:`${t(this.label)}?issuer=${t(this.issuer)}&`:`${t(this.label)}?`)+`secret=${t(this.secret.base32)}&`+`algorithm=${t(this.algorithm)}&`+`digits=${t(this.digits)}&`+`counter=${t(this.counter)}`}constructor({issuer:t=Mt.defaults.issuer,label:e=Mt.defaults.label,issuerInLabel:s=Mt.defaults.issuerInLabel,secret:i=new jt,algorithm:r=Mt.defaults.algorithm,digits:n=Mt.defaults.digits,counter:o=Mt.defaults.counter,hmac:h}={}){this.issuer=t,this.label=e,this.issuerInLabel=s,this.secret="string"==typeof i?jt.fromBase32(i):i,this.algorithm=h?r:Bt(r),this.digits=n,this.counter=o,this.hmac=h}}class Rt{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,period:30,window:1}}static counter({period:t=Rt.defaults.period,timestamp:e=Date.now()}={}){return Math.floor(e/1e3/t)}counter({timestamp:t=Date.now()}={}){return Rt.counter({period:this.period,timestamp:t})}static remaining({period:t=Rt.defaults.period,timestamp:e=Date.now()}={}){return 1e3*t-e%(1e3*t)}remaining({timestamp:t=Date.now()}={}){return Rt.remaining({period:this.period,timestamp:t})}static generate({secret:t,algorithm:e,digits:s,period:i=Rt.defaults.period,timestamp:r=Date.now(),hmac:n}){return Mt.generate({secret:t,algorithm:e,digits:s,counter:Rt.counter({period:i,timestamp:r}),hmac:n})}generate({timestamp:t=Date.now()}={}){return Rt.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:t,hmac:this.hmac})}static validate({token:t,secret:e,algorithm:s,digits:i,period:r=Rt.defaults.period,timestamp:n=Date.now(),window:o,hmac:h}){return Mt.validate({token:t,secret:e,algorithm:s,digits:i,counter:Rt.counter({period:r,timestamp:n}),window:o,hmac:h})}validate({token:t,timestamp:e,window:s}){return Rt.validate({token:t,secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:e,window:s,hmac:this.hmac})}toString(){
+const t=encodeURIComponent;return"otpauth://totp/"+(this.issuer.length>0?this.issuerInLabel?`${t(this.issuer)}:${t(this.label)}?issuer=${t(this.issuer)}&`:`${t(this.label)}?issuer=${t(this.issuer)}&`:`${t(this.label)}?`)+`secret=${t(this.secret.base32)}&`+`algorithm=${t(this.algorithm)}&`+`digits=${t(this.digits)}&`+`period=${t(this.period)}`}constructor({issuer:t=Rt.defaults.issuer,label:e=Rt.defaults.label,issuerInLabel:s=Rt.defaults.issuerInLabel,secret:i=new jt,algorithm:r=Rt.defaults.algorithm,digits:n=Rt.defaults.digits,period:o=Rt.defaults.period,hmac:h}={}){this.issuer=t,this.label=e,this.issuerInLabel=s,this.secret="string"==typeof i?jt.fromBase32(i):i,this.algorithm=h?r:Bt(r),this.digits=n,this.period=o,this.hmac=h}}const Xt=/^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i,Nt=/^[2-7A-Z]+=*$/i,Zt=/^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i,Vt=/^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i,zt=/^[+-]?\d+$/,Jt=/^\+?[1-9]\d*$/;class Kt{static parse(t,{hmac:e}={}){let s;try{s=t.match(Xt)}catch(t){}if(!Array.isArray(s))throw new URIError("Invalid URI format");const i=s[1].toLowerCase(),r=s[2].split(/(?::|%3A) *(.+)/i,2).map(decodeURIComponent),n=s[3].split("&").reduce((t,e)=>{const s=e.split(/=(.*)/,2).map(decodeURIComponent),i=s[0].toLowerCase(),r=s[1],n=t;return n[i]=r,n},{});let o;const h={};if("hotp"===i){if(o=Mt,void 0===n.counter||!zt.test(n.counter))throw new TypeError("Missing or invalid 'counter' parameter");h.counter=parseInt(n.counter,10)}else{if("totp"!==i)throw new TypeError("Unknown OTP type");if(o=Rt,void 0!==n.period){if(!Jt.test(n.period))throw new TypeError("Invalid 'period' parameter");h.period=parseInt(n.period,10)}}if(void 0!==n.issuer&&(h.issuer=n.issuer),2===r.length?(h.label=r[1],void 0===h.issuer||""===h.issuer?h.issuer=r[0]:""===r[0]&&(h.issuerInLabel=!1)):(h.label=r[0],void 0!==h.issuer&&""!==h.issuer&&(h.issuerInLabel=!1)),void 0===n.secret||!Nt.test(n.secret))throw new TypeError("Missing or invalid 'secret' parameter");if(h.secret=n.secret,
+void 0!==n.algorithm){if(!(e?Vt:Zt).test(n.algorithm))throw new TypeError("Invalid 'algorithm' parameter");h.algorithm=n.algorithm}if(void 0!==n.digits){if(!Jt.test(n.digits))throw new TypeError("Invalid 'digits' parameter");h.digits=parseInt(n.digits,10)}return void 0!==e&&(h.hmac=e),new o(h)}static stringify(t){if(t instanceof Mt||t instanceof Rt)return t.toString();throw new TypeError("Invalid 'HOTP/TOTP' object")}}const Qt="9.5.0";export{Mt as HOTP,jt as Secret,Rt as TOTP,Kt as URI,Qt as version};
+//# sourceMappingURL=otpauth.esm.min.js.map
diff --git a/server/node_modules/otpauth/dist/otpauth.esm.min.js.map b/server/node_modules/otpauth/dist/otpauth.esm.min.js.map
new file mode 100644
index 0000000..39f1830
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.esm.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"otpauth.esm.min.js","sources":["../node_modules/@noble/hashes/utils.js","../node_modules/@noble/hashes/hmac.js","../node_modules/@noble/hashes/_md.js","../node_modules/@noble/hashes/legacy.js","../node_modules/@noble/hashes/_u64.js","../node_modules/@noble/hashes/sha2.js","../node_modules/@noble/hashes/sha3.js","../src/internal/global-scope.js","../src/internal/crypto/hmac-digest.js","../src/internal/encoding/base32.js","../src/internal/encoding/hex.js","../src/internal/encoding/latin1.js","../src/internal/encoding/utf8.js","../src/secret.js","../src/internal/crypto/random-bytes.js","../src/hotp.js","../src/internal/encoding/uint.js","../src/internal/crypto/timing-safe-equal.js","../src/totp.js","../src/uri.js","../src/version.js"],"sourcesContent":["/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a) {\n return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n/** Asserts something is positive integer. */\nexport function anumber(n, title = '') {\n if (!Number.isSafeInteger(n) || n < 0) {\n const prefix = title && `\"${title}\" `;\n throw new Error(`${prefix}expected integer >= 0, got ${n}`);\n }\n}\n/** Asserts something is Uint8Array. */\nexport function abytes(value, length, title = '') {\n const bytes = isBytes(value);\n const len = value?.length;\n const needsLen = length !== undefined;\n if (!bytes || (needsLen && len !== length)) {\n const prefix = title && `\"${title}\" `;\n const ofLen = needsLen ? ` of length ${length}` : '';\n const got = bytes ? `length=${len}` : `type=${typeof value}`;\n throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);\n }\n return value;\n}\n/** Asserts something is hash */\nexport function ahash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash must wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n}\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out, instance) {\n abytes(out, undefined, 'digestInto() output');\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error('\"digestInto() output\" expected to be of length >=' + min);\n }\n}\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr) {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word, shift) {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/** The byte swap operation for uint32 */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE = isLE\n ? (n) => n\n : (n) => byteSwap(n);\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\nexport const swap32IfBE = isLE\n ? (u) => u\n : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n if (ch >= asciis._0 && ch <= asciis._9)\n return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F)\n return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f)\n return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // @ts-ignore\n if (hasHexBuiltin)\n return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async () => { };\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * Built-in doesn't validate input to be string: we do the check.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data, errorTitle = '') {\n if (typeof data === 'string')\n return utf8ToBytes(data);\n return abytes(data, undefined, errorTitle);\n}\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n/** Merges default options and passed options. */\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new Error('options must be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\n/** Creates function with outputLen, blockLen, create properties from a class constructor. */\nexport function createHasher(hashCons, info = {}) {\n const hashC = (msg, opts) => hashCons(opts).update(msg).digest();\n const tmp = hashCons(undefined);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n Object.assign(hashC, info);\n return Object.freeze(hashC);\n}\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32) {\n const cr = typeof globalThis === 'object' ? globalThis.crypto : null;\n if (typeof cr?.getRandomValues !== 'function')\n throw new Error('crypto.getRandomValues must be defined');\n return cr.getRandomValues(new Uint8Array(bytesLength));\n}\n/** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */\nexport const oidNist = (suffix) => ({\n oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),\n});\n//# sourceMappingURL=utils.js.map","/**\n * HMAC: RFC2104 message authentication code.\n * @module\n */\nimport { abytes, aexists, ahash, clean } from \"./utils.js\";\n/** Internal class for HMAC. */\nexport class _HMAC {\n oHash;\n iHash;\n blockLen;\n outputLen;\n finished = false;\n destroyed = false;\n constructor(hash, key) {\n ahash(hash);\n abytes(key, undefined, 'key');\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n clean(pad);\n }\n update(buf) {\n aexists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n aexists(this);\n abytes(out, this.outputLen, 'output');\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to ||= Object.create(Object.getPrototypeOf(this), {});\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n * @example\n * import { hmac } from '@noble/hashes/hmac';\n * import { sha256 } from '@noble/hashes/sha2';\n * const mac1 = hmac(sha256, 'key', 'message');\n */\nexport const hmac = (hash, key, message) => new _HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new _HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { abytes, aexists, aoutput, clean, createView } from \"./utils.js\";\n/** Choice: a ? b : c */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport class HashMD {\n blockLen;\n outputLen;\n padOffset;\n isLE;\n // For partial updates less than block size\n buffer;\n view;\n finished = false;\n length = 0;\n pos = 0;\n destroyed = false;\n constructor(blockLen, outputLen, padOffset, isLE) {\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen must be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to ||= new this.constructor();\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */\nexport const SHA224_IV = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n//# sourceMappingURL=_md.js.map","/**\n\nSHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.\nDon't use them in a new protocol. What \"weak\" means:\n\n- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.\n- No practical pre-image attacks (only theoretical, 2^123.4)\n- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151\n * @module\n */\nimport { Chi, HashMD, Maj } from \"./_md.js\";\nimport { clean, createHasher, rotl } from \"./utils.js\";\n/** Initial SHA1 state */\nconst SHA1_IV = /* @__PURE__ */ Uint32Array.from([\n 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,\n]);\n// Reusable temporary buffer\nconst SHA1_W = /* @__PURE__ */ new Uint32Array(80);\n/** Internal SHA1 legacy hash class. */\nexport class _SHA1 extends HashMD {\n A = SHA1_IV[0] | 0;\n B = SHA1_IV[1] | 0;\n C = SHA1_IV[2] | 0;\n D = SHA1_IV[3] | 0;\n E = SHA1_IV[4] | 0;\n constructor() {\n super(64, 20, 8, false);\n }\n get() {\n const { A, B, C, D, E } = this;\n return [A, B, C, D, E];\n }\n set(A, B, C, D, E) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n SHA1_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 80; i++)\n SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);\n // Compression function main loop, 80 rounds\n let { A, B, C, D, E } = this;\n for (let i = 0; i < 80; i++) {\n let F, K;\n if (i < 20) {\n F = Chi(B, C, D);\n K = 0x5a827999;\n }\n else if (i < 40) {\n F = B ^ C ^ D;\n K = 0x6ed9eba1;\n }\n else if (i < 60) {\n F = Maj(B, C, D);\n K = 0x8f1bbcdc;\n }\n else {\n F = B ^ C ^ D;\n K = 0xca62c1d6;\n }\n const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;\n E = D;\n D = C;\n C = rotl(B, 30);\n B = A;\n A = T;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n this.set(A, B, C, D, E);\n }\n roundClean() {\n clean(SHA1_W);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */\nexport const sha1 = /* @__PURE__ */ createHasher(() => new _SHA1());\n/** Per-round constants */\nconst p32 = /* @__PURE__ */ Math.pow(2, 32);\nconst K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) => Math.floor(p32 * Math.abs(Math.sin(i + 1))));\n/** md5 initial state: same as sha1, but 4 u32 instead of 5. */\nconst MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4);\n// Reusable temporary buffer\nconst MD5_W = /* @__PURE__ */ new Uint32Array(16);\n/** Internal MD5 legacy hash class. */\nexport class _MD5 extends HashMD {\n A = MD5_IV[0] | 0;\n B = MD5_IV[1] | 0;\n C = MD5_IV[2] | 0;\n D = MD5_IV[3] | 0;\n constructor() {\n super(64, 16, 8, true);\n }\n get() {\n const { A, B, C, D } = this;\n return [A, B, C, D];\n }\n set(A, B, C, D) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n MD5_W[i] = view.getUint32(offset, true);\n // Compression function main loop, 64 rounds\n let { A, B, C, D } = this;\n for (let i = 0; i < 64; i++) {\n let F, g, s;\n if (i < 16) {\n F = Chi(B, C, D);\n g = i;\n s = [7, 12, 17, 22];\n }\n else if (i < 32) {\n F = Chi(D, B, C);\n g = (5 * i + 1) % 16;\n s = [5, 9, 14, 20];\n }\n else if (i < 48) {\n F = B ^ C ^ D;\n g = (3 * i + 5) % 16;\n s = [4, 11, 16, 23];\n }\n else {\n F = C ^ (B | ~D);\n g = (7 * i) % 16;\n s = [6, 10, 15, 21];\n }\n F = F + A + K[i] + MD5_W[g];\n A = D;\n D = C;\n C = B;\n B = B + rotl(F, s[i % 4]);\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n this.set(A, B, C, D);\n }\n roundClean() {\n clean(MD5_W);\n }\n destroy() {\n this.set(0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/**\n * MD5 (RFC 1321) legacy hash function. It was cryptographically broken.\n * MD5 architecture is similar to SHA1, with some differences:\n * - Reduced output length: 16 bytes (128 bit) instead of 20\n * - 64 rounds, instead of 80\n * - Little-endian: could be faster, but will require more code\n * - Non-linear index selection: huge speed-up for unroll\n * - Per round constants: more memory accesses, additional speed-up for unroll\n */\nexport const md5 = /* @__PURE__ */ createHasher(() => new _MD5());\n// RIPEMD-160\nconst Rho160 = /* @__PURE__ */ Uint8Array.from([\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n]);\nconst Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();\nconst Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();\nconst idxLR = /* @__PURE__ */ (() => {\n const L = [Id160];\n const R = [Pi160];\n const res = [L, R];\n for (let i = 0; i < 4; i++)\n for (let j of res)\n j.push(j[i].map((k) => Rho160[k]));\n return res;\n})();\nconst idxL = /* @__PURE__ */ (() => idxLR[0])();\nconst idxR = /* @__PURE__ */ (() => idxLR[1])();\n// const [idxL, idxR] = idxLR;\nconst shifts160 = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => Uint8Array.from(i));\nconst shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));\nconst shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));\nconst Kl160 = /* @__PURE__ */ Uint32Array.from([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr160 = /* @__PURE__ */ Uint32Array.from([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// It's called f() in spec.\nfunction ripemd_f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n if (group === 1)\n return (x & y) | (~x & z);\n if (group === 2)\n return (x | ~y) ^ z;\n if (group === 3)\n return (x & z) | (y & ~z);\n return x ^ (y | ~z);\n}\n// Reusable temporary buffer\nconst BUF_160 = /* @__PURE__ */ new Uint32Array(16);\nexport class _RIPEMD160 extends HashMD {\n h0 = 0x67452301 | 0;\n h1 = 0xefcdab89 | 0;\n h2 = 0x98badcfe | 0;\n h3 = 0x10325476 | 0;\n h4 = 0xc3d2e1f0 | 0;\n constructor() {\n super(64, 20, 8, true);\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF_160[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n clean(BUF_160);\n }\n destroy() {\n this.destroyed = true;\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a legacy hash function from 1990s.\n * * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n * * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\n */\nexport const ripemd160 = /* @__PURE__ */ createHasher(() => new _RIPEMD160());\n//# sourceMappingURL=legacy.js.map","/**\n * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.\n * @todo re-check https://issues.chromium.org/issues/42212588\n * @module\n */\nconst U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n const len = lst.length;\n let Ah = new Uint32Array(len);\n let Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from \"./_md.js\";\nimport * as u64 from \"./_u64.js\";\nimport { clean, createHasher, oidNist, rotr } from \"./utils.js\";\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\n/** Internal 32-byte base SHA2 hash class. */\nclass SHA2_32B extends HashMD {\n constructor(outputLen) {\n super(64, outputLen, 8, false);\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** Internal SHA2-256 hash class. */\nexport class _SHA256 extends SHA2_32B {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n A = SHA256_IV[0] | 0;\n B = SHA256_IV[1] | 0;\n C = SHA256_IV[2] | 0;\n D = SHA256_IV[3] | 0;\n E = SHA256_IV[4] | 0;\n F = SHA256_IV[5] | 0;\n G = SHA256_IV[6] | 0;\n H = SHA256_IV[7] | 0;\n constructor() {\n super(32);\n }\n}\n/** Internal SHA2-224 hash class. */\nexport class _SHA224 extends SHA2_32B {\n A = SHA224_IV[0] | 0;\n B = SHA224_IV[1] | 0;\n C = SHA224_IV[2] | 0;\n D = SHA224_IV[3] | 0;\n E = SHA224_IV[4] | 0;\n F = SHA224_IV[5] | 0;\n G = SHA224_IV[6] | 0;\n H = SHA224_IV[7] | 0;\n constructor() {\n super(28);\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n/** Internal 64-byte base SHA2 hash class. */\nclass SHA2_64B extends HashMD {\n constructor(outputLen) {\n super(128, outputLen, 16, false);\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n/** Internal SHA2-512 hash class. */\nexport class _SHA512 extends SHA2_64B {\n Ah = SHA512_IV[0] | 0;\n Al = SHA512_IV[1] | 0;\n Bh = SHA512_IV[2] | 0;\n Bl = SHA512_IV[3] | 0;\n Ch = SHA512_IV[4] | 0;\n Cl = SHA512_IV[5] | 0;\n Dh = SHA512_IV[6] | 0;\n Dl = SHA512_IV[7] | 0;\n Eh = SHA512_IV[8] | 0;\n El = SHA512_IV[9] | 0;\n Fh = SHA512_IV[10] | 0;\n Fl = SHA512_IV[11] | 0;\n Gh = SHA512_IV[12] | 0;\n Gl = SHA512_IV[13] | 0;\n Hh = SHA512_IV[14] | 0;\n Hl = SHA512_IV[15] | 0;\n constructor() {\n super(64);\n }\n}\n/** Internal SHA2-384 hash class. */\nexport class _SHA384 extends SHA2_64B {\n Ah = SHA384_IV[0] | 0;\n Al = SHA384_IV[1] | 0;\n Bh = SHA384_IV[2] | 0;\n Bl = SHA384_IV[3] | 0;\n Ch = SHA384_IV[4] | 0;\n Cl = SHA384_IV[5] | 0;\n Dh = SHA384_IV[6] | 0;\n Dl = SHA384_IV[7] | 0;\n Eh = SHA384_IV[8] | 0;\n El = SHA384_IV[9] | 0;\n Fh = SHA384_IV[10] | 0;\n Fl = SHA384_IV[11] | 0;\n Gh = SHA384_IV[12] | 0;\n Gl = SHA384_IV[13] | 0;\n Hh = SHA384_IV[14] | 0;\n Hl = SHA384_IV[15] | 0;\n constructor() {\n super(48);\n }\n}\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See `test/misc/sha2-gen-iv.js`.\n */\n/** SHA512/224 IV */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n/** SHA512/256 IV */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n/** Internal SHA2-512/224 hash class. */\nexport class _SHA512_224 extends SHA2_64B {\n Ah = T224_IV[0] | 0;\n Al = T224_IV[1] | 0;\n Bh = T224_IV[2] | 0;\n Bl = T224_IV[3] | 0;\n Ch = T224_IV[4] | 0;\n Cl = T224_IV[5] | 0;\n Dh = T224_IV[6] | 0;\n Dl = T224_IV[7] | 0;\n Eh = T224_IV[8] | 0;\n El = T224_IV[9] | 0;\n Fh = T224_IV[10] | 0;\n Fl = T224_IV[11] | 0;\n Gh = T224_IV[12] | 0;\n Gl = T224_IV[13] | 0;\n Hh = T224_IV[14] | 0;\n Hl = T224_IV[15] | 0;\n constructor() {\n super(28);\n }\n}\n/** Internal SHA2-512/256 hash class. */\nexport class _SHA512_256 extends SHA2_64B {\n Ah = T256_IV[0] | 0;\n Al = T256_IV[1] | 0;\n Bh = T256_IV[2] | 0;\n Bl = T256_IV[3] | 0;\n Ch = T256_IV[4] | 0;\n Cl = T256_IV[5] | 0;\n Dh = T256_IV[6] | 0;\n Dl = T256_IV[7] | 0;\n Eh = T256_IV[8] | 0;\n El = T256_IV[9] | 0;\n Fh = T256_IV[10] | 0;\n Fl = T256_IV[11] | 0;\n Gh = T256_IV[12] | 0;\n Gl = T256_IV[13] | 0;\n Hh = T256_IV[14] | 0;\n Hl = T256_IV[15] | 0;\n constructor() {\n super(32);\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:\n *\n * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.\n * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n * - Each sha256 hash is executing 2^18 bit operations.\n * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), \n/* @__PURE__ */ oidNist(0x01));\n/** SHA2-224 hash function from RFC 4634 */\nexport const sha224 = /* @__PURE__ */ createHasher(() => new _SHA224(), \n/* @__PURE__ */ oidNist(0x04));\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), \n/* @__PURE__ */ oidNist(0x03));\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), \n/* @__PURE__ */ oidNist(0x02));\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_256 = /* @__PURE__ */ createHasher(() => new _SHA512_256(), \n/* @__PURE__ */ oidNist(0x06));\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_224 = /* @__PURE__ */ createHasher(() => new _SHA512_224(), \n/* @__PURE__ */ oidNist(0x05));\n//# sourceMappingURL=sha2.js.map","/**\n * SHA3 (keccak) hash function, based on a new \"Sponge function\" design.\n * Different from older hashes, the internal state is bigger than output size.\n *\n * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),\n * [Website](https://keccak.team/keccak.html),\n * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).\n *\n * Check out `sha3-addons` module for cSHAKE, k12, and others.\n * @module\n */\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from \"./_u64.js\";\n// prettier-ignore\nimport { abytes, aexists, anumber, aoutput, clean, createHasher, oidNist, swap32IfBE, u32 } from \"./utils.js\";\n// No __PURE__ annotations in sha3 header:\n// EVERYTHING is in fact used on every export.\n// Various per round constants calculations\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _7n = BigInt(7);\nconst _256n = BigInt(256);\nconst _0x71n = BigInt(0x71);\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = []; // no pure annotation: var is always used\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst IOTAS = split(_SHA3_IOTA, true);\nconst SHA3_IOTA_H = IOTAS[0];\nconst SHA3_IOTA_L = IOTAS[1];\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n/** `keccakf1600` internal function, additionally allows to adjust round count. */\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n clean(B);\n}\n/** Keccak sponge function. */\nexport class Keccak {\n state;\n pos = 0;\n posOut = 0;\n finished = false;\n state32;\n destroyed = false;\n blockLen;\n suffix;\n outputLen;\n enableXOF = false;\n rounds;\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n // Can be passed from user as dkLen\n anumber(outputLen, 'outputLen');\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n // 0 < blockLen < 200\n if (!(0 < blockLen && blockLen < 200))\n throw new Error('only keccak-f1600 function is supported');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n clone() {\n return this._cloneInto();\n }\n keccak() {\n swap32IfBE(this.state32);\n keccakP(this.state32, this.rounds);\n swap32IfBE(this.state32);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { blockLen, state } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n aexists(this, false);\n abytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n anumber(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n aoutput(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n clean(this.state);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);\n/** SHA3-224 hash function. */\nexport const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, \n/* @__PURE__ */ oidNist(0x07));\n/** SHA3-256 hash function. Different from keccak-256. */\nexport const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, \n/* @__PURE__ */ oidNist(0x08));\n/** SHA3-384 hash function. */\nexport const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, \n/* @__PURE__ */ oidNist(0x09));\n/** SHA3-512 hash function. */\nexport const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, \n/* @__PURE__ */ oidNist(0x0a));\n/** keccak-224 hash function. */\nexport const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28);\n/** keccak-256 hash function. Different from SHA3-256. */\nexport const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32);\n/** keccak-384 hash function. */\nexport const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48);\n/** keccak-512 hash function. */\nexport const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64);\nconst genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), info);\n/** SHAKE128 XOF with 128-bit security. */\nexport const shake128 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));\n/** SHAKE256 XOF with 256-bit security. */\nexport const shake256 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));\n/** SHAKE128 XOF with 256-bit output (NIST version). */\nexport const shake128_32 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));\n/** SHAKE256 XOF with 512-bit output (NIST version). */\nexport const shake256_64 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));\n//# sourceMappingURL=sha3.js.map","/**\n * \"globalThis\" ponyfill.\n * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)\n * @type {Object.}\n */\nconst globalScope = (() => {\n if (typeof globalThis === \"object\") return globalThis;\n else {\n Object.defineProperty(Object.prototype, \"__GLOBALTHIS__\", {\n get() {\n return this;\n },\n configurable: true,\n });\n try {\n // @ts-expect-error\n // eslint-disable-next-line no-undef\n if (typeof __GLOBALTHIS__ !== \"undefined\") return __GLOBALTHIS__;\n } finally {\n // @ts-expect-error\n delete Object.prototype.__GLOBALTHIS__;\n }\n }\n\n // Still unable to determine \"globalThis\", fall back to a naive method.\n if (typeof self !== \"undefined\") return self;\n else if (typeof window !== \"undefined\") return window;\n else if (typeof global !== \"undefined\") return global;\n\n return undefined;\n})();\n\nexport { globalScope };\n","import * as crypto from \"node:crypto\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha1 } from \"@noble/hashes/legacy.js\";\nimport { sha224, sha256, sha384, sha512 } from \"@noble/hashes/sha2.js\";\nimport { sha3_224, sha3_256, sha3_384, sha3_512 } from \"@noble/hashes/sha3.js\";\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * @noble/hashes hash functions.\n * @type {Object.}\n */\nconst nobleHashes = {\n SHA1: sha1,\n SHA224: sha224,\n SHA256: sha256,\n SHA384: sha384,\n SHA512: sha512,\n \"SHA3-224\": sha3_224,\n \"SHA3-256\": sha3_256,\n \"SHA3-384\": sha3_384,\n \"SHA3-512\": sha3_512,\n};\n\n/**\n * Canonicalizes a hash algorithm name.\n * @param {string} algorithm Hash algorithm name.\n * @returns {\"SHA1\"|\"SHA224\"|\"SHA256\"|\"SHA384\"|\"SHA512\"|\"SHA3-224\"|\"SHA3-256\"|\"SHA3-384\"|\"SHA3-512\"} Canonicalized hash algorithm name.\n */\nconst canonicalizeAlgorithm = (algorithm) => {\n switch (true) {\n case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):\n return \"SHA1\";\n case /^SHA(?:2?-)?224$/i.test(algorithm):\n return \"SHA224\";\n case /^SHA(?:2?-)?256$/i.test(algorithm):\n return \"SHA256\";\n case /^SHA(?:2?-)?384$/i.test(algorithm):\n return \"SHA384\";\n case /^SHA(?:2?-)?512$/i.test(algorithm):\n return \"SHA512\";\n case /^SHA3-224$/i.test(algorithm):\n return \"SHA3-224\";\n case /^SHA3-256$/i.test(algorithm):\n return \"SHA3-256\";\n case /^SHA3-384$/i.test(algorithm):\n return \"SHA3-384\";\n case /^SHA3-512$/i.test(algorithm):\n return \"SHA3-512\";\n default:\n throw new TypeError(`Unknown hash algorithm: ${algorithm}`);\n }\n};\n\n/**\n * Calculates an HMAC digest.\n * @param {string} algorithm Algorithm.\n * @param {Uint8Array} key Key.\n * @param {Uint8Array} message Message.\n * @returns {Uint8Array} Digest.\n */\nconst hmacDigest = (algorithm, key, message) => {\n if (crypto?.createHmac) {\n const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));\n hmac.update(globalScope.Buffer.from(message));\n return hmac.digest();\n } else if (hmac) {\n const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];\n return hmac(hash, key, message);\n } else {\n throw new Error(\"Missing HMAC function\");\n }\n};\n\nexport { canonicalizeAlgorithm, hmacDigest };\n","/**\n * RFC 4648 base32 alphabet without pad.\n * @type {string}\n */\nconst ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\n/**\n * Converts a base32 string to an Uint8Array (RFC 4648).\n * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)\n * @param {string} str Base32 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst base32Decode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n // Canonicalize to all upper case and remove padding if it exists.\n let end = str.length;\n while (str[end - 1] === \"=\") --end;\n str = (end < str.length ? str.substring(0, end) : str).toUpperCase();\n\n const buf = new ArrayBuffer(((str.length * 5) / 8) | 0);\n const arr = new Uint8Array(buf);\n let bits = 0;\n let value = 0;\n let index = 0;\n\n for (let i = 0; i < str.length; i++) {\n const idx = ALPHABET.indexOf(str[i]);\n if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);\n\n value = (value << 5) | idx;\n bits += 5;\n\n if (bits >= 8) {\n bits -= 8;\n arr[index++] = value >>> bits;\n }\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a base32 string (RFC 4648).\n * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Base32 string.\n */\nconst base32Encode = (arr) => {\n let bits = 0;\n let value = 0;\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n value = (value << 8) | arr[i];\n bits += 8;\n\n while (bits >= 5) {\n str += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n str += ALPHABET[(value << (5 - bits)) & 31];\n }\n\n return str;\n};\n\nexport { base32Decode, base32Encode };\n","/**\n * Converts a hexadecimal string to an Uint8Array.\n * @param {string} str Hexadecimal string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst hexDecode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n const buf = new ArrayBuffer(str.length / 2);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i += 2) {\n arr[i / 2] = parseInt(str.substring(i, i + 2), 16);\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a hexadecimal string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Hexadecimal string.\n */\nconst hexEncode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n const hex = arr[i].toString(16);\n if (hex.length === 1) str += \"0\";\n str += hex;\n }\n\n return str.toUpperCase();\n};\n\nexport { hexDecode, hexEncode };\n","/**\n * Converts a Latin-1 string to an Uint8Array.\n * @param {string} str Latin-1 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst latin1Decode = (str) => {\n const buf = new ArrayBuffer(str.length);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i) & 0xff;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a Latin-1 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Latin-1 string.\n */\nconst latin1Encode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n str += String.fromCharCode(arr[i]);\n }\n\n return str;\n};\n\nexport { latin1Decode, latin1Encode };\n","import { globalScope } from \"../global-scope.js\";\n\n/**\n * TextEncoder instance.\n * @type {TextEncoder|null}\n */\nconst ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;\n\n/**\n * TextDecoder instance.\n * @type {TextDecoder|null}\n */\nconst DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;\n\n/**\n * Converts an UTF-8 string to an Uint8Array.\n * @param {string} str String.\n * @returns {Uint8Array} Uint8Array.\n */\nconst utf8Decode = (str) => {\n if (!ENCODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return ENCODER.encode(str);\n};\n\n/**\n * Converts an Uint8Array to an UTF-8 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} String.\n */\nconst utf8Encode = (arr) => {\n if (!DECODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return DECODER.decode(arr);\n};\n\nexport { utf8Decode, utf8Encode };\n","import { base32Decode, base32Encode } from \"./internal/encoding/base32.js\";\nimport { hexDecode, hexEncode } from \"./internal/encoding/hex.js\";\nimport { latin1Decode, latin1Encode } from \"./internal/encoding/latin1.js\";\nimport { utf8Decode, utf8Encode } from \"./internal/encoding/utf8.js\";\nimport { randomBytes } from \"./internal/crypto/random-bytes.js\";\n\n/**\n * OTP secret key.\n */\nclass Secret {\n /**\n * Creates a secret key object.\n * @param {Object} [config] Configuration options.\n * @param {ArrayBufferLike} [config.buffer] Secret key buffer.\n * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.\n */\n constructor({ buffer, size = 20 } = {}) {\n /**\n * Secret key.\n * @type {Uint8Array}\n * @readonly\n */\n this.bytes = typeof buffer === \"undefined\" ? randomBytes(size) : new Uint8Array(buffer);\n\n // Prevent the \"bytes\" property from being modified.\n Object.defineProperty(this, \"bytes\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: this.bytes,\n });\n }\n\n /**\n * Converts a Latin-1 string to a Secret object.\n * @param {string} str Latin-1 string.\n * @returns {Secret} Secret object.\n */\n static fromLatin1(str) {\n return new Secret({ buffer: latin1Decode(str).buffer });\n }\n\n /**\n * Converts an UTF-8 string to a Secret object.\n * @param {string} str UTF-8 string.\n * @returns {Secret} Secret object.\n */\n static fromUTF8(str) {\n return new Secret({ buffer: utf8Decode(str).buffer });\n }\n\n /**\n * Converts a base32 string to a Secret object.\n * @param {string} str Base32 string.\n * @returns {Secret} Secret object.\n */\n static fromBase32(str) {\n return new Secret({ buffer: base32Decode(str).buffer });\n }\n\n /**\n * Converts a hexadecimal string to a Secret object.\n * @param {string} str Hexadecimal string.\n * @returns {Secret} Secret object.\n */\n static fromHex(str) {\n return new Secret({ buffer: hexDecode(str).buffer });\n }\n\n /**\n * Secret key buffer.\n * @deprecated For backward compatibility, the \"bytes\" property should be used instead.\n * @type {ArrayBufferLike}\n */\n get buffer() {\n return this.bytes.buffer;\n }\n\n /**\n * Latin-1 string representation of secret key.\n * @type {string}\n */\n get latin1() {\n Object.defineProperty(this, \"latin1\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: latin1Encode(this.bytes),\n });\n\n return this.latin1;\n }\n\n /**\n * UTF-8 string representation of secret key.\n * @type {string}\n */\n get utf8() {\n Object.defineProperty(this, \"utf8\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: utf8Encode(this.bytes),\n });\n\n return this.utf8;\n }\n\n /**\n * Base32 string representation of secret key.\n * @type {string}\n */\n get base32() {\n Object.defineProperty(this, \"base32\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: base32Encode(this.bytes),\n });\n\n return this.base32;\n }\n\n /**\n * Hexadecimal string representation of secret key.\n * @type {string}\n */\n get hex() {\n Object.defineProperty(this, \"hex\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: hexEncode(this.bytes),\n });\n\n return this.hex;\n }\n}\n\nexport { Secret };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns random bytes.\n * @param {number} size Size.\n * @returns {Uint8Array} Random bytes.\n */\nconst randomBytes = (size) => {\n if (crypto?.randomBytes) {\n return crypto.randomBytes(size);\n } else if (globalScope.crypto?.getRandomValues) {\n return globalScope.crypto.getRandomValues(new Uint8Array(size));\n } else {\n throw new Error(\"Cryptography API not available\");\n }\n};\n\nexport { randomBytes };\n","import { uintDecode } from \"./internal/encoding/uint.js\";\nimport { canonicalizeAlgorithm, hmacDigest } from \"./internal/crypto/hmac-digest.js\";\nimport { Secret } from \"./secret.js\";\nimport { timingSafeEqual } from \"./internal/crypto/timing-safe-equal.js\";\n\n/**\n * HOTP: An HMAC-based One-time Password Algorithm.\n * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)\n */\nclass HOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * counter: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n counter: 0,\n window: 1,\n };\n }\n\n /**\n * Creates an HOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Initial counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = HOTP.defaults.issuer,\n label = HOTP.defaults.label,\n issuerInLabel = HOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Initial counter value.\n * @type {number}\n */\n this.counter = counter;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({\n secret,\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac = hmacDigest,\n }) {\n const message = uintDecode(counter);\n const digest = hmac(algorithm, secret.bytes, message);\n if (!digest?.byteLength || digest.byteLength < 19) {\n throw new TypeError(\"Return value must be at least 19 bytes\");\n }\n const offset = digest[digest.byteLength - 1] & 15;\n const otp =\n (((digest[offset] & 127) << 24) |\n ((digest[offset + 1] & 255) << 16) |\n ((digest[offset + 2] & 255) << 8) |\n (digest[offset + 3] & 255)) %\n 10 ** digits;\n\n return otp.toString().padStart(digits, \"0\");\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.counter=this.counter++] Counter value.\n * @returns {string} Token.\n */\n generate({ counter = this.counter++ } = {}) {\n return HOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n window = HOTP.defaults.window,\n hmac = hmacDigest,\n }) {\n // Return early if the token length does not match the digit number.\n if (token.length !== digits) return null;\n\n let delta = null;\n\n const check = (/** @type {number} */ i) => {\n const generatedToken = HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: i,\n hmac,\n });\n if (timingSafeEqual(token, generatedToken)) {\n delta = i - counter;\n }\n };\n\n check(counter);\n for (let i = 1; i <= window && delta === null; ++i) {\n check(counter - i);\n if (delta !== null) break;\n check(counter + i);\n if (delta !== null) break;\n }\n\n return delta;\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.counter=this.counter] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, counter = this.counter, window }) {\n return HOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://hotp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `counter=${e(this.counter)}`\n );\n }\n}\n\nexport { HOTP };\n","/**\n * Converts an integer to an Uint8Array.\n * @param {number} num Integer.\n * @returns {Uint8Array} Uint8Array.\n */\nconst uintDecode = (num) => {\n const buf = new ArrayBuffer(8);\n const arr = new Uint8Array(buf);\n let acc = num;\n\n for (let i = 7; i >= 0; i--) {\n if (acc === 0) break;\n arr[i] = acc & 255;\n acc -= arr[i];\n acc /= 256;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to an integer.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {number} Integer.\n */\nconst uintEncode = (arr) => {\n let num = 0;\n\n for (let i = 0; i < arr.length; i++) {\n num *= 256;\n num += arr[i];\n }\n\n return num;\n};\n\nexport { uintDecode, uintEncode };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.\n * @param {string} a String a.\n * @param {string} b String b.\n * @returns {boolean} Equality result.\n */\nconst timingSafeEqual = (a, b) => {\n if (crypto?.timingSafeEqual) {\n return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));\n } else {\n if (a.length !== b.length) {\n throw new TypeError(\"Input strings must have the same length\");\n }\n let i = -1;\n let out = 0;\n while (++i < a.length) {\n out |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return out === 0;\n }\n};\n\nexport { timingSafeEqual };\n","import { canonicalizeAlgorithm } from \"./internal/crypto/hmac-digest.js\";\nimport { HOTP } from \"./hotp.js\";\nimport { Secret } from \"./secret.js\";\n\n/**\n * TOTP: Time-Based One-Time Password Algorithm.\n * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)\n */\nclass TOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * period: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n period: 30,\n window: 1,\n };\n }\n\n /**\n * Creates a TOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = TOTP.defaults.issuer,\n label = TOTP.defaults.label,\n issuerInLabel = TOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = TOTP.defaults.algorithm,\n digits = TOTP.defaults.digits,\n period = TOTP.defaults.period,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Token time-step duration.\n * @type {number}\n */\n this.period = period;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return Math.floor(timestamp / 1000 / period);\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n counter({ timestamp = Date.now() } = {}) {\n return TOTP.counter({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return period * 1000 - (timestamp % (period * 1000));\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n remaining({ timestamp = Date.now() } = {}) {\n return TOTP.remaining({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {\n return HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n hmac,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {string} Token.\n */\n generate({ timestamp = Date.now() } = {}) {\n return TOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits,\n period = TOTP.defaults.period,\n timestamp = Date.now(),\n window,\n hmac,\n }) {\n return HOTP.validate({\n token,\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n window,\n hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, timestamp, window }) {\n return TOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://totp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `period=${e(this.period)}`\n );\n }\n}\n\nexport { TOTP };\n","import { HOTP } from \"./hotp.js\";\nimport { TOTP } from \"./totp.js\";\n\n/**\n * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).\n * @type {RegExp}\n */\nconst OTPURI_REGEX = /^otpauth:\\/\\/([ht]otp)\\/(.+)\\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;\n\n/**\n * RFC 4648 base32 alphabet with pad.\n * @type {RegExp}\n */\nconst SECRET_REGEX = /^[2-7A-Z]+=*$/i;\n\n/**\n * Regex for supported algorithms in built-in HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;\n\n/**\n * Regex for custom algorithms in user-defined HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;\n\n/**\n * Integer regex.\n * @type {RegExp}\n */\nconst INTEGER_REGEX = /^[+-]?\\d+$/;\n\n/**\n * Positive integer regex.\n * @type {RegExp}\n */\nconst POSITIVE_INTEGER_REGEX = /^\\+?[1-9]\\d*$/;\n\n/**\n * HOTP/TOTP object/string conversion.\n * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)\n */\nclass URI {\n /**\n * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.\n * @param {string} uri Google Authenticator Key URI.\n * @param {Object} [config] Configuration options.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {HOTP|TOTP} HOTP/TOTP object.\n */\n static parse(uri, { hmac } = {}) {\n let uriGroups;\n\n try {\n uriGroups = uri.match(OTPURI_REGEX);\n // eslint-disable-next-line no-unused-vars\n } catch (_) {\n /* Handled below */\n }\n\n if (!Array.isArray(uriGroups)) {\n throw new URIError(\"Invalid URI format\");\n }\n\n // Extract URI groups.\n const uriType = uriGroups[1].toLowerCase();\n const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);\n /** @type {Object.} */\n const uriParams = uriGroups[3].split(\"&\").reduce((acc, cur) => {\n const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);\n const pairKey = pairArr[0].toLowerCase();\n const pairVal = pairArr[1];\n /** @type {Object.} */\n const pairAcc = acc;\n\n pairAcc[pairKey] = pairVal;\n return pairAcc;\n }, {});\n\n // 'OTP' will be instantiated with 'config' argument.\n let OTP;\n const config = {};\n\n if (uriType === \"hotp\") {\n OTP = HOTP;\n\n // Counter: required\n if (typeof uriParams.counter !== \"undefined\" && INTEGER_REGEX.test(uriParams.counter)) {\n config.counter = parseInt(uriParams.counter, 10);\n } else {\n throw new TypeError(\"Missing or invalid 'counter' parameter\");\n }\n } else if (uriType === \"totp\") {\n OTP = TOTP;\n\n // Period: optional\n if (typeof uriParams.period !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {\n config.period = parseInt(uriParams.period, 10);\n } else {\n throw new TypeError(\"Invalid 'period' parameter\");\n }\n }\n } else {\n throw new TypeError(\"Unknown OTP type\");\n }\n\n // Label: required\n // Issuer: optional\n if (typeof uriParams.issuer !== \"undefined\") {\n config.issuer = uriParams.issuer;\n }\n if (uriLabel.length === 2) {\n config.label = uriLabel[1];\n if (typeof config.issuer === \"undefined\" || config.issuer === \"\") {\n config.issuer = uriLabel[0];\n } else if (uriLabel[0] === \"\") {\n config.issuerInLabel = false;\n }\n } else {\n config.label = uriLabel[0];\n if (typeof config.issuer !== \"undefined\" && config.issuer !== \"\") {\n config.issuerInLabel = false;\n }\n }\n\n // Secret: required\n if (typeof uriParams.secret !== \"undefined\" && SECRET_REGEX.test(uriParams.secret)) {\n config.secret = uriParams.secret;\n } else {\n throw new TypeError(\"Missing or invalid 'secret' parameter\");\n }\n\n // Algorithm: optional\n if (typeof uriParams.algorithm !== \"undefined\") {\n if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {\n config.algorithm = uriParams.algorithm;\n } else {\n throw new TypeError(\"Invalid 'algorithm' parameter\");\n }\n }\n\n // Digits: optional\n if (typeof uriParams.digits !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {\n config.digits = parseInt(uriParams.digits, 10);\n } else {\n throw new TypeError(\"Invalid 'digits' parameter\");\n }\n }\n\n // HMAC: optional\n if (typeof hmac !== \"undefined\") {\n config.hmac = hmac;\n }\n\n return new OTP(config);\n }\n\n /**\n * Converts an HOTP/TOTP object to a Google Authenticator key URI.\n * @param {HOTP|TOTP} otp HOTP/TOTP object.\n * @returns {string} Google Authenticator Key URI.\n */\n static stringify(otp) {\n if (otp instanceof HOTP || otp instanceof TOTP) {\n return otp.toString();\n }\n\n throw new TypeError(\"Invalid 'HOTP/TOTP' object\");\n }\n}\n\nexport { URI };\n","/**\n * Library version.\n * @type {string}\n */\nconst version = \"__OTPAUTH_VERSION__\";\n\nexport { version };\n"],"names":["anumber","n","title","Number","isSafeInteger","Error","abytes","value","length","bytes","a","Uint8Array","ArrayBuffer","isView","constructor","name","len","needsLen","undefined","aexists","instance","checkFinished","destroyed","finished","aoutput","out","min","outputLen","clean","arrays","i","fill","createView","arr","DataView","buffer","byteOffset","byteLength","rotr","word","shift","rotl","byteSwap","swap32IfBE","Uint32Array","u","createHasher","hashCons","info","hashC","msg","opts","update","digest","tmp","blockLen","create","Object","assign","freeze","oidNist","suffix","oid","from","_HMAC","buf","this","iHash","digestInto","oHash","destroy","_cloneInto","to","getPrototypeOf","clone","hash","key","h","ahash","pad","set","hmac","message","Chi","b","c","Maj","HashMD","data","view","pos","take","Math","dataView","process","subarray","roundClean","isLE","padOffset","setBigUint64","BigInt","oview","outLen","state","get","setUint32","res","slice","SHA256_IV","SHA224_IV","SHA384_IV","SHA512_IV","SHA1_IV","SHA1_W","_SHA1","A","B","C","D","E","offset","getUint32","F","K","T","super","sha1","U32_MASK64","_32n","fromBig","le","l","split","lst","Ah","Al","shrSH","_l","s","shrSL","rotrSH","rotrSL","rotrBH","rotrBL","add","Bh","Bl","add3L","Cl","add3H","low","Ch","add4L","Dl","add4H","Dh","add5L","El","add5H","Eh","SHA256_K","SHA256_W","SHA2_32B","G","H","W15","W2","s0","s1","T1","T2","_SHA256","_SHA224","K512","u64.split","map","SHA512_Kh","SHA512_Kl","SHA512_W_H","SHA512_W_L","SHA2_64B","Fh","Fl","Gh","Gl","Hh","Hl","W15h","W15l","s0h","u64.rotrSH","u64.shrSH","s0l","u64.rotrSL","u64.shrSL","W2h","W2l","s1h","u64.rotrBH","s1l","u64.rotrBL","SUMl","u64.add4L","SUMh","u64.add4H","sigma1h","sigma1l","CHIh","T1ll","u64.add5L","T1h","u64.add5H","T1l","sigma0h","sigma0l","MAJh","MAJl","u64.add","All","u64.add3L","u64.add3H","_SHA512","_SHA384","sha256","sha224","sha512","sha384","_0n","_1n","_2n","_7n","_256n","_0x71n","SHA3_PI","SHA3_ROTL","_SHA3_IOTA","round","R","x","y","push","t","j","IOTAS","SHA3_IOTA_H","SHA3_IOTA_L","rotlH","rotlBH","rotlSH","rotlL","rotlBL","rotlSL","Keccak","keccak","state32","rounds","idx1","idx0","B0","B1","Th","Tl","curH","curL","PI","keccakP","posOut","finish","writeInto","bufferOut","xofInto","enableXOF","xof","floor","genKeccak","sha3_224","sha3_256","sha3_384","sha3_512","globalScope","globalThis","defineProperty","prototype","configurable","__GLOBALTHIS__","self","window","global","nobleHashes","SHA1","SHA224","SHA256","SHA384","SHA512","canonicalizeAlgorithm","algorithm","test","TypeError","hmacDigest","ALPHABET","base32Decode","str","end","replace","substring","toUpperCase","bits","index","idx","indexOf","base32Encode","hexDecode","parseInt","hexEncode","hex","toString","latin1Decode","charCodeAt","latin1Encode","String","fromCharCode","ENCODER","TextEncoder","DECODER","TextDecoder","utf8Decode","encode","utf8Encode","decode","Secret","fromLatin1","fromUTF8","fromBase32","fromHex","latin1","enumerable","writable","utf8","base32","size","crypto","getRandomValues","randomBytes","HOTP","defaults","issuer","label","issuerInLabel","digits","counter","generate","secret","num","acc","uintDecode","padStart","validate","token","delta","check","generatedToken","timingSafeEqual","e","encodeURIComponent","TOTP","period","timestamp","Date","now","remaining","OTPURI_REGEX","SECRET_REGEX","ALGORITHM_REGEX","ALGORITHM_CUSTOM_REGEX","INTEGER_REGEX","POSITIVE_INTEGER_REGEX","URI","parse","uri","uriGroups","match","_","Array","isArray","URIError","uriType","toLowerCase","uriLabel","decodeURIComponent","uriParams","reduce","cur","pairArr","pairKey","pairVal","pairAcc","OTP","config","stringify","otp","version"],"mappings":";;;;AAWM,SAAUA,EAAQC,EAAWC,EAAgB,IACjD,IAAKC,OAAOC,cAAcH,IAAMA,EAAI,EAElC,MAAM,IAAII,MAAM,GADDH,GAAS,IAAIA,mCAC2BD,IAE3D,CAGM,SAAUK,EAAOC,EAAmBC,EAAiBN,EAAgB,IACzE,MAAMO,GAdgBC,EAcAH,aAbFI,YAAcC,YAAaC,OAAOH,IAA6B,eAAvBA,EAAEI,YAAYC,KADtE,IAAkBL,EAetB,MAAMM,EAAMT,GAAOC,OACbS,OAAsBC,IAAXV,EACjB,IAAKC,GAASQ,GAAaD,I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6E,EAAUxB,OAAQ,GAI/C,CAGF,CAsBA,QAlBgC,IAArBwB,EAAU5C,SACnBoD,EAAOpD,OAAS4C,EAAU5C,QAEJ,IAApB0C,EAAS3X,QACXqY,EAAOnD,MAAQyC,EAAS,QACK,IAAlBU,EAAOpD,QAA4C,KAAlBoD,EAAOpD,OACjDoD,EAAOpD,OAAS0C,EAAS,GACA,KAAhBA,EAAS,KAClBU,EAAOlD,eAAgB,KAGzBkD,EAAOnD,MAAQyC,EAAS,QACK,IAAlBU,EAAOpD,QAA4C,KAAlBoD,EAAOpD,SACjDoD,EAAOlD,eAAgB,SAKK,IAArB0C,EAAUtC,SAA0BoB,GAAa3E,KAAK6F,EAAUtC,QAGzE,MAAM,IAAItD,UAAU,yCAItB,GANEoG,EAAO9C,OAASsC,EAAUtC;KAMO,IAAxBsC,EAAU9F,UAA2B,CAC9C,KAAKtN,EAAOoS,GAAyBD,IAAiB5E,KAAK6F,EAAU9F,WAGnE,MAAM,IAAIE,UAAU,iCAFpBoG,EAAOtG,UAAY8F,EAAU9F,SAIjC,CAGA,QAAgC,IAArB8F,EAAUzC,OAAwB,CAC3C,IAAI2B,GAAuB/E,KAAK6F,EAAUzC,QAGxC,MAAM,IAAInD,UAAU,8BAFpBoG,EAAOjD,OAASpC,SAAS6E,EAAUzC,OAAQ,GAI/C,CAOA,YAJoB,IAAT3Q,IACT4T,EAAO5T,KAAOA,GAGT,IAAI2T,EAAIC,EACjB,CAOA,gBAAOC,CAAUC,GACf,GAAIA,aAAexD,IAAQwD,aAAenC,GACxC,OAAOmC,EAAIpF,WAGb,MAAM,IAAIlB,UAAU,6BACtB,QCvKIuG,GAAU","x_google_ignoreList":[0,1,2,3,4,5,6]}
\ No newline at end of file
diff --git a/server/node_modules/otpauth/dist/otpauth.node.cjs b/server/node_modules/otpauth/dist/otpauth.node.cjs
new file mode 100644
index 0000000..ebee9db
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.cjs
@@ -0,0 +1,919 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+'use strict';
+
+var crypto = require('node:crypto');
+
+function _interopNamespaceDefault(e) {
+ var n = Object.create(null);
+ if (e) {
+ Object.keys(e).forEach(function (k) {
+ if (k !== 'default') {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () { return e[k]; }
+ });
+ }
+ });
+ }
+ n.default = e;
+ return Object.freeze(n);
+}
+
+var crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
+
+/**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+};
+
+/**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+})();
+
+/**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+};
+/**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ if (crypto__namespace?.createHmac) {
+ const hmac = crypto__namespace.createHmac(algorithm, globalScope.Buffer.from(key));
+ hmac.update(globalScope.Buffer.from(message));
+ return hmac.digest();
+ } else {
+ throw new Error("Missing HMAC function");
+ }
+};
+
+/**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+/**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+};
+
+/**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+};
+
+/**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+};
+
+/**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+/**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+/**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+};
+/**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+};
+
+/**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (crypto__namespace?.randomBytes) {
+ return crypto__namespace.randomBytes(size);
+ } else if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+};
+
+/**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+}
+
+/**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ if (crypto__namespace?.timingSafeEqual) {
+ return crypto__namespace.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));
+ } else {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+};
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+/**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+/**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+/**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+/**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+/**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
+ const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
+ const pairKey = pairArr[0].toLowerCase();
+ const pairVal = pairArr[1];
+ /** @type {Object.} */ const pairAcc = acc;
+ pairAcc[pairKey] = pairVal;
+ return pairAcc;
+ }, {});
+ // 'OTP' will be instantiated with 'config' argument.
+ let OTP;
+ const config = {};
+ if (uriType === "hotp") {
+ OTP = HOTP;
+ // Counter: required
+ if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
+ config.counter = parseInt(uriParams.counter, 10);
+ } else {
+ throw new TypeError("Missing or invalid 'counter' parameter");
+ }
+ } else if (uriType === "totp") {
+ OTP = TOTP;
+ // Period: optional
+ if (typeof uriParams.period !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
+ config.period = parseInt(uriParams.period, 10);
+ } else {
+ throw new TypeError("Invalid 'period' parameter");
+ }
+ }
+ } else {
+ throw new TypeError("Unknown OTP type");
+ }
+ // Label: required
+ // Issuer: optional
+ if (typeof uriParams.issuer !== "undefined") {
+ config.issuer = uriParams.issuer;
+ }
+ if (uriLabel.length === 2) {
+ config.label = uriLabel[1];
+ if (typeof config.issuer === "undefined" || config.issuer === "") {
+ config.issuer = uriLabel[0];
+ } else if (uriLabel[0] === "") {
+ config.issuerInLabel = false;
+ }
+ } else {
+ config.label = uriLabel[0];
+ if (typeof config.issuer !== "undefined" && config.issuer !== "") {
+ config.issuerInLabel = false;
+ }
+ }
+ // Secret: required
+ if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
+ config.secret = uriParams.secret;
+ } else {
+ throw new TypeError("Missing or invalid 'secret' parameter");
+ }
+ // Algorithm: optional
+ if (typeof uriParams.algorithm !== "undefined") {
+ if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
+ config.algorithm = uriParams.algorithm;
+ } else {
+ throw new TypeError("Invalid 'algorithm' parameter");
+ }
+ }
+ // Digits: optional
+ if (typeof uriParams.digits !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
+ config.digits = parseInt(uriParams.digits, 10);
+ } else {
+ throw new TypeError("Invalid 'digits' parameter");
+ }
+ }
+ // HMAC: optional
+ if (typeof hmac !== "undefined") {
+ config.hmac = hmac;
+ }
+ return new OTP(config);
+ }
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */ static stringify(otp) {
+ if (otp instanceof HOTP || otp instanceof TOTP) {
+ return otp.toString();
+ }
+ throw new TypeError("Invalid 'HOTP/TOTP' object");
+ }
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */ const version = "9.5.0";
+
+exports.HOTP = HOTP;
+exports.Secret = Secret;
+exports.TOTP = TOTP;
+exports.URI = URI;
+exports.version = version;
diff --git a/server/node_modules/otpauth/dist/otpauth.node.min.cjs b/server/node_modules/otpauth/dist/otpauth.node.min.cjs
new file mode 100644
index 0000000..b3dab53
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.min.cjs
@@ -0,0 +1,9 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+"use strict";function e(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var t=e(require("node:crypto"));const r=(()=>{if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"__GLOBALTHIS__",{get(){return this},configurable:!0});try{if("undefined"!=typeof __GLOBALTHIS__)return __GLOBALTHIS__}finally{delete Object.prototype.__GLOBALTHIS__}return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0})(),i=e=>{switch(!0){case/^(?:SHA-?1|SSL3-SHA1)$/i.test(e):return"SHA1";case/^SHA(?:2?-)?224$/i.test(e):return"SHA224";case/^SHA(?:2?-)?256$/i.test(e):return"SHA256";case/^SHA(?:2?-)?384$/i.test(e):return"SHA384";case/^SHA(?:2?-)?512$/i.test(e):return"SHA512";case/^SHA3-224$/i.test(e):return"SHA3-224";case/^SHA3-256$/i.test(e):return"SHA3-256";case/^SHA3-384$/i.test(e):return"SHA3-384";case/^SHA3-512$/i.test(e):return"SHA3-512";default:throw new TypeError(`Unknown hash algorithm: ${e}`)}},s=(e,i,s)=>{if(t?.createHmac){const n=t.createHmac(e,r.Buffer.from(i));return n.update(r.Buffer.from(s)),n.digest()}throw new Error("Missing HMAC function")},n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=e=>{let t=(e=e.replace(/ /g,"")).length;for(;"="===e[t-1];)--t;e=(t=8&&(s-=8,i[o++]=a>>>s)}return i},o=e=>{let t=0,r=0,i="";for(let s=0;s=5;)i+=n[r>>>t-5&31],t-=5;return t>0&&(i+=n[r<<5-t&31]),i},l=e=>{e=e.replace(/ /g,"");const t=new ArrayBuffer(e.length/2),r=new Uint8Array(t);for(let t=0;t{let t=""
+;for(let r=0;r{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t{let t="";for(let r=0;r{if(!d)throw new Error("Encoding API not available");return d.encode(e)},m=e=>{if(!f)throw new Error("Encoding API not available");return f.decode(e)};class p{static fromLatin1(e){return new p({buffer:h(e).buffer})}static fromUTF8(e){return new p({buffer:g(e).buffer})}static fromBase32(e){return new p({buffer:a(e).buffer})}static fromHex(e){return new p({buffer:l(e).buffer})}get buffer(){return this.bytes.buffer}get latin1(){return Object.defineProperty(this,"latin1",{enumerable:!0,writable:!1,configurable:!1,value:c(this.bytes)}),this.latin1}get utf8(){return Object.defineProperty(this,"utf8",{enumerable:!0,writable:!1,configurable:!1,value:m(this.bytes)}),this.utf8}get base32(){return Object.defineProperty(this,"base32",{enumerable:!0,writable:!1,configurable:!1,value:o(this.bytes)}),this.base32}get hex(){return Object.defineProperty(this,"hex",{enumerable:!0,writable:!1,configurable:!1,value:u(this.bytes)}),this.hex}constructor({buffer:e,size:i=20}={}){this.bytes=void 0===e?(e=>{if(t?.randomBytes)return t.randomBytes(e);if(r.crypto?.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(e));throw new Error("Cryptography API not available")})(i):new Uint8Array(e),Object.defineProperty(this,"bytes",{enumerable:!0,writable:!1,configurable:!1,value:this.bytes})}}class b{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,counter:0,window:1}}static generate({secret:e,algorithm:t=b.defaults.algorithm,digits:r=b.defaults.digits,counter:i=b.defaults.counter,hmac:n=s}){const a=(e=>{const t=new ArrayBuffer(8),r=new Uint8Array(t);let i=e;for(let e=7;e>=0&&0!==i;e--)r[e]=255&i,
+i-=r[e],i/=256;return r})(i),o=n(t,e.bytes,a);if(!o?.byteLength||o.byteLength<19)throw new TypeError("Return value must be at least 19 bytes");const l=15&o[o.byteLength-1];return(((127&o[l])<<24|(255&o[l+1])<<16|(255&o[l+2])<<8|255&o[l+3])%10**r).toString().padStart(r,"0")}generate({counter:e=this.counter++}={}){return b.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,counter:e,hmac:this.hmac})}static validate({token:e,secret:i,algorithm:n,digits:a=b.defaults.digits,counter:o=b.defaults.counter,window:l=b.defaults.window,hmac:u=s}){if(e.length!==a)return null;let h=null;const c=s=>{const l=b.generate({secret:i,algorithm:n,digits:a,counter:s,hmac:u});((e,i)=>{if(t?.timingSafeEqual)return t.timingSafeEqual(r.Buffer.from(e),r.Buffer.from(i));{if(e.length!==i.length)throw new TypeError("Input strings must have the same length");let t=-1,r=0;for(;++t0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`counter=${e(this.counter)}`}constructor({issuer:e=b.defaults.issuer,label:t=b.defaults.label,issuerInLabel:r=b.defaults.issuerInLabel,secret:s=new p,algorithm:n=b.defaults.algorithm,digits:a=b.defaults.digits,counter:o=b.defaults.counter,hmac:l}={}){this.issuer=e,this.label=t,this.issuerInLabel=r,this.secret="string"==typeof s?p.fromBase32(s):s,this.algorithm=l?n:i(n),this.digits=a,this.counter=o,this.hmac=l}}class w{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,
+algorithm:"SHA1",digits:6,period:30,window:1}}static counter({period:e=w.defaults.period,timestamp:t=Date.now()}={}){return Math.floor(t/1e3/e)}counter({timestamp:e=Date.now()}={}){return w.counter({period:this.period,timestamp:e})}static remaining({period:e=w.defaults.period,timestamp:t=Date.now()}={}){return 1e3*e-t%(1e3*e)}remaining({timestamp:e=Date.now()}={}){return w.remaining({period:this.period,timestamp:e})}static generate({secret:e,algorithm:t,digits:r,period:i=w.defaults.period,timestamp:s=Date.now(),hmac:n}){return b.generate({secret:e,algorithm:t,digits:r,counter:w.counter({period:i,timestamp:s}),hmac:n})}generate({timestamp:e=Date.now()}={}){return w.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:e,hmac:this.hmac})}static validate({token:e,secret:t,algorithm:r,digits:i,period:s=w.defaults.period,timestamp:n=Date.now(),window:a,hmac:o}){return b.validate({token:e,secret:t,algorithm:r,digits:i,counter:w.counter({period:s,timestamp:n}),window:a,hmac:o})}validate({token:e,timestamp:t,window:r}){return w.validate({token:e,secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:t,window:r,hmac:this.hmac})}toString(){const e=encodeURIComponent;return"otpauth://totp/"+(this.issuer.length>0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`period=${e(this.period)}`}constructor({issuer:e=w.defaults.issuer,label:t=w.defaults.label,issuerInLabel:r=w.defaults.issuerInLabel,secret:s=new p,algorithm:n=w.defaults.algorithm,digits:a=w.defaults.digits,period:o=w.defaults.period,hmac:l}={}){this.issuer=e,this.label=t,this.issuerInLabel=r,this.secret="string"==typeof s?p.fromBase32(s):s,this.algorithm=l?n:i(n),this.digits=a,this.period=o,this.hmac=l}}
+const y=/^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i,A=/^[2-7A-Z]+=*$/i,v=/^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i,S=/^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i,I=/^[+-]?\d+$/,$=/^\+?[1-9]\d*$/;exports.HOTP=b,exports.Secret=p,exports.TOTP=w,exports.URI=class{static parse(e,{hmac:t}={}){let r;try{r=e.match(y)}catch(e){}if(!Array.isArray(r))throw new URIError("Invalid URI format");const i=r[1].toLowerCase(),s=r[2].split(/(?::|%3A) *(.+)/i,2).map(decodeURIComponent),n=r[3].split("&").reduce((e,t)=>{const r=t.split(/=(.*)/,2).map(decodeURIComponent),i=r[0].toLowerCase(),s=r[1],n=e;return n[i]=s,n},{});let a;const o={};if("hotp"===i){if(a=b,void 0===n.counter||!I.test(n.counter))throw new TypeError("Missing or invalid 'counter' parameter");o.counter=parseInt(n.counter,10)}else{if("totp"!==i)throw new TypeError("Unknown OTP type");if(a=w,void 0!==n.period){if(!$.test(n.period))throw new TypeError("Invalid 'period' parameter");o.period=parseInt(n.period,10)}}if(void 0!==n.issuer&&(o.issuer=n.issuer),2===s.length?(o.label=s[1],void 0===o.issuer||""===o.issuer?o.issuer=s[0]:""===s[0]&&(o.issuerInLabel=!1)):(o.label=s[0],void 0!==o.issuer&&""!==o.issuer&&(o.issuerInLabel=!1)),void 0===n.secret||!A.test(n.secret))throw new TypeError("Missing or invalid 'secret' parameter");if(o.secret=n.secret,void 0!==n.algorithm){if(!(t?S:v).test(n.algorithm))throw new TypeError("Invalid 'algorithm' parameter");o.algorithm=n.algorithm}if(void 0!==n.digits){if(!$.test(n.digits))throw new TypeError("Invalid 'digits' parameter");o.digits=parseInt(n.digits,10)}return void 0!==t&&(o.hmac=t),new a(o)}static stringify(e){if(e instanceof b||e instanceof w)return e.toString();throw new TypeError("Invalid 'HOTP/TOTP' object")}},exports.version="9.5.0";
+//# sourceMappingURL=otpauth.node.min.cjs.map
diff --git a/server/node_modules/otpauth/dist/otpauth.node.min.cjs.map b/server/node_modules/otpauth/dist/otpauth.node.min.cjs.map
new file mode 100644
index 0000000..e3234ed
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.min.cjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"otpauth.node.min.cjs","sources":["../src/internal/encoding/uint.js","../src/internal/global-scope.js","../src/internal/crypto/hmac-digest.js","../src/internal/encoding/base32.js","../src/internal/encoding/hex.js","../src/internal/encoding/latin1.js","../src/internal/encoding/utf8.js","../src/secret.js","../src/internal/crypto/random-bytes.js","../src/hotp.js","../src/internal/crypto/timing-safe-equal.js","../src/totp.js","../src/uri.js","../src/version.js"],"sourcesContent":["/**\n * Converts an integer to an Uint8Array.\n * @param {number} num Integer.\n * @returns {Uint8Array} Uint8Array.\n */\nconst uintDecode = (num) => {\n const buf = new ArrayBuffer(8);\n const arr = new Uint8Array(buf);\n let acc = num;\n\n for (let i = 7; i >= 0; i--) {\n if (acc === 0) break;\n arr[i] = acc & 255;\n acc -= arr[i];\n acc /= 256;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to an integer.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {number} Integer.\n */\nconst uintEncode = (arr) => {\n let num = 0;\n\n for (let i = 0; i < arr.length; i++) {\n num *= 256;\n num += arr[i];\n }\n\n return num;\n};\n\nexport { uintDecode, uintEncode };\n","/**\n * \"globalThis\" ponyfill.\n * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)\n * @type {Object.}\n */\nconst globalScope = (() => {\n if (typeof globalThis === \"object\") return globalThis;\n else {\n Object.defineProperty(Object.prototype, \"__GLOBALTHIS__\", {\n get() {\n return this;\n },\n configurable: true,\n });\n try {\n // @ts-expect-error\n // eslint-disable-next-line no-undef\n if (typeof __GLOBALTHIS__ !== \"undefined\") return __GLOBALTHIS__;\n } finally {\n // @ts-expect-error\n delete Object.prototype.__GLOBALTHIS__;\n }\n }\n\n // Still unable to determine \"globalThis\", fall back to a naive method.\n if (typeof self !== \"undefined\") return self;\n else if (typeof window !== \"undefined\") return window;\n else if (typeof global !== \"undefined\") return global;\n\n return undefined;\n})();\n\nexport { globalScope };\n","import * as crypto from \"node:crypto\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha1 } from \"@noble/hashes/legacy.js\";\nimport { sha224, sha256, sha384, sha512 } from \"@noble/hashes/sha2.js\";\nimport { sha3_224, sha3_256, sha3_384, sha3_512 } from \"@noble/hashes/sha3.js\";\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * @noble/hashes hash functions.\n * @type {Object.}\n */\nconst nobleHashes = {\n SHA1: sha1,\n SHA224: sha224,\n SHA256: sha256,\n SHA384: sha384,\n SHA512: sha512,\n \"SHA3-224\": sha3_224,\n \"SHA3-256\": sha3_256,\n \"SHA3-384\": sha3_384,\n \"SHA3-512\": sha3_512,\n};\n\n/**\n * Canonicalizes a hash algorithm name.\n * @param {string} algorithm Hash algorithm name.\n * @returns {\"SHA1\"|\"SHA224\"|\"SHA256\"|\"SHA384\"|\"SHA512\"|\"SHA3-224\"|\"SHA3-256\"|\"SHA3-384\"|\"SHA3-512\"} Canonicalized hash algorithm name.\n */\nconst canonicalizeAlgorithm = (algorithm) => {\n switch (true) {\n case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):\n return \"SHA1\";\n case /^SHA(?:2?-)?224$/i.test(algorithm):\n return \"SHA224\";\n case /^SHA(?:2?-)?256$/i.test(algorithm):\n return \"SHA256\";\n case /^SHA(?:2?-)?384$/i.test(algorithm):\n return \"SHA384\";\n case /^SHA(?:2?-)?512$/i.test(algorithm):\n return \"SHA512\";\n case /^SHA3-224$/i.test(algorithm):\n return \"SHA3-224\";\n case /^SHA3-256$/i.test(algorithm):\n return \"SHA3-256\";\n case /^SHA3-384$/i.test(algorithm):\n return \"SHA3-384\";\n case /^SHA3-512$/i.test(algorithm):\n return \"SHA3-512\";\n default:\n throw new TypeError(`Unknown hash algorithm: ${algorithm}`);\n }\n};\n\n/**\n * Calculates an HMAC digest.\n * @param {string} algorithm Algorithm.\n * @param {Uint8Array} key Key.\n * @param {Uint8Array} message Message.\n * @returns {Uint8Array} Digest.\n */\nconst hmacDigest = (algorithm, key, message) => {\n if (crypto?.createHmac) {\n const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));\n hmac.update(globalScope.Buffer.from(message));\n return hmac.digest();\n } else if (hmac) {\n const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];\n return hmac(hash, key, message);\n } else {\n throw new Error(\"Missing HMAC function\");\n }\n};\n\nexport { canonicalizeAlgorithm, hmacDigest };\n","/**\n * RFC 4648 base32 alphabet without pad.\n * @type {string}\n */\nconst ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\n/**\n * Converts a base32 string to an Uint8Array (RFC 4648).\n * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)\n * @param {string} str Base32 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst base32Decode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n // Canonicalize to all upper case and remove padding if it exists.\n let end = str.length;\n while (str[end - 1] === \"=\") --end;\n str = (end < str.length ? str.substring(0, end) : str).toUpperCase();\n\n const buf = new ArrayBuffer(((str.length * 5) / 8) | 0);\n const arr = new Uint8Array(buf);\n let bits = 0;\n let value = 0;\n let index = 0;\n\n for (let i = 0; i < str.length; i++) {\n const idx = ALPHABET.indexOf(str[i]);\n if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);\n\n value = (value << 5) | idx;\n bits += 5;\n\n if (bits >= 8) {\n bits -= 8;\n arr[index++] = value >>> bits;\n }\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a base32 string (RFC 4648).\n * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Base32 string.\n */\nconst base32Encode = (arr) => {\n let bits = 0;\n let value = 0;\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n value = (value << 8) | arr[i];\n bits += 8;\n\n while (bits >= 5) {\n str += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n str += ALPHABET[(value << (5 - bits)) & 31];\n }\n\n return str;\n};\n\nexport { base32Decode, base32Encode };\n","/**\n * Converts a hexadecimal string to an Uint8Array.\n * @param {string} str Hexadecimal string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst hexDecode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n const buf = new ArrayBuffer(str.length / 2);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i += 2) {\n arr[i / 2] = parseInt(str.substring(i, i + 2), 16);\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a hexadecimal string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Hexadecimal string.\n */\nconst hexEncode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n const hex = arr[i].toString(16);\n if (hex.length === 1) str += \"0\";\n str += hex;\n }\n\n return str.toUpperCase();\n};\n\nexport { hexDecode, hexEncode };\n","/**\n * Converts a Latin-1 string to an Uint8Array.\n * @param {string} str Latin-1 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst latin1Decode = (str) => {\n const buf = new ArrayBuffer(str.length);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i) & 0xff;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a Latin-1 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Latin-1 string.\n */\nconst latin1Encode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n str += String.fromCharCode(arr[i]);\n }\n\n return str;\n};\n\nexport { latin1Decode, latin1Encode };\n","import { globalScope } from \"../global-scope.js\";\n\n/**\n * TextEncoder instance.\n * @type {TextEncoder|null}\n */\nconst ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;\n\n/**\n * TextDecoder instance.\n * @type {TextDecoder|null}\n */\nconst DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;\n\n/**\n * Converts an UTF-8 string to an Uint8Array.\n * @param {string} str String.\n * @returns {Uint8Array} Uint8Array.\n */\nconst utf8Decode = (str) => {\n if (!ENCODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return ENCODER.encode(str);\n};\n\n/**\n * Converts an Uint8Array to an UTF-8 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} String.\n */\nconst utf8Encode = (arr) => {\n if (!DECODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return DECODER.decode(arr);\n};\n\nexport { utf8Decode, utf8Encode };\n","import { base32Decode, base32Encode } from \"./internal/encoding/base32.js\";\nimport { hexDecode, hexEncode } from \"./internal/encoding/hex.js\";\nimport { latin1Decode, latin1Encode } from \"./internal/encoding/latin1.js\";\nimport { utf8Decode, utf8Encode } from \"./internal/encoding/utf8.js\";\nimport { randomBytes } from \"./internal/crypto/random-bytes.js\";\n\n/**\n * OTP secret key.\n */\nclass Secret {\n /**\n * Creates a secret key object.\n * @param {Object} [config] Configuration options.\n * @param {ArrayBufferLike} [config.buffer] Secret key buffer.\n * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.\n */\n constructor({ buffer, size = 20 } = {}) {\n /**\n * Secret key.\n * @type {Uint8Array}\n * @readonly\n */\n this.bytes = typeof buffer === \"undefined\" ? randomBytes(size) : new Uint8Array(buffer);\n\n // Prevent the \"bytes\" property from being modified.\n Object.defineProperty(this, \"bytes\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: this.bytes,\n });\n }\n\n /**\n * Converts a Latin-1 string to a Secret object.\n * @param {string} str Latin-1 string.\n * @returns {Secret} Secret object.\n */\n static fromLatin1(str) {\n return new Secret({ buffer: latin1Decode(str).buffer });\n }\n\n /**\n * Converts an UTF-8 string to a Secret object.\n * @param {string} str UTF-8 string.\n * @returns {Secret} Secret object.\n */\n static fromUTF8(str) {\n return new Secret({ buffer: utf8Decode(str).buffer });\n }\n\n /**\n * Converts a base32 string to a Secret object.\n * @param {string} str Base32 string.\n * @returns {Secret} Secret object.\n */\n static fromBase32(str) {\n return new Secret({ buffer: base32Decode(str).buffer });\n }\n\n /**\n * Converts a hexadecimal string to a Secret object.\n * @param {string} str Hexadecimal string.\n * @returns {Secret} Secret object.\n */\n static fromHex(str) {\n return new Secret({ buffer: hexDecode(str).buffer });\n }\n\n /**\n * Secret key buffer.\n * @deprecated For backward compatibility, the \"bytes\" property should be used instead.\n * @type {ArrayBufferLike}\n */\n get buffer() {\n return this.bytes.buffer;\n }\n\n /**\n * Latin-1 string representation of secret key.\n * @type {string}\n */\n get latin1() {\n Object.defineProperty(this, \"latin1\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: latin1Encode(this.bytes),\n });\n\n return this.latin1;\n }\n\n /**\n * UTF-8 string representation of secret key.\n * @type {string}\n */\n get utf8() {\n Object.defineProperty(this, \"utf8\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: utf8Encode(this.bytes),\n });\n\n return this.utf8;\n }\n\n /**\n * Base32 string representation of secret key.\n * @type {string}\n */\n get base32() {\n Object.defineProperty(this, \"base32\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: base32Encode(this.bytes),\n });\n\n return this.base32;\n }\n\n /**\n * Hexadecimal string representation of secret key.\n * @type {string}\n */\n get hex() {\n Object.defineProperty(this, \"hex\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: hexEncode(this.bytes),\n });\n\n return this.hex;\n }\n}\n\nexport { Secret };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns random bytes.\n * @param {number} size Size.\n * @returns {Uint8Array} Random bytes.\n */\nconst randomBytes = (size) => {\n if (crypto?.randomBytes) {\n return crypto.randomBytes(size);\n } else if (globalScope.crypto?.getRandomValues) {\n return globalScope.crypto.getRandomValues(new Uint8Array(size));\n } else {\n throw new Error(\"Cryptography API not available\");\n }\n};\n\nexport { randomBytes };\n","import { uintDecode } from \"./internal/encoding/uint.js\";\nimport { canonicalizeAlgorithm, hmacDigest } from \"./internal/crypto/hmac-digest.js\";\nimport { Secret } from \"./secret.js\";\nimport { timingSafeEqual } from \"./internal/crypto/timing-safe-equal.js\";\n\n/**\n * HOTP: An HMAC-based One-time Password Algorithm.\n * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)\n */\nclass HOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * counter: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n counter: 0,\n window: 1,\n };\n }\n\n /**\n * Creates an HOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Initial counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = HOTP.defaults.issuer,\n label = HOTP.defaults.label,\n issuerInLabel = HOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Initial counter value.\n * @type {number}\n */\n this.counter = counter;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({\n secret,\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac = hmacDigest,\n }) {\n const message = uintDecode(counter);\n const digest = hmac(algorithm, secret.bytes, message);\n if (!digest?.byteLength || digest.byteLength < 19) {\n throw new TypeError(\"Return value must be at least 19 bytes\");\n }\n const offset = digest[digest.byteLength - 1] & 15;\n const otp =\n (((digest[offset] & 127) << 24) |\n ((digest[offset + 1] & 255) << 16) |\n ((digest[offset + 2] & 255) << 8) |\n (digest[offset + 3] & 255)) %\n 10 ** digits;\n\n return otp.toString().padStart(digits, \"0\");\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.counter=this.counter++] Counter value.\n * @returns {string} Token.\n */\n generate({ counter = this.counter++ } = {}) {\n return HOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n window = HOTP.defaults.window,\n hmac = hmacDigest,\n }) {\n // Return early if the token length does not match the digit number.\n if (token.length !== digits) return null;\n\n let delta = null;\n\n const check = (/** @type {number} */ i) => {\n const generatedToken = HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: i,\n hmac,\n });\n if (timingSafeEqual(token, generatedToken)) {\n delta = i - counter;\n }\n };\n\n check(counter);\n for (let i = 1; i <= window && delta === null; ++i) {\n check(counter - i);\n if (delta !== null) break;\n check(counter + i);\n if (delta !== null) break;\n }\n\n return delta;\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.counter=this.counter] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, counter = this.counter, window }) {\n return HOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://hotp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `counter=${e(this.counter)}`\n );\n }\n}\n\nexport { HOTP };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.\n * @param {string} a String a.\n * @param {string} b String b.\n * @returns {boolean} Equality result.\n */\nconst timingSafeEqual = (a, b) => {\n if (crypto?.timingSafeEqual) {\n return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));\n } else {\n if (a.length !== b.length) {\n throw new TypeError(\"Input strings must have the same length\");\n }\n let i = -1;\n let out = 0;\n while (++i < a.length) {\n out |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return out === 0;\n }\n};\n\nexport { timingSafeEqual };\n","import { canonicalizeAlgorithm } from \"./internal/crypto/hmac-digest.js\";\nimport { HOTP } from \"./hotp.js\";\nimport { Secret } from \"./secret.js\";\n\n/**\n * TOTP: Time-Based One-Time Password Algorithm.\n * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)\n */\nclass TOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * period: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n period: 30,\n window: 1,\n };\n }\n\n /**\n * Creates a TOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = TOTP.defaults.issuer,\n label = TOTP.defaults.label,\n issuerInLabel = TOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = TOTP.defaults.algorithm,\n digits = TOTP.defaults.digits,\n period = TOTP.defaults.period,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Token time-step duration.\n * @type {number}\n */\n this.period = period;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return Math.floor(timestamp / 1000 / period);\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n counter({ timestamp = Date.now() } = {}) {\n return TOTP.counter({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return period * 1000 - (timestamp % (period * 1000));\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n remaining({ timestamp = Date.now() } = {}) {\n return TOTP.remaining({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {\n return HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n hmac,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {string} Token.\n */\n generate({ timestamp = Date.now() } = {}) {\n return TOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits,\n period = TOTP.defaults.period,\n timestamp = Date.now(),\n window,\n hmac,\n }) {\n return HOTP.validate({\n token,\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n window,\n hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, timestamp, window }) {\n return TOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://totp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `period=${e(this.period)}`\n );\n }\n}\n\nexport { TOTP };\n","import { HOTP } from \"./hotp.js\";\nimport { TOTP } from \"./totp.js\";\n\n/**\n * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).\n * @type {RegExp}\n */\nconst OTPURI_REGEX = /^otpauth:\\/\\/([ht]otp)\\/(.+)\\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;\n\n/**\n * RFC 4648 base32 alphabet with pad.\n * @type {RegExp}\n */\nconst SECRET_REGEX = /^[2-7A-Z]+=*$/i;\n\n/**\n * Regex for supported algorithms in built-in HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;\n\n/**\n * Regex for custom algorithms in user-defined HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;\n\n/**\n * Integer regex.\n * @type {RegExp}\n */\nconst INTEGER_REGEX = /^[+-]?\\d+$/;\n\n/**\n * Positive integer regex.\n * @type {RegExp}\n */\nconst POSITIVE_INTEGER_REGEX = /^\\+?[1-9]\\d*$/;\n\n/**\n * HOTP/TOTP object/string conversion.\n * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)\n */\nclass URI {\n /**\n * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.\n * @param {string} uri Google Authenticator Key URI.\n * @param {Object} [config] Configuration options.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {HOTP|TOTP} HOTP/TOTP object.\n */\n static parse(uri, { hmac } = {}) {\n let uriGroups;\n\n try {\n uriGroups = uri.match(OTPURI_REGEX);\n // eslint-disable-next-line no-unused-vars\n } catch (_) {\n /* Handled below */\n }\n\n if (!Array.isArray(uriGroups)) {\n throw new URIError(\"Invalid URI format\");\n }\n\n // Extract URI groups.\n const uriType = uriGroups[1].toLowerCase();\n const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);\n /** @type {Object.} */\n const uriParams = uriGroups[3].split(\"&\").reduce((acc, cur) => {\n const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);\n const pairKey = pairArr[0].toLowerCase();\n const pairVal = pairArr[1];\n /** @type {Object.} */\n const pairAcc = acc;\n\n pairAcc[pairKey] = pairVal;\n return pairAcc;\n }, {});\n\n // 'OTP' will be instantiated with 'config' argument.\n let OTP;\n const config = {};\n\n if (uriType === \"hotp\") {\n OTP = HOTP;\n\n // Counter: required\n if (typeof uriParams.counter !== \"undefined\" && INTEGER_REGEX.test(uriParams.counter)) {\n config.counter = parseInt(uriParams.counter, 10);\n } else {\n throw new TypeError(\"Missing or invalid 'counter' parameter\");\n }\n } else if (uriType === \"totp\") {\n OTP = TOTP;\n\n // Period: optional\n if (typeof uriParams.period !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {\n config.period = parseInt(uriParams.period, 10);\n } else {\n throw new TypeError(\"Invalid 'period' parameter\");\n }\n }\n } else {\n throw new TypeError(\"Unknown OTP type\");\n }\n\n // Label: required\n // Issuer: optional\n if (typeof uriParams.issuer !== \"undefined\") {\n config.issuer = uriParams.issuer;\n }\n if (uriLabel.length === 2) {\n config.label = uriLabel[1];\n if (typeof config.issuer === \"undefined\" || config.issuer === \"\") {\n config.issuer = uriLabel[0];\n } else if (uriLabel[0] === \"\") {\n config.issuerInLabel = false;\n }\n } else {\n config.label = uriLabel[0];\n if (typeof config.issuer !== \"undefined\" && config.issuer !== \"\") {\n config.issuerInLabel = false;\n }\n }\n\n // Secret: required\n if (typeof uriParams.secret !== \"undefined\" && SECRET_REGEX.test(uriParams.secret)) {\n config.secret = uriParams.secret;\n } else {\n throw new TypeError(\"Missing or invalid 'secret' parameter\");\n }\n\n // Algorithm: optional\n if (typeof uriParams.algorithm !== \"undefined\") {\n if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {\n config.algorithm = uriParams.algorithm;\n } else {\n throw new TypeError(\"Invalid 'algorithm' parameter\");\n }\n }\n\n // Digits: optional\n if (typeof uriParams.digits !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {\n config.digits = parseInt(uriParams.digits, 10);\n } else {\n throw new TypeError(\"Invalid 'digits' parameter\");\n }\n }\n\n // HMAC: optional\n if (typeof hmac !== \"undefined\") {\n config.hmac = hmac;\n }\n\n return new OTP(config);\n }\n\n /**\n * Converts an HOTP/TOTP object to a Google Authenticator key URI.\n * @param {HOTP|TOTP} otp HOTP/TOTP object.\n * @returns {string} Google Authenticator Key URI.\n */\n static stringify(otp) {\n if (otp instanceof HOTP || otp instanceof TOTP) {\n return otp.toString();\n }\n\n throw new TypeError(\"Invalid 'HOTP/TOTP' object\");\n }\n}\n\nexport { URI };\n","/**\n * Library version.\n * @type {string}\n */\nconst version = \"__OTPAUTH_VERSION__\";\n\nexport { version };\n"],"names":["globalScope","globalThis","Object","defineProperty","prototype","get","this","configurable","__GLOBALTHIS__","self","window","global","canonicalizeAlgorithm","algorithm","test","TypeError","hmacDigest","key","message","crypto","createHmac","hmac","Buffer","from","update","digest","Error","ALPHABET","base32Decode","str","end","replace","length","substring","toUpperCase","buf","ArrayBuffer","arr","Uint8Array","bits","value","index","i","idx","indexOf","base32Encode","hexDecode","parseInt","hexEncode","hex","toString","latin1Decode","charCodeAt","latin1Encode","String","fromCharCode","ENCODER","TextEncoder","DECODER","TextDecoder","utf8Decode","encode","utf8Encode","decode","Secret","fromLatin1","buffer","fromUTF8","fromBase32","fromHex","bytes","latin1","enumerable","writable","utf8","base32","constructor","size","randomBytes","getRandomValues","HOTP","defaults","issuer","label","issuerInLabel","digits","counter","generate","secret","num","acc","uintDecode","byteLength","offset","padStart","validate","token","delta","check","generatedToken","a","b","timingSafeEqual","out","e","encodeURIComponent","TOTP","period","timestamp","Date","now","Math","floor","remaining","OTPURI_REGEX","SECRET_REGEX","ALGORITHM_REGEX","ALGORITHM_CUSTOM_REGEX","INTEGER_REGEX","POSITIVE_INTEGER_REGEX","parse","uri","uriGroups","match","_","Array","isArray","URIError","uriType","toLowerCase","uriLabel","split","map","decodeURIComponent","uriParams","reduce","cur","pairArr","pairKey","pairVal","pairAcc","OTP","config","stringify","otp"],"mappings":";;;8SAKA,MCAMA,EAAe,MACnB,GAA0B,iBAAfC,WAAyB,OAAOA,WAEzCC,OAAOC,eAAeD,OAAOE,UAAW,iBAAkB,CACx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B,OAAwB,CAC3C,IAAIY,EAAuBzG,KAAKwH,EAAU3B,QAGxC,MAAM,IAAI5F,UAAU,8BAFpB+H,EAAOnC,OAAS5D,SAASuF,EAAU3B,OAAQ,GAI/C,CAGF,CAsBA,QAlBgC,IAArB2B,EAAUpD,SACnB4D,EAAO5D,OAASoD,EAAUpD,QAEJ,IAApBgD,EAASlG,QACX8G,EAAO3D,MAAQ+C,EAAS,QACK,IAAlBY,EAAO5D,QAA4C,KAAlB4D,EAAO5D,OACjD4D,EAAO5D,OAASgD,EAAS,GACA,KAAhBA,EAAS,KAClBY,EAAO1D,eAAgB,KAGzB0D,EAAO3D,MAAQ+C,EAAS,QACK,IAAlBY,EAAO5D,QAA4C,KAAlB4D,EAAO5D,SACjD4D,EAAO1D,eAAgB,SAKK,IAArBkD,EAAU9C,SAA0B2B,EAAarG,KAAKwH,EAAU9C,QAGzE,MAAM,IAAIzE,UAAU,yCAItB,GANE+H,EAAOtD,OAAS8C,EAAU9C,YAMO,IAAxB8C,EAAUzH,UAA2B,CAC9C,KAAKQ,EAAOgG,EAAyBD,GAAiBtG,KAAKwH,EAAUzH,WAGnE,MAAM,IAAIE,UAAU,iCAFpB+H,EAAOjI,UAAYyH,EAAUzH,SAIjC,CAGA,QAAgC,IAArByH,EAAUjD,OAAwB,CAC3C,IAAIkC,EAAuBzG,KAAKwH,EAAUjD,QAGxC,MAAM,IAAItE,UAAU,8BAFpB+H,EAAOzD,OAAStC,SAASuF,EAAUjD,OAAQ,GAI/C,CAOA,YAJoB,IAAThE,IACTyH,EAAOzH,KAAOA,GAGT,IAAIwH,EAAIC,EACjB,CAOA,gBAAOC,CAAUC,GACf,GAAIA,aAAehE,GAAQgE,aAAetC,EACxC,OAAOsC,EAAI9F,WAGb,MAAM,IAAInC,UAAU,6BACtB,mBCvKc"}
\ No newline at end of file
diff --git a/server/node_modules/otpauth/dist/otpauth.node.min.mjs b/server/node_modules/otpauth/dist/otpauth.node.min.mjs
new file mode 100644
index 0000000..56505e5
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.min.mjs
@@ -0,0 +1,9 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+import*as e from"node:crypto";const t=(()=>{if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"__GLOBALTHIS__",{get(){return this},configurable:!0});try{if("undefined"!=typeof __GLOBALTHIS__)return __GLOBALTHIS__}finally{delete Object.prototype.__GLOBALTHIS__}return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0})(),r=e=>{switch(!0){case/^(?:SHA-?1|SSL3-SHA1)$/i.test(e):return"SHA1";case/^SHA(?:2?-)?224$/i.test(e):return"SHA224";case/^SHA(?:2?-)?256$/i.test(e):return"SHA256";case/^SHA(?:2?-)?384$/i.test(e):return"SHA384";case/^SHA(?:2?-)?512$/i.test(e):return"SHA512";case/^SHA3-224$/i.test(e):return"SHA3-224";case/^SHA3-256$/i.test(e):return"SHA3-256";case/^SHA3-384$/i.test(e):return"SHA3-384";case/^SHA3-512$/i.test(e):return"SHA3-512";default:throw new TypeError(`Unknown hash algorithm: ${e}`)}},i=(r,i,s)=>{if(e?.createHmac){const n=e.createHmac(r,t.Buffer.from(i));return n.update(t.Buffer.from(s)),n.digest()}throw new Error("Missing HMAC function")},s="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=e=>{let t=(e=e.replace(/ /g,"")).length;for(;"="===e[t-1];)--t;e=(t=8&&(n-=8,i[o++]=a>>>n)}return i},a=e=>{let t=0,r=0,i="";for(let n=0;n=5;)i+=s[r>>>t-5&31],t-=5;return t>0&&(i+=s[r<<5-t&31]),i},o=e=>{e=e.replace(/ /g,"");const t=new ArrayBuffer(e.length/2),r=new Uint8Array(t);for(let t=0;t{let t="";for(let r=0;r{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t{let t=""
+;for(let r=0;r{if(!c)throw new Error("Encoding API not available");return c.encode(e)},g=e=>{if(!d)throw new Error("Encoding API not available");return d.decode(e)};class m{static fromLatin1(e){return new m({buffer:u(e).buffer})}static fromUTF8(e){return new m({buffer:f(e).buffer})}static fromBase32(e){return new m({buffer:n(e).buffer})}static fromHex(e){return new m({buffer:o(e).buffer})}get buffer(){return this.bytes.buffer}get latin1(){return Object.defineProperty(this,"latin1",{enumerable:!0,writable:!1,configurable:!1,value:h(this.bytes)}),this.latin1}get utf8(){return Object.defineProperty(this,"utf8",{enumerable:!0,writable:!1,configurable:!1,value:g(this.bytes)}),this.utf8}get base32(){return Object.defineProperty(this,"base32",{enumerable:!0,writable:!1,configurable:!1,value:a(this.bytes)}),this.base32}get hex(){return Object.defineProperty(this,"hex",{enumerable:!0,writable:!1,configurable:!1,value:l(this.bytes)}),this.hex}constructor({buffer:r,size:i=20}={}){this.bytes=void 0===r?(r=>{if(e?.randomBytes)return e.randomBytes(r);if(t.crypto?.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(r));throw new Error("Cryptography API not available")})(i):new Uint8Array(r),Object.defineProperty(this,"bytes",{enumerable:!0,writable:!1,configurable:!1,value:this.bytes})}}class p{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,counter:0,window:1}}static generate({secret:e,algorithm:t=p.defaults.algorithm,digits:r=p.defaults.digits,counter:s=p.defaults.counter,hmac:n=i}){const a=(e=>{const t=new ArrayBuffer(8),r=new Uint8Array(t);let i=e;for(let e=7;e>=0&&0!==i;e--)r[e]=255&i,i-=r[e],i/=256;return r})(s),o=n(t,e.bytes,a);if(!o?.byteLength||o.byteLength<19)throw new TypeError("Return value must be at least 19 bytes");const l=15&o[o.byteLength-1]
+;return(((127&o[l])<<24|(255&o[l+1])<<16|(255&o[l+2])<<8|255&o[l+3])%10**r).toString().padStart(r,"0")}generate({counter:e=this.counter++}={}){return p.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,counter:e,hmac:this.hmac})}static validate({token:r,secret:s,algorithm:n,digits:a=p.defaults.digits,counter:o=p.defaults.counter,window:l=p.defaults.window,hmac:u=i}){if(r.length!==a)return null;let h=null;const c=i=>{const l=p.generate({secret:s,algorithm:n,digits:a,counter:i,hmac:u});((r,i)=>{if(e?.timingSafeEqual)return e.timingSafeEqual(t.Buffer.from(r),t.Buffer.from(i));{if(r.length!==i.length)throw new TypeError("Input strings must have the same length");let e=-1,t=0;for(;++e0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`counter=${e(this.counter)}`}constructor({issuer:e=p.defaults.issuer,label:t=p.defaults.label,issuerInLabel:i=p.defaults.issuerInLabel,secret:s=new m,algorithm:n=p.defaults.algorithm,digits:a=p.defaults.digits,counter:o=p.defaults.counter,hmac:l}={}){this.issuer=e,this.label=t,this.issuerInLabel=i,this.secret="string"==typeof s?m.fromBase32(s):s,this.algorithm=l?n:r(n),this.digits=a,this.counter=o,this.hmac=l}}class b{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,period:30,window:1}}static counter({period:e=b.defaults.period,timestamp:t=Date.now()}={}){return Math.floor(t/1e3/e)}
+counter({timestamp:e=Date.now()}={}){return b.counter({period:this.period,timestamp:e})}static remaining({period:e=b.defaults.period,timestamp:t=Date.now()}={}){return 1e3*e-t%(1e3*e)}remaining({timestamp:e=Date.now()}={}){return b.remaining({period:this.period,timestamp:e})}static generate({secret:e,algorithm:t,digits:r,period:i=b.defaults.period,timestamp:s=Date.now(),hmac:n}){return p.generate({secret:e,algorithm:t,digits:r,counter:b.counter({period:i,timestamp:s}),hmac:n})}generate({timestamp:e=Date.now()}={}){return b.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:e,hmac:this.hmac})}static validate({token:e,secret:t,algorithm:r,digits:i,period:s=b.defaults.period,timestamp:n=Date.now(),window:a,hmac:o}){return p.validate({token:e,secret:t,algorithm:r,digits:i,counter:b.counter({period:s,timestamp:n}),window:a,hmac:o})}validate({token:e,timestamp:t,window:r}){return b.validate({token:e,secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:t,window:r,hmac:this.hmac})}toString(){const e=encodeURIComponent;return"otpauth://totp/"+(this.issuer.length>0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`period=${e(this.period)}`}constructor({issuer:e=b.defaults.issuer,label:t=b.defaults.label,issuerInLabel:i=b.defaults.issuerInLabel,secret:s=new m,algorithm:n=b.defaults.algorithm,digits:a=b.defaults.digits,period:o=b.defaults.period,hmac:l}={}){this.issuer=e,this.label=t,this.issuerInLabel=i,this.secret="string"==typeof s?m.fromBase32(s):s,this.algorithm=l?n:r(n),this.digits=a,this.period=o,this.hmac=l}}
+const w=/^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i,y=/^[2-7A-Z]+=*$/i,A=/^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i,S=/^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i,I=/^[+-]?\d+$/,$=/^\+?[1-9]\d*$/;class v{static parse(e,{hmac:t}={}){let r;try{r=e.match(w)}catch(e){}if(!Array.isArray(r))throw new URIError("Invalid URI format");const i=r[1].toLowerCase(),s=r[2].split(/(?::|%3A) *(.+)/i,2).map(decodeURIComponent),n=r[3].split("&").reduce((e,t)=>{const r=t.split(/=(.*)/,2).map(decodeURIComponent),i=r[0].toLowerCase(),s=r[1],n=e;return n[i]=s,n},{});let a;const o={};if("hotp"===i){if(a=p,void 0===n.counter||!I.test(n.counter))throw new TypeError("Missing or invalid 'counter' parameter");o.counter=parseInt(n.counter,10)}else{if("totp"!==i)throw new TypeError("Unknown OTP type");if(a=b,void 0!==n.period){if(!$.test(n.period))throw new TypeError("Invalid 'period' parameter");o.period=parseInt(n.period,10)}}if(void 0!==n.issuer&&(o.issuer=n.issuer),2===s.length?(o.label=s[1],void 0===o.issuer||""===o.issuer?o.issuer=s[0]:""===s[0]&&(o.issuerInLabel=!1)):(o.label=s[0],void 0!==o.issuer&&""!==o.issuer&&(o.issuerInLabel=!1)),void 0===n.secret||!y.test(n.secret))throw new TypeError("Missing or invalid 'secret' parameter");if(o.secret=n.secret,void 0!==n.algorithm){if(!(t?S:A).test(n.algorithm))throw new TypeError("Invalid 'algorithm' parameter");o.algorithm=n.algorithm}if(void 0!==n.digits){if(!$.test(n.digits))throw new TypeError("Invalid 'digits' parameter");o.digits=parseInt(n.digits,10)}return void 0!==t&&(o.hmac=t),new a(o)}static stringify(e){if(e instanceof p||e instanceof b)return e.toString();throw new TypeError("Invalid 'HOTP/TOTP' object")}}const H="9.5.0";export{p as HOTP,m as Secret,b as TOTP,v as URI,H as version};
+//# sourceMappingURL=otpauth.node.min.mjs.map
diff --git a/server/node_modules/otpauth/dist/otpauth.node.min.mjs.map b/server/node_modules/otpauth/dist/otpauth.node.min.mjs.map
new file mode 100644
index 0000000..fc3e6c3
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.min.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"otpauth.node.min.mjs","sources":["../src/internal/encoding/uint.js","../src/internal/global-scope.js","../src/internal/crypto/hmac-digest.js","../src/internal/encoding/base32.js","../src/internal/encoding/hex.js","../src/internal/encoding/latin1.js","../src/internal/encoding/utf8.js","../src/secret.js","../src/internal/crypto/random-bytes.js","../src/hotp.js","../src/internal/crypto/timing-safe-equal.js","../src/totp.js","../src/uri.js","../src/version.js"],"sourcesContent":["/**\n * Converts an integer to an Uint8Array.\n * @param {number} num Integer.\n * @returns {Uint8Array} Uint8Array.\n */\nconst uintDecode = (num) => {\n const buf = new ArrayBuffer(8);\n const arr = new Uint8Array(buf);\n let acc = num;\n\n for (let i = 7; i >= 0; i--) {\n if (acc === 0) break;\n arr[i] = acc & 255;\n acc -= arr[i];\n acc /= 256;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to an integer.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {number} Integer.\n */\nconst uintEncode = (arr) => {\n let num = 0;\n\n for (let i = 0; i < arr.length; i++) {\n num *= 256;\n num += arr[i];\n }\n\n return num;\n};\n\nexport { uintDecode, uintEncode };\n","/**\n * \"globalThis\" ponyfill.\n * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)\n * @type {Object.}\n */\nconst globalScope = (() => {\n if (typeof globalThis === \"object\") return globalThis;\n else {\n Object.defineProperty(Object.prototype, \"__GLOBALTHIS__\", {\n get() {\n return this;\n },\n configurable: true,\n });\n try {\n // @ts-expect-error\n // eslint-disable-next-line no-undef\n if (typeof __GLOBALTHIS__ !== \"undefined\") return __GLOBALTHIS__;\n } finally {\n // @ts-expect-error\n delete Object.prototype.__GLOBALTHIS__;\n }\n }\n\n // Still unable to determine \"globalThis\", fall back to a naive method.\n if (typeof self !== \"undefined\") return self;\n else if (typeof window !== \"undefined\") return window;\n else if (typeof global !== \"undefined\") return global;\n\n return undefined;\n})();\n\nexport { globalScope };\n","import * as crypto from \"node:crypto\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha1 } from \"@noble/hashes/legacy.js\";\nimport { sha224, sha256, sha384, sha512 } from \"@noble/hashes/sha2.js\";\nimport { sha3_224, sha3_256, sha3_384, sha3_512 } from \"@noble/hashes/sha3.js\";\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * @noble/hashes hash functions.\n * @type {Object.}\n */\nconst nobleHashes = {\n SHA1: sha1,\n SHA224: sha224,\n SHA256: sha256,\n SHA384: sha384,\n SHA512: sha512,\n \"SHA3-224\": sha3_224,\n \"SHA3-256\": sha3_256,\n \"SHA3-384\": sha3_384,\n \"SHA3-512\": sha3_512,\n};\n\n/**\n * Canonicalizes a hash algorithm name.\n * @param {string} algorithm Hash algorithm name.\n * @returns {\"SHA1\"|\"SHA224\"|\"SHA256\"|\"SHA384\"|\"SHA512\"|\"SHA3-224\"|\"SHA3-256\"|\"SHA3-384\"|\"SHA3-512\"} Canonicalized hash algorithm name.\n */\nconst canonicalizeAlgorithm = (algorithm) => {\n switch (true) {\n case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):\n return \"SHA1\";\n case /^SHA(?:2?-)?224$/i.test(algorithm):\n return \"SHA224\";\n case /^SHA(?:2?-)?256$/i.test(algorithm):\n return \"SHA256\";\n case /^SHA(?:2?-)?384$/i.test(algorithm):\n return \"SHA384\";\n case /^SHA(?:2?-)?512$/i.test(algorithm):\n return \"SHA512\";\n case /^SHA3-224$/i.test(algorithm):\n return \"SHA3-224\";\n case /^SHA3-256$/i.test(algorithm):\n return \"SHA3-256\";\n case /^SHA3-384$/i.test(algorithm):\n return \"SHA3-384\";\n case /^SHA3-512$/i.test(algorithm):\n return \"SHA3-512\";\n default:\n throw new TypeError(`Unknown hash algorithm: ${algorithm}`);\n }\n};\n\n/**\n * Calculates an HMAC digest.\n * @param {string} algorithm Algorithm.\n * @param {Uint8Array} key Key.\n * @param {Uint8Array} message Message.\n * @returns {Uint8Array} Digest.\n */\nconst hmacDigest = (algorithm, key, message) => {\n if (crypto?.createHmac) {\n const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));\n hmac.update(globalScope.Buffer.from(message));\n return hmac.digest();\n } else if (hmac) {\n const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];\n return hmac(hash, key, message);\n } else {\n throw new Error(\"Missing HMAC function\");\n }\n};\n\nexport { canonicalizeAlgorithm, hmacDigest };\n","/**\n * RFC 4648 base32 alphabet without pad.\n * @type {string}\n */\nconst ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\n/**\n * Converts a base32 string to an Uint8Array (RFC 4648).\n * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)\n * @param {string} str Base32 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst base32Decode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n // Canonicalize to all upper case and remove padding if it exists.\n let end = str.length;\n while (str[end - 1] === \"=\") --end;\n str = (end < str.length ? str.substring(0, end) : str).toUpperCase();\n\n const buf = new ArrayBuffer(((str.length * 5) / 8) | 0);\n const arr = new Uint8Array(buf);\n let bits = 0;\n let value = 0;\n let index = 0;\n\n for (let i = 0; i < str.length; i++) {\n const idx = ALPHABET.indexOf(str[i]);\n if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);\n\n value = (value << 5) | idx;\n bits += 5;\n\n if (bits >= 8) {\n bits -= 8;\n arr[index++] = value >>> bits;\n }\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a base32 string (RFC 4648).\n * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Base32 string.\n */\nconst base32Encode = (arr) => {\n let bits = 0;\n let value = 0;\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n value = (value << 8) | arr[i];\n bits += 8;\n\n while (bits >= 5) {\n str += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n str += ALPHABET[(value << (5 - bits)) & 31];\n }\n\n return str;\n};\n\nexport { base32Decode, base32Encode };\n","/**\n * Converts a hexadecimal string to an Uint8Array.\n * @param {string} str Hexadecimal string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst hexDecode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n const buf = new ArrayBuffer(str.length / 2);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i += 2) {\n arr[i / 2] = parseInt(str.substring(i, i + 2), 16);\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a hexadecimal string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Hexadecimal string.\n */\nconst hexEncode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n const hex = arr[i].toString(16);\n if (hex.length === 1) str += \"0\";\n str += hex;\n }\n\n return str.toUpperCase();\n};\n\nexport { hexDecode, hexEncode };\n","/**\n * Converts a Latin-1 string to an Uint8Array.\n * @param {string} str Latin-1 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst latin1Decode = (str) => {\n const buf = new ArrayBuffer(str.length);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i) & 0xff;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a Latin-1 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Latin-1 string.\n */\nconst latin1Encode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n str += String.fromCharCode(arr[i]);\n }\n\n return str;\n};\n\nexport { latin1Decode, latin1Encode };\n","import { globalScope } from \"../global-scope.js\";\n\n/**\n * TextEncoder instance.\n * @type {TextEncoder|null}\n */\nconst ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;\n\n/**\n * TextDecoder instance.\n * @type {TextDecoder|null}\n */\nconst DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;\n\n/**\n * Converts an UTF-8 string to an Uint8Array.\n * @param {string} str String.\n * @returns {Uint8Array} Uint8Array.\n */\nconst utf8Decode = (str) => {\n if (!ENCODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return ENCODER.encode(str);\n};\n\n/**\n * Converts an Uint8Array to an UTF-8 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} String.\n */\nconst utf8Encode = (arr) => {\n if (!DECODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return DECODER.decode(arr);\n};\n\nexport { utf8Decode, utf8Encode };\n","import { base32Decode, base32Encode } from \"./internal/encoding/base32.js\";\nimport { hexDecode, hexEncode } from \"./internal/encoding/hex.js\";\nimport { latin1Decode, latin1Encode } from \"./internal/encoding/latin1.js\";\nimport { utf8Decode, utf8Encode } from \"./internal/encoding/utf8.js\";\nimport { randomBytes } from \"./internal/crypto/random-bytes.js\";\n\n/**\n * OTP secret key.\n */\nclass Secret {\n /**\n * Creates a secret key object.\n * @param {Object} [config] Configuration options.\n * @param {ArrayBufferLike} [config.buffer] Secret key buffer.\n * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.\n */\n constructor({ buffer, size = 20 } = {}) {\n /**\n * Secret key.\n * @type {Uint8Array}\n * @readonly\n */\n this.bytes = typeof buffer === \"undefined\" ? randomBytes(size) : new Uint8Array(buffer);\n\n // Prevent the \"bytes\" property from being modified.\n Object.defineProperty(this, \"bytes\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: this.bytes,\n });\n }\n\n /**\n * Converts a Latin-1 string to a Secret object.\n * @param {string} str Latin-1 string.\n * @returns {Secret} Secret object.\n */\n static fromLatin1(str) {\n return new Secret({ buffer: latin1Decode(str).buffer });\n }\n\n /**\n * Converts an UTF-8 string to a Secret object.\n * @param {string} str UTF-8 string.\n * @returns {Secret} Secret object.\n */\n static fromUTF8(str) {\n return new Secret({ buffer: utf8Decode(str).buffer });\n }\n\n /**\n * Converts a base32 string to a Secret object.\n * @param {string} str Base32 string.\n * @returns {Secret} Secret object.\n */\n static fromBase32(str) {\n return new Secret({ buffer: base32Decode(str).buffer });\n }\n\n /**\n * Converts a hexadecimal string to a Secret object.\n * @param {string} str Hexadecimal string.\n * @returns {Secret} Secret object.\n */\n static fromHex(str) {\n return new Secret({ buffer: hexDecode(str).buffer });\n }\n\n /**\n * Secret key buffer.\n * @deprecated For backward compatibility, the \"bytes\" property should be used instead.\n * @type {ArrayBufferLike}\n */\n get buffer() {\n return this.bytes.buffer;\n }\n\n /**\n * Latin-1 string representation of secret key.\n * @type {string}\n */\n get latin1() {\n Object.defineProperty(this, \"latin1\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: latin1Encode(this.bytes),\n });\n\n return this.latin1;\n }\n\n /**\n * UTF-8 string representation of secret key.\n * @type {string}\n */\n get utf8() {\n Object.defineProperty(this, \"utf8\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: utf8Encode(this.bytes),\n });\n\n return this.utf8;\n }\n\n /**\n * Base32 string representation of secret key.\n * @type {string}\n */\n get base32() {\n Object.defineProperty(this, \"base32\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: base32Encode(this.bytes),\n });\n\n return this.base32;\n }\n\n /**\n * Hexadecimal string representation of secret key.\n * @type {string}\n */\n get hex() {\n Object.defineProperty(this, \"hex\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: hexEncode(this.bytes),\n });\n\n return this.hex;\n }\n}\n\nexport { Secret };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns random bytes.\n * @param {number} size Size.\n * @returns {Uint8Array} Random bytes.\n */\nconst randomBytes = (size) => {\n if (crypto?.randomBytes) {\n return crypto.randomBytes(size);\n } else if (globalScope.crypto?.getRandomValues) {\n return globalScope.crypto.getRandomValues(new Uint8Array(size));\n } else {\n throw new Error(\"Cryptography API not available\");\n }\n};\n\nexport { randomBytes };\n","import { uintDecode } from \"./internal/encoding/uint.js\";\nimport { canonicalizeAlgorithm, hmacDigest } from \"./internal/crypto/hmac-digest.js\";\nimport { Secret } from \"./secret.js\";\nimport { timingSafeEqual } from \"./internal/crypto/timing-safe-equal.js\";\n\n/**\n * HOTP: An HMAC-based One-time Password Algorithm.\n * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)\n */\nclass HOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * counter: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n counter: 0,\n window: 1,\n };\n }\n\n /**\n * Creates an HOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Initial counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = HOTP.defaults.issuer,\n label = HOTP.defaults.label,\n issuerInLabel = HOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Initial counter value.\n * @type {number}\n */\n this.counter = counter;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({\n secret,\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac = hmacDigest,\n }) {\n const message = uintDecode(counter);\n const digest = hmac(algorithm, secret.bytes, message);\n if (!digest?.byteLength || digest.byteLength < 19) {\n throw new TypeError(\"Return value must be at least 19 bytes\");\n }\n const offset = digest[digest.byteLength - 1] & 15;\n const otp =\n (((digest[offset] & 127) << 24) |\n ((digest[offset + 1] & 255) << 16) |\n ((digest[offset + 2] & 255) << 8) |\n (digest[offset + 3] & 255)) %\n 10 ** digits;\n\n return otp.toString().padStart(digits, \"0\");\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.counter=this.counter++] Counter value.\n * @returns {string} Token.\n */\n generate({ counter = this.counter++ } = {}) {\n return HOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n window = HOTP.defaults.window,\n hmac = hmacDigest,\n }) {\n // Return early if the token length does not match the digit number.\n if (token.length !== digits) return null;\n\n let delta = null;\n\n const check = (/** @type {number} */ i) => {\n const generatedToken = HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: i,\n hmac,\n });\n if (timingSafeEqual(token, generatedToken)) {\n delta = i - counter;\n }\n };\n\n check(counter);\n for (let i = 1; i <= window && delta === null; ++i) {\n check(counter - i);\n if (delta !== null) break;\n check(counter + i);\n if (delta !== null) break;\n }\n\n return delta;\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.counter=this.counter] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, counter = this.counter, window }) {\n return HOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://hotp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `counter=${e(this.counter)}`\n );\n }\n}\n\nexport { HOTP };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.\n * @param {string} a String a.\n * @param {string} b String b.\n * @returns {boolean} Equality result.\n */\nconst timingSafeEqual = (a, b) => {\n if (crypto?.timingSafeEqual) {\n return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));\n } else {\n if (a.length !== b.length) {\n throw new TypeError(\"Input strings must have the same length\");\n }\n let i = -1;\n let out = 0;\n while (++i < a.length) {\n out |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return out === 0;\n }\n};\n\nexport { timingSafeEqual };\n","import { canonicalizeAlgorithm } from \"./internal/crypto/hmac-digest.js\";\nimport { HOTP } from \"./hotp.js\";\nimport { Secret } from \"./secret.js\";\n\n/**\n * TOTP: Time-Based One-Time Password Algorithm.\n * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)\n */\nclass TOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * period: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n period: 30,\n window: 1,\n };\n }\n\n /**\n * Creates a TOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = TOTP.defaults.issuer,\n label = TOTP.defaults.label,\n issuerInLabel = TOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = TOTP.defaults.algorithm,\n digits = TOTP.defaults.digits,\n period = TOTP.defaults.period,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Token time-step duration.\n * @type {number}\n */\n this.period = period;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return Math.floor(timestamp / 1000 / period);\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n counter({ timestamp = Date.now() } = {}) {\n return TOTP.counter({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return period * 1000 - (timestamp % (period * 1000));\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n remaining({ timestamp = Date.now() } = {}) {\n return TOTP.remaining({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {\n return HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n hmac,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {string} Token.\n */\n generate({ timestamp = Date.now() } = {}) {\n return TOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits,\n period = TOTP.defaults.period,\n timestamp = Date.now(),\n window,\n hmac,\n }) {\n return HOTP.validate({\n token,\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n window,\n hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, timestamp, window }) {\n return TOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://totp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `period=${e(this.period)}`\n );\n }\n}\n\nexport { TOTP };\n","import { HOTP } from \"./hotp.js\";\nimport { TOTP } from \"./totp.js\";\n\n/**\n * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).\n * @type {RegExp}\n */\nconst OTPURI_REGEX = /^otpauth:\\/\\/([ht]otp)\\/(.+)\\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;\n\n/**\n * RFC 4648 base32 alphabet with pad.\n * @type {RegExp}\n */\nconst SECRET_REGEX = /^[2-7A-Z]+=*$/i;\n\n/**\n * Regex for supported algorithms in built-in HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;\n\n/**\n * Regex for custom algorithms in user-defined HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;\n\n/**\n * Integer regex.\n * @type {RegExp}\n */\nconst INTEGER_REGEX = /^[+-]?\\d+$/;\n\n/**\n * Positive integer regex.\n * @type {RegExp}\n */\nconst POSITIVE_INTEGER_REGEX = /^\\+?[1-9]\\d*$/;\n\n/**\n * HOTP/TOTP object/string conversion.\n * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)\n */\nclass URI {\n /**\n * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.\n * @param {string} uri Google Authenticator Key URI.\n * @param {Object} [config] Configuration options.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {HOTP|TOTP} HOTP/TOTP object.\n */\n static parse(uri, { hmac } = {}) {\n let uriGroups;\n\n try {\n uriGroups = uri.match(OTPURI_REGEX);\n // eslint-disable-next-line no-unused-vars\n } catch (_) {\n /* Handled below */\n }\n\n if (!Array.isArray(uriGroups)) {\n throw new URIError(\"Invalid URI format\");\n }\n\n // Extract URI groups.\n const uriType = uriGroups[1].toLowerCase();\n const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);\n /** @type {Object.} */\n const uriParams = uriGroups[3].split(\"&\").reduce((acc, cur) => {\n const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);\n const pairKey = pairArr[0].toLowerCase();\n const pairVal = pairArr[1];\n /** @type {Object.} */\n const pairAcc = acc;\n\n pairAcc[pairKey] = pairVal;\n return pairAcc;\n }, {});\n\n // 'OTP' will be instantiated with 'config' argument.\n let OTP;\n const config = {};\n\n if (uriType === \"hotp\") {\n OTP = HOTP;\n\n // Counter: required\n if (typeof uriParams.counter !== \"undefined\" && INTEGER_REGEX.test(uriParams.counter)) {\n config.counter = parseInt(uriParams.counter, 10);\n } else {\n throw new TypeError(\"Missing or invalid 'counter' parameter\");\n }\n } else if (uriType === \"totp\") {\n OTP = TOTP;\n\n // Period: optional\n if (typeof uriParams.period !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {\n config.period = parseInt(uriParams.period, 10);\n } else {\n throw new TypeError(\"Invalid 'period' parameter\");\n }\n }\n } else {\n throw new TypeError(\"Unknown OTP type\");\n }\n\n // Label: required\n // Issuer: optional\n if (typeof uriParams.issuer !== \"undefined\") {\n config.issuer = uriParams.issuer;\n }\n if (uriLabel.length === 2) {\n config.label = uriLabel[1];\n if (typeof config.issuer === \"undefined\" || config.issuer === \"\") {\n config.issuer = uriLabel[0];\n } else if (uriLabel[0] === \"\") {\n config.issuerInLabel = false;\n }\n } else {\n config.label = uriLabel[0];\n if (typeof config.issuer !== \"undefined\" && config.issuer !== \"\") {\n config.issuerInLabel = false;\n }\n }\n\n // Secret: required\n if (typeof uriParams.secret !== \"undefined\" && SECRET_REGEX.test(uriParams.secret)) {\n config.secret = uriParams.secret;\n } else {\n throw new TypeError(\"Missing or invalid 'secret' parameter\");\n }\n\n // Algorithm: optional\n if (typeof uriParams.algorithm !== \"undefined\") {\n if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {\n config.algorithm = uriParams.algorithm;\n } else {\n throw new TypeError(\"Invalid 'algorithm' parameter\");\n }\n }\n\n // Digits: optional\n if (typeof uriParams.digits !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {\n config.digits = parseInt(uriParams.digits, 10);\n } else {\n throw new TypeError(\"Invalid 'digits' parameter\");\n }\n }\n\n // HMAC: optional\n if (typeof hmac !== \"undefined\") {\n config.hmac = hmac;\n }\n\n return new OTP(config);\n }\n\n /**\n * Converts an HOTP/TOTP object to a Google Authenticator key URI.\n * @param {HOTP|TOTP} otp HOTP/TOTP object.\n * @returns {string} Google Authenticator Key URI.\n */\n static stringify(otp) {\n if (otp instanceof HOTP || otp instanceof TOTP) {\n return otp.toString();\n }\n\n throw new TypeError(\"Invalid 'HOTP/TOTP' object\");\n }\n}\n\nexport { URI };\n","/**\n * Library version.\n * @type {string}\n */\nconst version = \"__OTPAUTH_VERSION__\";\n\nexport { version };\n"],"names":["globalScope","globalThis","Object","defineProperty","prototype","get","this","configurable","__GLOBALTHIS__","self","window","global","canonicalizeAlgorithm","algorithm","test","TypeError","hmacDigest","key","message","crypto","createHmac","hmac","Buffer","from","update","digest","Error","ALPHABET","base32Decode","str","end","replace","length","substring","toUpperCase","buf","ArrayBuffer","arr","Uint8Array","bits","value","index","i","idx","indexOf","base32Encode","hexDecode","parseInt","hexEncode","hex","toString","latin1Decode","charCodeAt","latin1Encode","String","fromCharCode","ENCODER","TextEncoder","DECODER","TextDecoder","utf8Decode","encode","utf8Encode","decode","Secret","fromLatin1","buffer","fromUTF8","fromBase32","fromHex","bytes","latin1","enumerable","writable","utf8","base32","constructor","size","randomBytes","getRandomValues","HOTP","defaults","issuer","label","issuerInLabel","digits","counter","generate","secret","num","acc","uintDecode","byteLength","offset","padStart","validate","token","delta","check","generatedToken","a","b","timingSafeEqual","out","e","encodeURIComponent","TOTP","period","timestamp","Date","now","Math","floor","remaining","OTPURI_REGEX","SECRET_REGEX","ALGORITHM_REGEX","ALGORITHM_CUSTOM_REGEX","INTEGER_REGEX","POSITIVE_INTEGER_REGEX","URI","parse","uri","uriGroups","match","_","Array","isArray","URIError","uriType","toLowerCase","uriLabel","split","map","decodeURIComponent","uriParams","reduce","cur","pairArr","pairKey","pairVal","pairAcc","OTP","config","stringify","otp","version"],"mappings":";;;8BAKA,MCAMA,EAAe,MACnB,GAA0B,iBAAfC,WAAyB,OAAOA,WAEzCC,OAAOC,eAAeD,OAAOE,UAAW,iBAAkB,CACxDC,GAAAA,GACE,OAAOC,IACT,EACAC,cAAc,IAEhB,IAGE,GAA8B,oBAAnBC,eAAgC,OAAOA,cACpD,CAAA,eAESN,OAAOE,UAAUI,cAC1B,CAIF,MAAoB,oBAATC,KAA6BA,KACb,oBAAXC,OAA+BA,OACpB,oBAAXC,OAA+BA,YAA1C,CAGP,EAzBqB,GCuBfC,EAAyBC,IAC7B,QAAQ,GACN,IAAK,0BAA0BC,KAAKD,GAClC,MAAO,OACT,IAAK,oBAAoBC,KAAKD,GAC5B,MAAO,SACT,IAAK,oBAAoBC,KAAKD,GAC5B,MAAO,SACT,IAAK,oBAAoBC,KAAKD,GAC5B,MAAO,SACT,IAAK,oBAAoBC,KAAKD,GAC5B,MAAO,SACT,IAAK,cA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SACjD6D,EAAO3D,eAAgB,SAKK,IAArBmD,EAAU/C,SAA0B2B,EAAarG,KAAKyH,EAAU/C,QAGzE,MAAM,IAAIzE,UAAU,yCAItB,GANEgI,EAAOvD,OAAS+C,EAAU/C,YAMO,IAAxB+C,EAAU1H,UAA2B,CAC9C,KAAKQ,EAAOgG,EAAyBD,GAAiBtG,KAAKyH,EAAU1H,WAGnE,MAAM,IAAIE,UAAU,iCAFpBgI,EAAOlI,UAAY0H,EAAU1H,SAIjC,CAGA,QAAgC,IAArB0H,EAAUlD,OAAwB,CAC3C,IAAIkC,EAAuBzG,KAAKyH,EAAUlD,QAGxC,MAAM,IAAItE,UAAU,8BAFpBgI,EAAO1D,OAAStC,SAASwF,EAAUlD,OAAQ,GAI/C,CAOA,YAJoB,IAAThE,IACT0H,EAAO1H,KAAOA,GAGT,IAAIyH,EAAIC,EACjB,CAOA,gBAAOC,CAAUC,GACf,GAAIA,aAAejE,GAAQiE,aAAevC,EACxC,OAAOuC,EAAI/F,WAGb,MAAM,IAAInC,UAAU,6BACtB,QCvKImI,EAAU"}
\ No newline at end of file
diff --git a/server/node_modules/otpauth/dist/otpauth.node.mjs b/server/node_modules/otpauth/dist/otpauth.node.mjs
new file mode 100644
index 0000000..7fe3814
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.node.mjs
@@ -0,0 +1,894 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+///
+// @ts-nocheck
+import * as crypto from 'node:crypto';
+
+/**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+};
+
+/**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+})();
+
+/**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+};
+/**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ if (crypto?.createHmac) {
+ const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));
+ hmac.update(globalScope.Buffer.from(message));
+ return hmac.digest();
+ } else {
+ throw new Error("Missing HMAC function");
+ }
+};
+
+/**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+/**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+};
+
+/**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+};
+
+/**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+};
+
+/**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+/**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+/**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+};
+/**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+};
+
+/**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (crypto?.randomBytes) {
+ return crypto.randomBytes(size);
+ } else if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+};
+
+/**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+}
+
+/**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ if (crypto?.timingSafeEqual) {
+ return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));
+ } else {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+};
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+/**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+/**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+/**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+/**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+/**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
+ const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
+ const pairKey = pairArr[0].toLowerCase();
+ const pairVal = pairArr[1];
+ /** @type {Object.} */ const pairAcc = acc;
+ pairAcc[pairKey] = pairVal;
+ return pairAcc;
+ }, {});
+ // 'OTP' will be instantiated with 'config' argument.
+ let OTP;
+ const config = {};
+ if (uriType === "hotp") {
+ OTP = HOTP;
+ // Counter: required
+ if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
+ config.counter = parseInt(uriParams.counter, 10);
+ } else {
+ throw new TypeError("Missing or invalid 'counter' parameter");
+ }
+ } else if (uriType === "totp") {
+ OTP = TOTP;
+ // Period: optional
+ if (typeof uriParams.period !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
+ config.period = parseInt(uriParams.period, 10);
+ } else {
+ throw new TypeError("Invalid 'period' parameter");
+ }
+ }
+ } else {
+ throw new TypeError("Unknown OTP type");
+ }
+ // Label: required
+ // Issuer: optional
+ if (typeof uriParams.issuer !== "undefined") {
+ config.issuer = uriParams.issuer;
+ }
+ if (uriLabel.length === 2) {
+ config.label = uriLabel[1];
+ if (typeof config.issuer === "undefined" || config.issuer === "") {
+ config.issuer = uriLabel[0];
+ } else if (uriLabel[0] === "") {
+ config.issuerInLabel = false;
+ }
+ } else {
+ config.label = uriLabel[0];
+ if (typeof config.issuer !== "undefined" && config.issuer !== "") {
+ config.issuerInLabel = false;
+ }
+ }
+ // Secret: required
+ if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
+ config.secret = uriParams.secret;
+ } else {
+ throw new TypeError("Missing or invalid 'secret' parameter");
+ }
+ // Algorithm: optional
+ if (typeof uriParams.algorithm !== "undefined") {
+ if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
+ config.algorithm = uriParams.algorithm;
+ } else {
+ throw new TypeError("Invalid 'algorithm' parameter");
+ }
+ }
+ // Digits: optional
+ if (typeof uriParams.digits !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
+ config.digits = parseInt(uriParams.digits, 10);
+ } else {
+ throw new TypeError("Invalid 'digits' parameter");
+ }
+ }
+ // HMAC: optional
+ if (typeof hmac !== "undefined") {
+ config.hmac = hmac;
+ }
+ return new OTP(config);
+ }
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */ static stringify(otp) {
+ if (otp instanceof HOTP || otp instanceof TOTP) {
+ return otp.toString();
+ }
+ throw new TypeError("Invalid 'HOTP/TOTP' object");
+ }
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */ const version = "9.5.0";
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.slim.esm.js b/server/node_modules/otpauth/dist/otpauth.slim.esm.js
new file mode 100644
index 0000000..4231c68
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.slim.esm.js
@@ -0,0 +1,907 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+//! noble-hashes 2.0.1 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
+///
+// @ts-nocheck
+import { hmac } from '@noble/hashes/hmac.js';
+import { sha1 } from '@noble/hashes/legacy.js';
+import { sha512, sha384, sha256, sha224 } from '@noble/hashes/sha2.js';
+import { sha3_512, sha3_384, sha3_256, sha3_224 } from '@noble/hashes/sha3.js';
+
+/**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+};
+
+/**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+})();
+
+/**
+ * @noble/hashes hash functions.
+ * @type {Object.}
+ */ const nobleHashes = {
+ SHA1: sha1,
+ SHA224: sha224,
+ SHA256: sha256,
+ SHA384: sha384,
+ SHA512: sha512,
+ "SHA3-224": sha3_224,
+ "SHA3-256": sha3_256,
+ "SHA3-384": sha3_384,
+ "SHA3-512": sha3_512
+};
+/**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+};
+/**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ if (hmac) {
+ const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];
+ return hmac(hash, key, message);
+ } else {
+ throw new Error("Missing HMAC function");
+ }
+};
+
+/**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+/**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+};
+
+/**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+};
+
+/**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+};
+/**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+};
+
+/**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+/**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+/**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+};
+/**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+};
+
+/**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+};
+
+/**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+}
+
+/**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+};
+
+/**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+}
+
+/**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+/**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+/**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+/**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+/**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+/**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+/**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
+ const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
+ const pairKey = pairArr[0].toLowerCase();
+ const pairVal = pairArr[1];
+ /** @type {Object.} */ const pairAcc = acc;
+ pairAcc[pairKey] = pairVal;
+ return pairAcc;
+ }, {});
+ // 'OTP' will be instantiated with 'config' argument.
+ let OTP;
+ const config = {};
+ if (uriType === "hotp") {
+ OTP = HOTP;
+ // Counter: required
+ if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
+ config.counter = parseInt(uriParams.counter, 10);
+ } else {
+ throw new TypeError("Missing or invalid 'counter' parameter");
+ }
+ } else if (uriType === "totp") {
+ OTP = TOTP;
+ // Period: optional
+ if (typeof uriParams.period !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
+ config.period = parseInt(uriParams.period, 10);
+ } else {
+ throw new TypeError("Invalid 'period' parameter");
+ }
+ }
+ } else {
+ throw new TypeError("Unknown OTP type");
+ }
+ // Label: required
+ // Issuer: optional
+ if (typeof uriParams.issuer !== "undefined") {
+ config.issuer = uriParams.issuer;
+ }
+ if (uriLabel.length === 2) {
+ config.label = uriLabel[1];
+ if (typeof config.issuer === "undefined" || config.issuer === "") {
+ config.issuer = uriLabel[0];
+ } else if (uriLabel[0] === "") {
+ config.issuerInLabel = false;
+ }
+ } else {
+ config.label = uriLabel[0];
+ if (typeof config.issuer !== "undefined" && config.issuer !== "") {
+ config.issuerInLabel = false;
+ }
+ }
+ // Secret: required
+ if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
+ config.secret = uriParams.secret;
+ } else {
+ throw new TypeError("Missing or invalid 'secret' parameter");
+ }
+ // Algorithm: optional
+ if (typeof uriParams.algorithm !== "undefined") {
+ if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
+ config.algorithm = uriParams.algorithm;
+ } else {
+ throw new TypeError("Invalid 'algorithm' parameter");
+ }
+ }
+ // Digits: optional
+ if (typeof uriParams.digits !== "undefined") {
+ if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
+ config.digits = parseInt(uriParams.digits, 10);
+ } else {
+ throw new TypeError("Invalid 'digits' parameter");
+ }
+ }
+ // HMAC: optional
+ if (typeof hmac !== "undefined") {
+ config.hmac = hmac;
+ }
+ return new OTP(config);
+ }
+ /**
+ * Converts an HOTP/TOTP object to a Google Authenticator key URI.
+ * @param {HOTP|TOTP} otp HOTP/TOTP object.
+ * @returns {string} Google Authenticator Key URI.
+ */ static stringify(otp) {
+ if (otp instanceof HOTP || otp instanceof TOTP) {
+ return otp.toString();
+ }
+ throw new TypeError("Invalid 'HOTP/TOTP' object");
+ }
+}
+
+/**
+ * Library version.
+ * @type {string}
+ */ const version = "9.5.0";
+
+export { HOTP, Secret, TOTP, URI, version };
diff --git a/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js b/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js
new file mode 100644
index 0000000..9239db0
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js
@@ -0,0 +1,10 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+//! noble-hashes 2.0.1 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
+///
+// @ts-nocheck
+import{hmac as e}from"@noble/hashes/hmac.js";import{sha1 as t}from"@noble/hashes/legacy.js";import{sha512 as r,sha384 as i,sha256 as s,sha224 as n}from"@noble/hashes/sha2.js";import{sha3_512 as o,sha3_384 as a,sha3_256 as l,sha3_224 as u}from"@noble/hashes/sha3.js";const h=(()=>{if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"__GLOBALTHIS__",{get(){return this},configurable:!0});try{if("undefined"!=typeof __GLOBALTHIS__)return __GLOBALTHIS__}finally{delete Object.prototype.__GLOBALTHIS__}return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0})(),c={SHA1:t,SHA224:n,SHA256:s,SHA384:i,SHA512:r,"SHA3-224":u,"SHA3-256":l,"SHA3-384":a,"SHA3-512":o},d=e=>{switch(!0){case/^(?:SHA-?1|SSL3-SHA1)$/i.test(e):return"SHA1";case/^SHA(?:2?-)?224$/i.test(e):return"SHA224";case/^SHA(?:2?-)?256$/i.test(e):return"SHA256";case/^SHA(?:2?-)?384$/i.test(e):return"SHA384";case/^SHA(?:2?-)?512$/i.test(e):return"SHA512";case/^SHA3-224$/i.test(e):return"SHA3-224";case/^SHA3-256$/i.test(e):return"SHA3-256";case/^SHA3-384$/i.test(e):return"SHA3-384";case/^SHA3-512$/i.test(e):return"SHA3-512";default:throw new TypeError(`Unknown hash algorithm: ${e}`)}},g=(t,r,i)=>{if(e){const s=c[t]??c[d(t)];return e(s,r,i)}throw new Error("Missing HMAC function")},f="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",m=e=>{let t=(e=e.replace(/ /g,"")).length;for(;"="===e[t-1];)--t;e=(t=8&&(s-=8,i[o++]=n>>>s)}return i},p=e=>{let t=0,r=0,i="";for(let s=0;s=5;)i+=f[r>>>t-5&31],t-=5;return t>0&&(i+=f[r<<5-t&31]),i},b=e=>{e=e.replace(/ /g,"");const t=new ArrayBuffer(e.length/2),r=new Uint8Array(t);for(let t=0;t{let t=""
+;for(let r=0;r{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t{let t="";for(let r=0;r{if(!S)throw new Error("Encoding API not available");return S.encode(e)},$=e=>{if(!H)throw new Error("Encoding API not available");return H.decode(e)};class v{static fromLatin1(e){return new v({buffer:A(e).buffer})}static fromUTF8(e){return new v({buffer:I(e).buffer})}static fromBase32(e){return new v({buffer:m(e).buffer})}static fromHex(e){return new v({buffer:b(e).buffer})}get buffer(){return this.bytes.buffer}get latin1(){return Object.defineProperty(this,"latin1",{enumerable:!0,writable:!1,configurable:!1,value:y(this.bytes)}),this.latin1}get utf8(){return Object.defineProperty(this,"utf8",{enumerable:!0,writable:!1,configurable:!1,value:$(this.bytes)}),this.utf8}get base32(){return Object.defineProperty(this,"base32",{enumerable:!0,writable:!1,configurable:!1,value:p(this.bytes)}),this.base32}get hex(){return Object.defineProperty(this,"hex",{enumerable:!0,writable:!1,configurable:!1,value:w(this.bytes)}),this.hex}constructor({buffer:e,size:t=20}={}){this.bytes=void 0===e?(e=>{if(h.crypto?.getRandomValues)return h.crypto.getRandomValues(new Uint8Array(e));throw new Error("Cryptography API not available")})(t):new Uint8Array(e),Object.defineProperty(this,"bytes",{enumerable:!0,writable:!1,configurable:!1,value:this.bytes})}}class T{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,counter:0,window:1}}static generate({secret:e,algorithm:t=T.defaults.algorithm,digits:r=T.defaults.digits,counter:i=T.defaults.counter,hmac:s=g}){const n=(e=>{const t=new ArrayBuffer(8),r=new Uint8Array(t);let i=e;for(let e=7;e>=0&&0!==i;e--)r[e]=255&i,i-=r[e],i/=256;return r})(i),o=s(t,e.bytes,n)
+;if(!o?.byteLength||o.byteLength<19)throw new TypeError("Return value must be at least 19 bytes");const a=15&o[o.byteLength-1];return(((127&o[a])<<24|(255&o[a+1])<<16|(255&o[a+2])<<8|255&o[a+3])%10**r).toString().padStart(r,"0")}generate({counter:e=this.counter++}={}){return T.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,counter:e,hmac:this.hmac})}static validate({token:e,secret:t,algorithm:r,digits:i=T.defaults.digits,counter:s=T.defaults.counter,window:n=T.defaults.window,hmac:o=g}){if(e.length!==i)return null;let a=null;const l=n=>{const l=T.generate({secret:t,algorithm:r,digits:i,counter:n,hmac:o});((e,t)=>{{if(e.length!==t.length)throw new TypeError("Input strings must have the same length");let r=-1,i=0;for(;++r0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`counter=${e(this.counter)}`}constructor({issuer:e=T.defaults.issuer,label:t=T.defaults.label,issuerInLabel:r=T.defaults.issuerInLabel,secret:i=new v,algorithm:s=T.defaults.algorithm,digits:n=T.defaults.digits,counter:o=T.defaults.counter,hmac:a}={}){this.issuer=e,this.label=t,this.issuerInLabel=r,this.secret="string"==typeof i?v.fromBase32(i):i,this.algorithm=a?s:d(s),this.digits=n,this.counter=o,this.hmac=a}}class L{static get defaults(){return{issuer:"",label:"OTPAuth",issuerInLabel:!0,algorithm:"SHA1",digits:6,period:30,window:1}}static counter({period:e=L.defaults.period,timestamp:t=Date.now()}={}){
+return Math.floor(t/1e3/e)}counter({timestamp:e=Date.now()}={}){return L.counter({period:this.period,timestamp:e})}static remaining({period:e=L.defaults.period,timestamp:t=Date.now()}={}){return 1e3*e-t%(1e3*e)}remaining({timestamp:e=Date.now()}={}){return L.remaining({period:this.period,timestamp:e})}static generate({secret:e,algorithm:t,digits:r,period:i=L.defaults.period,timestamp:s=Date.now(),hmac:n}){return T.generate({secret:e,algorithm:t,digits:r,counter:L.counter({period:i,timestamp:s}),hmac:n})}generate({timestamp:e=Date.now()}={}){return L.generate({secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:e,hmac:this.hmac})}static validate({token:e,secret:t,algorithm:r,digits:i,period:s=L.defaults.period,timestamp:n=Date.now(),window:o,hmac:a}){return T.validate({token:e,secret:t,algorithm:r,digits:i,counter:L.counter({period:s,timestamp:n}),window:o,hmac:a})}validate({token:e,timestamp:t,window:r}){return L.validate({token:e,secret:this.secret,algorithm:this.algorithm,digits:this.digits,period:this.period,timestamp:t,window:r,hmac:this.hmac})}toString(){const e=encodeURIComponent;return"otpauth://totp/"+(this.issuer.length>0?this.issuerInLabel?`${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?issuer=${e(this.issuer)}&`:`${e(this.label)}?`)+`secret=${e(this.secret.base32)}&`+`algorithm=${e(this.algorithm)}&`+`digits=${e(this.digits)}&`+`period=${e(this.period)}`}constructor({issuer:e=L.defaults.issuer,label:t=L.defaults.label,issuerInLabel:r=L.defaults.issuerInLabel,secret:i=new v,algorithm:s=L.defaults.algorithm,digits:n=L.defaults.digits,period:o=L.defaults.period,hmac:a}={}){this.issuer=e,this.label=t,this.issuerInLabel=r,this.secret="string"==typeof i?v.fromBase32(i):i,this.algorithm=a?s:d(s),this.digits=n,this.period=o,this.hmac=a}}
+const E=/^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i,O=/^[2-7A-Z]+=*$/i,_=/^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i,U=/^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i,C=/^[+-]?\d+$/,P=/^\+?[1-9]\d*$/;class j{static parse(e,{hmac:t}={}){let r;try{r=e.match(E)}catch(e){}if(!Array.isArray(r))throw new URIError("Invalid URI format");const i=r[1].toLowerCase(),s=r[2].split(/(?::|%3A) *(.+)/i,2).map(decodeURIComponent),n=r[3].split("&").reduce((e,t)=>{const r=t.split(/=(.*)/,2).map(decodeURIComponent),i=r[0].toLowerCase(),s=r[1],n=e;return n[i]=s,n},{});let o;const a={};if("hotp"===i){if(o=T,void 0===n.counter||!C.test(n.counter))throw new TypeError("Missing or invalid 'counter' parameter");a.counter=parseInt(n.counter,10)}else{if("totp"!==i)throw new TypeError("Unknown OTP type");if(o=L,void 0!==n.period){if(!P.test(n.period))throw new TypeError("Invalid 'period' parameter");a.period=parseInt(n.period,10)}}if(void 0!==n.issuer&&(a.issuer=n.issuer),2===s.length?(a.label=s[1],void 0===a.issuer||""===a.issuer?a.issuer=s[0]:""===s[0]&&(a.issuerInLabel=!1)):(a.label=s[0],void 0!==a.issuer&&""!==a.issuer&&(a.issuerInLabel=!1)),void 0===n.secret||!O.test(n.secret))throw new TypeError("Missing or invalid 'secret' parameter");if(a.secret=n.secret,void 0!==n.algorithm){if(!(t?U:_).test(n.algorithm))throw new TypeError("Invalid 'algorithm' parameter");a.algorithm=n.algorithm}if(void 0!==n.digits){if(!P.test(n.digits))throw new TypeError("Invalid 'digits' parameter");a.digits=parseInt(n.digits,10)}return void 0!==t&&(a.hmac=t),new o(a)}static stringify(e){if(e instanceof T||e instanceof L)return e.toString();throw new TypeError("Invalid 'HOTP/TOTP' object")}}const B="9.5.0";export{T as HOTP,v as Secret,L as TOTP,j as URI,B as version};
+//# sourceMappingURL=otpauth.slim.esm.min.js.map
diff --git a/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js.map b/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js.map
new file mode 100644
index 0000000..3898993
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.slim.esm.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"otpauth.slim.esm.min.js","sources":["../src/internal/encoding/uint.js","../src/internal/global-scope.js","../src/internal/crypto/hmac-digest.js","../src/internal/encoding/base32.js","../src/internal/encoding/hex.js","../src/internal/encoding/latin1.js","../src/internal/encoding/utf8.js","../src/secret.js","../src/internal/crypto/random-bytes.js","../src/hotp.js","../src/internal/crypto/timing-safe-equal.js","../src/totp.js","../src/uri.js","../src/version.js"],"sourcesContent":["/**\n * Converts an integer to an Uint8Array.\n * @param {number} num Integer.\n * @returns {Uint8Array} Uint8Array.\n */\nconst uintDecode = (num) => {\n const buf = new ArrayBuffer(8);\n const arr = new Uint8Array(buf);\n let acc = num;\n\n for (let i = 7; i >= 0; i--) {\n if (acc === 0) break;\n arr[i] = acc & 255;\n acc -= arr[i];\n acc /= 256;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to an integer.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {number} Integer.\n */\nconst uintEncode = (arr) => {\n let num = 0;\n\n for (let i = 0; i < arr.length; i++) {\n num *= 256;\n num += arr[i];\n }\n\n return num;\n};\n\nexport { uintDecode, uintEncode };\n","/**\n * \"globalThis\" ponyfill.\n * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)\n * @type {Object.}\n */\nconst globalScope = (() => {\n if (typeof globalThis === \"object\") return globalThis;\n else {\n Object.defineProperty(Object.prototype, \"__GLOBALTHIS__\", {\n get() {\n return this;\n },\n configurable: true,\n });\n try {\n // @ts-expect-error\n // eslint-disable-next-line no-undef\n if (typeof __GLOBALTHIS__ !== \"undefined\") return __GLOBALTHIS__;\n } finally {\n // @ts-expect-error\n delete Object.prototype.__GLOBALTHIS__;\n }\n }\n\n // Still unable to determine \"globalThis\", fall back to a naive method.\n if (typeof self !== \"undefined\") return self;\n else if (typeof window !== \"undefined\") return window;\n else if (typeof global !== \"undefined\") return global;\n\n return undefined;\n})();\n\nexport { globalScope };\n","import * as crypto from \"node:crypto\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha1 } from \"@noble/hashes/legacy.js\";\nimport { sha224, sha256, sha384, sha512 } from \"@noble/hashes/sha2.js\";\nimport { sha3_224, sha3_256, sha3_384, sha3_512 } from \"@noble/hashes/sha3.js\";\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * @noble/hashes hash functions.\n * @type {Object.}\n */\nconst nobleHashes = {\n SHA1: sha1,\n SHA224: sha224,\n SHA256: sha256,\n SHA384: sha384,\n SHA512: sha512,\n \"SHA3-224\": sha3_224,\n \"SHA3-256\": sha3_256,\n \"SHA3-384\": sha3_384,\n \"SHA3-512\": sha3_512,\n};\n\n/**\n * Canonicalizes a hash algorithm name.\n * @param {string} algorithm Hash algorithm name.\n * @returns {\"SHA1\"|\"SHA224\"|\"SHA256\"|\"SHA384\"|\"SHA512\"|\"SHA3-224\"|\"SHA3-256\"|\"SHA3-384\"|\"SHA3-512\"} Canonicalized hash algorithm name.\n */\nconst canonicalizeAlgorithm = (algorithm) => {\n switch (true) {\n case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):\n return \"SHA1\";\n case /^SHA(?:2?-)?224$/i.test(algorithm):\n return \"SHA224\";\n case /^SHA(?:2?-)?256$/i.test(algorithm):\n return \"SHA256\";\n case /^SHA(?:2?-)?384$/i.test(algorithm):\n return \"SHA384\";\n case /^SHA(?:2?-)?512$/i.test(algorithm):\n return \"SHA512\";\n case /^SHA3-224$/i.test(algorithm):\n return \"SHA3-224\";\n case /^SHA3-256$/i.test(algorithm):\n return \"SHA3-256\";\n case /^SHA3-384$/i.test(algorithm):\n return \"SHA3-384\";\n case /^SHA3-512$/i.test(algorithm):\n return \"SHA3-512\";\n default:\n throw new TypeError(`Unknown hash algorithm: ${algorithm}`);\n }\n};\n\n/**\n * Calculates an HMAC digest.\n * @param {string} algorithm Algorithm.\n * @param {Uint8Array} key Key.\n * @param {Uint8Array} message Message.\n * @returns {Uint8Array} Digest.\n */\nconst hmacDigest = (algorithm, key, message) => {\n if (crypto?.createHmac) {\n const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));\n hmac.update(globalScope.Buffer.from(message));\n return hmac.digest();\n } else if (hmac) {\n const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];\n return hmac(hash, key, message);\n } else {\n throw new Error(\"Missing HMAC function\");\n }\n};\n\nexport { canonicalizeAlgorithm, hmacDigest };\n","/**\n * RFC 4648 base32 alphabet without pad.\n * @type {string}\n */\nconst ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\n\n/**\n * Converts a base32 string to an Uint8Array (RFC 4648).\n * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)\n * @param {string} str Base32 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst base32Decode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n // Canonicalize to all upper case and remove padding if it exists.\n let end = str.length;\n while (str[end - 1] === \"=\") --end;\n str = (end < str.length ? str.substring(0, end) : str).toUpperCase();\n\n const buf = new ArrayBuffer(((str.length * 5) / 8) | 0);\n const arr = new Uint8Array(buf);\n let bits = 0;\n let value = 0;\n let index = 0;\n\n for (let i = 0; i < str.length; i++) {\n const idx = ALPHABET.indexOf(str[i]);\n if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);\n\n value = (value << 5) | idx;\n bits += 5;\n\n if (bits >= 8) {\n bits -= 8;\n arr[index++] = value >>> bits;\n }\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a base32 string (RFC 4648).\n * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Base32 string.\n */\nconst base32Encode = (arr) => {\n let bits = 0;\n let value = 0;\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n value = (value << 8) | arr[i];\n bits += 8;\n\n while (bits >= 5) {\n str += ALPHABET[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n str += ALPHABET[(value << (5 - bits)) & 31];\n }\n\n return str;\n};\n\nexport { base32Decode, base32Encode };\n","/**\n * Converts a hexadecimal string to an Uint8Array.\n * @param {string} str Hexadecimal string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst hexDecode = (str) => {\n // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).\n str = str.replace(/ /g, \"\");\n\n const buf = new ArrayBuffer(str.length / 2);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i += 2) {\n arr[i / 2] = parseInt(str.substring(i, i + 2), 16);\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a hexadecimal string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Hexadecimal string.\n */\nconst hexEncode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n const hex = arr[i].toString(16);\n if (hex.length === 1) str += \"0\";\n str += hex;\n }\n\n return str.toUpperCase();\n};\n\nexport { hexDecode, hexEncode };\n","/**\n * Converts a Latin-1 string to an Uint8Array.\n * @param {string} str Latin-1 string.\n * @returns {Uint8Array} Uint8Array.\n */\nconst latin1Decode = (str) => {\n const buf = new ArrayBuffer(str.length);\n const arr = new Uint8Array(buf);\n\n for (let i = 0; i < str.length; i++) {\n arr[i] = str.charCodeAt(i) & 0xff;\n }\n\n return arr;\n};\n\n/**\n * Converts an Uint8Array to a Latin-1 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} Latin-1 string.\n */\nconst latin1Encode = (arr) => {\n let str = \"\";\n\n for (let i = 0; i < arr.length; i++) {\n str += String.fromCharCode(arr[i]);\n }\n\n return str;\n};\n\nexport { latin1Decode, latin1Encode };\n","import { globalScope } from \"../global-scope.js\";\n\n/**\n * TextEncoder instance.\n * @type {TextEncoder|null}\n */\nconst ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;\n\n/**\n * TextDecoder instance.\n * @type {TextDecoder|null}\n */\nconst DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;\n\n/**\n * Converts an UTF-8 string to an Uint8Array.\n * @param {string} str String.\n * @returns {Uint8Array} Uint8Array.\n */\nconst utf8Decode = (str) => {\n if (!ENCODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return ENCODER.encode(str);\n};\n\n/**\n * Converts an Uint8Array to an UTF-8 string.\n * @param {Uint8Array} arr Uint8Array.\n * @returns {string} String.\n */\nconst utf8Encode = (arr) => {\n if (!DECODER) {\n throw new Error(\"Encoding API not available\");\n }\n\n return DECODER.decode(arr);\n};\n\nexport { utf8Decode, utf8Encode };\n","import { base32Decode, base32Encode } from \"./internal/encoding/base32.js\";\nimport { hexDecode, hexEncode } from \"./internal/encoding/hex.js\";\nimport { latin1Decode, latin1Encode } from \"./internal/encoding/latin1.js\";\nimport { utf8Decode, utf8Encode } from \"./internal/encoding/utf8.js\";\nimport { randomBytes } from \"./internal/crypto/random-bytes.js\";\n\n/**\n * OTP secret key.\n */\nclass Secret {\n /**\n * Creates a secret key object.\n * @param {Object} [config] Configuration options.\n * @param {ArrayBufferLike} [config.buffer] Secret key buffer.\n * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.\n */\n constructor({ buffer, size = 20 } = {}) {\n /**\n * Secret key.\n * @type {Uint8Array}\n * @readonly\n */\n this.bytes = typeof buffer === \"undefined\" ? randomBytes(size) : new Uint8Array(buffer);\n\n // Prevent the \"bytes\" property from being modified.\n Object.defineProperty(this, \"bytes\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: this.bytes,\n });\n }\n\n /**\n * Converts a Latin-1 string to a Secret object.\n * @param {string} str Latin-1 string.\n * @returns {Secret} Secret object.\n */\n static fromLatin1(str) {\n return new Secret({ buffer: latin1Decode(str).buffer });\n }\n\n /**\n * Converts an UTF-8 string to a Secret object.\n * @param {string} str UTF-8 string.\n * @returns {Secret} Secret object.\n */\n static fromUTF8(str) {\n return new Secret({ buffer: utf8Decode(str).buffer });\n }\n\n /**\n * Converts a base32 string to a Secret object.\n * @param {string} str Base32 string.\n * @returns {Secret} Secret object.\n */\n static fromBase32(str) {\n return new Secret({ buffer: base32Decode(str).buffer });\n }\n\n /**\n * Converts a hexadecimal string to a Secret object.\n * @param {string} str Hexadecimal string.\n * @returns {Secret} Secret object.\n */\n static fromHex(str) {\n return new Secret({ buffer: hexDecode(str).buffer });\n }\n\n /**\n * Secret key buffer.\n * @deprecated For backward compatibility, the \"bytes\" property should be used instead.\n * @type {ArrayBufferLike}\n */\n get buffer() {\n return this.bytes.buffer;\n }\n\n /**\n * Latin-1 string representation of secret key.\n * @type {string}\n */\n get latin1() {\n Object.defineProperty(this, \"latin1\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: latin1Encode(this.bytes),\n });\n\n return this.latin1;\n }\n\n /**\n * UTF-8 string representation of secret key.\n * @type {string}\n */\n get utf8() {\n Object.defineProperty(this, \"utf8\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: utf8Encode(this.bytes),\n });\n\n return this.utf8;\n }\n\n /**\n * Base32 string representation of secret key.\n * @type {string}\n */\n get base32() {\n Object.defineProperty(this, \"base32\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: base32Encode(this.bytes),\n });\n\n return this.base32;\n }\n\n /**\n * Hexadecimal string representation of secret key.\n * @type {string}\n */\n get hex() {\n Object.defineProperty(this, \"hex\", {\n enumerable: true,\n writable: false,\n configurable: false,\n value: hexEncode(this.bytes),\n });\n\n return this.hex;\n }\n}\n\nexport { Secret };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns random bytes.\n * @param {number} size Size.\n * @returns {Uint8Array} Random bytes.\n */\nconst randomBytes = (size) => {\n if (crypto?.randomBytes) {\n return crypto.randomBytes(size);\n } else if (globalScope.crypto?.getRandomValues) {\n return globalScope.crypto.getRandomValues(new Uint8Array(size));\n } else {\n throw new Error(\"Cryptography API not available\");\n }\n};\n\nexport { randomBytes };\n","import { uintDecode } from \"./internal/encoding/uint.js\";\nimport { canonicalizeAlgorithm, hmacDigest } from \"./internal/crypto/hmac-digest.js\";\nimport { Secret } from \"./secret.js\";\nimport { timingSafeEqual } from \"./internal/crypto/timing-safe-equal.js\";\n\n/**\n * HOTP: An HMAC-based One-time Password Algorithm.\n * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)\n */\nclass HOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * counter: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n counter: 0,\n window: 1,\n };\n }\n\n /**\n * Creates an HOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Initial counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = HOTP.defaults.issuer,\n label = HOTP.defaults.label,\n issuerInLabel = HOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Initial counter value.\n * @type {number}\n */\n this.counter = counter;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({\n secret,\n algorithm = HOTP.defaults.algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n hmac = hmacDigest,\n }) {\n const message = uintDecode(counter);\n const digest = hmac(algorithm, secret.bytes, message);\n if (!digest?.byteLength || digest.byteLength < 19) {\n throw new TypeError(\"Return value must be at least 19 bytes\");\n }\n const offset = digest[digest.byteLength - 1] & 15;\n const otp =\n (((digest[offset] & 127) << 24) |\n ((digest[offset + 1] & 255) << 16) |\n ((digest[offset + 2] & 255) << 8) |\n (digest[offset + 3] & 255)) %\n 10 ** digits;\n\n return otp.toString().padStart(digits, \"0\");\n }\n\n /**\n * Generates an HOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.counter=this.counter++] Counter value.\n * @returns {string} Token.\n */\n generate({ counter = this.counter++ } = {}) {\n return HOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.counter=0] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits = HOTP.defaults.digits,\n counter = HOTP.defaults.counter,\n window = HOTP.defaults.window,\n hmac = hmacDigest,\n }) {\n // Return early if the token length does not match the digit number.\n if (token.length !== digits) return null;\n\n let delta = null;\n\n const check = (/** @type {number} */ i) => {\n const generatedToken = HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: i,\n hmac,\n });\n if (timingSafeEqual(token, generatedToken)) {\n delta = i - counter;\n }\n };\n\n check(counter);\n for (let i = 1; i <= window && delta === null; ++i) {\n check(counter - i);\n if (delta !== null) break;\n check(counter + i);\n if (delta !== null) break;\n }\n\n return delta;\n }\n\n /**\n * Validates an HOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.counter=this.counter] Counter value.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, counter = this.counter, window }) {\n return HOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n counter,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://hotp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `counter=${e(this.counter)}`\n );\n }\n}\n\nexport { HOTP };\n","import * as crypto from \"node:crypto\";\n\nimport { globalScope } from \"../global-scope.js\";\n\n/**\n * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.\n * @param {string} a String a.\n * @param {string} b String b.\n * @returns {boolean} Equality result.\n */\nconst timingSafeEqual = (a, b) => {\n if (crypto?.timingSafeEqual) {\n return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));\n } else {\n if (a.length !== b.length) {\n throw new TypeError(\"Input strings must have the same length\");\n }\n let i = -1;\n let out = 0;\n while (++i < a.length) {\n out |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return out === 0;\n }\n};\n\nexport { timingSafeEqual };\n","import { canonicalizeAlgorithm } from \"./internal/crypto/hmac-digest.js\";\nimport { HOTP } from \"./hotp.js\";\nimport { Secret } from \"./secret.js\";\n\n/**\n * TOTP: Time-Based One-Time Password Algorithm.\n * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)\n */\nclass TOTP {\n /**\n * Default configuration.\n * @type {{\n * issuer: string,\n * label: string,\n * issuerInLabel: boolean,\n * algorithm: string,\n * digits: number,\n * period: number\n * window: number\n * }}\n */\n static get defaults() {\n return {\n issuer: \"\",\n label: \"OTPAuth\",\n issuerInLabel: true,\n algorithm: \"SHA1\",\n digits: 6,\n period: 30,\n window: 1,\n };\n }\n\n /**\n * Creates a TOTP object.\n * @param {Object} [config] Configuration options.\n * @param {string} [config.issuer=''] Account provider.\n * @param {string} [config.label='OTPAuth'] Account label.\n * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.\n * @param {Secret|string} [config.secret=Secret] Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n */\n constructor({\n issuer = TOTP.defaults.issuer,\n label = TOTP.defaults.label,\n issuerInLabel = TOTP.defaults.issuerInLabel,\n secret = new Secret(),\n algorithm = TOTP.defaults.algorithm,\n digits = TOTP.defaults.digits,\n period = TOTP.defaults.period,\n hmac,\n } = {}) {\n /**\n * Account provider.\n * @type {string}\n */\n this.issuer = issuer;\n /**\n * Account label.\n * @type {string}\n */\n this.label = label;\n /**\n * Include issuer prefix in label.\n * @type {boolean}\n */\n this.issuerInLabel = issuerInLabel;\n /**\n * Secret key.\n * @type {Secret}\n */\n this.secret = typeof secret === \"string\" ? Secret.fromBase32(secret) : secret;\n /**\n * HMAC hashing algorithm.\n * @type {string}\n */\n this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);\n /**\n * Token length.\n * @type {number}\n */\n this.digits = digits;\n /**\n * Token time-step duration.\n * @type {number}\n */\n this.period = period;\n /**\n * Custom HMAC function.\n * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}\n */\n this.hmac = hmac;\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return Math.floor(timestamp / 1000 / period);\n }\n\n /**\n * Calculates the counter. i.e. the number of periods since timestamp 0.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} Counter.\n */\n counter({ timestamp = Date.now() } = {}) {\n return TOTP.counter({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {\n return period * 1000 - (timestamp % (period * 1000));\n }\n\n /**\n * Calculates the remaining time in milliseconds until the next token is generated.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {number} counter.\n */\n remaining({ timestamp = Date.now() } = {}) {\n return TOTP.remaining({\n period: this.period,\n timestamp,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {string} Token.\n */\n static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {\n return HOTP.generate({\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n hmac,\n });\n }\n\n /**\n * Generates a TOTP token.\n * @param {Object} [config] Configuration options.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @returns {string} Token.\n */\n generate({ timestamp = Date.now() } = {}) {\n return TOTP.generate({\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n hmac: this.hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {Secret} config.secret Secret key.\n * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.\n * @param {number} [config.digits=6] Token length.\n * @param {number} [config.period=30] Token time-step duration.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n static validate({\n token,\n secret,\n algorithm,\n digits,\n period = TOTP.defaults.period,\n timestamp = Date.now(),\n window,\n hmac,\n }) {\n return HOTP.validate({\n token,\n secret,\n algorithm,\n digits,\n counter: TOTP.counter({ period, timestamp }),\n window,\n hmac,\n });\n }\n\n /**\n * Validates a TOTP token.\n * @param {Object} config Configuration options.\n * @param {string} config.token Token value.\n * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.\n * @param {number} [config.window=1] Window of counter values to test.\n * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.\n */\n validate({ token, timestamp, window }) {\n return TOTP.validate({\n token,\n secret: this.secret,\n algorithm: this.algorithm,\n digits: this.digits,\n period: this.period,\n timestamp,\n window,\n hmac: this.hmac,\n });\n }\n\n /**\n * Returns a Google Authenticator key URI.\n * @returns {string} URI.\n */\n toString() {\n const e = encodeURIComponent;\n return (\n \"otpauth://totp/\" +\n `${\n this.issuer.length > 0\n ? this.issuerInLabel\n ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?issuer=${e(this.issuer)}&`\n : `${e(this.label)}?`\n }` +\n `secret=${e(this.secret.base32)}&` +\n `algorithm=${e(this.algorithm)}&` +\n `digits=${e(this.digits)}&` +\n `period=${e(this.period)}`\n );\n }\n}\n\nexport { TOTP };\n","import { HOTP } from \"./hotp.js\";\nimport { TOTP } from \"./totp.js\";\n\n/**\n * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).\n * @type {RegExp}\n */\nconst OTPURI_REGEX = /^otpauth:\\/\\/([ht]otp)\\/(.+)\\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;\n\n/**\n * RFC 4648 base32 alphabet with pad.\n * @type {RegExp}\n */\nconst SECRET_REGEX = /^[2-7A-Z]+=*$/i;\n\n/**\n * Regex for supported algorithms in built-in HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;\n\n/**\n * Regex for custom algorithms in user-defined HMAC function.\n * @type {RegExp}\n */\nconst ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;\n\n/**\n * Integer regex.\n * @type {RegExp}\n */\nconst INTEGER_REGEX = /^[+-]?\\d+$/;\n\n/**\n * Positive integer regex.\n * @type {RegExp}\n */\nconst POSITIVE_INTEGER_REGEX = /^\\+?[1-9]\\d*$/;\n\n/**\n * HOTP/TOTP object/string conversion.\n * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)\n */\nclass URI {\n /**\n * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.\n * @param {string} uri Google Authenticator Key URI.\n * @param {Object} [config] Configuration options.\n * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.\n * @returns {HOTP|TOTP} HOTP/TOTP object.\n */\n static parse(uri, { hmac } = {}) {\n let uriGroups;\n\n try {\n uriGroups = uri.match(OTPURI_REGEX);\n // eslint-disable-next-line no-unused-vars\n } catch (_) {\n /* Handled below */\n }\n\n if (!Array.isArray(uriGroups)) {\n throw new URIError(\"Invalid URI format\");\n }\n\n // Extract URI groups.\n const uriType = uriGroups[1].toLowerCase();\n const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);\n /** @type {Object.} */\n const uriParams = uriGroups[3].split(\"&\").reduce((acc, cur) => {\n const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);\n const pairKey = pairArr[0].toLowerCase();\n const pairVal = pairArr[1];\n /** @type {Object.} */\n const pairAcc = acc;\n\n pairAcc[pairKey] = pairVal;\n return pairAcc;\n }, {});\n\n // 'OTP' will be instantiated with 'config' argument.\n let OTP;\n const config = {};\n\n if (uriType === \"hotp\") {\n OTP = HOTP;\n\n // Counter: required\n if (typeof uriParams.counter !== \"undefined\" && INTEGER_REGEX.test(uriParams.counter)) {\n config.counter = parseInt(uriParams.counter, 10);\n } else {\n throw new TypeError(\"Missing or invalid 'counter' parameter\");\n }\n } else if (uriType === \"totp\") {\n OTP = TOTP;\n\n // Period: optional\n if (typeof uriParams.period !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {\n config.period = parseInt(uriParams.period, 10);\n } else {\n throw new TypeError(\"Invalid 'period' parameter\");\n }\n }\n } else {\n throw new TypeError(\"Unknown OTP type\");\n }\n\n // Label: required\n // Issuer: optional\n if (typeof uriParams.issuer !== \"undefined\") {\n config.issuer = uriParams.issuer;\n }\n if (uriLabel.length === 2) {\n config.label = uriLabel[1];\n if (typeof config.issuer === \"undefined\" || config.issuer === \"\") {\n config.issuer = uriLabel[0];\n } else if (uriLabel[0] === \"\") {\n config.issuerInLabel = false;\n }\n } else {\n config.label = uriLabel[0];\n if (typeof config.issuer !== \"undefined\" && config.issuer !== \"\") {\n config.issuerInLabel = false;\n }\n }\n\n // Secret: required\n if (typeof uriParams.secret !== \"undefined\" && SECRET_REGEX.test(uriParams.secret)) {\n config.secret = uriParams.secret;\n } else {\n throw new TypeError(\"Missing or invalid 'secret' parameter\");\n }\n\n // Algorithm: optional\n if (typeof uriParams.algorithm !== \"undefined\") {\n if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {\n config.algorithm = uriParams.algorithm;\n } else {\n throw new TypeError(\"Invalid 'algorithm' parameter\");\n }\n }\n\n // Digits: optional\n if (typeof uriParams.digits !== \"undefined\") {\n if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {\n config.digits = parseInt(uriParams.digits, 10);\n } else {\n throw new TypeError(\"Invalid 'digits' parameter\");\n }\n }\n\n // HMAC: optional\n if (typeof hmac !== \"undefined\") {\n config.hmac = hmac;\n }\n\n return new OTP(config);\n }\n\n /**\n * Converts an HOTP/TOTP object to a Google Authenticator key URI.\n * @param {HOTP|TOTP} otp HOTP/TOTP object.\n * @returns {string} Google Authenticator Key URI.\n */\n static stringify(otp) {\n if (otp instanceof HOTP || otp instanceof TOTP) {\n return otp.toString();\n }\n\n throw new TypeError(\"Invalid 'HOTP/TOTP' object\");\n }\n}\n\nexport { URI };\n","/**\n * Library version.\n * @type {string}\n */\nconst version = \"__OTPAUTH_VERSION__\";\n\nexport { version };\n"],"names":["globalScope","globalThis","Object","defineProperty","prototype","get","this","configurable","__GLOBALTHIS__","self","window","global","nobleHashes","SHA1","sha1","SHA224","sha224","SHA256","sha256","SHA384","sha384","SHA512","sha512","sha3_224","sha3_256","sha3_384","sha3_512","canonicalizeAlgorithm","algorithm","test","TypeError","hmacDigest","key","message","hmac","hash","Error","ALPHABET","base32Decode","str","end","replace","length","substring","toUpperCase","buf","ArrayBuffer","arr","Uint8Array","bits","value","index","i","idx","indexOf","base32Encode","hexDecode","parseInt","hexEncode","hex","toString","latin1Decode","charCodeAt","latin1Encode","String","fromCharCode","ENCODER","TextEncoder","DECODER","TextDecoder","utf8Decode","encode","utf8Encode","decode","Secret","fromLatin1","buffer","fromUTF8","fromBase32","fromHex","bytes","latin1","enumerable","writable","utf8","base32","constructor","size","crypto","getRandomValues","randomBytes","HOTP","defaults","issuer","label","issuerInLabel","digits","counter","generate","secret","num","acc","uintDecode","digest","byteLength","offset","padStart","validate","token","delta","check","generatedToken","a","b","out","timingSafeEqual","e","encodeURIComponent","TOTP","period","timestamp","Date","now","Math","floor","remaining","OTPURI_REGEX","SECRET_REGEX","ALGORITHM_REGEX","ALGORITHM_CUSTOM_REGEX","INTEGER_REGEX","POSITIVE_INTEGER_REGEX","URI","parse","uri","uriGroups","match","_","Array","isArray","URIError","uriType","toLowerCase","uriLabel","split","map","decodeURIComponent","uriParams","reduce","cur","pairArr","pairKey","pairVal","pairAcc","OTP","config","stringify","otp","version"],"mappings":";;;;0QAKA,MCAMA,EAAe,MACnB,GAA0B,iBAAfC,WAAyB,OAAOA,WAEzCC,OAAOC,eAAeD,OAAOE,UAAW,iBAAkB,CACxDC,GAAAA,GACE,OAAOC,IACT,EACAC,cAAc,IAEhB,IAGE,GAA8B,oBAAnBC,eAAgC,OAAOA,cACpD,CAAA,eAESN,OAAOE,UAAUI,cAC1B,CAIF,MAAoB,oBAATC,KAA6BA,KACb,oBAAXC,OAA+BA,OACpB,oBAAXC,OAA+BA,YAA1C,CAGP,EAzBqB,GCMfC,EAAc,CAClBC,KAAMC,EACNC,OAAQC,EACRC,OAAQC,EACRC,OAAQC,EACRC,OAAQC,EACR,WAAYC,EACZ,WAAYC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AS,KAClBY,EAAO5D,eAAgB,KAGzB4D,EAAO7D,MAAQiD,EAAS,QACK,IAAlBY,EAAO9D,QAA4C,KAAlB8D,EAAO9D,SACjD8D,EAAO5D,eAAgB,SAKK,IAArBoD,EAAUhD,SAA0B4B,EAAalG,KAAKsH,EAAUhD,QAGzE,MAAM,IAAIrE,UAAU,yCAItB,GANE6H,EAAOxD,OAASgD,EAAUhD,YAMO,IAAxBgD,EAAUvH,UAA2B,CAC9C,KAAKM,EAAO+F,EAAyBD,GAAiBnG,KAAKsH,EAAUvH,WAGnE,MAAM,IAAIE,UAAU,iCAFpB6H,EAAO/H,UAAYuH,EAAUvH,SAIjC,CAGA,QAAgC,IAArBuH,EAAUnD,OAAwB,CAC3C,IAAImC,EAAuBtG,KAAKsH,EAAUnD,QAGxC,MAAM,IAAIlE,UAAU,8BAFpB6H,EAAO3D,OAASvC,SAAS0F,EAAUnD,OAAQ,GAI/C,CAOA,YAJoB,IAAT9D,IACTyH,EAAOzH,KAAOA,GAGT,IAAIwH,EAAIC,EACjB,CAOA,gBAAOC,CAAUC,GACf,GAAIA,aAAelE,GAAQkE,aAAevC,EACxC,OAAOuC,EAAIjG,WAGb,MAAM,IAAI9B,UAAU,6BACtB,QCvKIgI,EAAU"}
\ No newline at end of file
diff --git a/server/node_modules/otpauth/dist/otpauth.umd.js b/server/node_modules/otpauth/dist/otpauth.umd.js
new file mode 100644
index 0000000..703b4e5
--- /dev/null
+++ b/server/node_modules/otpauth/dist/otpauth.umd.js
@@ -0,0 +1,1969 @@
+//! otpauth 9.5.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
+//! noble-hashes 2.0.1 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
+///
+// @ts-nocheck
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.OTPAuth = {}));
+})(this, (function (exports) { 'use strict';
+
+ /**
+ * Converts an integer to an Uint8Array.
+ * @param {number} num Integer.
+ * @returns {Uint8Array} Uint8Array.
+ */ const uintDecode = (num)=>{
+ const buf = new ArrayBuffer(8);
+ const arr = new Uint8Array(buf);
+ let acc = num;
+ for(let i = 7; i >= 0; i--){
+ if (acc === 0) break;
+ arr[i] = acc & 255;
+ acc -= arr[i];
+ acc /= 256;
+ }
+ return arr;
+ };
+
+ /**
+ * Utilities for hex, bytes, CSPRNG.
+ * @module
+ */ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */ function isBytes(a) {
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array';
+ }
+ /** Asserts something is positive integer. */ function anumber(n, title = '') {
+ if (!Number.isSafeInteger(n) || n < 0) {
+ const prefix = title && `"${title}" `;
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
+ }
+ }
+ /** Asserts something is Uint8Array. */ function abytes(value, length, title = '') {
+ const bytes = isBytes(value);
+ const len = value?.length;
+ const needsLen = length !== undefined;
+ if (!bytes || needsLen && len !== length) {
+ const prefix = title && `"${title}" `;
+ const ofLen = needsLen ? ` of length ${length}` : '';
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
+ throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
+ }
+ return value;
+ }
+ /** Asserts something is hash */ function ahash(h) {
+ if (typeof h !== 'function' || typeof h.create !== 'function') throw new Error('Hash must wrapped by utils.createHasher');
+ anumber(h.outputLen);
+ anumber(h.blockLen);
+ }
+ /** Asserts a hash instance has not been destroyed / finished */ function aexists(instance, checkFinished = true) {
+ if (instance.destroyed) throw new Error('Hash instance has been destroyed');
+ if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');
+ }
+ /** Asserts output is properly-sized byte array */ function aoutput(out, instance) {
+ abytes(out, undefined, 'digestInto() output');
+ const min = instance.outputLen;
+ if (out.length < min) {
+ throw new Error('"digestInto() output" expected to be of length >=' + min);
+ }
+ }
+ /** Cast u8 / u16 / u32 to u32. */ function u32(arr) {
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
+ }
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */ function clean(...arrays) {
+ for(let i = 0; i < arrays.length; i++){
+ arrays[i].fill(0);
+ }
+ }
+ /** Create DataView of an array for easy byte-level manipulation. */ function createView(arr) {
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
+ }
+ /** The rotate right (circular right shift) operation for uint32 */ function rotr(word, shift) {
+ return word << 32 - shift | word >>> shift;
+ }
+ /** The rotate left (circular left shift) operation for uint32 */ function rotl(word, shift) {
+ return word << shift | word >>> 32 - shift >>> 0;
+ }
+ /** Is current platform little-endian? Most are. Big-Endian platform: IBM */ const isLE = /* @__PURE__ */ (()=>new Uint8Array(new Uint32Array([
+ 0x11223344
+ ]).buffer)[0] === 0x44)();
+ /** The byte swap operation for uint32 */ function byteSwap(word) {
+ return word << 24 & 0xff000000 | word << 8 & 0xff0000 | word >>> 8 & 0xff00 | word >>> 24 & 0xff;
+ }
+ /** In place byte swap for Uint32Array */ function byteSwap32(arr) {
+ for(let i = 0; i < arr.length; i++){
+ arr[i] = byteSwap(arr[i]);
+ }
+ return arr;
+ }
+ const swap32IfBE = isLE ? (u)=>u : byteSwap32;
+ /** Creates function with outputLen, blockLen, create properties from a class constructor. */ function createHasher(hashCons, info = {}) {
+ const hashC = (msg, opts)=>hashCons(opts).update(msg).digest();
+ const tmp = hashCons(undefined);
+ hashC.outputLen = tmp.outputLen;
+ hashC.blockLen = tmp.blockLen;
+ hashC.create = (opts)=>hashCons(opts);
+ Object.assign(hashC, info);
+ return Object.freeze(hashC);
+ }
+ /** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */ const oidNist = (suffix)=>({
+ oid: Uint8Array.from([
+ 0x06,
+ 0x09,
+ 0x60,
+ 0x86,
+ 0x48,
+ 0x01,
+ 0x65,
+ 0x03,
+ 0x04,
+ 0x02,
+ suffix
+ ])
+ });
+
+ /** Internal class for HMAC. */ class _HMAC {
+ update(buf) {
+ aexists(this);
+ this.iHash.update(buf);
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ abytes(out, this.outputLen, 'output');
+ this.finished = true;
+ this.iHash.digestInto(out);
+ this.oHash.update(out);
+ this.oHash.digestInto(out);
+ this.destroy();
+ }
+ digest() {
+ const out = new Uint8Array(this.oHash.outputLen);
+ this.digestInto(out);
+ return out;
+ }
+ _cloneInto(to) {
+ // Create new instance without calling constructor since key already in state and we don't know it.
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
+ to = to;
+ to.finished = finished;
+ to.destroyed = destroyed;
+ to.blockLen = blockLen;
+ to.outputLen = outputLen;
+ to.oHash = oHash._cloneInto(to.oHash);
+ to.iHash = iHash._cloneInto(to.iHash);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ destroy() {
+ this.destroyed = true;
+ this.oHash.destroy();
+ this.iHash.destroy();
+ }
+ constructor(hash, key){
+ this.finished = false;
+ this.destroyed = false;
+ ahash(hash);
+ abytes(key, undefined, 'key');
+ this.iHash = hash.create();
+ if (typeof this.iHash.update !== 'function') throw new Error('Expected instance of class which extends utils.Hash');
+ this.blockLen = this.iHash.blockLen;
+ this.outputLen = this.iHash.outputLen;
+ const blockLen = this.blockLen;
+ const pad = new Uint8Array(blockLen);
+ // blockLen can be bigger than outputLen
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36;
+ this.iHash.update(pad);
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
+ this.oHash = hash.create();
+ // Undo internal XOR && apply outer XOR
+ for(let i = 0; i < pad.length; i++)pad[i] ^= 0x36 ^ 0x5c;
+ this.oHash.update(pad);
+ clean(pad);
+ }
+ }
+ /**
+ * HMAC: RFC2104 message authentication code.
+ * @param hash - function that would be used e.g. sha256
+ * @param key - message key
+ * @param message - message data
+ * @example
+ * import { hmac } from '@noble/hashes/hmac';
+ * import { sha256 } from '@noble/hashes/sha2';
+ * const mac1 = hmac(sha256, 'key', 'message');
+ */ const hmac = (hash, key, message)=>new _HMAC(hash, key).update(message).digest();
+ hmac.create = (hash, key)=>new _HMAC(hash, key);
+
+ /** Choice: a ? b : c */ function Chi(a, b, c) {
+ return a & b ^ ~a & c;
+ }
+ /** Majority function, true if any two inputs is true. */ function Maj(a, b, c) {
+ return a & b ^ a & c ^ b & c;
+ }
+ /**
+ * Merkle-Damgard hash construction base class.
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
+ */ class HashMD {
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { view, buffer, blockLen } = this;
+ const len = data.length;
+ for(let pos = 0; pos < len;){
+ const take = Math.min(blockLen - this.pos, len - pos);
+ // Fast path: we have at least one block in input, cast it to view and process
+ if (take === blockLen) {
+ const dataView = createView(data);
+ for(; blockLen <= len - pos; pos += blockLen)this.process(dataView, pos);
+ continue;
+ }
+ buffer.set(data.subarray(pos, pos + take), this.pos);
+ this.pos += take;
+ pos += take;
+ if (this.pos === blockLen) {
+ this.process(view, 0);
+ this.pos = 0;
+ }
+ }
+ this.length += data.length;
+ this.roundClean();
+ return this;
+ }
+ digestInto(out) {
+ aexists(this);
+ aoutput(out, this);
+ this.finished = true;
+ // Padding
+ // We can avoid allocation of buffer for padding completely if it
+ // was previously not allocated here. But it won't change performance.
+ const { buffer, view, blockLen, isLE } = this;
+ let { pos } = this;
+ // append the bit '1' to the message
+ buffer[pos++] = 0b10000000;
+ clean(this.buffer.subarray(pos));
+ // we have less than padOffset left in buffer, so we cannot put length in
+ // current block, need process it and pad again
+ if (this.padOffset > blockLen - pos) {
+ this.process(view, 0);
+ pos = 0;
+ }
+ // Pad until full block byte with zeros
+ for(let i = pos; i < blockLen; i++)buffer[i] = 0;
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
+ // So we just write lowest 64 bits of that value.
+ view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
+ this.process(view, 0);
+ const oview = createView(out);
+ const len = this.outputLen;
+ // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
+ if (len % 4) throw new Error('_sha2: outputLen must be aligned to 32bit');
+ const outLen = len / 4;
+ const state = this.get();
+ if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');
+ for(let i = 0; i < outLen; i++)oview.setUint32(4 * i, state[i], isLE);
+ }
+ digest() {
+ const { buffer, outputLen } = this;
+ this.digestInto(buffer);
+ const res = buffer.slice(0, outputLen);
+ this.destroy();
+ return res;
+ }
+ _cloneInto(to) {
+ to || (to = new this.constructor());
+ to.set(...this.get());
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
+ to.destroyed = destroyed;
+ to.finished = finished;
+ to.length = length;
+ to.pos = pos;
+ if (length % blockLen) to.buffer.set(buffer);
+ return to;
+ }
+ clone() {
+ return this._cloneInto();
+ }
+ constructor(blockLen, outputLen, padOffset, isLE){
+ this.finished = false;
+ this.length = 0;
+ this.pos = 0;
+ this.destroyed = false;
+ this.blockLen = blockLen;
+ this.outputLen = outputLen;
+ this.padOffset = padOffset;
+ this.isLE = isLE;
+ this.buffer = new Uint8Array(blockLen);
+ this.view = createView(this.buffer);
+ }
+ }
+ /**
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
+ */ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667,
+ 0xbb67ae85,
+ 0x3c6ef372,
+ 0xa54ff53a,
+ 0x510e527f,
+ 0x9b05688c,
+ 0x1f83d9ab,
+ 0x5be0cd19
+ ]);
+ /** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */ const SHA224_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xc1059ed8,
+ 0x367cd507,
+ 0x3070dd17,
+ 0xf70e5939,
+ 0xffc00b31,
+ 0x68581511,
+ 0x64f98fa7,
+ 0xbefa4fa4
+ ]);
+ /** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */ const SHA384_IV = /* @__PURE__ */ Uint32Array.from([
+ 0xcbbb9d5d,
+ 0xc1059ed8,
+ 0x629a292a,
+ 0x367cd507,
+ 0x9159015a,
+ 0x3070dd17,
+ 0x152fecd8,
+ 0xf70e5939,
+ 0x67332667,
+ 0xffc00b31,
+ 0x8eb44a87,
+ 0x68581511,
+ 0xdb0c2e0d,
+ 0x64f98fa7,
+ 0x47b5481d,
+ 0xbefa4fa4
+ ]);
+ /** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */ const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x6a09e667,
+ 0xf3bcc908,
+ 0xbb67ae85,
+ 0x84caa73b,
+ 0x3c6ef372,
+ 0xfe94f82b,
+ 0xa54ff53a,
+ 0x5f1d36f1,
+ 0x510e527f,
+ 0xade682d1,
+ 0x9b05688c,
+ 0x2b3e6c1f,
+ 0x1f83d9ab,
+ 0xfb41bd6b,
+ 0x5be0cd19,
+ 0x137e2179
+ ]);
+
+ /** Initial SHA1 state */ const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
+ 0x67452301,
+ 0xefcdab89,
+ 0x98badcfe,
+ 0x10325476,
+ 0xc3d2e1f0
+ ]);
+ // Reusable temporary buffer
+ const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
+ /** Internal SHA1 legacy hash class. */ class _SHA1 extends HashMD {
+ get() {
+ const { A, B, C, D, E } = this;
+ return [
+ A,
+ B,
+ C,
+ D,
+ E
+ ];
+ }
+ set(A, B, C, D, E) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ }
+ process(view, offset) {
+ for(let i = 0; i < 16; i++, offset += 4)SHA1_W[i] = view.getUint32(offset, false);
+ for(let i = 16; i < 80; i++)SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
+ // Compression function main loop, 80 rounds
+ let { A, B, C, D, E } = this;
+ for(let i = 0; i < 80; i++){
+ let F, K;
+ if (i < 20) {
+ F = Chi(B, C, D);
+ K = 0x5a827999;
+ } else if (i < 40) {
+ F = B ^ C ^ D;
+ K = 0x6ed9eba1;
+ } else if (i < 60) {
+ F = Maj(B, C, D);
+ K = 0x8f1bbcdc;
+ } else {
+ F = B ^ C ^ D;
+ K = 0xca62c1d6;
+ }
+ const T = rotl(A, 5) + F + E + K + SHA1_W[i] | 0;
+ E = D;
+ D = C;
+ C = rotl(B, 30);
+ B = A;
+ A = T;
+ }
+ // Add the compressed chunk to the current hash value
+ A = A + this.A | 0;
+ B = B + this.B | 0;
+ C = C + this.C | 0;
+ D = D + this.D | 0;
+ E = E + this.E | 0;
+ this.set(A, B, C, D, E);
+ }
+ roundClean() {
+ clean(SHA1_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+ constructor(){
+ super(64, 20, 8, false), this.A = SHA1_IV[0] | 0, this.B = SHA1_IV[1] | 0, this.C = SHA1_IV[2] | 0, this.D = SHA1_IV[3] | 0, this.E = SHA1_IV[4] | 0;
+ }
+ }
+ /** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */ const sha1 = /* @__PURE__ */ createHasher(()=>new _SHA1());
+
+ /**
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
+ * @todo re-check https://issues.chromium.org/issues/42212588
+ * @module
+ */ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
+ const _32n = /* @__PURE__ */ BigInt(32);
+ function fromBig(n, le = false) {
+ if (le) return {
+ h: Number(n & U32_MASK64),
+ l: Number(n >> _32n & U32_MASK64)
+ };
+ return {
+ h: Number(n >> _32n & U32_MASK64) | 0,
+ l: Number(n & U32_MASK64) | 0
+ };
+ }
+ function split(lst, le = false) {
+ const len = lst.length;
+ let Ah = new Uint32Array(len);
+ let Al = new Uint32Array(len);
+ for(let i = 0; i < len; i++){
+ const { h, l } = fromBig(lst[i], le);
+ [Ah[i], Al[i]] = [
+ h,
+ l
+ ];
+ }
+ return [
+ Ah,
+ Al
+ ];
+ }
+ // for Shift in [0, 32)
+ const shrSH = (h, _l, s)=>h >>> s;
+ const shrSL = (h, l, s)=>h << 32 - s | l >>> s;
+ // Right rotate for Shift in [1, 32)
+ const rotrSH = (h, l, s)=>h >>> s | l << 32 - s;
+ const rotrSL = (h, l, s)=>h << 32 - s | l >>> s;
+ // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
+ const rotrBH = (h, l, s)=>h << 64 - s | l >>> s - 32;
+ const rotrBL = (h, l, s)=>h >>> s - 32 | l << 64 - s;
+ // Left rotate for Shift in [1, 32)
+ const rotlSH = (h, l, s)=>h << s | l >>> 32 - s;
+ const rotlSL = (h, l, s)=>l << s | h >>> 32 - s;
+ // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
+ const rotlBH = (h, l, s)=>l << s - 32 | h >>> 64 - s;
+ const rotlBL = (h, l, s)=>h << s - 32 | l >>> 64 - s;
+ // JS uses 32-bit signed integers for bitwise operations which means we cannot
+ // simple take carry out of low bit sum by shift, we need to use division.
+ function add(Ah, Al, Bh, Bl) {
+ const l = (Al >>> 0) + (Bl >>> 0);
+ return {
+ h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
+ l: l | 0
+ };
+ }
+ // Addition with more than 2 elements
+ const add3L = (Al, Bl, Cl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
+ const add3H = (low, Ah, Bh, Ch)=>Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
+ const add4L = (Al, Bl, Cl, Dl)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
+ const add4H = (low, Ah, Bh, Ch, Dh)=>Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
+ const add5L = (Al, Bl, Cl, Dl, El)=>(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
+ const add5H = (low, Ah, Bh, Ch, Dh, Eh)=>Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
+
+ /**
+ * Round constants:
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
+ */ // prettier-ignore
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
+ 0x428a2f98,
+ 0x71374491,
+ 0xb5c0fbcf,
+ 0xe9b5dba5,
+ 0x3956c25b,
+ 0x59f111f1,
+ 0x923f82a4,
+ 0xab1c5ed5,
+ 0xd807aa98,
+ 0x12835b01,
+ 0x243185be,
+ 0x550c7dc3,
+ 0x72be5d74,
+ 0x80deb1fe,
+ 0x9bdc06a7,
+ 0xc19bf174,
+ 0xe49b69c1,
+ 0xefbe4786,
+ 0x0fc19dc6,
+ 0x240ca1cc,
+ 0x2de92c6f,
+ 0x4a7484aa,
+ 0x5cb0a9dc,
+ 0x76f988da,
+ 0x983e5152,
+ 0xa831c66d,
+ 0xb00327c8,
+ 0xbf597fc7,
+ 0xc6e00bf3,
+ 0xd5a79147,
+ 0x06ca6351,
+ 0x14292967,
+ 0x27b70a85,
+ 0x2e1b2138,
+ 0x4d2c6dfc,
+ 0x53380d13,
+ 0x650a7354,
+ 0x766a0abb,
+ 0x81c2c92e,
+ 0x92722c85,
+ 0xa2bfe8a1,
+ 0xa81a664b,
+ 0xc24b8b70,
+ 0xc76c51a3,
+ 0xd192e819,
+ 0xd6990624,
+ 0xf40e3585,
+ 0x106aa070,
+ 0x19a4c116,
+ 0x1e376c08,
+ 0x2748774c,
+ 0x34b0bcb5,
+ 0x391c0cb3,
+ 0x4ed8aa4a,
+ 0x5b9cca4f,
+ 0x682e6ff3,
+ 0x748f82ee,
+ 0x78a5636f,
+ 0x84c87814,
+ 0x8cc70208,
+ 0x90befffa,
+ 0xa4506ceb,
+ 0xbef9a3f7,
+ 0xc67178f2
+ ]);
+ /** Reusable temporary buffer. "W" comes straight from spec. */ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
+ /** Internal 32-byte base SHA2 hash class. */ class SHA2_32B extends HashMD {
+ get() {
+ const { A, B, C, D, E, F, G, H } = this;
+ return [
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ G,
+ H
+ ];
+ }
+ // prettier-ignore
+ set(A, B, C, D, E, F, G, H) {
+ this.A = A | 0;
+ this.B = B | 0;
+ this.C = C | 0;
+ this.D = D | 0;
+ this.E = E | 0;
+ this.F = F | 0;
+ this.G = G | 0;
+ this.H = H | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
+ for(let i = 0; i < 16; i++, offset += 4)SHA256_W[i] = view.getUint32(offset, false);
+ for(let i = 16; i < 64; i++){
+ const W15 = SHA256_W[i - 15];
+ const W2 = SHA256_W[i - 2];
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
+ }
+ // Compression function main loop, 64 rounds
+ let { A, B, C, D, E, F, G, H } = this;
+ for(let i = 0; i < 64; i++){
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
+ const T2 = sigma0 + Maj(A, B, C) | 0;
+ H = G;
+ G = F;
+ F = E;
+ E = D + T1 | 0;
+ D = C;
+ C = B;
+ B = A;
+ A = T1 + T2 | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ A = A + this.A | 0;
+ B = B + this.B | 0;
+ C = C + this.C | 0;
+ D = D + this.D | 0;
+ E = E + this.E | 0;
+ F = F + this.F | 0;
+ G = G + this.G | 0;
+ H = H + this.H | 0;
+ this.set(A, B, C, D, E, F, G, H);
+ }
+ roundClean() {
+ clean(SHA256_W);
+ }
+ destroy() {
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
+ clean(this.buffer);
+ }
+ constructor(outputLen){
+ super(64, outputLen, 8, false);
+ }
+ }
+ /** Internal SHA2-256 hash class. */ class _SHA256 extends SHA2_32B {
+ constructor(){
+ super(32), // We cannot use array here since array allows indexing by variable
+ // which means optimizer/compiler cannot use registers.
+ this.A = SHA256_IV[0] | 0, this.B = SHA256_IV[1] | 0, this.C = SHA256_IV[2] | 0, this.D = SHA256_IV[3] | 0, this.E = SHA256_IV[4] | 0, this.F = SHA256_IV[5] | 0, this.G = SHA256_IV[6] | 0, this.H = SHA256_IV[7] | 0;
+ }
+ }
+ /** Internal SHA2-224 hash class. */ class _SHA224 extends SHA2_32B {
+ constructor(){
+ super(28), this.A = SHA224_IV[0] | 0, this.B = SHA224_IV[1] | 0, this.C = SHA224_IV[2] | 0, this.D = SHA224_IV[3] | 0, this.E = SHA224_IV[4] | 0, this.F = SHA224_IV[5] | 0, this.G = SHA224_IV[6] | 0, this.H = SHA224_IV[7] | 0;
+ }
+ }
+ // SHA2-512 is slower than sha256 in js because u64 operations are slow.
+ // Round contants
+ // First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409
+ // prettier-ignore
+ const K512 = /* @__PURE__ */ (()=>split([
+ '0x428a2f98d728ae22',
+ '0x7137449123ef65cd',
+ '0xb5c0fbcfec4d3b2f',
+ '0xe9b5dba58189dbbc',
+ '0x3956c25bf348b538',
+ '0x59f111f1b605d019',
+ '0x923f82a4af194f9b',
+ '0xab1c5ed5da6d8118',
+ '0xd807aa98a3030242',
+ '0x12835b0145706fbe',
+ '0x243185be4ee4b28c',
+ '0x550c7dc3d5ffb4e2',
+ '0x72be5d74f27b896f',
+ '0x80deb1fe3b1696b1',
+ '0x9bdc06a725c71235',
+ '0xc19bf174cf692694',
+ '0xe49b69c19ef14ad2',
+ '0xefbe4786384f25e3',
+ '0x0fc19dc68b8cd5b5',
+ '0x240ca1cc77ac9c65',
+ '0x2de92c6f592b0275',
+ '0x4a7484aa6ea6e483',
+ '0x5cb0a9dcbd41fbd4',
+ '0x76f988da831153b5',
+ '0x983e5152ee66dfab',
+ '0xa831c66d2db43210',
+ '0xb00327c898fb213f',
+ '0xbf597fc7beef0ee4',
+ '0xc6e00bf33da88fc2',
+ '0xd5a79147930aa725',
+ '0x06ca6351e003826f',
+ '0x142929670a0e6e70',
+ '0x27b70a8546d22ffc',
+ '0x2e1b21385c26c926',
+ '0x4d2c6dfc5ac42aed',
+ '0x53380d139d95b3df',
+ '0x650a73548baf63de',
+ '0x766a0abb3c77b2a8',
+ '0x81c2c92e47edaee6',
+ '0x92722c851482353b',
+ '0xa2bfe8a14cf10364',
+ '0xa81a664bbc423001',
+ '0xc24b8b70d0f89791',
+ '0xc76c51a30654be30',
+ '0xd192e819d6ef5218',
+ '0xd69906245565a910',
+ '0xf40e35855771202a',
+ '0x106aa07032bbd1b8',
+ '0x19a4c116b8d2d0c8',
+ '0x1e376c085141ab53',
+ '0x2748774cdf8eeb99',
+ '0x34b0bcb5e19b48a8',
+ '0x391c0cb3c5c95a63',
+ '0x4ed8aa4ae3418acb',
+ '0x5b9cca4f7763e373',
+ '0x682e6ff3d6b2b8a3',
+ '0x748f82ee5defb2fc',
+ '0x78a5636f43172f60',
+ '0x84c87814a1f0ab72',
+ '0x8cc702081a6439ec',
+ '0x90befffa23631e28',
+ '0xa4506cebde82bde9',
+ '0xbef9a3f7b2c67915',
+ '0xc67178f2e372532b',
+ '0xca273eceea26619c',
+ '0xd186b8c721c0c207',
+ '0xeada7dd6cde0eb1e',
+ '0xf57d4f7fee6ed178',
+ '0x06f067aa72176fba',
+ '0x0a637dc5a2c898a6',
+ '0x113f9804bef90dae',
+ '0x1b710b35131c471b',
+ '0x28db77f523047d84',
+ '0x32caab7b40c72493',
+ '0x3c9ebe0a15c9bebc',
+ '0x431d67c49c100d4c',
+ '0x4cc5d4becb3e42b6',
+ '0x597f299cfc657e2a',
+ '0x5fcb6fab3ad6faec',
+ '0x6c44198c4a475817'
+ ].map((n)=>BigInt(n))))();
+ const SHA512_Kh = /* @__PURE__ */ (()=>K512[0])();
+ const SHA512_Kl = /* @__PURE__ */ (()=>K512[1])();
+ // Reusable temporary buffers
+ const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
+ const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
+ /** Internal 64-byte base SHA2 hash class. */ class SHA2_64B extends HashMD {
+ // prettier-ignore
+ get() {
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ return [
+ Ah,
+ Al,
+ Bh,
+ Bl,
+ Ch,
+ Cl,
+ Dh,
+ Dl,
+ Eh,
+ El,
+ Fh,
+ Fl,
+ Gh,
+ Gl,
+ Hh,
+ Hl
+ ];
+ }
+ // prettier-ignore
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
+ this.Ah = Ah | 0;
+ this.Al = Al | 0;
+ this.Bh = Bh | 0;
+ this.Bl = Bl | 0;
+ this.Ch = Ch | 0;
+ this.Cl = Cl | 0;
+ this.Dh = Dh | 0;
+ this.Dl = Dl | 0;
+ this.Eh = Eh | 0;
+ this.El = El | 0;
+ this.Fh = Fh | 0;
+ this.Fl = Fl | 0;
+ this.Gh = Gh | 0;
+ this.Gl = Gl | 0;
+ this.Hh = Hh | 0;
+ this.Hl = Hl | 0;
+ }
+ process(view, offset) {
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
+ for(let i = 0; i < 16; i++, offset += 4){
+ SHA512_W_H[i] = view.getUint32(offset);
+ SHA512_W_L[i] = view.getUint32(offset += 4);
+ }
+ for(let i = 16; i < 80; i++){
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
+ const W15h = SHA512_W_H[i - 15] | 0;
+ const W15l = SHA512_W_L[i - 15] | 0;
+ const s0h = rotrSH(W15h, W15l, 1) ^ rotrSH(W15h, W15l, 8) ^ shrSH(W15h, W15l, 7);
+ const s0l = rotrSL(W15h, W15l, 1) ^ rotrSL(W15h, W15l, 8) ^ shrSL(W15h, W15l, 7);
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
+ const W2h = SHA512_W_H[i - 2] | 0;
+ const W2l = SHA512_W_L[i - 2] | 0;
+ const s1h = rotrSH(W2h, W2l, 19) ^ rotrBH(W2h, W2l, 61) ^ shrSH(W2h, W2l, 6);
+ const s1l = rotrSL(W2h, W2l, 19) ^ rotrBL(W2h, W2l, 61) ^ shrSL(W2h, W2l, 6);
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
+ const SUMl = add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
+ const SUMh = add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
+ SHA512_W_H[i] = SUMh | 0;
+ SHA512_W_L[i] = SUMl | 0;
+ }
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
+ // Compression function main loop, 80 rounds
+ for(let i = 0; i < 80; i++){
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
+ const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
+ const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
+ const CHIh = Eh & Fh ^ ~Eh & Gh;
+ const CHIl = El & Fl ^ ~El & Gl;
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
+ // prettier-ignore
+ const T1ll = add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
+ const T1h = add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
+ const T1l = T1ll | 0;
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
+ const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
+ const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
+ const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
+ const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
+ Hh = Gh | 0;
+ Hl = Gl | 0;
+ Gh = Fh | 0;
+ Gl = Fl | 0;
+ Fh = Eh | 0;
+ Fl = El | 0;
+ ({ h: Eh, l: El } = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
+ Dh = Ch | 0;
+ Dl = Cl | 0;
+ Ch = Bh | 0;
+ Cl = Bl | 0;
+ Bh = Ah | 0;
+ Bl = Al | 0;
+ const All = add3L(T1l, sigma0l, MAJl);
+ Ah = add3H(All, T1h, sigma0h, MAJh);
+ Al = All | 0;
+ }
+ // Add the compressed chunk to the current hash value
+ ({ h: Ah, l: Al } = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
+ ({ h: Bh, l: Bl } = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
+ ({ h: Ch, l: Cl } = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
+ ({ h: Dh, l: Dl } = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
+ ({ h: Eh, l: El } = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
+ ({ h: Fh, l: Fl } = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
+ ({ h: Gh, l: Gl } = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
+ ({ h: Hh, l: Hl } = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
+ }
+ roundClean() {
+ clean(SHA512_W_H, SHA512_W_L);
+ }
+ destroy() {
+ clean(this.buffer);
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+ constructor(outputLen){
+ super(128, outputLen, 16, false);
+ }
+ }
+ /** Internal SHA2-512 hash class. */ class _SHA512 extends SHA2_64B {
+ constructor(){
+ super(64), this.Ah = SHA512_IV[0] | 0, this.Al = SHA512_IV[1] | 0, this.Bh = SHA512_IV[2] | 0, this.Bl = SHA512_IV[3] | 0, this.Ch = SHA512_IV[4] | 0, this.Cl = SHA512_IV[5] | 0, this.Dh = SHA512_IV[6] | 0, this.Dl = SHA512_IV[7] | 0, this.Eh = SHA512_IV[8] | 0, this.El = SHA512_IV[9] | 0, this.Fh = SHA512_IV[10] | 0, this.Fl = SHA512_IV[11] | 0, this.Gh = SHA512_IV[12] | 0, this.Gl = SHA512_IV[13] | 0, this.Hh = SHA512_IV[14] | 0, this.Hl = SHA512_IV[15] | 0;
+ }
+ }
+ /** Internal SHA2-384 hash class. */ class _SHA384 extends SHA2_64B {
+ constructor(){
+ super(48), this.Ah = SHA384_IV[0] | 0, this.Al = SHA384_IV[1] | 0, this.Bh = SHA384_IV[2] | 0, this.Bl = SHA384_IV[3] | 0, this.Ch = SHA384_IV[4] | 0, this.Cl = SHA384_IV[5] | 0, this.Dh = SHA384_IV[6] | 0, this.Dl = SHA384_IV[7] | 0, this.Eh = SHA384_IV[8] | 0, this.El = SHA384_IV[9] | 0, this.Fh = SHA384_IV[10] | 0, this.Fl = SHA384_IV[11] | 0, this.Gh = SHA384_IV[12] | 0, this.Gl = SHA384_IV[13] | 0, this.Hh = SHA384_IV[14] | 0, this.Hl = SHA384_IV[15] | 0;
+ }
+ }
+ /**
+ * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
+ *
+ * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
+ * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
+ * - Each sha256 hash is executing 2^18 bit operations.
+ * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
+ */ const sha256 = /* @__PURE__ */ createHasher(()=>new _SHA256(), /* @__PURE__ */ oidNist(0x01));
+ /** SHA2-224 hash function from RFC 4634 */ const sha224 = /* @__PURE__ */ createHasher(()=>new _SHA224(), /* @__PURE__ */ oidNist(0x04));
+ /** SHA2-512 hash function from RFC 4634. */ const sha512 = /* @__PURE__ */ createHasher(()=>new _SHA512(), /* @__PURE__ */ oidNist(0x03));
+ /** SHA2-384 hash function from RFC 4634. */ const sha384 = /* @__PURE__ */ createHasher(()=>new _SHA384(), /* @__PURE__ */ oidNist(0x02));
+
+ // No __PURE__ annotations in sha3 header:
+ // EVERYTHING is in fact used on every export.
+ // Various per round constants calculations
+ const _0n = BigInt(0);
+ const _1n = BigInt(1);
+ const _2n = BigInt(2);
+ const _7n = BigInt(7);
+ const _256n = BigInt(256);
+ const _0x71n = BigInt(0x71);
+ const SHA3_PI = [];
+ const SHA3_ROTL = [];
+ const _SHA3_IOTA = []; // no pure annotation: var is always used
+ for(let round = 0, R = _1n, x = 1, y = 0; round < 24; round++){
+ // Pi
+ [x, y] = [
+ y,
+ (2 * x + 3 * y) % 5
+ ];
+ SHA3_PI.push(2 * (5 * y + x));
+ // Rotational
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
+ // Iota
+ let t = _0n;
+ for(let j = 0; j < 7; j++){
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
+ if (R & _2n) t ^= _1n << (_1n << BigInt(j)) - _1n;
+ }
+ _SHA3_IOTA.push(t);
+ }
+ const IOTAS = split(_SHA3_IOTA, true);
+ const SHA3_IOTA_H = IOTAS[0];
+ const SHA3_IOTA_L = IOTAS[1];
+ // Left rotation (without 0, 32, 64)
+ const rotlH = (h, l, s)=>s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
+ const rotlL = (h, l, s)=>s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
+ /** `keccakf1600` internal function, additionally allows to adjust round count. */ function keccakP(s, rounds = 24) {
+ const B = new Uint32Array(5 * 2);
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
+ for(let round = 24 - rounds; round < 24; round++){
+ // Theta θ
+ for(let x = 0; x < 10; x++)B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
+ for(let x = 0; x < 10; x += 2){
+ const idx1 = (x + 8) % 10;
+ const idx0 = (x + 2) % 10;
+ const B0 = B[idx0];
+ const B1 = B[idx0 + 1];
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
+ for(let y = 0; y < 50; y += 10){
+ s[x + y] ^= Th;
+ s[x + y + 1] ^= Tl;
+ }
+ }
+ // Rho (ρ) and Pi (π)
+ let curH = s[2];
+ let curL = s[3];
+ for(let t = 0; t < 24; t++){
+ const shift = SHA3_ROTL[t];
+ const Th = rotlH(curH, curL, shift);
+ const Tl = rotlL(curH, curL, shift);
+ const PI = SHA3_PI[t];
+ curH = s[PI];
+ curL = s[PI + 1];
+ s[PI] = Th;
+ s[PI + 1] = Tl;
+ }
+ // Chi (χ)
+ for(let y = 0; y < 50; y += 10){
+ for(let x = 0; x < 10; x++)B[x] = s[y + x];
+ for(let x = 0; x < 10; x++)s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
+ }
+ // Iota (ι)
+ s[0] ^= SHA3_IOTA_H[round];
+ s[1] ^= SHA3_IOTA_L[round];
+ }
+ clean(B);
+ }
+ /** Keccak sponge function. */ class Keccak {
+ clone() {
+ return this._cloneInto();
+ }
+ keccak() {
+ swap32IfBE(this.state32);
+ keccakP(this.state32, this.rounds);
+ swap32IfBE(this.state32);
+ this.posOut = 0;
+ this.pos = 0;
+ }
+ update(data) {
+ aexists(this);
+ abytes(data);
+ const { blockLen, state } = this;
+ const len = data.length;
+ for(let pos = 0; pos < len;){
+ const take = Math.min(blockLen - this.pos, len - pos);
+ for(let i = 0; i < take; i++)state[this.pos++] ^= data[pos++];
+ if (this.pos === blockLen) this.keccak();
+ }
+ return this;
+ }
+ finish() {
+ if (this.finished) return;
+ this.finished = true;
+ const { state, suffix, pos, blockLen } = this;
+ // Do the padding
+ state[pos] ^= suffix;
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
+ state[blockLen - 1] ^= 0x80;
+ this.keccak();
+ }
+ writeInto(out) {
+ aexists(this, false);
+ abytes(out);
+ this.finish();
+ const bufferOut = this.state;
+ const { blockLen } = this;
+ for(let pos = 0, len = out.length; pos < len;){
+ if (this.posOut >= blockLen) this.keccak();
+ const take = Math.min(blockLen - this.posOut, len - pos);
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
+ this.posOut += take;
+ pos += take;
+ }
+ return out;
+ }
+ xofInto(out) {
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
+ if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
+ return this.writeInto(out);
+ }
+ xof(bytes) {
+ anumber(bytes);
+ return this.xofInto(new Uint8Array(bytes));
+ }
+ digestInto(out) {
+ aoutput(out, this);
+ if (this.finished) throw new Error('digest() was already called');
+ this.writeInto(out);
+ this.destroy();
+ return out;
+ }
+ digest() {
+ return this.digestInto(new Uint8Array(this.outputLen));
+ }
+ destroy() {
+ this.destroyed = true;
+ clean(this.state);
+ }
+ _cloneInto(to) {
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
+ to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
+ to.state32.set(this.state32);
+ to.pos = this.pos;
+ to.posOut = this.posOut;
+ to.finished = this.finished;
+ to.rounds = rounds;
+ // Suffix can change in cSHAKE
+ to.suffix = suffix;
+ to.outputLen = outputLen;
+ to.enableXOF = enableXOF;
+ to.destroyed = this.destroyed;
+ return to;
+ }
+ // NOTE: we accept arguments in bytes instead of bits here.
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24){
+ this.pos = 0;
+ this.posOut = 0;
+ this.finished = false;
+ this.destroyed = false;
+ this.enableXOF = false;
+ this.blockLen = blockLen;
+ this.suffix = suffix;
+ this.outputLen = outputLen;
+ this.enableXOF = enableXOF;
+ this.rounds = rounds;
+ // Can be passed from user as dkLen
+ anumber(outputLen, 'outputLen');
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
+ // 0 < blockLen < 200
+ if (!(0 < blockLen && blockLen < 200)) throw new Error('only keccak-f1600 function is supported');
+ this.state = new Uint8Array(200);
+ this.state32 = u32(this.state);
+ }
+ }
+ const genKeccak = (suffix, blockLen, outputLen, info = {})=>createHasher(()=>new Keccak(blockLen, suffix, outputLen), info);
+ /** SHA3-224 hash function. */ const sha3_224 = /* @__PURE__ */ genKeccak(0x06, 144, 28, /* @__PURE__ */ oidNist(0x07));
+ /** SHA3-256 hash function. Different from keccak-256. */ const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, /* @__PURE__ */ oidNist(0x08));
+ /** SHA3-384 hash function. */ const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, /* @__PURE__ */ oidNist(0x09));
+ /** SHA3-512 hash function. */ const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, /* @__PURE__ */ oidNist(0x0a));
+
+ /**
+ * "globalThis" ponyfill.
+ * @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
+ * @type {Object.}
+ */ const globalScope = (()=>{
+ if (typeof globalThis === "object") return globalThis;
+ else {
+ Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
+ get () {
+ return this;
+ },
+ configurable: true
+ });
+ try {
+ // @ts-expect-error
+ // eslint-disable-next-line no-undef
+ if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
+ } finally{
+ // @ts-expect-error
+ delete Object.prototype.__GLOBALTHIS__;
+ }
+ }
+ // Still unable to determine "globalThis", fall back to a naive method.
+ if (typeof self !== "undefined") return self;
+ else if (typeof window !== "undefined") return window;
+ else if (typeof global !== "undefined") return global;
+ return undefined;
+ })();
+
+ /**
+ * @noble/hashes hash functions.
+ * @type {Object.}
+ */ const nobleHashes = {
+ SHA1: sha1,
+ SHA224: sha224,
+ SHA256: sha256,
+ SHA384: sha384,
+ SHA512: sha512,
+ "SHA3-224": sha3_224,
+ "SHA3-256": sha3_256,
+ "SHA3-384": sha3_384,
+ "SHA3-512": sha3_512
+ };
+ /**
+ * Canonicalizes a hash algorithm name.
+ * @param {string} algorithm Hash algorithm name.
+ * @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
+ */ const canonicalizeAlgorithm = (algorithm)=>{
+ switch(true){
+ case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
+ return "SHA1";
+ case /^SHA(?:2?-)?224$/i.test(algorithm):
+ return "SHA224";
+ case /^SHA(?:2?-)?256$/i.test(algorithm):
+ return "SHA256";
+ case /^SHA(?:2?-)?384$/i.test(algorithm):
+ return "SHA384";
+ case /^SHA(?:2?-)?512$/i.test(algorithm):
+ return "SHA512";
+ case /^SHA3-224$/i.test(algorithm):
+ return "SHA3-224";
+ case /^SHA3-256$/i.test(algorithm):
+ return "SHA3-256";
+ case /^SHA3-384$/i.test(algorithm):
+ return "SHA3-384";
+ case /^SHA3-512$/i.test(algorithm):
+ return "SHA3-512";
+ default:
+ throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
+ }
+ };
+ /**
+ * Calculates an HMAC digest.
+ * @param {string} algorithm Algorithm.
+ * @param {Uint8Array} key Key.
+ * @param {Uint8Array} message Message.
+ * @returns {Uint8Array} Digest.
+ */ const hmacDigest = (algorithm, key, message)=>{
+ if (hmac) {
+ const hash = nobleHashes[algorithm] ?? nobleHashes[canonicalizeAlgorithm(algorithm)];
+ return hmac(hash, key, message);
+ } else {
+ throw new Error("Missing HMAC function");
+ }
+ };
+
+ /**
+ * RFC 4648 base32 alphabet without pad.
+ * @type {string}
+ */ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+ /**
+ * Converts a base32 string to an Uint8Array (RFC 4648).
+ * @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
+ * @param {string} str Base32 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const base32Decode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ // Canonicalize to all upper case and remove padding if it exists.
+ let end = str.length;
+ while(str[end - 1] === "=")--end;
+ str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
+ const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
+ const arr = new Uint8Array(buf);
+ let bits = 0;
+ let value = 0;
+ let index = 0;
+ for(let i = 0; i < str.length; i++){
+ const idx = ALPHABET.indexOf(str[i]);
+ if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
+ value = value << 5 | idx;
+ bits += 5;
+ if (bits >= 8) {
+ bits -= 8;
+ arr[index++] = value >>> bits;
+ }
+ }
+ return arr;
+ };
+ /**
+ * Converts an Uint8Array to a base32 string (RFC 4648).
+ * @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Base32 string.
+ */ const base32Encode = (arr)=>{
+ let bits = 0;
+ let value = 0;
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ value = value << 8 | arr[i];
+ bits += 8;
+ while(bits >= 5){
+ str += ALPHABET[value >>> bits - 5 & 31];
+ bits -= 5;
+ }
+ }
+ if (bits > 0) {
+ str += ALPHABET[value << 5 - bits & 31];
+ }
+ return str;
+ };
+
+ /**
+ * Converts a hexadecimal string to an Uint8Array.
+ * @param {string} str Hexadecimal string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const hexDecode = (str)=>{
+ // Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
+ str = str.replace(/ /g, "");
+ const buf = new ArrayBuffer(str.length / 2);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i += 2){
+ arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
+ }
+ return arr;
+ };
+ /**
+ * Converts an Uint8Array to a hexadecimal string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Hexadecimal string.
+ */ const hexEncode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ const hex = arr[i].toString(16);
+ if (hex.length === 1) str += "0";
+ str += hex;
+ }
+ return str.toUpperCase();
+ };
+
+ /**
+ * Converts a Latin-1 string to an Uint8Array.
+ * @param {string} str Latin-1 string.
+ * @returns {Uint8Array} Uint8Array.
+ */ const latin1Decode = (str)=>{
+ const buf = new ArrayBuffer(str.length);
+ const arr = new Uint8Array(buf);
+ for(let i = 0; i < str.length; i++){
+ arr[i] = str.charCodeAt(i) & 0xff;
+ }
+ return arr;
+ };
+ /**
+ * Converts an Uint8Array to a Latin-1 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} Latin-1 string.
+ */ const latin1Encode = (arr)=>{
+ let str = "";
+ for(let i = 0; i < arr.length; i++){
+ str += String.fromCharCode(arr[i]);
+ }
+ return str;
+ };
+
+ /**
+ * TextEncoder instance.
+ * @type {TextEncoder|null}
+ */ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
+ /**
+ * TextDecoder instance.
+ * @type {TextDecoder|null}
+ */ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
+ /**
+ * Converts an UTF-8 string to an Uint8Array.
+ * @param {string} str String.
+ * @returns {Uint8Array} Uint8Array.
+ */ const utf8Decode = (str)=>{
+ if (!ENCODER) {
+ throw new Error("Encoding API not available");
+ }
+ return ENCODER.encode(str);
+ };
+ /**
+ * Converts an Uint8Array to an UTF-8 string.
+ * @param {Uint8Array} arr Uint8Array.
+ * @returns {string} String.
+ */ const utf8Encode = (arr)=>{
+ if (!DECODER) {
+ throw new Error("Encoding API not available");
+ }
+ return DECODER.decode(arr);
+ };
+
+ /**
+ * Returns random bytes.
+ * @param {number} size Size.
+ * @returns {Uint8Array} Random bytes.
+ */ const randomBytes = (size)=>{
+ if (globalScope.crypto?.getRandomValues) {
+ return globalScope.crypto.getRandomValues(new Uint8Array(size));
+ } else {
+ throw new Error("Cryptography API not available");
+ }
+ };
+
+ /**
+ * OTP secret key.
+ */ class Secret {
+ /**
+ * Converts a Latin-1 string to a Secret object.
+ * @param {string} str Latin-1 string.
+ * @returns {Secret} Secret object.
+ */ static fromLatin1(str) {
+ return new Secret({
+ buffer: latin1Decode(str).buffer
+ });
+ }
+ /**
+ * Converts an UTF-8 string to a Secret object.
+ * @param {string} str UTF-8 string.
+ * @returns {Secret} Secret object.
+ */ static fromUTF8(str) {
+ return new Secret({
+ buffer: utf8Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a base32 string to a Secret object.
+ * @param {string} str Base32 string.
+ * @returns {Secret} Secret object.
+ */ static fromBase32(str) {
+ return new Secret({
+ buffer: base32Decode(str).buffer
+ });
+ }
+ /**
+ * Converts a hexadecimal string to a Secret object.
+ * @param {string} str Hexadecimal string.
+ * @returns {Secret} Secret object.
+ */ static fromHex(str) {
+ return new Secret({
+ buffer: hexDecode(str).buffer
+ });
+ }
+ /**
+ * Secret key buffer.
+ * @deprecated For backward compatibility, the "bytes" property should be used instead.
+ * @type {ArrayBufferLike}
+ */ get buffer() {
+ return this.bytes.buffer;
+ }
+ /**
+ * Latin-1 string representation of secret key.
+ * @type {string}
+ */ get latin1() {
+ Object.defineProperty(this, "latin1", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: latin1Encode(this.bytes)
+ });
+ return this.latin1;
+ }
+ /**
+ * UTF-8 string representation of secret key.
+ * @type {string}
+ */ get utf8() {
+ Object.defineProperty(this, "utf8", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: utf8Encode(this.bytes)
+ });
+ return this.utf8;
+ }
+ /**
+ * Base32 string representation of secret key.
+ * @type {string}
+ */ get base32() {
+ Object.defineProperty(this, "base32", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: base32Encode(this.bytes)
+ });
+ return this.base32;
+ }
+ /**
+ * Hexadecimal string representation of secret key.
+ * @type {string}
+ */ get hex() {
+ Object.defineProperty(this, "hex", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: hexEncode(this.bytes)
+ });
+ return this.hex;
+ }
+ /**
+ * Creates a secret key object.
+ * @param {Object} [config] Configuration options.
+ * @param {ArrayBufferLike} [config.buffer] Secret key buffer.
+ * @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
+ */ constructor({ buffer, size = 20 } = {}){
+ /**
+ * Secret key.
+ * @type {Uint8Array}
+ * @readonly
+ */ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
+ // Prevent the "bytes" property from being modified.
+ Object.defineProperty(this, "bytes", {
+ enumerable: true,
+ writable: false,
+ configurable: false,
+ value: this.bytes
+ });
+ }
+ }
+
+ /**
+ * Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
+ * @param {string} a String a.
+ * @param {string} b String b.
+ * @returns {boolean} Equality result.
+ */ const timingSafeEqual = (a, b)=>{
+ {
+ if (a.length !== b.length) {
+ throw new TypeError("Input strings must have the same length");
+ }
+ let i = -1;
+ let out = 0;
+ while(++i < a.length){
+ out |= a.charCodeAt(i) ^ b.charCodeAt(i);
+ }
+ return out === 0;
+ }
+ };
+
+ /**
+ * HOTP: An HMAC-based One-time Password Algorithm.
+ * @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
+ */ class HOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * counter: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ counter: 0,
+ window: 1
+ };
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
+ const message = uintDecode(counter);
+ const digest = hmac(algorithm, secret.bytes, message);
+ if (!digest?.byteLength || digest.byteLength < 19) {
+ throw new TypeError("Return value must be at least 19 bytes");
+ }
+ const offset = digest[digest.byteLength - 1] & 15;
+ const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
+ return otp.toString().padStart(digits, "0");
+ }
+ /**
+ * Generates an HOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.counter=this.counter++] Counter value.
+ * @returns {string} Token.
+ */ generate({ counter = this.counter++ } = {}) {
+ return HOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
+ // Return early if the token length does not match the digit number.
+ if (token.length !== digits) return null;
+ let delta = null;
+ const check = (/** @type {number} */ i)=>{
+ const generatedToken = HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: i,
+ hmac
+ });
+ if (timingSafeEqual(token, generatedToken)) {
+ delta = i - counter;
+ }
+ };
+ check(counter);
+ for(let i = 1; i <= window && delta === null; ++i){
+ check(counter - i);
+ if (delta !== null) break;
+ check(counter + i);
+ if (delta !== null) break;
+ }
+ return delta;
+ }
+ /**
+ * Validates an HOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.counter=this.counter] Counter value.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, counter = this.counter, window }) {
+ return HOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ counter,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
+ }
+ /**
+ * Creates an HOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.counter=0] Initial counter value.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Initial counter value.
+ * @type {number}
+ */ this.counter = counter;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+ }
+
+ /**
+ * TOTP: Time-Based One-Time Password Algorithm.
+ * @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
+ */ class TOTP {
+ /**
+ * Default configuration.
+ * @type {{
+ * issuer: string,
+ * label: string,
+ * issuerInLabel: boolean,
+ * algorithm: string,
+ * digits: number,
+ * period: number
+ * window: number
+ * }}
+ */ static get defaults() {
+ return {
+ issuer: "",
+ label: "OTPAuth",
+ issuerInLabel: true,
+ algorithm: "SHA1",
+ digits: 6,
+ period: 30,
+ window: 1
+ };
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return Math.floor(timestamp / 1000 / period);
+ }
+ /**
+ * Calculates the counter. i.e. the number of periods since timestamp 0.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} Counter.
+ */ counter({ timestamp = Date.now() } = {}) {
+ return TOTP.counter({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
+ return period * 1000 - timestamp % (period * 1000);
+ }
+ /**
+ * Calculates the remaining time in milliseconds until the next token is generated.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {number} counter.
+ */ remaining({ timestamp = Date.now() } = {}) {
+ return TOTP.remaining({
+ period: this.period,
+ timestamp
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {string} Token.
+ */ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
+ return HOTP.generate({
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ hmac
+ });
+ }
+ /**
+ * Generates a TOTP token.
+ * @param {Object} [config] Configuration options.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @returns {string} Token.
+ */ generate({ timestamp = Date.now() } = {}) {
+ return TOTP.generate({
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {Secret} config.secret Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
+ return HOTP.validate({
+ token,
+ secret,
+ algorithm,
+ digits,
+ counter: TOTP.counter({
+ period,
+ timestamp
+ }),
+ window,
+ hmac
+ });
+ }
+ /**
+ * Validates a TOTP token.
+ * @param {Object} config Configuration options.
+ * @param {string} config.token Token value.
+ * @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
+ * @param {number} [config.window=1] Window of counter values to test.
+ * @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
+ */ validate({ token, timestamp, window }) {
+ return TOTP.validate({
+ token,
+ secret: this.secret,
+ algorithm: this.algorithm,
+ digits: this.digits,
+ period: this.period,
+ timestamp,
+ window,
+ hmac: this.hmac
+ });
+ }
+ /**
+ * Returns a Google Authenticator key URI.
+ * @returns {string} URI.
+ */ toString() {
+ const e = encodeURIComponent;
+ return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
+ }
+ /**
+ * Creates a TOTP object.
+ * @param {Object} [config] Configuration options.
+ * @param {string} [config.issuer=''] Account provider.
+ * @param {string} [config.label='OTPAuth'] Account label.
+ * @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
+ * @param {Secret|string} [config.secret=Secret] Secret key.
+ * @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
+ * @param {number} [config.digits=6] Token length.
+ * @param {number} [config.period=30] Token time-step duration.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ */ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
+ /**
+ * Account provider.
+ * @type {string}
+ */ this.issuer = issuer;
+ /**
+ * Account label.
+ * @type {string}
+ */ this.label = label;
+ /**
+ * Include issuer prefix in label.
+ * @type {boolean}
+ */ this.issuerInLabel = issuerInLabel;
+ /**
+ * Secret key.
+ * @type {Secret}
+ */ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
+ /**
+ * HMAC hashing algorithm.
+ * @type {string}
+ */ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
+ /**
+ * Token length.
+ * @type {number}
+ */ this.digits = digits;
+ /**
+ * Token time-step duration.
+ * @type {number}
+ */ this.period = period;
+ /**
+ * Custom HMAC function.
+ * @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
+ */ this.hmac = hmac;
+ }
+ }
+
+ /**
+ * Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
+ * @type {RegExp}
+ */ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
+ /**
+ * RFC 4648 base32 alphabet with pad.
+ * @type {RegExp}
+ */ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
+ /**
+ * Regex for supported algorithms in built-in HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
+ /**
+ * Regex for custom algorithms in user-defined HMAC function.
+ * @type {RegExp}
+ */ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
+ /**
+ * Integer regex.
+ * @type {RegExp}
+ */ const INTEGER_REGEX = /^[+-]?\d+$/;
+ /**
+ * Positive integer regex.
+ * @type {RegExp}
+ */ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
+ /**
+ * HOTP/TOTP object/string conversion.
+ * @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
+ */ class URI {
+ /**
+ * Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
+ * @param {string} uri Google Authenticator Key URI.
+ * @param {Object} [config] Configuration options.
+ * @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
+ * @returns {HOTP|TOTP} HOTP/TOTP object.
+ */ static parse(uri, { hmac } = {}) {
+ let uriGroups;
+ try {
+ uriGroups = uri.match(OTPURI_REGEX);
+ // eslint-disable-next-line no-unused-vars
+ } catch (_) {
+ /* Handled below */ }
+ if (!Array.isArray(uriGroups)) {
+ throw new URIError("Invalid URI format");
+ }
+ // Extract URI groups.
+ const uriType = uriGroups[1].toLowerCase();
+ const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
+ /** @type {Object.