|
1 | | -import { IConnection, IOptions } from "../connection.ts"; |
2 | | -import { ESPConnection } from "../espConnection.ts"; |
| 1 | +import { CodesignServiceBase, WsCodesign } from "./wsdl/ws_codesign/v1.1/ws_codesign.ts"; |
3 | 2 |
|
4 | | -/* |
5 | | - Response structures generated via: |
6 | | - * http://localhost:8010/ws_codesign/?ver_=1.1&respjson_ |
7 | | - * http://json2ts.com/ |
8 | | -*/ |
9 | | -export namespace WsCodesign { |
| 3 | +export { WsCodesign }; |
10 | 4 |
|
11 | | - export interface ListUserIDsRequest { |
12 | | - } |
13 | | - |
14 | | - export interface WsCodesignPingRequest { |
15 | | - } |
16 | | - |
17 | | - export interface SignRequest { |
18 | | - SigningMethod?: string; |
19 | | - UserID: string; |
20 | | - KeyPass: string; |
21 | | - Text: string; |
22 | | - } |
23 | | - |
24 | | - export interface VerifyRequest { |
25 | | - Text: string; |
26 | | - } |
27 | | - |
28 | | - export interface Exception { |
29 | | - Code: string; |
30 | | - Audience: string; |
31 | | - Source: string; |
32 | | - Message: string; |
33 | | - } |
34 | | - |
35 | | - export interface Exceptions { |
36 | | - Source: string; |
37 | | - Exception: Exception[]; |
38 | | - } |
39 | | - |
40 | | - export interface UserIDs { |
41 | | - Item: string[]; |
42 | | - } |
43 | | - |
44 | | - export interface ListUserIDsResponse { |
45 | | - Exceptions: Exceptions; |
46 | | - UserIDs: UserIDs; |
47 | | - } |
| 5 | +export class CodesignService extends CodesignServiceBase { |
48 | 6 |
|
49 | | - export interface WsCodesignPingResponse { |
50 | | - } |
51 | | - |
52 | | - export interface SignResponse { |
53 | | - Exceptions: Exceptions; |
54 | | - RetCode: number; |
55 | | - ErrMsg: string; |
56 | | - SignedText: string; |
57 | | - } |
58 | | - |
59 | | - export interface VerifyResponse { |
60 | | - Exceptions: Exceptions; |
61 | | - RetCode: number; |
62 | | - ErrMsg: string; |
63 | | - IsVerified: boolean; |
64 | | - SignedBy: string; |
65 | | - } |
66 | | -} |
67 | | - |
68 | | -export class CodesignService { |
69 | | - private _connection: ESPConnection; |
70 | | - |
71 | | - constructor(optsConnection: IOptions | IConnection) { |
72 | | - this._connection = new ESPConnection(optsConnection, "ws_codesign", "1.1"); |
73 | | - } |
74 | | - |
75 | | - connectionOptions(): IOptions { |
76 | | - return this._connection.opts(); |
77 | | - } |
78 | | - |
79 | | - ListUserIDs(request: WsCodesign.ListUserIDsRequest): Promise<string[]> { |
80 | | - return this._connection.send("ListUserIDs", request).then((response: WsCodesign.ListUserIDsResponse) => { |
| 7 | + ListUserIDsEx(request: Partial<WsCodesign.ListUserIDsRequest>): Promise<string[]> { |
| 8 | + return super.ListUserIDs(request).then((response: WsCodesign.ListUserIDsResponse) => { |
81 | 9 | return response.UserIDs.Item; |
82 | 10 | }).catch(e => { |
83 | 11 | return []; |
84 | 12 | }); |
85 | 13 | } |
86 | 14 |
|
87 | | - Sign(request: WsCodesign.SignRequest): Promise<WsCodesign.SignResponse> { |
88 | | - return this._connection.send("Sign", { SigningMethod: "gpg", ...request }); |
89 | | - } |
90 | | - |
91 | | - Verify(request: WsCodesign.VerifyRequest): Promise<WsCodesign.VerifyResponse> { |
92 | | - return this._connection.send("Verify", request); |
| 15 | + Sign(request: Partial<WsCodesign.SignRequest>): Promise<WsCodesign.SignResponse> { |
| 16 | + return super.Sign({ SigningMethod: WsCodesign.SigningMethodType.gpg, ...request }); |
93 | 17 | } |
94 | 18 | } |
0 commit comments