Server data from the Official MCP Registry
Ask for passwords/API keys/tokens without pasting values into chat. Zero-knowledge, stdio only.
About
Ask for passwords/API keys/tokens without pasting values into chat. Zero-knowledge, stdio only.
Security Report
Valid MCP server (0 strong, 2 medium validity signals). No known CVEs in dependencies. ⚠️ Package registry links to a different repository than scanned source. Imported from the Official MCP Registry. 1 finding(s) downgraded by scanner intelligence.
10 files analyzed · 1 issue found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Permissions Required
This plugin requests these system permissions. Most are normal for its category.
How to Install
Add this to your MCP configuration file:
{
"mcpServers": {
"journal-mcp": {
"command": "npx",
"args": [
"-y",
"@tacet-ink/journal-mcp"
]
}
}
}Some servers take additional arguments. See the repository for details.
Documentation
View on GitHubFrom the project's GitHub README.
@tacet-ink/journal-core
零知識日記核心:端對端加密、密語即身份的 auth、傳輸與限流原語。 伺服器看不到任何一個字:passphrase 永不過線,密鑰包裹與密文都在客戶端完成。
English: Zero-knowledge journaling core — E2E-encrypted notes, passphrase-as-identity auth, transport & rate-limiting primitives. The server never sees a single word: the passphrase never crosses the wire, and all key wrapping and encryption happen client-side. See the English summary below.
高階 Vault API(client/vault):createVault(pass, { app }) 零設定建 vault → 記錄包裹加解密 → 解鎖/24 詞復原 → PH1 登入憑證,一個子路徑走完。
這是 默·Tacet(tacet.ink) 的客戶端/伺服端核心原語層, 從多個姊妹產品共用的密碼學本體抽取而成,以品牌前綴參數化(前綴契約見下表)。
Live demo
https://tacet.ink/secret:默·Tacet 的一次性分享站,也是本函式庫原語的線上演示。 read-once(讀取一次即失效)、零帳號、免安裝;伺服器永不落明文:加密與解密都在瀏覽器端完成(端對端), 密文經 AES-GCM-256 加密、連結 id 是 SHA-256 截斷(兩者皆與本函式庫同組 WebCrypto 原語、同一呼叫形)。單頁、無框架; 原始碼在 Tacet 主 repo(private),頁尾另有驗證頁入口。
English: Live demo: https://tacet.ink/secret. Read-once, zero-account, E2E secret sharing built on this library's WebCrypto primitives. Single-page, no framework.
Quickstart
// example.mts
import { createVault, unlockVault, recoverVault, deriveVaultPh1, isVaultError }
from '@tacet-ink/journal-core/client/vault';
const PASS = 'correct horse battery staple';
const cfg = { app: 'myapp', recovery: true }; // 零設定:全前綴由 app 推導(myapp1v./myapp4w./myapp1r.…);recovery=復原套件 opt-in
// 1. 建 vault:隨機 noteKey+Argon2id 密語包裹。serverRecord=上傳伺服器的包裹欄;kit=復原套件(只顯示一次)
const { vault, serverRecord, recovery: kit } = await createVault(PASS, cfg);
// 2. 記錄加解密:AAD 綁 app+recordId——密文搬到別筆 recordId 即 ERR_VAULT_DECRYPT
const blob = await vault.encrypt('note-1', { title: '今天', body: '寫了一點東西。' });
console.log(blob.slice(0, 8)); // 'myapp1v.'
console.log(await vault.decrypt('note-1', blob)); // { title: '今天', body: '寫了一點東西。' }
// 3. 換裝置解鎖:密語+伺服器帶回的 serverRecord(同一 cfg)
const unlocked = await unlockVault(PASS, serverRecord, cfg);
console.log(await unlocked.decrypt('note-1', blob)); // 同上
try { await unlockVault('wrong passphrase', serverRecord, cfg); }
catch (e) { console.log(isVaultError(e, 'ERR_VAULT_WRONG_PASSPHRASE')); } // true(拋出碼恆 ERR_VAULT_WRAP_MISMATCH)
// 4. 忘記密語:24 詞復原(伺服器存 kit.wrappedRec+kit.recTokenHash;詞只給使用者抄寫)
if (!kit) throw new Error('recovery kit missing'); // cfg 未開 recovery=null
console.log(kit.words.length); // 24
const recovered = await recoverVault(kit.words, kit.wrappedRec, cfg);
console.log(await recovered.decrypt('note-1', blob)); // 同上
const newRecord = await recovered.changePassphrase('a new passphrase'); // 設新密語 → 覆存 serverRecord
// 5. 登入憑證:PH1(hex64)上線、密語本體不過線;鹽=per-product 固定域鹽(⚠️ 見下方「PH1 派生」節鹽域警告)
const ph1 = await deriveVaultPh1(PASS, new TextEncoder().encode('myapp-ph1-v1'));
console.log(ph1.length); // 64
// server(fork 端,'@tacet-ink/journal-core/server/auth'):return loginRouteCore(env, store, ip, ph1);
run: npm install @tacet-ink/journal-core && node example.mts(0.3.4 起;Node ≥ 24.7——dist ESM 直載免 strip-types 旗標,.mts 不受 package.json type 影響;Argon2id 走內建 node:crypto 免注入 loader)
源碼 clone 跑驗證閘:
git clone https://github.com/tacet-ink/journal-core.git && cd journal-core
npm ci --ignore-scripts
npm run verify # 743 assertions, all green, run against the real modules (no mocks); needs this repo checkout — the published package is dist-only since 0.3.4 (no gate, no src/, no scripts/)
上例為高階 Vault API;錯誤碼見例外契約(VaultError 表)。低階原語範例(note-crypto 兩時代加解密、前綴自配)與完整 API 見使用(Usage)節。Live product: https://tacet.ink
(驗證頁:https://tacet.ink/verify)。
安全回報流程見 SECURITY.md、版本歷史見 CHANGELOG.md。
設計(Design)
- 兩時代金鑰模型:未綁定(guest)時代以
K_u = SHA-256(guestKdfPrefix ‖ identity)純客戶端派生(混淆級);綁定後改用隨機 256-bit noteKey 加密, noteKey 再以 passphrase(KEK)與復原套件(KEK_rec)雙重包裹上傳。 此後 passphrase 不再過線:線上只送 PH1(雜湊形),伺服器存 PH2 = SHA-256(PH1)。 - 帶內版本化:升級 KDF 參數 = 換新前綴(舊前綴照解、原地改語意是禁手)。 前綴全部可配置,AAD(防搬移綁結)由呼叫端傳入。
- extractable 鐵律:要被 exportKey/wrap 的 key(noteKey 全部產生路徑),
import 當下就必須
extractable=true;KEK/guest key 恆 nonextractable。 - opt-in 原語:選配契約(cipherGuest/wrapDual/wrapShare/pinLock/cipherAttach/cipherLocal/ wrap4/wrapDual4/wrapLocal/wrapRec+recKekHkdf(兩欄一體——同缺同在,部分配置拒寫)/recKekSalt)未配置=回落語意(wrapRec 系照走舊契約面;其他面拒絕或退場),各 fork 未選用的原語行為不受影響(cipherGuest 未配置時 bound 路徑不受牽連, 解密面 guest 家族整面拒絕、不明字串與畸形空字串配置不當明文顯示)。wrapLocal 為選配: 未配置=寫面功能退場——v1 可用者(借用期部署)升級後需配置 wrapLocal 才保留本機包裹寫入 (讀取面照走舊形回落,零資料損失面)。
- 明文相容層 opt-out(
allowPlaintext,0.7.0 起):反 opt-in——未配置/true=現行 契約零變(opt-out 母型:關閉是 fork 顯式選擇,未配置態 byte-identical);false=關閉: clientdecryptNote無前綴字串一律 null 不落明文;servermakeInboundCipher落帽真明文 →null、超帽真明文→null(明文截斷帽不折半收假密文,截斷必壞同律)、帽內純 b64 慣例軌 →null(無前綴=不可驗證內容)。相容層回傳值=未驗證內容——伺服器或傳輸層不需金鑰 即可寫入此層(舊版客戶端明文筆記的唯一通道);關閉態回傳值不再含未驗證內容。退場條件: 0.7.0 後兩個 minor 週期內遷移完即摘(屆時 fork 需顯式配置allowPlaintext:true或接受摘除面;詳「界限」節+rotation-design §12 誠實面)。 - 限流鍵雜湊化(0.11.1 起):upgrade 後 DB 既有窗列由既有 GC 自然汰換、零 migration、零行為變(429 閾值/窗口照舊);salt 輪換=鍵域換代、跨窗計數失憶一次(可接受)——有
RATE_KEY_SALT才是 pepper,缺省僅域分離。
模組(Modules)
| 模組 | 內容 |
|---|---|
src/client/note-crypto.ts | 兩時代加解密、passphrase/復原套件/本機三路包裹、PIN 第二因子合鑰(jr2w.) |
src/client/argon2.ts | Argon2id 包裹原語(jr3w./jr3d./jr3s.+密語正規化 v3 世代 jr4w./jr4d.)、PH1 v2/v3 派生、RFC 9106 KAT、雙載體(node:crypto+hash-wasm) |
src/client/pinlock.ts | 本機 PIN 鎖定包裹(jr1p.,開啟時鎖定) |
src/client/bip39.ts | 復原套件 24 詞 ⇄ hex64 轉寫層(BIP39,零依賴自製) |
src/client/keys.ts | 品牌前綴 localStorage 命名空間 |
src/server/auth.ts | 零知識 auth 核心:PH1→PH2 login 動線、入庫格式驗證、包裹欄組成對(pair 檢查 pickKeyPackage);PH2 UNIQUE 衝突與 session 撤銷=呼叫端職責;PH2 落庫形派生 AuthStore.ph2Of?(optional,0.4.0)=pepper 收口注入點(未注入=sha256Hex(PH1) 單查零變) |
src/server/ladder.ts | 密語正規化 v3 世代 ladder 表原語(ph2_ladder:以舊 ph2 查列/遷移入表 upsert 值主權威)+幽靈守衛查表接線已內建 loginRouteCore——fork 只需配 ladderLookup store+0011 migration(未配置=單查行為零變) |
src/server/ratelimit.ts | per-IP fixed-window 限流(單句 UPSERT…RETURNING;D1 計數,跨 isolate 有效;IPv6 鍵經 normalizeRateIp 聚合至 /64;IPv4-mapped 位址回點分 IPv4 鍵(=原生同 /32 鍵);0.4.1 第二層粗桶 normalizeRateIpCoarse(/48 |
src/server/cors.ts/hash.ts | 共用 CORS/雜湊工具(src/server/env.ts 為內部 Env 介面,不入 exports) |
src/secret/jr5s.ts/jr5e.ts | secret 家族原語(R3a 0.11.0):jr5s. 一次性密語密文(/secret 方案 B;key=S raw 32B 外部+0x73 標記+AAD 綁 locator;b64url 無 padding 正形)+jr5e. ECDH 單向封裝(P-256 ephemeral 用畢即棄+HKDF(salt=eph_pub, info=AAD)→AES-256-GCM)——子路徑 ./secret/jr5s/./secret/jr5e(src/secret/util.ts 為內部 b64url 工具,不入 exports) |
發行形(0.3.0 起):dist/=tsc 原生 emit 的 ESM .js+.d.ts,exports 全部子路徑指向 dist。
0.3.4 起發行包 dist-only:files 白名單恰 dist/docs/migrations/README/LICENSE——src/、scripts/
不再隨包(驗證閘與向量產生器為 repo 樹面,走源碼 clone 動線);稽核/閱讀路徑=GitHub 瀏覽 src/+
docs/format-spec.md 規格+docs/vectors/ 向量(docs/ 仍隨包)。
monorepo(0.11.0 起):npm workspaces packages/*——packages/cli(R3b:索取祕密
本機 CLI tacet-secret request/verify/submit——N3 先驗證再交付、參照白名單、送出預設關、
值永不回模型上下文)/packages/mcp(R3c:stdio MCP server——request 貼連結主路徑+
URL elicitation 增強面、verify 四方帳、零遠端 MCP;mcpName=io.github.tacet-ink/tacet-secret
=官方 MCP Registry 名(server.json 的 name 恆同),另帶 Claude plugin bundle
(.claude-plugin/+skills/))。兩包 R5/JCM1 上架公開 npm(首發 cli 0.12.0/mcp 0.11.1;骨架期曾
private: true);發佈動線、tag 檢對帳與 chris 親行節見 docs/RELEASE.md。
加密一律 import 本包,自帶加密實作禁。
發佈 tag 規約(2026-10-24 裁定):多包 tag 形 <名>-v<version>(如 journal-mcp-v0.11.1);
包名禁 v 開頭(防 tag 撞名);root 包維持 v* 單包形。
前綴契約(家族表:19 列/18 個資料前綴+閘對照組 jr1g.)
前綴是版本契約:payload 佈局與 KDF 由前綴界定,升級 = 新前綴。 逐位元組布局、KDF 參數、AAD 與世代契約的完整規格見 docs/format-spec.md, 測試向量見 docs/vectors/(真原語產生的凍結證據;閘 [26] 檢存在性與 shape)。 Tacet 部署實例(config 傳入):
| 前綴 | 語意 | KDF | payload |
|---|---|---|---|
jr1u. | guest 時代密文 | K_u = SHA-256(guestKdfPrefix ‖ identity) | AES-GCM |
jr1b. | 綁定時代密文 | 隨機 256-bit noteKey | AES-GCM,AAD 綁 noteId |
jr1c. | 附件密文(image attachments;選配) | 同筆記金鑰(noteKey/guest key 由呼叫端決定) | AES-GCM,AAD jr1a:<noteId>:<attachId> |
jr1d. | 本機 IDB stored 密文(notes store;選配) | 同筆記金鑰(呼叫端注入) | AES-GCM,AAD 綁 note_id,payload 自帶 v 欄 |
jr1l. | 本機包裹(PWA session 期免重打密語;選配;deprecated——混淆級,用途由「開啟時鎖定」jr1p./jr2p.(0.5.0 起已上線)取代,讀面照走、新整合不配置 wrapLocal) | deriveGuestKey=K_u 同 guest 面(identity 派生、passphrase-free) | 同 jr1w. 形,AAD notekey-local |
jr1r. | 復原套件包裹(wrappedRec 專用;v0.2.0 世代,選配,與 recKekHkdf 兩欄一體) | HKDF-SHA256(ikm=recToken, salt=recKekSalt?, info=journal-kek-rec-v1:+recKekHkdf)——兩欄齊備才寫 jr1r. 面 | 同 jr1w. 形,AAD notekey-rec(部分配置拒寫;舊契約面 jr1w.+PBKDF2+AAD notekey 永不變——新世代讀舊寫新雙試) |
jr1w. | passphrase 包裹+復原套件包裹(未配置世代) | PBKDF2-SHA256 600k(復原套件 KEK=PBKDF2(recToken, recSaltPrefix‖identity)) | b64(iv[12] ‖ GCM(hex(noteKey))),AAD notekey(復原套件與 passphrase 同 AAD 慣例=未配置世代借形) |
jr2w. | PIN 第二因子合鑰(PBKDF2 版) | PBKDF2 600k(pass)+2M(pin) → HKDF-SHA256 | pinSalt[16] ‖ iv[12] ‖ GCM,108B,AAD notekey2 |
jr3w. | passphrase 包裹(Argon2id 版) | Argon2id m=64MiB t=3 p=1 tag=32B | 同 jr1w. 形,AAD notekey |
jr3d. | PIN 第二因子合鑰(Argon2id 版) | Argon2id(pass)+Argon2id(pin) → HKDF-SHA256 | 同 jr2w. 形,108B,AAD notekey2 |
jr4w. | passphrase 包裹(密語正規化 v3 世代) | Argon2id(normalizePassphrase(pass),NFKC-only) 同上參數 | 同 jr1w./jr3w. 形,AAD notekey |
jr4d. | PIN 第二因子合鑰(密語正規化 v3 世代) | Argon2id(normalizePassphrase(pass))+Argon2id(pin) → HKDF-SHA256 | 同 jr2w./jr3d. 形,108B,AAD notekey2 |
jrsw. | 分享包裹 V1(PBKDF2 版;建立面退役,讀取面兩代並行保留) | PBKDF2-SHA256 600k | 同 jr1w. 形,AAD notekey-share(⚠️ 不可傳入帳戶主鑰 noteKey——分享包裹的金鑰範圍=該次分享;傳主鑰=收分享者可解全帳戶(J1;tacet 親例)) |
jr3s. | 單篇分享連結包裹(Argon2id 版;createShareEnvelope 高階組裝產出) | Argon2id(同上參數) | 同 jr1w. 形,AAD notekey-share(⚠️ 不可傳入帳戶主鑰 noteKey——分享包裹的金鑰範圍=該次分享;傳主鑰=收分享者可解全帳戶(J1;tacet 親例)) |
jr1p. | 本機 PIN 鎖定(開啟時鎖定) | PBKDF2-SHA256 600k(刻意不用 Argon2id:解鎖要即時) | 同 jr2w. 形,AAD notekey-pinlock |
jr5s. | 一次性密語密文(/secret 方案 B;R3a 0.11.0) | 無(key=S raw 32B 外部) | b64url(iv[12] ‖ GCM(0x73 ‖ UTF8(明文))),AAD jr5s:<id>(id=sha256Hex(b64url(S)) 前 32 hex;編碼例外=b64url 無 padding) |
jr5e. | ECDH 單向封裝(request-secret;R3a 0.11.0) | ECDH P-256 shared ‖ HKDF-SHA256(salt=eph_pub raw 65B, info=AAD) | b64url(eph_pub[65] ‖ iv[12] ‖ GCM(明文)),ephemeral 用畢即棄;AAD 呼叫端傳入(部署形 jr5e:<slot_id>) |
guest 密文前綴在閘對照組另驗 jr1g.(閘自造前綴,驗證品牌參數化本身;tacet 部署實例 guest 用 jr1u.)。
跨前綴呼叫一律回 null(前綴守衛+AAD+長度把關),不拋、不降級。
世代命名兩軸(jr4w./jr4d. 起):前綴數字軸=KDF 世代代(jr1w→jr2w→jr3w→jr4w,
KEK 輸入契約改變即換世代);「v3 家族」文案=PH1 規格代(PH1 v3 用 derivePh1ArgonV3)。
密語正規化 v3 世代=KEK 吃 normalizePassphrase(NFKC-only:不 trim、不分大小寫——
大小寫摺疊禁絕=大小寫差恆不同 KEK/ph2)——
舊前綴家族(jr1w./jr3w./jr2w./jr3d.)契約面永不變(raw 密語派生,帶內版本化禁原地改語意);
跨前綴呼叫恆 null(家族隔離)。同密語寫法差(全形/NFD/NFC)在 v3 世代收容為同一 KEK/PH2,
首尾空白與大小寫仍刻意分流(v3 契約只收容寫法差)。
jr4d. 的 KEK2 HKDF info 域='journal-kek2-v1:' + wrapDual4(自有域——NFKC-effective 密語下
jr3d/jr4d 兩入參數同輸入,域分離由 info 承載;凍結 KAT 兩 blob 互解 null 為證)。
驗證(Verification)
npm ci --ignore-scripts
npm run verify # 743 帳對真模組(禁鏡像;限流單句 UPSERT…RETURNING 直載真 SQLite):roundtrip/AAD 防搬移/
# extractable/時代隔離/跨前綴家族隔離/payload 竄改/RFC 9106 KAT/BIP39 @scure 對照 200 組/
# server-side(inboundCipher/validWrappedKey/pickKeyPackage/checkRate/timingSafeEq)+ pinlock 全函式
# + 密語正規化 v3 世代(normalizePassphrase/jr4w./jr4d./PH1 v3 鹽域分離+帶內版本化舊契約向量)
# + 本機包裹專用前綴(wrapLocal=jr1l. opt-in+讀舊寫新自癒)
# +復原套件專用前綴與 HKDF 世代 [20](wrapRec=jr1r.+recKekHkdf opt-in+讀舊寫新雙試+KAT)
# +loginRouteCore ladder 查表守衛 [23](外審 #8 幽靈帳:現值 miss → ladder → 兩面 miss 才建幽靈;真 node:sqlite 直驅七情境+拷貝樹毒化接線摘除案)
# +ladder 表與重取鹽面 [19](ph2_ladder 原語/upsert 值主權威行為面/unwrapNoteKeyDual4WithSalt)
# +常駐毒化矩陣 [16][18](/tmp 拷貝樹突變重跑=毒化證據隨每執行重建)
# +KAT 凍結向量 [17](HKDF info 域世代分離+v3/raw 入口契約四 blob)
# +包裹前綴快檢 [13-2](錯前綴試探免付 KDF:五入口行為+計時帽+計數錨)
# +CI 供應鏈面 [21](npm ci --ignore-scripts+dependabot runner fromJSON 分流+腳本摘除+NIT-1 錨+r2 MINOR-1 URL 直傳;
# 743 帳=repo 樹——workflow 錨在 .github=repo 樹恆在、四條全跑;包內 SKIP 對照帳段隨 0.3.4 dist-only 瘦身退役:發行包不再帶閘=無包內帳可言)
# +發行 tarball 治理面 [22](pack 白名單零 open-card-pr.sh)
# +格式規格+測試向量 [26](docs/format-spec.md+docs/vectors 存在性/位元組 shape/欄位名對規格/凍結 KAT 逐字對閘)
# +高階 Vault API [27](roundtrip 三形/新舊前綴解鎖/upgrade/換密語/復原/VaultError 毒化/載體覆寫+Worker 回退鏈/vendor 孿生)
# +分享 envelope 高階 API [28](createShareEnvelope:一次性 shareKey 與主鑰隔離+jr3s. 包裹三件組+無狀態純函數毒化錨)
- 產品碼零執行時依賴(WebCrypto 原語);devDependencies 僅閘用(typescript、@scure/bip39 對照、workers types)。
- node_modules 出廠態說明:本 repo 的
@scure/bip39/@noble/hashes由閘的 vendor 修復 腿(scripts/prepare-core-pkg.cjs,plainnpm ci後執行)補齊 symlink 與 vendored 副本—— 與 devDependencies 安裝態等價(provenance 註記:現場樹的非 pristine 安裝形態屬此機制, 非手工污染;reproduce 走 plainnpm ci後跑 prepare 腿即收斂)。 - Argon2id 雙載體:node 走
node:crypto(Node 24.7+ 原生)、瀏覽器走 hash-wasm(wasm 內嵌), RFC 9106 標準向量逐位元一致;無載體即 throw(禁 fallback 鐵律)。 - BIP39 原語自製零依賴,與 @scure/bip39 參照 200 組雙向對照(僅 entropy↔words 轉寫層,禁用其 seed 派生)。
- 本地 commit 衛生守衛:clone 後於工作樹
git config core.hooksPath githooks(pre-commit 拒新卡號/機器/agent 字樣;動線=docs/RELEASE.md §7)。
使用(Usage)
0.3.0 起發行 dist/(ESM .js+.d.ts):npm 安裝後瀏覽器、Node、Deno、Bun、Workers
皆可直接 import,不需打包器、不需 strip-types(0.2.x 的「npm 安裝必走打包器」限制已退役)。
源碼 clone 仍可直接 node --experimental-strip-types 跑 src/。
import { makeKeyStore, makeHeldKey, generateNoteKey, encryptNote, decryptNote } from '@tacet-ink/journal-core';
// 或子路徑:'@tacet-ink/journal-core/client/note-crypto'
低階原語最小 roundtrip(源碼 clone 形,import ./src/*):
// example.ts
import { makeHeldKey, generateNoteKey, encryptNote, decryptNote } from './src/index.ts';
import { makeKeyStore } from './src/client/keys.ts';
const cfg = {
guestKdfPrefix: 'myapp-note-u1',
recSaltPrefix: 'myapp-note-rec1:',
cipherGuest: 'jr1g.', // your own brand prefix family (guest era, opt-in)
cipherBound: 'jr1b.',
wrap: 'jr1w.',
store: makeKeyStore({ brand: 'myapp' }),
};
const held = makeHeldKey();
held.set(await generateNoteKey()); // bound era: random 256-bit noteKey
const identity = { current: () => 'acct-xxxxxxxxxxxxxxxx' };
const cipher = await encryptNote(cfg, held, '今天寫了一點東西。', 'noteId:n1', identity);
console.log(cipher.slice(0, 5)); // 'jr1b.' — ciphertext; nobody reads it without the key
console.log(await decryptNote(cfg, held, cipher, 'noteId:n1', identity)); // '今天寫了一點東西。' — roundtrip
run: node --experimental-strip-types example.ts
npm 安裝形(完整 cfg 欄位):
import { generateNoteKey, encryptNote, decryptNote, makeHeldKey,
wrapNoteKey, unwrapNoteKey } from '@tacet-ink/journal-core/client/note-crypto';
import { makeKeyStore } from '@tacet-ink/journal-core/client/keys';
import { derivePh1Argon } from '@tacet-ink/journal-core/client/argon2';
const cfg = {
guestKdfPrefix: 'myapp-note-u1',
recSaltPrefix: 'myapp-note-rec1:',
cipherGuest: 'jr1g.', // 換成你自己的品牌前綴家族
cipherBound: 'jr1b.',
wrap: 'jr1w.',
wrapLocal: 'jr1l.', // 選配:本機包裹專用前綴(未配置 = 讀舊形回落、寫面退場)
// 復原套件 v0.2.0 世代(選配):wrapRec+jr1r. 專用前綴+recKekHkdf HKDF 派生
// (info='journal-kek-rec-v1:'+recKekHkdf;recKekSalt 16B hex 鹽域)。兩欄一體:
// 要開就兩欄一起配(部分配置=ERR_REC_CFG_PARTIAL 拒寫)。兩欄皆缺席 =
// 行為不變態(jr1w.+PBKDF2+AAD 'notekey' 舊契約面照走,舊 blob 永遠可解)。
store: makeKeyStore({ brand: 'myapp' }),
// cipherGuest / wrapDual / wrapShare / pinLock / cipherAttach / cipherLocal:選配,未配置即拒絕
};
const held = makeHeldKey();
const identity = { current: () => 'acct-xxxxxxxxxxxxxxxx' };
const cipher = await encryptNote(cfg, held, '今天寫了一點東西。', 'noteId:n1', identity);
單篇分享 envelope(client/argon2,0.3.6):一次性 shareKey+該次快照密文+jr3s. 包裹
三件一組——shareKey 與帳戶主鑰隔離(J1:主鑰過分享包=收分享者可解全帳戶,tacet 親例已修),
無狀態純函數(shareKey 每次新生成,module 層無快取殘留):
import { createShareEnvelope, unwrapNoteKeyShare3 } from '@tacet-ink/journal-core/client/argon2';
// createShareEnvelope 亦經根 barrel 公開匯出('@tacet-ink/journal-core')
const argon = { wrapShare3: 'jr3s.' }; // Argon3Config:wrapShare3 選配(未配置=分享 API 拒絕)
const env = await createShareEnvelope(cfg, argon, '今天寫了一點東西。', 'noteId:n1', 'share-pass', identity);
// env = { ciphertext, wrapped, salt }——存 shares 表(salt 外置 hex);密文前綴 cfg.cipherBound(held 恆 set 路徑)
const shareKey = await unwrapNoteKeyShare3(argon, env.wrapped, 'share-pass', env.salt); // 收分享端
PH1 派生(登入憑證):derivePh1Argon(pass, saltArg?) 預設鹽 PH1_V2_SALT
('tacet-ph1-v1',Tacet 實例,raw pass)。其他產品可自選固定域鹽傳入 saltArg——
鹽一經選定即 per-product 恆固定(PH2 UNIQUE 約束:同一密語必須恆生同一 PH2;
per-user 鹽會摧毀幽靈帳號機制)。改鹽=帶內版本化換鹽尾碼重遷移,禁原地改語意。
PH1 v3(密語正規化世代):derivePh1ArgonV3(pass, saltArg?) 預設鹽 PH1_V3_SALT
('tacet-ph1-v2',新鹽域=世代 ph2 命名空間分離——同鹽域會讓 v3 'PASS' 與 v2 世代
raw 'PASS' 撞同一 ph2)。派生輸入吃 normalizePassphrase(NFKC-only;大小寫摺疊禁絕=
大小寫差恆不同 ph2);v2/legacy 派生面零變更(舊帳戶憑證 raw 契約)。兩代 ph2 可並存查表=
tacet 遷移層職責(v0.2.0 世代收口)。
ph1Of(legacy,SHA-256(pass))標 @deprecated:無塩 SHA-256 過登入 wire,DB 洩後
ph2 離線爆破面=快雜湊重算命中——不可與 Argon2id PH1 同時作為上線探證。新整合恆改用
derivePh1ArgonV3/deriveVaultPh1(Argon2id 派生、固定域鹽)。函式本體零動(legacy 平台
登入與 deleteAccount 證明面仍在用;退場窗口=J2a 批)。
server 登入動線(fork 端):loginRouteCore(env, store, ip, ph1) 內建
ladder 查表守衛——現值 miss 時經 AuthStore.ladderLookup(optional)查 ph2_ladder,
命中回舊帳不建幽靈、兩面 miss 才 createUser;未配置=行為與 0.2.3 單查恆等。
接法:store 實作 ladderLookup(tacet 參考形=SQL_FIND_PH2_LADDER_BY_OLD+fail-open
catch)+套用 migrations/0011-ph2-ladder.sql(+0012 索引修正);查表零寫入面
(insert 在 rekeyWithLadder 遷移線、delete 在 fork 的 delete-account 批)。
⚠️ 鹽撞位警告:PH1_V3_SALT 禁當 derivePh1Argon 的 saltArg 餵入(反之亦然)——
把 v3 鹽域值餵 v2 派生(或 fork 把同一 saltArg 帶到兩面)=NFKC-effective 密語與 v2 raw 密語
同值撞 ph2,跨世代帳戶空間混合。v3 的 saltArg 必須異於本 product 的 v2 鹽域值。
高階 Vault API 零設定前綴(resolveVaultConfig,0.3.4):createVault(pass, { app }) 最小設定
——全前綴由 app 決定性推導:記錄密文 <app>1v.、寫面 <app>4w./PIN <app>4d.、
鹽域 <app>3s:、舊世代讀面 <app>3w./<app>3d./<app>1w./<app>2w./<app>1s.;
recovery: true opt-in(復原套件 <app>1r.+HKDF info 域 <app>kek1,recKekSalt 未指定=
零鹽契約照舊)——未指定恆不推導(零鹽選擇不可靜默)。app 契約 ^[A-Za-z0-9_-]+$
(前綴字面=線上 ASCII 契約)=零設定路徑專載——非契約 app 誤入零設定=
ERR_VAULT_CONFIG fail-closed 不猜;顯式全配置路徑 app 字面照 0.3.3 既有契約零驗形
(非 ASCII/帶點 app 走顯式全配置照舊——契約閘不跨路徑加寬、顯式回歸 diff 恆 0)。
顯式路徑判別:argon 或 cipher 任一在場=顯式全配置路徑(resolver 零推導——既有
五值手填契約照舊、顯式配置回歸 diff 恆 0);半顯式態(argon 組推導+legacy 物件槽顯式欄位)
推導值與顯式值同進前綴互斥檢查(例 legacy: { wrap: <app>4w.bait } 與推導 <app>4w. 互為
前綴=拒——歧義配置不猜)。跨設定形前綴隔離照舊(推導包裹顯式設定不解、顯式包裹他設定不解
=ERR_VAULT_WRAP_UNKNOWN,app 即前綴契約域)。
例外契約(錯誤碼語意)
客戶端(client/)
| 錯誤碼 | 拋出面 |
|---|---|
ERR_NO_IDENTITY | guest 加密面空 identity(解密面同面回 null) |
ERR_GUEST_NOT_CONFIGURED | encryptNote 未配置 cipherGuest |
ERR_BAD_HEX | hexToBytes 非法 hex(奇數長度/非 hex 字元/空字串) |
ERR_WRAP_NOT_CONFIGURED | 包裹未配置(sealNoteKey 本體+wrapNoteKey 入口雙防線) |
ERR_WRAPTAMPER_LEN32 | sealNoteKey noteKey 非 32B(內部契約面) |
ERR_DUAL_NOT_CONFIGURED | wrapNoteKeyDual 未配置 wrapDual/pinSaltPrefix |
ERR_SHARE_NOT_CONFIGURED | wrapNoteKeyShare 未配置 wrapShare |
ERR_LOCAL_NOT_CONFIGURED | encryptLocal 未配置 cipherLocal |
ERR_ATTACH_NOT_CONFIGURED | encryptAttach 未配置 cipherAttach |
ERR_PIN_EMPTY | wrapNoteKeyDual/3/4 空 PIN(≠ 未配置——語意分離) |
ERR_PINLOCK_NOT_CONFIGURED | pinlock 未配置三欄任一 |
ERR_PINLOCK_EMPTY | pinlock 空 PIN |
ERR_REC_CFG_PARTIAL | wrapRec/recKekHkdf 部分配置(配對門拒寫) |
ERR_REC_KEK_SALT | recKekSalt 非 16B hex(HKDF 世代鹽域 fail-closed) |
ERR_JR3W_NOT_CONFIGURED | wrapNoteKey3/wrapNoteKeyDual3(+share 面)未配置 |
ERR_JR3S_NOT_CONFIGURED | wrapNoteKeyShare3 未配置 wrapShare3 |
ERR_JR4W_NOT_CONFIGURED | wrapNoteKey4 未配置 wrap4 |
ERR_JR4D_NOT_CONFIGURED | wrapNoteKeyDual4 未配置 wrapDual4 |
ERR_ARGON2_TAGLEN | Argon2id 載體 tag 非 32B(載體契約面) |
ERR_ARGON2_UNAVAILABLE | 無 Argon2id 載體(node<24.7 且無 hash-wasm 注入——禁 fallback) |
高階 Vault API(client/vault)
低階原語面不動(throw 'ERR_*' 字串錯誤+unwrap 恆 null 的混態照舊)——只在 vault.ts/argon-auto.ts 邊界轉譯:高階 API 一律 throw VaultError,呼叫端以 code 分流,不比對 message。
失敗面刻意不細分「密語錯」與「密文竄改」(同一 GCM 失敗——細分=oracle)。
VaultError(e.code)+型別守衛 isVaultError(e, code?):14 個拋出碼+1 個查詢別名。
| 錯誤碼 | 拋出面 |
|---|---|
ERR_VAULT_CONFIG | 配置缺欄/畸形(app、cipher、argon.wrap4、recovery 兩欄一體…)——opt-in 未配置即拒 |
ERR_VAULT_BAD_RECORD | serverRecord 缺 wrapped/salt 欄或形不符(不猜) |
ERR_VAULT_WRAP_UNKNOWN | wrapped 前綴不屬任何已配置家族(未知世代/他產品前綴) |
ERR_VAULT_WRAP_MISMATCH | 家族辨識成功但解包失敗:密語/PIN 錯或包裹竄改(刻意不分) |
ERR_VAULT_WRONG_PASSPHRASE | 查詢別名(拋出面恆 WRAP_MISMATCH):isVaultError(e, 'ERR_VAULT_WRONG_PASSPHRASE') 與查 ERR_VAULT_WRAP_MISMATCH 雙向等值;本 API 不拋此碼 |
ERR_VAULT_PIN_REQUIRED | 雙因子家族(jr2w./jr3d./jr4d. 形)缺 PIN |
ERR_VAULT_BAD_PASSPHRASE | 密語空值/非字串 |
ERR_VAULT_BAD_PIN | PIN 正規化後為空 |
ERR_VAULT_KDF_UNSUPPORTED | Argon2id 載體缺席或失效(zero-fallback:禁 PBKDF2/zeros 兜底) |
ERR_VAULT_BAD_RECORD_ID | recordId 非字串或空 |
ERR_VAULT_BAD_DATA | encrypt 資料形不支援(undefined、BigInt、循環 JSON、非 Uint8Array 的 ArrayBuffer 族…) |
ERR_VAULT_BAD_BLOB | 密文 blob 形不符(前綴/base64/長度/型別標記) |
ERR_VAULT_DECRYPT | 密文解密失敗:recordId(AAD)不符、金鑰不符或密文竄改(刻意不分) |
ERR_VAULT_RECOVERY | 復原套件形不符(recToken 非 hex64/24 詞不符、wrappedRec 前綴不符)或解包失敗 |
ERR_VAULT_INTERNAL | 未預期的低階錯誤(cause 帶原錯) |
伺服端(server/)+閘
| 錯誤碼 | 拋出面 |
|---|---|
ERR_BAD_REQUEST | auth 動線缺 PH1 等必填(400 面回應) |
ERR_RATE_LIMITED | 限流命中(429 面回應) |
ERR_RATE_TABLE_NAME | 限流表名非法字元(SQL 面 fail-closed) |
ERR_SQLITE_UNAVAILABLE | 驗證閘環境 node:sqlite 缺席 |
ERR_FS_UNAVAILABLE | 驗證閘環境 node:fs 缺席 |
PinLockConfig:解包輸出的 noteKey 恆extractable=true(鐵律,非可調選項)—— config 只帶三個前綴欄(pinLock/pinLockSaltPrefix/pinLockAad),缺任一即拒。
Argon2id 瀏覽器載體需另裝 hash-wasm 並以 setArgonLoader() 注入(詳 src/client/argon2.ts 檔頭);
Node ≥ 24.7 走內建 node:crypto 免注入。
界限(誠實面)
- guest 時代是混淆級不是 e2e(K_u 由 identity 可派生);e2e 承諾從綁定(隨機 noteKey)起。
- 明文相容層(
allowPlaintext,0.7.0 起):未配置/true 時decryptNote對無前綴舊版 明文原樣返回、makeInboundCipher對明文照收截帽入庫——該面回傳值/入庫值=未驗證內容 (伺服器或傳輸層不需金鑰即可寫入此層;舊版客戶端明文筆記的唯一通道);false=關閉 (無前綴明文一律 null、截斷面同步關閉、帽內 b64 慣例軌同面 null)。退場條件(誠實面 落條):0.7.0 後兩個 minor 週期內遷移完即摘——屆時 fork 需顯式allowPlaintext:true(接受未驗證內容面)或接受相容層摘除(舊明文讀 null);未遷移 fork 摘除面零通知(相容層靜默消失=舊明文筆記不可讀),升級前先盤點 own 明文存量。 - PIN 類保護(本機鎖定/雙因子 PIN 腿)是 PBKDF2-SHA256 600k:6 位純數字在 RTX 4090 公開基準(≈8.8e9 iter/s;速率外推非實測)≈68 秒(外推)、8 位數字 ≈1.9 小時(外推)、6 碼小寫英數 ≈41 小時(外推)(PoC C 實證底:4 位 16 核 CPU 28.7s 命中)=門檻不是牆——鎖定閘取即時性、非登入 oracle 戰場,強度取捨見設計。
- 分享面金鑰範圍:v0.3.6 起
createShareEnvelope用一次性shareKey(單篇分享建檔、不可傳入帳戶主鑰);此前分享面=帳戶歷史主鑰(J1 收口前的舊形,舊 blob 照解)。 jr1l.本機包裹(storeLocalWrap/loadLocalWrap,wrapLocal選配)是混淆級非 e2e(KEK 由 identity 派生、passphrase-free——與 guest 同級):已 deprecated,用途由「開啟時鎖定」(jr1p./jr2p.,0.5.0 起已上線)取代;讀面照走(舊 blob 可解承諾不破),新整合不配置wrapLocal(寫面自然退場)。- 主鑰輪替(
rotateNoteKey)設計面在 docs/rotation-design.md(2026-10 階段 1 設計定稿,§9 裁定點 2026-10-24 全採;階段 2 實作另開卡):0.5.1 起原語族(KeyRing/kid 契約/jr2b.jr2c.jr2d.前綴族/jr2p.pinlock2)已上線 npm(./client/keyring子路徑+barrel),rotateNoteKey端到端動線(server 兩階段+client 重寫)尚未落——現行changePassphrase/upgrade仍是同一 noteKey 重包(資料零換鑰),主鑰外流在輪替動線收口前無補救=誠實界線;輪替是前止(輪替後新寫對舊金鑰副本失效),不回收已外流的密文副本。 - ring 回滾面(
RingMacConfig+單調 epoch,0.7.0 起;0.8.0 N1/N2 收口;外審 2026-11-07 #3/2026-11-10):未配置 MAC 的 ring blob(legacy 態)被入侵 server 仍可回推舊 blob(輪替復活)或置 null(鏡像摘除)——收口面=blob 內 MAC(client-side HMAC-SHA256,MAC 輸入ep<epoch>:<accountId>:<canonical>——帳號域必帶、同 key 異帳恆異 MAC=對調兩帳 ring 面收口)+parse fail-closed(驗證聲明後無 key/mac 不符/帳域形廢/mk 形廢=null)+epoch floor(配置態 epoch 缺席/<1 恆拋/null——「epoch ≥ 1 ⇔ MAC 已驗」不變式,v2 面 epoch-0 恆 null=與 legacy face 自然可分辨)+legacy blob 讀契約保留(epoch=0;requireMac:true選配後恆 null——開啟時機=消費端遷移裁定)。macKey 多裝置承載(0.8.0):macKey 恆 32B getRandomValues(generateRingMacKey),以密語 KEK+復原 KEK 雙包(macKeyWrapped,WrappedForms同構)內嵌 blobmk尾欄、受 MAC 覆蓋、隨 blob 上 server=server 零知識不變(見密文);第二裝置僅憑密語解包(keyRingWrappedMacKey→ 既有 unwrap 族 →ringMacKeyHexOf→parseKeyRing)=寫出即全裝置可驗;換密語=重包不重簽——凡不走 addEntry/retire 的 re-emission(換密語重包、復原套件重出)必先keyRingBumpEpoch再 serialize(同 epoch 新 MAC 會被次裝置高水紀錄恆拒——R1 MAJOR-1)。變換即推進(0.8.0):帶 epoch ring 的 addEntry/retire 自動 +1(serialize 恆可出恆帶推進後 epoch——同 epoch 改寫面殲;keyRingBumpEpoch保留相容);keyRingMeetsHighWater高水比對(epoch 低→拒、同 epoch 異 mac→拒;parseKeyRingv2 帶回 mac=高水紀錄 epoch+mac 同存)。殘餘界線=新裝置無本地高水紀錄首見即信;無 mk 欄的 v2 blob(host 未提供macKeyWrapped)第二裝置讀不到=fail-closed(部署面非攻擊面);已配置但從未寫出 v2≥1 blob 的帳(高水 book 仍 0)期窗內 strip-both/replay 落地仍 0≥0 照收(單調 epoch 本質界線)——users.keyring:null拒絕接線、LS 高水 book(per-account epoch+mac)、v2 寫入端接線與 PinLock macKey 承載=tacet 產品層 follow-up(本層只交付原語+形面)。 - Argon2id(m=64MiB t=3 p=1)對 PBKDF2-SHA256 600k 的 GPU 離線成本倍數 ≈10-20 倍(記憶體頻寬受限;PoC B CPU 面 SHA-256d vs Argon2id ≈5×10⁴)——僅覆蓋 Argon 派生的密語指紋面;legacy PH1 的 wire 層
SHA-256(pass)(ph1Of,已@deprecated、帶內版本化不可原地摘除)不受它保護。tacet 產品層 login 已轉 v3-first(S3 收案:Argon2id 派生 PH1 首發+legacy 命中計數+ladder 舊列 DELETE),core 層loginRouteCore對 legacy PH1 hex64 的相容面照留(兄弟 fork/舊平台帶內版本化)。 - PH1 派生方式由各產品自定義(快雜湊或 Argon2id 派生皆可),本層只驗 hex64 形。
- 本 repo 不含產品層:路由/配額/訂閱/GC/webhook 在各產品 fork。
- 未經第三方正式稽核;密語遺失設計上無救援(伺服器零知識的代價)。
授權
版本歷史見 CHANGELOG.md。
MIT。安全問題聯絡 security@tacet.ink(安全回報流程見 SECURITY.md)。
English Summary
What this is. @tacet-ink/journal-core is the cryptographic and server-primitive layer powering
默·Tacet (tacet.ink), a zero-knowledge journal: the server stores only ciphertext
and salted hashes, and never learns your passphrase or the content of any note.
High-level Vault API. @tacet-ink/journal-core/client/vault (0.3.4+) wraps the primitives in a
single flow. createVault(passphrase, { app: 'myapp', recovery: true }) derives every prefix from
app (zero config), wraps a random note key with Argon2id, and returns the serverRecord to upload
plus an opt-in 24-word recovery kit. vault.encrypt(recordId, data) / vault.decrypt(recordId, blob)
bind each record to app:recordId as AAD, so a ciphertext moved to another record fails to decrypt.
unlockVault(passphrase, serverRecord, cfg) reopens the vault on another device, and
recoverVault(words, wrappedRec, cfg) reopens it from the recovery kit. deriveVaultPh1(passphrase, salt)
produces the hex64 login credential your server passes to loginRouteCore(env, store, ip, ph1).
Failures throw a VaultError with a stable code; a wrong passphrase and a tampered wrap
deliberately share one code, since telling them apart would create an oracle.
Security model.
- Two key eras. Before binding an account, notes are encrypted with a client-derived key
K_u = SHA-256(guestKdfPrefix ‖ identity)(obfuscation-grade, not true E2E). After binding, notes are encrypted with a random 256-bit noteKey. The noteKey is wrapped twice — with the passphrase (KEK) and with a recovery package (KEK_rec) — before upload. From that point the passphrase never crosses the wire: only PH1 (a client-side hash form) is transmitted, and the server stores onlyPH2 = SHA-256(PH1). - Plaintext compat rail (
allowPlaintext, 0.7.0). Legacy unprefixed plaintext notes are still accepted by default (decryptNotepasses them through;makeInboundCipherstores them up tocipherMax) — that rail carries unverified content the server (or any transport layer) can write without any key. Opting out (allowPlaintext: falseon client config and serverCipherFormats) makes unprefixed plaintext return/storenullwith no truncation path; the rail is scheduled for removal two minor cycles after 0.7.0. - In-band versioning. Payload layout and KDF are defined by configurable cipher prefixes
(e.g.
jr1b.for bound-era ciphertext,jr3w.for Argon2id-wrapped note keys). Upgrading KDF parameters always means a new prefix; old prefixes keep decrypting forever (no in-place semantic changes). Cross-prefix calls always returnnull— prefix guard + AAD + length checks; they never throw or fall back. The passphrase-normalization generation follows the same rule:jr4w./jr4d.wrap withnormalizePassphrase(NFKC-only — no trim, no case-folding); older prefixes keep deriving from the raw passphrase, so every legacy payload stays decryptable as-is. - Tamper-evidence. Every AES-GCM operation binds additional authenticated data (AAD) — e.g. ciphertext is bound to its note id, so records cannot be shuffled between notes.
- Key hygiene. Any key that must be exported/wrapped is imported with
extractable=true; KEK and guest keys are permanently non-extractable.
Server login wiring. loginRouteCore(env, store, ip, ph1) ships with the ladder guard built in
(v0.2.4, external-review #8 ghost-account fix): on a current-value (PH2) miss it consults the
ph2_ladder table via the optional AuthStore.ladderLookup — a ladder hit returns the
existing account (no ghost creation); a ladder miss, an unconfigured lookup, or a
ladder-store error (fail-open, treated as a miss) all fall through to the legacy
single-lookup behavior of ≤0.2.3. Forks adopt the guard by configuring ladderLookup
on their store (the tacet reference: d1AuthStore) and applying migrations/0011-ph2-ladder.sql
— the lookup itself never writes (inserts stay on the rekeyWithLadder migration path,
deletes on the fork's delete-account flow).
PH2 pepper injection (0.4.0, J2b). The PH2 stored-value derivation is now injectable via
the optional AuthStore.ph2Of?(ph1Hex) → Promise<string>: when a fork injects a peppered
form (tacet: HMAC-SHA256(PH2_PEPPER, sha256Hex(PH1))) loginRouteCore runs a dual-read
migration window — current value ph2Of(PH1) first (pepper-closed), then the legacy
sha256(PH1) form + ladder guard on a miss; ghost account creation always takes the
new form createUser(ph2Of(PH1)) so fresh accounts are pepper-closed at rest. Uninjected
(undefined) is byte-identical to the 0.3.x single sha256Hex(PH1) lookup (sibling-fork
zero-impact iron rule; the optional field means a fork pinned to 0.3.5 builds unchanged).
The opportunistic rewrite of a legacy-form hit to the new form is fork-owned (this layer is
write-free); ph2Of throwing is surfaced (fail-closed, not fail-open — a missing/failed
pepper read is a loud 5xx, never a silent downgrade to the un-peppered form).
Opt-in primitives. Optional contracts (cipherGuest / wrapDual / wrapShare / pinLock /
cipherAttach / cipherLocal / wrap4 / wrapDual4 / wrapLocal / wrapRec (paired with
recKekHkdf: configured together or not at all; partial configuration is rejected on write) /
recKekHkdf / recKekSalt): the wrapRec family falls back to the legacy face when unconfigured,
so forks that don't use a primitive are unaffected. Unknown or malformed strings never
decrypt to plaintext. wrapLocal is opt-in: unconfigured means the write face retires —
v1-era deployments (borrow-period) must configure wrapLocal after upgrading to keep local
key-wrap writes (the read face still falls back to the legacy blob; no data is lost).
Modules. Client: two-era crypto (note-crypto.ts), Argon2id wrapping (argon2.ts, dual
carrier: node:crypto ≥ Node 24.7 / hash-wasm in browsers, RFC 9106 test vectors), local PIN lock
(pinlock.ts), recovery-package BIP39 codec (bip39.ts, zero-dependency, cross-checked against
@scure/bip39), brand-namespaced key storage (keys.ts). Server: zero-knowledge auth core with a
PH1→PH2 login flow, inbound cipher/package validation and paired key-package selection
(auth.ts; PH2-UNIQUE conflict and session revocation are caller-owned wiring), per-IP
(IPv6 keyed per /64 prefix; IPv4-mapped addresses un-map to the native dotted IPv4 key) fixed-window rate limiting on D1 (ratelimit.ts), shared CORS/hash utilities. Since 0.3.0 the
package ships dist/ (tsc-emitted ESM .js + .d.ts); every exports subpath resolves to dist.
Since 0.3.4 the package is dist-only: src/ and scripts/ no longer ship (the tarball carries dist/,
docs/, migrations/, README and LICENSE). To read or audit the source, browse src/ on GitHub
alongside the format spec and test vectors in docs/.
Format spec & test vectors. The byte-level wire format of every prefix family — payload layout
and field lengths, KDF parameters, AAD strings, and the in-band versioning contract — is specified
in docs/format-spec.md (Chinese; transcribed from the source, not a new
contract). JSON test vectors live in docs/vectors/: one wrap/encrypt sample per
prefix family (families.json), known-answer vectors (RFC 9106 Argon2id, the gate's frozen
jr2w./jr3w./jr3d./jr4w./jr4d./jr1r./jr1w. blobs, and PH1/PH2 credential samples in
kat.json), and 34 BIP39 samples (bip39.json). They were generated once by
scripts/generate-vectors.ts against the real primitives and committed as frozen evidence; the
verify gate checks their presence and shape (section [26]) and does not regenerate them.
Verification. npm run verify runs 743 assertions against the real modules (no mocks; run it from a repo checkout — since 0.3.4 the published package is dist-only and carries no gate):
roundtrips, AAD tamper-evidence, extractability rules, era isolation, cross-prefix family
isolation, payload tampering, RFC 9106 KAT, a 200-vector BIP39 cross-check, and the
login ladder-guard behavior suite (external audit #8), and presence/shape checks for the format
spec and test vectors.
Usage. Since 0.3.0 the npm package ships compiled ESM in dist/, so browsers, Node, Deno, Bun
and Workers can import it directly — no bundler and no strip-types needed (the 0.2.x "must bundle"
requirement is retired). A source checkout can still run src/ with node --experimental-strip-types.
In browsers, inject the hash-wasm Argon2id carrier via setArgonLoader(); Node ≥ 24.7 uses the
built-in node:crypto. The Quickstart opens with a runnable Vault walkthrough (create → encrypt →
unlock → recover → PH1); the low-level primitive samples are in the 使用 section.
Honest limits. The guest era is obfuscation-grade, not E2E. PH1 derivation is defined by each
product (fast hash or Argon2id); this layer only validates its hex64 form. Key-ring rollback
(external review #3, 0.7.0; multi-device carry and same-epoch rewrite closed in 0.8.0) is closed
at the primitive face only: without RingMacConfig a compromised server can still resurrect an
old ring blob or null it — the blob-carried MAC plus fail-closed parsing and the epoch floor
(configured mode: missing/<1 throws on write and nulls on read — "epoch ≥ 1 ⇔ MAC verified") is
the core-side remedy. Since 0.8.0 the MAC key reaches other devices via the passphrase-KEK /
recovery-KEK double-wrapped macKey embedded in the blob (mk field, MAC-covered; the server stays
zero-knowledge), the MAC input carries the accountId (same key, different account ⇒ different
MAC), requireMac can reject legacy (MAC-less) blobs, ring transforms auto-advance the epoch
(same-epoch rewrite closed) and keyRingMeetsHighWater compares epoch+mac. Still: a fresh device
with no local high-water record trusts on first sight; a v2 blob without an embedded wrapped macKey
is unreadable to other devices (fail-closed); and an account configured but never yet having
written a v2≥1 blob (high-water book still 0) accepts a strip-both/replayed legacy-state blob in
that window (inherent to monotonic epochs); the sync guard, high-water-mark book and v2 write-side
wiring are product-layer follow-up. Product concerns (routing, quotas, subscriptions, GC, webhooks)
live in the product forks. No third-party audit yet. A lost passphrase is unrecoverable by design —
that is the price of server-side zero knowledge.
License
MIT. Security contact: security@tacet.ink. Version history: CHANGELOG.md. Security reporting process: SECURITY.md.
Trademark
"默·Tacet" and the Tacet name and logo are not licensed under MIT; forks and derivatives must not present themselves as Tacet.
Reviews
No reviews yet
Be the first to review this server!
More Developer Tools MCP Servers
Rea
Freeby Morluto · Developer Tools
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Paperclip
Freeby Paperclipai · Developer Tools
Trending hip-hop artist momentum scores across four cultural dimensions.
Scrapling
Freeby D4Vinci · Developer Tools
Web scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported.
Server Time
Freeby Modelcontextprotocol · Developer Tools
Current time lookup and conversion between IANA timezones
Toleno
Freeby Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
MCP Marketplace
Freeby mcp-marketplace · Developer Tools
Search and install MCP servers from inside your AI client.
