system.ts
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 签名规范 / 公钥下发(免签接口,规范 §2/§6)
// 继承 ApiClient,共享 http 与 RSA 加签/验签。
import { ApiClient } from '../core/client';
import type { LoginSession } from '../../access/session';
export interface LoginParams {
account: string;
password: string;
}
export type LoginResult = LoginSession;
export interface SignSpec {
expireSeconds: number;
nonceEnabled: boolean;
appIds: string[];
requestCanonicalRule: string;
responseCanonicalRule: string;
sample?: {
requestCanonical: string;
responseCanonical: string;
responseCanonicalSign: string;
serverPublicKey?: string;
};
serverPublicKey?: string;
serverPublicKeyPem?: string;
}
class System extends ApiClient {
login(data: LoginParams) {
return this.post<LoginResult>('/system/auth/login', data);
}
info() {
return this.get<Record<string, unknown>>('/system/auth/info');
}
spec() {
return this.get<SignSpec>('/system/sign/spec');
}
}
export const system = new System();