D-20260814-25|Profile 密封網路授權¶
背景與驅動力¶
TURN credential 原先以裝置設定 store 中的獨立 PIN 密文保存;修改 PIN 只重加密 profile seed, 造成新 PIN 能解鎖身分卻無法解開 TURN。更根本地,同一 origin 可有不同 PIN 的多個 profile, 不存在可正確擁有這份裝置全域密文的唯一 PIN;跨 store 重封也會產生失敗與分頁競爭窗口。
考慮過的選項¶
- 在 changePin 同時重封裝置 TURN 密文:無法解決多 profile 所有權與跨 store 原子性,否決。
- 新增獨立裝置主密鑰並讓所有 profile 共用:增加復原與撤銷邊界,現況無必要,否決。
- 以 active profile master seed 派生不可攜 network-authority domain(採納)。
決定¶
- AppSettings 只保存公開服務發現與信任偏好:endpoint、mode、enabled、priority、providerId、
pinning
writeEnabled與 ICE 的 logicalturnCredentialRef;無身分時仍可設定並跨登入保留。 - TURN manual credential、pinning API token 與長期 signaling credential 屬目前 profile 的
network-authoritysealed domain。完整 current shape 含三個具名 slot maps,以 master seed 的既有 HKDF/AES-GCM domain key 封存,不由 PIN 派生;換 PIN 不重封。 - signaling session token、socket/challenge、TURN 短期 token 與 pinning upload grant 只留 session 記憶體。profile 切換、登出、跨分頁撤銷、刪除或 shell dispose 必須先同步清除;晚到 async read/ write 不得復活明文。
turnCredentialRef只在 active profile namespace 解析;slot 不存在即保持無 credential,不得讀取 其他 profile。Pinning 寫入仍同時要求裝置writeEnabled、active profile 簽章與服務端授權。network-authority是不可攜 domain,不進.open4wd-backup;匯出的 network device settings 仍移除 secret reference。刪除 profile 與 identity container 的同一 transaction 會一併刪除其網路授權。- 專案為 pre-launch,舊裝置全域
secret:turn-credential不保留 reader、migration 或 rekey 分支。
後果與影響¶
PIN 修改只處理 encrypted seed,profile secrets 自然延續;不同 PIN 的 profile 可安全使用同名 logical slot 而互不讀取。設定頁與部署資料仍可在未登入時編輯公開 endpoint,但實際私密授權只有解鎖後可用。