@huaqiu/dsh-auth 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +22 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +1427 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.mts +73 -0
- package/lib/index.mjs +291 -0
- package/package.json +55 -0
- package/src/client/auth-state.ts +96 -0
- package/src/client/client.ts +169 -0
- package/src/client/i18n.ts +97 -0
- package/src/client/index.tsx +109 -0
- package/src/client/lib.ts +234 -0
- package/src/client/storage.ts +43 -0
- package/src/client/transport.ts +36 -0
- package/src/client/ui/common.tsx +169 -0
- package/src/client/ui/hq-icon.tsx +50 -0
- package/src/client/ui/login-dialog.ts +219 -0
- package/src/client/ui/needs-auth-toolview.tsx +118 -0
- package/src/client/ui/sidebar-action.tsx +395 -0
- package/src/client/ui-env.ts +175 -0
- package/src/host.ts +139 -0
- package/src/index.ts +42 -0
- package/src/routes.ts +84 -0
- package/src/service.ts +172 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 深圳华秋智联股份有限公司
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @huaqiu/dsh-auth
|
|
2
|
+
|
|
3
|
+
Huaqiu account plugin: browser↔node credential flow for the Huaqiu PCB EDA tool set.
|
|
4
|
+
|
|
5
|
+
- Dual-face package. Browser half: auth.eda.cn overlay iframe + strict-origin postMessage
|
|
6
|
+
handling + localStorage cache + push to node. Node half: `huaqiuAuth` capability
|
|
7
|
+
(`getAccessToken` / `getUserInfo`) backed by an in-memory cache fed over the
|
|
8
|
+
plugin-owned `webServer` route `/api/v1/huaqiu/auth`.
|
|
9
|
+
- **HQ Edge host mode.** When the plugin is loaded with a `config.hqEdgeBaseUrl`
|
|
10
|
+
(injected by the HQ Edge supervisor as overlay entry `config`), the node half
|
|
11
|
+
fetches the operator credential directly from HQ Edge's
|
|
12
|
+
`GET /api/v1/auth/token` and is authoritative on boot — no browser login
|
|
13
|
+
required. Resolution order inside `getUserInfo()`: host session → pushed
|
|
14
|
+
(browser) session → persisted file (`~/.dsh/auth/session.json`) → null.
|
|
15
|
+
Env fallback (`HQ_EDGE_BASE_URL` / `HQ_EDGE_AUTH_PATH` / `HQ_EDGE_HOST_TTL_SECONDS`)
|
|
16
|
+
covers installs without a supervisor. See `src/host.ts`.
|
|
17
|
+
- Node-side persistence: the last known session is written to `~/.dsh/auth/session.json`
|
|
18
|
+
on every `setCredentials`, so standalone auth survives a process restart (previously
|
|
19
|
+
the in-memory cache was empty until the next browser login).
|
|
20
|
+
- Phase 0A POC. The chosen browser→host channel is a `webServer` route
|
|
21
|
+
(`apiProxy`'s dispatch table is closed — see `docs/tasks/phase0-implementation-spec.md` §7).
|
|
22
|
+
- Status: host mode + persistence implemented (spec `docs/tasks/dsh-auth-artifact.md`).
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# DSH bundle patch: inserts the Huaqiu account/auth plugin.
|
|
2
|
+
# The webServer route is the browser→node credential channel (the smallest
|
|
3
|
+
# supported extension point — see phase0-implementation-spec.md §7).
|
|
4
|
+
- insert:
|
|
5
|
+
- id: huaqiu-auth
|
|
6
|
+
name: '@huaqiu/dsh-auth'
|
|
7
|
+
inject: ['webServer']
|