gws-client 0.0.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/README.md +1 -0
- package/dist/index.es.d.ts +270 -0
- package/dist/index.es.js +1043 -0
- package/dist/index.umd.js +1 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# gws-client
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
declare type CertType = {
|
|
2
|
+
CN: string;
|
|
3
|
+
sn: string;
|
|
4
|
+
CertB64: string;
|
|
5
|
+
CertType: string;
|
|
6
|
+
ContainerName: string;
|
|
7
|
+
DevClass: string;
|
|
8
|
+
manu?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare class EventBus {
|
|
13
|
+
deps: Map<string, Function>;
|
|
14
|
+
on(topic: string, callback: Function): void;
|
|
15
|
+
emit(topic: string, data: SocketResponseType | Event): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class GwsCore {
|
|
19
|
+
private socketInstance;
|
|
20
|
+
eventBus: EventBus;
|
|
21
|
+
isRememberPin: boolean;
|
|
22
|
+
socketEvent: undefined | Event;
|
|
23
|
+
pinPolicy: number;
|
|
24
|
+
constructor(config: ServiceConfigType);
|
|
25
|
+
createSocket(config: ServiceConfigType): WebSocket;
|
|
26
|
+
getSocketReadyState: () => number | undefined;
|
|
27
|
+
destroy: () => void;
|
|
28
|
+
sendMessage: (eventName: string, msg: Record<string, unknown>) => Promise<any>;
|
|
29
|
+
handleEventData: (event: MessageEvent<Blob>) => Promise<void>;
|
|
30
|
+
private getIsLogin;
|
|
31
|
+
base64Encode: (text: string) => string;
|
|
32
|
+
base64Decode: (base64String: string) => string;
|
|
33
|
+
changeIsRememberPin: (bol: boolean) => Promise<void>;
|
|
34
|
+
changePinPolicy: (pinPolicy: number) => Promise<void>;
|
|
35
|
+
checkCertIsLogin: (params: {
|
|
36
|
+
ContainerName: string;
|
|
37
|
+
}) => Promise<any>;
|
|
38
|
+
certLogin: (ContainerName: string) => Promise<void>;
|
|
39
|
+
getCert: (params: {
|
|
40
|
+
CertType?: string;
|
|
41
|
+
}, curCert?: CertType) => Promise<CertType>;
|
|
42
|
+
getCertList: (params: {
|
|
43
|
+
CertType?: string;
|
|
44
|
+
}) => Promise<CertType[]>;
|
|
45
|
+
chooseCert: (params: {
|
|
46
|
+
CertType?: string;
|
|
47
|
+
}) => Promise<CertType>;
|
|
48
|
+
pkcs1Sign: (params: {
|
|
49
|
+
ContainerName: string;
|
|
50
|
+
Data: string;
|
|
51
|
+
}) => Promise<any>;
|
|
52
|
+
pkcs1Base64Sign: (params: {
|
|
53
|
+
ContainerName: string;
|
|
54
|
+
DataB64: string;
|
|
55
|
+
}) => Promise<any>;
|
|
56
|
+
pkcs1VerifySignature: (params: {
|
|
57
|
+
CertB64: string;
|
|
58
|
+
Data: string;
|
|
59
|
+
SignData: string;
|
|
60
|
+
}) => Promise<any>;
|
|
61
|
+
pkcs1Base64VerifySignature: (params: {
|
|
62
|
+
CertB64: string;
|
|
63
|
+
DataB64: string;
|
|
64
|
+
SignData: string;
|
|
65
|
+
}) => Promise<any>;
|
|
66
|
+
getSealList: (params: {
|
|
67
|
+
ContainerName: string;
|
|
68
|
+
}) => Promise<any>;
|
|
69
|
+
sm2SignPreprocess1: (params: {
|
|
70
|
+
CertB64: string;
|
|
71
|
+
}) => Promise<any>;
|
|
72
|
+
sm2SignPreprocess2: (params: {
|
|
73
|
+
CertB64: string;
|
|
74
|
+
DataB64: string;
|
|
75
|
+
}) => Promise<any>;
|
|
76
|
+
pkcs1HashSign: (params: {
|
|
77
|
+
ContainerName: string;
|
|
78
|
+
DataB64: string;
|
|
79
|
+
HashAlg: string;
|
|
80
|
+
}) => Promise<any>;
|
|
81
|
+
pkcs1HashVerifySignature: (params: {
|
|
82
|
+
CertB64: string;
|
|
83
|
+
DataB64: string;
|
|
84
|
+
SignData: string;
|
|
85
|
+
HashAlg: string;
|
|
86
|
+
}) => Promise<any>;
|
|
87
|
+
pkcs7Sign: (params: {
|
|
88
|
+
ContainerName: string;
|
|
89
|
+
DataB64: string;
|
|
90
|
+
IsDetached: string;
|
|
91
|
+
}) => Promise<any>;
|
|
92
|
+
pkcs7VerifySignature: (params: {
|
|
93
|
+
SignData: string;
|
|
94
|
+
DataB64: string;
|
|
95
|
+
}) => Promise<any>;
|
|
96
|
+
sm3Hash: (params: {
|
|
97
|
+
Data: string;
|
|
98
|
+
}) => Promise<any>;
|
|
99
|
+
sm3HexHash: (params: {
|
|
100
|
+
DataB64: string;
|
|
101
|
+
}) => Promise<any>;
|
|
102
|
+
sm3FileHash: (params: {
|
|
103
|
+
SrcFile: string;
|
|
104
|
+
}) => Promise<any>;
|
|
105
|
+
sm3HashEncryption: (params: {
|
|
106
|
+
dataB64: string;
|
|
107
|
+
keyB64: string;
|
|
108
|
+
alg: string;
|
|
109
|
+
}) => Promise<any>;
|
|
110
|
+
pkcs7Encryption: (params: {
|
|
111
|
+
CertB64List: string;
|
|
112
|
+
DataB64: string;
|
|
113
|
+
}) => Promise<any>;
|
|
114
|
+
pkcs7Decryption: (params: {
|
|
115
|
+
ContainerName: string;
|
|
116
|
+
DataB64: string;
|
|
117
|
+
}) => Promise<any>;
|
|
118
|
+
asymmetricEncryption: (params: {
|
|
119
|
+
CertB64: string;
|
|
120
|
+
Data: string;
|
|
121
|
+
}) => Promise<any>;
|
|
122
|
+
asymmetricDecryption: (params: {
|
|
123
|
+
ContainerName: string;
|
|
124
|
+
Data: string;
|
|
125
|
+
}) => Promise<any>;
|
|
126
|
+
sm4Encryption: (params: {
|
|
127
|
+
Data: string;
|
|
128
|
+
}) => Promise<any>;
|
|
129
|
+
sm4Decryption: (params: {
|
|
130
|
+
Data: string;
|
|
131
|
+
KeyB64: string;
|
|
132
|
+
}) => Promise<any>;
|
|
133
|
+
getCertInfo: (params: {
|
|
134
|
+
CertB64: string;
|
|
135
|
+
}) => Promise<any>;
|
|
136
|
+
getCertInfoByOid: (params: {
|
|
137
|
+
CertB64: string;
|
|
138
|
+
Oid: string;
|
|
139
|
+
}) => Promise<any>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare class GwsService {
|
|
143
|
+
static instance: GwsService | null;
|
|
144
|
+
coreInstance: GwsCore | null;
|
|
145
|
+
private gwsConfig;
|
|
146
|
+
constructor(config?: Record<string, any>);
|
|
147
|
+
private createGwsCore;
|
|
148
|
+
private appendCertBase64;
|
|
149
|
+
destroy: () => void;
|
|
150
|
+
restart: (config?: Record<string, any>) => void;
|
|
151
|
+
getSocketReadyState: () => number | undefined;
|
|
152
|
+
getSignatureCert: (cert?: CertType) => Promise<CertType | undefined>;
|
|
153
|
+
getEncryptionCert: (cert?: CertType) => Promise<CertType | undefined>;
|
|
154
|
+
base64Encode: (text: string) => string;
|
|
155
|
+
base64Decode: (text: string) => string | undefined;
|
|
156
|
+
changeIsRememberPin: (bol: boolean) => void;
|
|
157
|
+
changePinPolicy: (pinPolicy: number) => void;
|
|
158
|
+
pkcs1Sign: (params: {
|
|
159
|
+
Data: string;
|
|
160
|
+
}, curCert?: CertType) => Promise<any>;
|
|
161
|
+
pkcs1VerifySignature: (params: {
|
|
162
|
+
CertB64?: string;
|
|
163
|
+
Data: string;
|
|
164
|
+
SignData: string;
|
|
165
|
+
}) => Promise<boolean>;
|
|
166
|
+
pkcs1Base64Sign: (params: {
|
|
167
|
+
Data?: string;
|
|
168
|
+
DataB64?: string;
|
|
169
|
+
}, curCert?: CertType) => Promise<any>;
|
|
170
|
+
pkcs1Base64VerifySignature: (params: {
|
|
171
|
+
CertB64?: string;
|
|
172
|
+
Data?: string;
|
|
173
|
+
DataB64?: string;
|
|
174
|
+
SignData: string;
|
|
175
|
+
}) => Promise<boolean>;
|
|
176
|
+
getSealList: () => Promise<{
|
|
177
|
+
cert: CertType | undefined;
|
|
178
|
+
sealList: {
|
|
179
|
+
SealId: string;
|
|
180
|
+
}[];
|
|
181
|
+
}>;
|
|
182
|
+
sm2SignPreprocess1: (params: {
|
|
183
|
+
CertB64?: string;
|
|
184
|
+
}) => Promise<any>;
|
|
185
|
+
sm2SignPreprocess2: (params: {
|
|
186
|
+
CertB64?: string;
|
|
187
|
+
Data: string;
|
|
188
|
+
}) => Promise<any>;
|
|
189
|
+
pkcs1HashSign: (params: {
|
|
190
|
+
DataB64: string;
|
|
191
|
+
HashAlg?: string;
|
|
192
|
+
}, curCert?: CertType) => Promise<any>;
|
|
193
|
+
pkcs1HashVerifySignature: (params: {
|
|
194
|
+
CertB64?: string;
|
|
195
|
+
DataB64: string;
|
|
196
|
+
SignData: string;
|
|
197
|
+
HashAlg?: string;
|
|
198
|
+
}) => Promise<boolean>;
|
|
199
|
+
pkcs7Sign: (params: {
|
|
200
|
+
Data?: string;
|
|
201
|
+
IsDetached: string;
|
|
202
|
+
DataB64?: string;
|
|
203
|
+
}, curCert?: CertType) => Promise<any>;
|
|
204
|
+
pkcs7VerifySignature: (params: {
|
|
205
|
+
Data?: string;
|
|
206
|
+
DataB64?: string;
|
|
207
|
+
SignData: string;
|
|
208
|
+
}) => Promise<boolean>;
|
|
209
|
+
sm3Hash: (params: {
|
|
210
|
+
Data: string;
|
|
211
|
+
}) => Promise<any>;
|
|
212
|
+
sm3HexHash: (params: {
|
|
213
|
+
DataB64: string;
|
|
214
|
+
}) => Promise<any>;
|
|
215
|
+
sm3FileHash: (params: {
|
|
216
|
+
SrcFile: string;
|
|
217
|
+
}) => Promise<any>;
|
|
218
|
+
sm3HashEncryption: (params: {
|
|
219
|
+
Data?: string;
|
|
220
|
+
DataB64?: string;
|
|
221
|
+
Key?: string;
|
|
222
|
+
KeyB64?: string;
|
|
223
|
+
}) => Promise<any>;
|
|
224
|
+
pkcs7Encryption: (params: {
|
|
225
|
+
Data?: string;
|
|
226
|
+
DataB64?: string;
|
|
227
|
+
CertB64List?: string;
|
|
228
|
+
}) => Promise<any>;
|
|
229
|
+
pkcs7Decryption: (params: {
|
|
230
|
+
DataB64: string;
|
|
231
|
+
shouldDecodeBase64?: boolean;
|
|
232
|
+
}) => Promise<any>;
|
|
233
|
+
asymmetricEncryption: (params: {
|
|
234
|
+
CertB64?: string;
|
|
235
|
+
Data: string;
|
|
236
|
+
}) => Promise<any>;
|
|
237
|
+
asymmetricDecryption: (params: {
|
|
238
|
+
Data: string;
|
|
239
|
+
}) => Promise<any>;
|
|
240
|
+
sm4Encryption: (params: {
|
|
241
|
+
Data: string;
|
|
242
|
+
}) => Promise<any>;
|
|
243
|
+
sm4Decryption: (params: {
|
|
244
|
+
Data: string;
|
|
245
|
+
KeyB64: string;
|
|
246
|
+
}) => Promise<any>;
|
|
247
|
+
getCertInfo: () => Promise<any>;
|
|
248
|
+
getCertInfoByOid: (params: {
|
|
249
|
+
Oid: string;
|
|
250
|
+
}) => Promise<any>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
declare type ServiceConfigType = {
|
|
254
|
+
url?: string;
|
|
255
|
+
pinPolicy?: number;
|
|
256
|
+
isRememberPin?: boolean;
|
|
257
|
+
onOpen?: (event: Event) => void;
|
|
258
|
+
onMessage?: (event: MessageEvent) => void;
|
|
259
|
+
onError?: (event: Event) => void;
|
|
260
|
+
onClose?: (event: Event) => void;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare type SocketResponseType = {
|
|
264
|
+
data?: any;
|
|
265
|
+
success?: boolean;
|
|
266
|
+
msg: string;
|
|
267
|
+
errCode: number;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export { }
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();var Ct = Object.defineProperty;
|
|
2
|
+
var vt = (n, t, e) => t in n ? Ct(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var c = (n, t, e) => vt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
const xt = window.location.href.includes("https") ? "wss://localhost:19528" : "ws://localhost:9527", kt = "1", Bt = "2";
|
|
5
|
+
var it = /* @__PURE__ */ ((n) => (n[n.MIN = 0] = "MIN", n[n.LOW = 1] = "LOW", n[n.MIDDLE = 2] = "MIDDLE", n[n.HIGH = 3] = "HIGH", n))(it || {}), Z = {};
|
|
6
|
+
Z.byteLength = Dt;
|
|
7
|
+
Z.toByteArray = It;
|
|
8
|
+
Z.fromByteArray = _t;
|
|
9
|
+
var B = [], y = [], St = typeof Uint8Array < "u" ? Uint8Array : Array, R = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
10
|
+
for (var E = 0, bt = R.length; E < bt; ++E)
|
|
11
|
+
B[E] = R[E], y[R.charCodeAt(E)] = E;
|
|
12
|
+
y[45] = 62;
|
|
13
|
+
y[95] = 63;
|
|
14
|
+
function lt(n) {
|
|
15
|
+
var t = n.length;
|
|
16
|
+
if (t % 4 > 0)
|
|
17
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
18
|
+
var e = n.indexOf("=");
|
|
19
|
+
e === -1 && (e = t);
|
|
20
|
+
var s = e === t ? 0 : 4 - e % 4;
|
|
21
|
+
return [e, s];
|
|
22
|
+
}
|
|
23
|
+
function Dt(n) {
|
|
24
|
+
var t = lt(n), e = t[0], s = t[1];
|
|
25
|
+
return (e + s) * 3 / 4 - s;
|
|
26
|
+
}
|
|
27
|
+
function $t(n, t, e) {
|
|
28
|
+
return (t + e) * 3 / 4 - e;
|
|
29
|
+
}
|
|
30
|
+
function It(n) {
|
|
31
|
+
var t, e = lt(n), s = e[0], a = e[1], r = new St($t(n, s, a)), o = 0, i = a > 0 ? s - 4 : s, d;
|
|
32
|
+
for (d = 0; d < i; d += 4)
|
|
33
|
+
t = y[n.charCodeAt(d)] << 18 | y[n.charCodeAt(d + 1)] << 12 | y[n.charCodeAt(d + 2)] << 6 | y[n.charCodeAt(d + 3)], r[o++] = t >> 16 & 255, r[o++] = t >> 8 & 255, r[o++] = t & 255;
|
|
34
|
+
return a === 2 && (t = y[n.charCodeAt(d)] << 2 | y[n.charCodeAt(d + 1)] >> 4, r[o++] = t & 255), a === 1 && (t = y[n.charCodeAt(d)] << 10 | y[n.charCodeAt(d + 1)] << 4 | y[n.charCodeAt(d + 2)] >> 2, r[o++] = t >> 8 & 255, r[o++] = t & 255), r;
|
|
35
|
+
}
|
|
36
|
+
function At(n) {
|
|
37
|
+
return B[n >> 18 & 63] + B[n >> 12 & 63] + B[n >> 6 & 63] + B[n & 63];
|
|
38
|
+
}
|
|
39
|
+
function Et(n, t, e) {
|
|
40
|
+
for (var s, a = [], r = t; r < e; r += 3)
|
|
41
|
+
s = (n[r] << 16 & 16711680) + (n[r + 1] << 8 & 65280) + (n[r + 2] & 255), a.push(At(s));
|
|
42
|
+
return a.join("");
|
|
43
|
+
}
|
|
44
|
+
function _t(n) {
|
|
45
|
+
for (var t, e = n.length, s = e % 3, a = [], r = 16383, o = 0, i = e - s; o < i; o += r)
|
|
46
|
+
a.push(Et(n, o, o + r > i ? i : o + r));
|
|
47
|
+
return s === 1 ? (t = n[e - 1], a.push(
|
|
48
|
+
B[t >> 2] + B[t << 4 & 63] + "=="
|
|
49
|
+
)) : s === 2 && (t = (n[e - 2] << 8) + n[e - 1], a.push(
|
|
50
|
+
B[t >> 10] + B[t >> 4 & 63] + B[t << 2 & 63] + "="
|
|
51
|
+
)), a.join("");
|
|
52
|
+
}
|
|
53
|
+
class Lt {
|
|
54
|
+
constructor() {
|
|
55
|
+
c(this, "deps", /* @__PURE__ */ new Map());
|
|
56
|
+
}
|
|
57
|
+
on(t, e) {
|
|
58
|
+
this.deps.set(t, e);
|
|
59
|
+
}
|
|
60
|
+
emit(t, e) {
|
|
61
|
+
const s = this.deps.get(t);
|
|
62
|
+
s && s(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
(function() {
|
|
66
|
+
try {
|
|
67
|
+
var n = document.createElement("style");
|
|
68
|
+
n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")), document.head.appendChild(n);
|
|
69
|
+
} catch (t) {
|
|
70
|
+
console.error("vite-plugin-css-injected-by-js", t);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
var Pt = Object.defineProperty, Ht = (n, t, e) => t in n ? Pt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, Y = (n, t, e) => Ht(n, typeof t != "symbol" ? t + "" : t, e);
|
|
74
|
+
function W() {
|
|
75
|
+
}
|
|
76
|
+
function Tt(n, t) {
|
|
77
|
+
for (const e in t) n[e] = t[e];
|
|
78
|
+
return (
|
|
79
|
+
/** @type {T & S} */
|
|
80
|
+
n
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function dt(n) {
|
|
84
|
+
return n();
|
|
85
|
+
}
|
|
86
|
+
function tt() {
|
|
87
|
+
return /* @__PURE__ */ Object.create(null);
|
|
88
|
+
}
|
|
89
|
+
function N(n) {
|
|
90
|
+
n.forEach(dt);
|
|
91
|
+
}
|
|
92
|
+
function G(n) {
|
|
93
|
+
return typeof n == "function";
|
|
94
|
+
}
|
|
95
|
+
function ut(n, t) {
|
|
96
|
+
return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
|
|
97
|
+
}
|
|
98
|
+
function Mt(n) {
|
|
99
|
+
return Object.keys(n).length === 0;
|
|
100
|
+
}
|
|
101
|
+
function Gt(n, t, e, s) {
|
|
102
|
+
if (n) {
|
|
103
|
+
const a = ht(n, t, e, s);
|
|
104
|
+
return n[0](a);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function ht(n, t, e, s) {
|
|
108
|
+
return n[1] && s ? Tt(e.ctx.slice(), n[1](s(t))) : e.ctx;
|
|
109
|
+
}
|
|
110
|
+
function Ft(n, t, e, s) {
|
|
111
|
+
if (n[2] && s) {
|
|
112
|
+
const a = n[2](s(e));
|
|
113
|
+
if (t.dirty === void 0)
|
|
114
|
+
return a;
|
|
115
|
+
if (typeof a == "object") {
|
|
116
|
+
const r = [], o = Math.max(t.dirty.length, a.length);
|
|
117
|
+
for (let i = 0; i < o; i += 1)
|
|
118
|
+
r[i] = t.dirty[i] | a[i];
|
|
119
|
+
return r;
|
|
120
|
+
}
|
|
121
|
+
return t.dirty | a;
|
|
122
|
+
}
|
|
123
|
+
return t.dirty;
|
|
124
|
+
}
|
|
125
|
+
function jt(n, t, e, s, a, r) {
|
|
126
|
+
if (a) {
|
|
127
|
+
const o = ht(t, e, s, r);
|
|
128
|
+
n.p(o, a);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function Zt(n) {
|
|
132
|
+
if (n.ctx.length > 32) {
|
|
133
|
+
const t = [], e = n.ctx.length / 32;
|
|
134
|
+
for (let s = 0; s < e; s++)
|
|
135
|
+
t[s] = -1;
|
|
136
|
+
return t;
|
|
137
|
+
}
|
|
138
|
+
return -1;
|
|
139
|
+
}
|
|
140
|
+
function et(n) {
|
|
141
|
+
return n ?? "";
|
|
142
|
+
}
|
|
143
|
+
function g(n, t) {
|
|
144
|
+
n.appendChild(t);
|
|
145
|
+
}
|
|
146
|
+
function q(n, t, e) {
|
|
147
|
+
n.insertBefore(t, e || null);
|
|
148
|
+
}
|
|
149
|
+
function z(n) {
|
|
150
|
+
n.parentNode && n.parentNode.removeChild(n);
|
|
151
|
+
}
|
|
152
|
+
function Nt(n, t) {
|
|
153
|
+
for (let e = 0; e < n.length; e += 1)
|
|
154
|
+
n[e] && n[e].d(t);
|
|
155
|
+
}
|
|
156
|
+
function k(n) {
|
|
157
|
+
return document.createElement(n);
|
|
158
|
+
}
|
|
159
|
+
function S(n) {
|
|
160
|
+
return document.createTextNode(n);
|
|
161
|
+
}
|
|
162
|
+
function F() {
|
|
163
|
+
return S(" ");
|
|
164
|
+
}
|
|
165
|
+
function Ot() {
|
|
166
|
+
return S("");
|
|
167
|
+
}
|
|
168
|
+
function M(n, t, e, s) {
|
|
169
|
+
return n.addEventListener(t, e, s), () => n.removeEventListener(t, e, s);
|
|
170
|
+
}
|
|
171
|
+
function v(n, t, e) {
|
|
172
|
+
e == null ? n.removeAttribute(t) : n.getAttribute(t) !== e && n.setAttribute(t, e);
|
|
173
|
+
}
|
|
174
|
+
function zt(n) {
|
|
175
|
+
return Array.from(n.childNodes);
|
|
176
|
+
}
|
|
177
|
+
function H(n, t) {
|
|
178
|
+
t = "" + t, n.data !== t && (n.data = /** @type {string} */
|
|
179
|
+
t);
|
|
180
|
+
}
|
|
181
|
+
let Q;
|
|
182
|
+
function j(n) {
|
|
183
|
+
Q = n;
|
|
184
|
+
}
|
|
185
|
+
const L = [], nt = [];
|
|
186
|
+
let T = [];
|
|
187
|
+
const st = [], Vt = /* @__PURE__ */ Promise.resolve();
|
|
188
|
+
let J = !1;
|
|
189
|
+
function Rt() {
|
|
190
|
+
J || (J = !0, Vt.then(gt));
|
|
191
|
+
}
|
|
192
|
+
function K(n) {
|
|
193
|
+
T.push(n);
|
|
194
|
+
}
|
|
195
|
+
const U = /* @__PURE__ */ new Set();
|
|
196
|
+
let _ = 0;
|
|
197
|
+
function gt() {
|
|
198
|
+
if (_ !== 0)
|
|
199
|
+
return;
|
|
200
|
+
const n = Q;
|
|
201
|
+
do {
|
|
202
|
+
try {
|
|
203
|
+
for (; _ < L.length; ) {
|
|
204
|
+
const t = L[_];
|
|
205
|
+
_++, j(t), Ut(t.$$);
|
|
206
|
+
}
|
|
207
|
+
} catch (t) {
|
|
208
|
+
throw L.length = 0, _ = 0, t;
|
|
209
|
+
}
|
|
210
|
+
for (j(null), L.length = 0, _ = 0; nt.length; ) nt.pop()();
|
|
211
|
+
for (let t = 0; t < T.length; t += 1) {
|
|
212
|
+
const e = T[t];
|
|
213
|
+
U.has(e) || (U.add(e), e());
|
|
214
|
+
}
|
|
215
|
+
T.length = 0;
|
|
216
|
+
} while (L.length);
|
|
217
|
+
for (; st.length; )
|
|
218
|
+
st.pop()();
|
|
219
|
+
J = !1, U.clear(), j(n);
|
|
220
|
+
}
|
|
221
|
+
function Ut(n) {
|
|
222
|
+
if (n.fragment !== null) {
|
|
223
|
+
n.update(), N(n.before_update);
|
|
224
|
+
const t = n.dirty;
|
|
225
|
+
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, t), n.after_update.forEach(K);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function Wt(n) {
|
|
229
|
+
const t = [], e = [];
|
|
230
|
+
T.forEach((s) => n.indexOf(s) === -1 ? t.push(s) : e.push(s)), e.forEach((s) => s()), T = t;
|
|
231
|
+
}
|
|
232
|
+
const O = /* @__PURE__ */ new Set();
|
|
233
|
+
let Jt;
|
|
234
|
+
function X(n, t) {
|
|
235
|
+
n && n.i && (O.delete(n), n.i(t));
|
|
236
|
+
}
|
|
237
|
+
function ft(n, t, e, s) {
|
|
238
|
+
if (n && n.o) {
|
|
239
|
+
if (O.has(n)) return;
|
|
240
|
+
O.add(n), Jt.c.push(() => {
|
|
241
|
+
O.delete(n);
|
|
242
|
+
}), n.o(t);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function at(n) {
|
|
246
|
+
return (n == null ? void 0 : n.length) !== void 0 ? n : Array.from(n);
|
|
247
|
+
}
|
|
248
|
+
function Kt(n) {
|
|
249
|
+
n && n.c();
|
|
250
|
+
}
|
|
251
|
+
function pt(n, t, e) {
|
|
252
|
+
const { fragment: s, after_update: a } = n.$$;
|
|
253
|
+
s && s.m(t, e), K(() => {
|
|
254
|
+
const r = n.$$.on_mount.map(dt).filter(G);
|
|
255
|
+
n.$$.on_destroy ? n.$$.on_destroy.push(...r) : N(r), n.$$.on_mount = [];
|
|
256
|
+
}), a.forEach(K);
|
|
257
|
+
}
|
|
258
|
+
function yt(n, t) {
|
|
259
|
+
const e = n.$$;
|
|
260
|
+
e.fragment !== null && (Wt(e.after_update), N(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
|
|
261
|
+
}
|
|
262
|
+
function qt(n, t) {
|
|
263
|
+
n.$$.dirty[0] === -1 && (L.push(n), Rt(), n.$$.dirty.fill(0)), n.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
264
|
+
}
|
|
265
|
+
function mt(n, t, e, s, a, r, o = null, i = [-1]) {
|
|
266
|
+
const d = Q;
|
|
267
|
+
j(n);
|
|
268
|
+
const l = n.$$ = {
|
|
269
|
+
fragment: null,
|
|
270
|
+
ctx: [],
|
|
271
|
+
// state
|
|
272
|
+
props: r,
|
|
273
|
+
update: W,
|
|
274
|
+
not_equal: a,
|
|
275
|
+
bound: tt(),
|
|
276
|
+
// lifecycle
|
|
277
|
+
on_mount: [],
|
|
278
|
+
on_destroy: [],
|
|
279
|
+
on_disconnect: [],
|
|
280
|
+
before_update: [],
|
|
281
|
+
after_update: [],
|
|
282
|
+
context: new Map(t.context || (d ? d.$$.context : [])),
|
|
283
|
+
// everything else
|
|
284
|
+
callbacks: tt(),
|
|
285
|
+
dirty: i,
|
|
286
|
+
skip_bound: !1,
|
|
287
|
+
root: t.target || d.$$.root
|
|
288
|
+
};
|
|
289
|
+
o && o(l.root);
|
|
290
|
+
let f = !1;
|
|
291
|
+
if (l.ctx = e ? e(n, t.props || {}, (u, m, ...h) => {
|
|
292
|
+
const p = h.length ? h[0] : m;
|
|
293
|
+
return l.ctx && a(l.ctx[u], l.ctx[u] = p) && (!l.skip_bound && l.bound[u] && l.bound[u](p), f && qt(n, u)), m;
|
|
294
|
+
}) : [], l.update(), f = !0, N(l.before_update), l.fragment = s ? s(l.ctx) : !1, t.target) {
|
|
295
|
+
if (t.hydrate) {
|
|
296
|
+
const u = zt(t.target);
|
|
297
|
+
l.fragment && l.fragment.l(u), u.forEach(z);
|
|
298
|
+
} else
|
|
299
|
+
l.fragment && l.fragment.c();
|
|
300
|
+
t.intro && X(n.$$.fragment), pt(n, t.target, t.anchor), gt();
|
|
301
|
+
}
|
|
302
|
+
j(d);
|
|
303
|
+
}
|
|
304
|
+
class wt {
|
|
305
|
+
constructor() {
|
|
306
|
+
Y(this, "$$"), Y(this, "$$set");
|
|
307
|
+
}
|
|
308
|
+
/** @returns {void} */
|
|
309
|
+
$destroy() {
|
|
310
|
+
yt(this, 1), this.$destroy = W;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @template {Extract<keyof Events, string>} K
|
|
314
|
+
* @param {K} type
|
|
315
|
+
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
316
|
+
* @returns {() => void}
|
|
317
|
+
*/
|
|
318
|
+
$on(t, e) {
|
|
319
|
+
if (!G(e))
|
|
320
|
+
return W;
|
|
321
|
+
const s = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
322
|
+
return s.push(e), () => {
|
|
323
|
+
const a = s.indexOf(e);
|
|
324
|
+
a !== -1 && s.splice(a, 1);
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @param {Partial<Props>} props
|
|
329
|
+
* @returns {void}
|
|
330
|
+
*/
|
|
331
|
+
$set(t) {
|
|
332
|
+
this.$$set && !Mt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const Qt = "4";
|
|
336
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Qt);
|
|
337
|
+
function Xt(n) {
|
|
338
|
+
let t, e, s, a = (
|
|
339
|
+
/*title*/
|
|
340
|
+
(n[1] || "标题") + ""
|
|
341
|
+
), r, o, i, d, l, f, u = (
|
|
342
|
+
/*cancelText*/
|
|
343
|
+
(n[4] || "取消") + ""
|
|
344
|
+
), m, h, p, $ = (
|
|
345
|
+
/*okText*/
|
|
346
|
+
(n[5] || "确认") + ""
|
|
347
|
+
), A, w, b, D;
|
|
348
|
+
const V = (
|
|
349
|
+
/*#slots*/
|
|
350
|
+
n[7].default
|
|
351
|
+
), C = Gt(
|
|
352
|
+
V,
|
|
353
|
+
n,
|
|
354
|
+
/*$$scope*/
|
|
355
|
+
n[6],
|
|
356
|
+
null
|
|
357
|
+
);
|
|
358
|
+
return {
|
|
359
|
+
c() {
|
|
360
|
+
t = k("div"), e = k("div"), s = k("div"), r = S(a), o = F(), i = k("div"), C && C.c(), d = F(), l = k("div"), f = k("button"), m = S(u), h = F(), p = k("button"), A = S($), v(s, "class", "model-title svelte-n1zwga"), v(i, "class", "slot svelte-n1zwga"), v(f, "class", "modal-btn svelte-n1zwga"), v(p, "class", "modal-btn success svelte-n1zwga"), v(l, "class", "modal-footer svelte-n1zwga"), v(e, "class", "modal-content svelte-n1zwga"), v(t, "class", "modal-background modal-visible svelte-n1zwga");
|
|
361
|
+
},
|
|
362
|
+
m(x, I) {
|
|
363
|
+
q(x, t, I), g(t, e), g(e, s), g(s, r), g(e, o), g(e, i), C && C.m(i, null), g(e, d), g(e, l), g(l, f), g(f, m), g(l, h), g(l, p), g(p, A), w = !0, b || (D = [
|
|
364
|
+
M(f, "click", function() {
|
|
365
|
+
G(
|
|
366
|
+
/*onCancel*/
|
|
367
|
+
n[0]
|
|
368
|
+
) && n[0].apply(this, arguments);
|
|
369
|
+
}),
|
|
370
|
+
M(p, "click", function() {
|
|
371
|
+
G(
|
|
372
|
+
/*onOk*/
|
|
373
|
+
n[2]
|
|
374
|
+
) && n[2].apply(this, arguments);
|
|
375
|
+
}),
|
|
376
|
+
M(e, "click", Yt),
|
|
377
|
+
M(t, "click", function() {
|
|
378
|
+
G(
|
|
379
|
+
/*onClose*/
|
|
380
|
+
n[3]
|
|
381
|
+
) && n[3].apply(this, arguments);
|
|
382
|
+
})
|
|
383
|
+
], b = !0);
|
|
384
|
+
},
|
|
385
|
+
p(x, [I]) {
|
|
386
|
+
n = x, (!w || I & /*title*/
|
|
387
|
+
2) && a !== (a = /*title*/
|
|
388
|
+
(n[1] || "标题") + "") && H(r, a), C && C.p && (!w || I & /*$$scope*/
|
|
389
|
+
64) && jt(
|
|
390
|
+
C,
|
|
391
|
+
V,
|
|
392
|
+
n,
|
|
393
|
+
/*$$scope*/
|
|
394
|
+
n[6],
|
|
395
|
+
w ? Ft(
|
|
396
|
+
V,
|
|
397
|
+
/*$$scope*/
|
|
398
|
+
n[6],
|
|
399
|
+
I,
|
|
400
|
+
null
|
|
401
|
+
) : Zt(
|
|
402
|
+
/*$$scope*/
|
|
403
|
+
n[6]
|
|
404
|
+
),
|
|
405
|
+
null
|
|
406
|
+
), (!w || I & /*cancelText*/
|
|
407
|
+
16) && u !== (u = /*cancelText*/
|
|
408
|
+
(n[4] || "取消") + "") && H(m, u), (!w || I & /*okText*/
|
|
409
|
+
32) && $ !== ($ = /*okText*/
|
|
410
|
+
(n[5] || "确认") + "") && H(A, $);
|
|
411
|
+
},
|
|
412
|
+
i(x) {
|
|
413
|
+
w || (X(C, x), w = !0);
|
|
414
|
+
},
|
|
415
|
+
o(x) {
|
|
416
|
+
ft(C, x), w = !1;
|
|
417
|
+
},
|
|
418
|
+
d(x) {
|
|
419
|
+
x && z(t), C && C.d(x), b = !1, N(D);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const Yt = (n) => n.stopPropagation();
|
|
424
|
+
function te(n, t, e) {
|
|
425
|
+
let { $$slots: s = {}, $$scope: a } = t, { onCancel: r } = t, { title: o } = t, { onOk: i } = t, { onClose: d } = t, { cancelText: l } = t, { okText: f } = t;
|
|
426
|
+
return n.$$set = (u) => {
|
|
427
|
+
"onCancel" in u && e(0, r = u.onCancel), "title" in u && e(1, o = u.title), "onOk" in u && e(2, i = u.onOk), "onClose" in u && e(3, d = u.onClose), "cancelText" in u && e(4, l = u.cancelText), "okText" in u && e(5, f = u.okText), "$$scope" in u && e(6, a = u.$$scope);
|
|
428
|
+
}, [r, o, i, d, l, f, a, s];
|
|
429
|
+
}
|
|
430
|
+
class ee extends wt {
|
|
431
|
+
constructor(t) {
|
|
432
|
+
super(), mt(this, t, te, Xt, ut, {
|
|
433
|
+
onCancel: 0,
|
|
434
|
+
title: 1,
|
|
435
|
+
onOk: 2,
|
|
436
|
+
onClose: 3,
|
|
437
|
+
cancelText: 4,
|
|
438
|
+
okText: 5
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function rt(n, t, e) {
|
|
443
|
+
const s = n.slice();
|
|
444
|
+
return s[10] = t[e], s[12] = e, s;
|
|
445
|
+
}
|
|
446
|
+
function ot(n) {
|
|
447
|
+
let t, e, s = (
|
|
448
|
+
/*item*/
|
|
449
|
+
n[10].CN + ""
|
|
450
|
+
), a, r, o, i = (
|
|
451
|
+
/*item*/
|
|
452
|
+
n[10].DevClass + ""
|
|
453
|
+
), d, l, f = (
|
|
454
|
+
/*item*/
|
|
455
|
+
n[10].sn + ""
|
|
456
|
+
), u, m, h, p, $, A;
|
|
457
|
+
function w() {
|
|
458
|
+
return (
|
|
459
|
+
/*click_handler*/
|
|
460
|
+
n[9](
|
|
461
|
+
/*index*/
|
|
462
|
+
n[12]
|
|
463
|
+
)
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
return {
|
|
467
|
+
c() {
|
|
468
|
+
t = k("div"), e = k("span"), a = S(s), r = F(), o = k("span"), d = S(i), l = S("("), u = S(f), m = S(")"), h = F(), v(e, "class", "svelte-jtc2v4"), v(o, "class", "svelte-jtc2v4"), v(t, "class", p = et(`cert-item ${/*index*/
|
|
469
|
+
n[12] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
470
|
+
n[12] === /*selectedIndex*/
|
|
471
|
+
n[4] ? "cert-item-selected" : ""}`) + " svelte-jtc2v4");
|
|
472
|
+
},
|
|
473
|
+
m(b, D) {
|
|
474
|
+
q(b, t, D), g(t, e), g(e, a), g(t, r), g(t, o), g(o, d), g(o, l), g(o, u), g(o, m), g(t, h), $ || (A = M(t, "click", w), $ = !0);
|
|
475
|
+
},
|
|
476
|
+
p(b, D) {
|
|
477
|
+
n = b, D & /*certList*/
|
|
478
|
+
1 && s !== (s = /*item*/
|
|
479
|
+
n[10].CN + "") && H(a, s), D & /*certList*/
|
|
480
|
+
1 && i !== (i = /*item*/
|
|
481
|
+
n[10].DevClass + "") && H(d, i), D & /*certList*/
|
|
482
|
+
1 && f !== (f = /*item*/
|
|
483
|
+
n[10].sn + "") && H(u, f), D & /*selectedIndex*/
|
|
484
|
+
16 && p !== (p = et(`cert-item ${/*index*/
|
|
485
|
+
n[12] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
486
|
+
n[12] === /*selectedIndex*/
|
|
487
|
+
n[4] ? "cert-item-selected" : ""}`) + " svelte-jtc2v4") && v(t, "class", p);
|
|
488
|
+
},
|
|
489
|
+
d(b) {
|
|
490
|
+
b && z(t), $ = !1, A();
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function ne(n) {
|
|
495
|
+
let t, e = at(
|
|
496
|
+
/*certList*/
|
|
497
|
+
n[0]
|
|
498
|
+
), s = [];
|
|
499
|
+
for (let a = 0; a < e.length; a += 1)
|
|
500
|
+
s[a] = ot(rt(n, e, a));
|
|
501
|
+
return {
|
|
502
|
+
c() {
|
|
503
|
+
for (let a = 0; a < s.length; a += 1)
|
|
504
|
+
s[a].c();
|
|
505
|
+
t = Ot();
|
|
506
|
+
},
|
|
507
|
+
m(a, r) {
|
|
508
|
+
for (let o = 0; o < s.length; o += 1)
|
|
509
|
+
s[o] && s[o].m(a, r);
|
|
510
|
+
q(a, t, r);
|
|
511
|
+
},
|
|
512
|
+
p(a, r) {
|
|
513
|
+
if (r & /*selectedIndex, certList*/
|
|
514
|
+
17) {
|
|
515
|
+
e = at(
|
|
516
|
+
/*certList*/
|
|
517
|
+
a[0]
|
|
518
|
+
);
|
|
519
|
+
let o;
|
|
520
|
+
for (o = 0; o < e.length; o += 1) {
|
|
521
|
+
const i = rt(a, e, o);
|
|
522
|
+
s[o] ? s[o].p(i, r) : (s[o] = ot(i), s[o].c(), s[o].m(t.parentNode, t));
|
|
523
|
+
}
|
|
524
|
+
for (; o < s.length; o += 1)
|
|
525
|
+
s[o].d(1);
|
|
526
|
+
s.length = e.length;
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
d(a) {
|
|
530
|
+
a && z(t), Nt(s, a);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function se(n) {
|
|
535
|
+
let t, e;
|
|
536
|
+
return t = new ee({
|
|
537
|
+
props: {
|
|
538
|
+
onOk: (
|
|
539
|
+
/*handleConfirm*/
|
|
540
|
+
n[6]
|
|
541
|
+
),
|
|
542
|
+
onClose: (
|
|
543
|
+
/*onClose*/
|
|
544
|
+
n[1]
|
|
545
|
+
),
|
|
546
|
+
onCancel: (
|
|
547
|
+
/*handleCancel*/
|
|
548
|
+
n[5]
|
|
549
|
+
),
|
|
550
|
+
cancelText: (
|
|
551
|
+
/*cancelText*/
|
|
552
|
+
n[2]
|
|
553
|
+
),
|
|
554
|
+
okText: (
|
|
555
|
+
/*okText*/
|
|
556
|
+
n[3]
|
|
557
|
+
),
|
|
558
|
+
title: "选择证书",
|
|
559
|
+
$$slots: { default: [ne] },
|
|
560
|
+
$$scope: { ctx: n }
|
|
561
|
+
}
|
|
562
|
+
}), {
|
|
563
|
+
c() {
|
|
564
|
+
Kt(t.$$.fragment);
|
|
565
|
+
},
|
|
566
|
+
m(s, a) {
|
|
567
|
+
pt(t, s, a), e = !0;
|
|
568
|
+
},
|
|
569
|
+
p(s, [a]) {
|
|
570
|
+
const r = {};
|
|
571
|
+
a & /*onClose*/
|
|
572
|
+
2 && (r.onClose = /*onClose*/
|
|
573
|
+
s[1]), a & /*cancelText*/
|
|
574
|
+
4 && (r.cancelText = /*cancelText*/
|
|
575
|
+
s[2]), a & /*okText*/
|
|
576
|
+
8 && (r.okText = /*okText*/
|
|
577
|
+
s[3]), a & /*$$scope, certList, selectedIndex*/
|
|
578
|
+
8209 && (r.$$scope = { dirty: a, ctx: s }), t.$set(r);
|
|
579
|
+
},
|
|
580
|
+
i(s) {
|
|
581
|
+
e || (X(t.$$.fragment, s), e = !0);
|
|
582
|
+
},
|
|
583
|
+
o(s) {
|
|
584
|
+
ft(t.$$.fragment, s), e = !1;
|
|
585
|
+
},
|
|
586
|
+
d(s) {
|
|
587
|
+
yt(t, s);
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function ae(n, t, e) {
|
|
592
|
+
let { certList: s = [] } = t, { onCancel: a } = t, { onOk: r } = t, { onClose: o } = t, { cancelText: i = "" } = t, { okText: d = "" } = t, l = 0;
|
|
593
|
+
const f = () => {
|
|
594
|
+
o == null || o();
|
|
595
|
+
}, u = () => {
|
|
596
|
+
r == null || r(s[l]), o == null || o();
|
|
597
|
+
}, m = (h) => e(4, l = h);
|
|
598
|
+
return n.$$set = (h) => {
|
|
599
|
+
"certList" in h && e(0, s = h.certList), "onCancel" in h && e(7, a = h.onCancel), "onOk" in h && e(8, r = h.onOk), "onClose" in h && e(1, o = h.onClose), "cancelText" in h && e(2, i = h.cancelText), "okText" in h && e(3, d = h.okText);
|
|
600
|
+
}, [
|
|
601
|
+
s,
|
|
602
|
+
o,
|
|
603
|
+
i,
|
|
604
|
+
d,
|
|
605
|
+
l,
|
|
606
|
+
f,
|
|
607
|
+
u,
|
|
608
|
+
a,
|
|
609
|
+
r,
|
|
610
|
+
m
|
|
611
|
+
];
|
|
612
|
+
}
|
|
613
|
+
class re extends wt {
|
|
614
|
+
constructor(t) {
|
|
615
|
+
super(), mt(this, t, ae, se, ut, {
|
|
616
|
+
certList: 0,
|
|
617
|
+
onCancel: 7,
|
|
618
|
+
onOk: 8,
|
|
619
|
+
onClose: 1,
|
|
620
|
+
cancelText: 2,
|
|
621
|
+
okText: 3
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
class oe {
|
|
626
|
+
constructor() {
|
|
627
|
+
c(this, "modalInstance", { current: null });
|
|
628
|
+
c(this, "open", (t) => new Promise((e, s) => {
|
|
629
|
+
this.modalInstance.current = new re({
|
|
630
|
+
target: document.body,
|
|
631
|
+
props: {
|
|
632
|
+
...t,
|
|
633
|
+
onCancel: (a) => {
|
|
634
|
+
s();
|
|
635
|
+
},
|
|
636
|
+
onOk: (a) => {
|
|
637
|
+
e(a);
|
|
638
|
+
},
|
|
639
|
+
onClose: () => {
|
|
640
|
+
this.close();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}));
|
|
645
|
+
c(this, "close", () => {
|
|
646
|
+
setTimeout(() => {
|
|
647
|
+
var t;
|
|
648
|
+
(t = this.modalInstance.current) == null || t.$destroy();
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
const ce = new oe();
|
|
654
|
+
class ie {
|
|
655
|
+
constructor(t) {
|
|
656
|
+
c(this, "socketInstance", null);
|
|
657
|
+
c(this, "eventBus", new Lt());
|
|
658
|
+
c(this, "isRememberPin", !1);
|
|
659
|
+
c(this, "socketEvent");
|
|
660
|
+
c(this, "pinPolicy");
|
|
661
|
+
c(this, "getSocketReadyState", () => {
|
|
662
|
+
var t;
|
|
663
|
+
return (t = this.socketInstance) == null ? void 0 : t.readyState;
|
|
664
|
+
});
|
|
665
|
+
c(this, "destroy", () => {
|
|
666
|
+
var t;
|
|
667
|
+
(t = this.socketInstance) == null || t.close();
|
|
668
|
+
});
|
|
669
|
+
c(this, "sendMessage", (t, e) => new Promise((s, a) => {
|
|
670
|
+
var o, i;
|
|
671
|
+
if (((o = this.socketInstance) == null ? void 0 : o.readyState) !== WebSocket.OPEN) {
|
|
672
|
+
a({
|
|
673
|
+
errCode: -1,
|
|
674
|
+
message: "socket连接未建立"
|
|
675
|
+
});
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const r = {
|
|
679
|
+
function: t,
|
|
680
|
+
args: [e ?? {}]
|
|
681
|
+
};
|
|
682
|
+
(i = this.socketInstance) == null || i.send(JSON.stringify(r)), this.eventBus.on(t, (d) => {
|
|
683
|
+
d.success ? s(d.data) : a(d);
|
|
684
|
+
});
|
|
685
|
+
}));
|
|
686
|
+
c(this, "handleEventData", async (t) => {
|
|
687
|
+
var e, s, a, r;
|
|
688
|
+
if (t.data instanceof Blob) {
|
|
689
|
+
const o = await t.data.arrayBuffer(), d = new TextDecoder("gbk").decode(o), l = JSON.parse(d);
|
|
690
|
+
this.eventBus.emit((e = l.result) == null ? void 0 : e.function, {
|
|
691
|
+
data: l.data,
|
|
692
|
+
success: (s = l.result) == null ? void 0 : s.success,
|
|
693
|
+
msg: (a = l.result) == null ? void 0 : a.msg,
|
|
694
|
+
errCode: (r = l.result) == null ? void 0 : r.errCode
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
c(this, "base64Encode", (t) => {
|
|
699
|
+
const e = new TextEncoder().encode(t);
|
|
700
|
+
return Z.fromByteArray(e);
|
|
701
|
+
});
|
|
702
|
+
c(this, "base64Decode", (t) => {
|
|
703
|
+
const e = Z.toByteArray(t);
|
|
704
|
+
return new TextDecoder().decode(e);
|
|
705
|
+
});
|
|
706
|
+
c(this, "changeIsRememberPin", async (t) => {
|
|
707
|
+
this.isRememberPin = t;
|
|
708
|
+
});
|
|
709
|
+
c(this, "changePinPolicy", async (t) => {
|
|
710
|
+
this.pinPolicy = t;
|
|
711
|
+
});
|
|
712
|
+
c(this, "checkCertIsLogin", async (t) => await this.sendMessage("GZCA_IsLogin", t));
|
|
713
|
+
c(this, "certLogin", async (t) => {
|
|
714
|
+
const e = await this.checkCertIsLogin({
|
|
715
|
+
ContainerName: t
|
|
716
|
+
});
|
|
717
|
+
e != null && e[0].isLogin || await this.sendMessage("GZCA_Login", {
|
|
718
|
+
ContainerName: t,
|
|
719
|
+
IsLogin: "N",
|
|
720
|
+
UserPin: "123456",
|
|
721
|
+
PinPolicy: this.pinPolicy
|
|
722
|
+
});
|
|
723
|
+
});
|
|
724
|
+
c(this, "getCert", async (t, e) => {
|
|
725
|
+
const s = e ?? await this.chooseCert(t);
|
|
726
|
+
return await this.certLogin(s.ContainerName), s;
|
|
727
|
+
});
|
|
728
|
+
c(this, "getCertList", async (t) => await this.sendMessage(
|
|
729
|
+
"GZCA_GetCertList",
|
|
730
|
+
t
|
|
731
|
+
));
|
|
732
|
+
c(this, "chooseCert", async (t) => {
|
|
733
|
+
const e = await this.getCertList(t);
|
|
734
|
+
return (e == null ? void 0 : e.length) === 1 ? e[0] : await ce.open({
|
|
735
|
+
certList: e
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
c(this, "pkcs1Sign", async (t) => await this.sendMessage("GZCA_Pkcs1SignData", {
|
|
739
|
+
...t,
|
|
740
|
+
IsLogin: this.getIsLogin(),
|
|
741
|
+
PinPolicy: this.pinPolicy
|
|
742
|
+
}));
|
|
743
|
+
c(this, "pkcs1Base64Sign", async (t) => await this.sendMessage("GZCA_Pkcs1SignDataEx", {
|
|
744
|
+
...t,
|
|
745
|
+
IsLogin: this.getIsLogin(),
|
|
746
|
+
PinPolicy: this.pinPolicy
|
|
747
|
+
}));
|
|
748
|
+
c(this, "pkcs1VerifySignature", async (t) => await this.sendMessage("GZCA_Pkcs1VerifySign", t));
|
|
749
|
+
c(this, "pkcs1Base64VerifySignature", async (t) => await this.sendMessage("GZCA_Pkcs1VerifySignEx", t));
|
|
750
|
+
c(this, "getSealList", async (t) => await this.sendMessage("GZCA_EnumSeals", {
|
|
751
|
+
...t,
|
|
752
|
+
IsLogin: this.getIsLogin()
|
|
753
|
+
}));
|
|
754
|
+
c(this, "sm2SignPreprocess1", async (t) => await this.sendMessage("GZCA_PrepareSm2SignStep1", t));
|
|
755
|
+
c(this, "sm2SignPreprocess2", async (t) => await this.sendMessage("GZCA_PrepareSm2SignStep2", t));
|
|
756
|
+
c(this, "pkcs1HashSign", async (t) => await this.sendMessage("GZCA_Pkcs1SignDataForHash", {
|
|
757
|
+
...t ?? {},
|
|
758
|
+
IsLogin: this.getIsLogin(),
|
|
759
|
+
PinPolicy: this.pinPolicy
|
|
760
|
+
}));
|
|
761
|
+
c(this, "pkcs1HashVerifySignature", async (t) => await this.sendMessage("GZCA_Pkcs1VerifySignForHash", t));
|
|
762
|
+
c(this, "pkcs7Sign", async (t) => await this.sendMessage("GZCA_Pkcs7SignData", {
|
|
763
|
+
...t,
|
|
764
|
+
IsLogin: this.getIsLogin(),
|
|
765
|
+
IsAuthAttr: "Y",
|
|
766
|
+
PinPolicy: this.pinPolicy
|
|
767
|
+
}));
|
|
768
|
+
c(this, "pkcs7VerifySignature", async (t) => await this.sendMessage("GZCA_Pkcs7VerifySign", t));
|
|
769
|
+
c(this, "sm3Hash", async (t) => await this.sendMessage("GZCA_HashData", t));
|
|
770
|
+
c(this, "sm3HexHash", async (t) => await this.sendMessage("GZCA_HashDataEx", t));
|
|
771
|
+
c(this, "sm3FileHash", async (t) => await this.sendMessage("GZCA_HashFile", t));
|
|
772
|
+
c(this, "sm3HashEncryption", async (t) => await this.sendMessage("GZCA_HMac", t));
|
|
773
|
+
c(this, "pkcs7Encryption", async (t) => await this.sendMessage("GZCA_Pkcs7EncryptData", t));
|
|
774
|
+
c(this, "pkcs7Decryption", async (t) => await this.sendMessage("GZCA_Pkcs7DecryptData", {
|
|
775
|
+
...t,
|
|
776
|
+
IsLogin: this.getIsLogin()
|
|
777
|
+
}));
|
|
778
|
+
c(this, "asymmetricEncryption", async (t) => await this.sendMessage("GZCA_AsymEncryptData", t));
|
|
779
|
+
c(this, "asymmetricDecryption", async (t) => await this.sendMessage("GZCA_AsymDecryptData", {
|
|
780
|
+
...t,
|
|
781
|
+
IsLogin: this.getIsLogin()
|
|
782
|
+
}));
|
|
783
|
+
c(this, "sm4Encryption", async (t) => await this.sendMessage("GZCA_EncryptDataEx", t));
|
|
784
|
+
c(this, "sm4Decryption", async (t) => await this.sendMessage("GZCA_DecryptDataEx", t));
|
|
785
|
+
c(this, "getCertInfo", async (t) => await this.sendMessage("GZCA_GetCertInfo", t));
|
|
786
|
+
c(this, "getCertInfoByOid", async (t) => await this.sendMessage("GZCA_GetCertInfoByOid", t));
|
|
787
|
+
this.socketInstance = this.createSocket(t), this.isRememberPin = t.isRememberPin ?? !1, this.pinPolicy = t.pinPolicy ?? it.MIN;
|
|
788
|
+
}
|
|
789
|
+
createSocket(t) {
|
|
790
|
+
const e = new WebSocket(t.url);
|
|
791
|
+
return e.onerror = (s) => {
|
|
792
|
+
var a;
|
|
793
|
+
(a = t.onError) == null || a.call(t, s);
|
|
794
|
+
}, e.onopen = (s) => {
|
|
795
|
+
var a;
|
|
796
|
+
(a = t.onOpen) == null || a.call(t, s);
|
|
797
|
+
}, e.onmessage = (s) => {
|
|
798
|
+
this.handleEventData(s);
|
|
799
|
+
}, e.onclose = (s) => {
|
|
800
|
+
var a;
|
|
801
|
+
(a = t.onClose) == null || a.call(t, s);
|
|
802
|
+
}, e;
|
|
803
|
+
}
|
|
804
|
+
getIsLogin() {
|
|
805
|
+
return this.isRememberPin ? "Y" : "N";
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
const P = class P {
|
|
809
|
+
constructor(t) {
|
|
810
|
+
c(this, "coreInstance", null);
|
|
811
|
+
c(this, "gwsConfig", {});
|
|
812
|
+
c(this, "createGwsCore", (t) => {
|
|
813
|
+
this.gwsConfig = t ?? {}, this.coreInstance = new ie({
|
|
814
|
+
...t ?? {},
|
|
815
|
+
url: xt
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
c(this, "appendCertBase64", async (t, e = !0) => {
|
|
819
|
+
if (t.CertB64) return t;
|
|
820
|
+
const s = e ? await this.getSignatureCert() : await this.getEncryptionCert();
|
|
821
|
+
return { ...t ?? {}, CertB64: s == null ? void 0 : s.CertB64 };
|
|
822
|
+
});
|
|
823
|
+
c(this, "destroy", () => {
|
|
824
|
+
var t;
|
|
825
|
+
(t = this.coreInstance) == null || t.destroy(), this.coreInstance = null;
|
|
826
|
+
});
|
|
827
|
+
c(this, "restart", (t) => {
|
|
828
|
+
this.coreInstance && this.destroy(), this.gwsConfig = t ?? this.gwsConfig, this.createGwsCore(t);
|
|
829
|
+
});
|
|
830
|
+
c(this, "getSocketReadyState", () => {
|
|
831
|
+
var t;
|
|
832
|
+
return (t = this.coreInstance) == null ? void 0 : t.getSocketReadyState();
|
|
833
|
+
});
|
|
834
|
+
c(this, "getSignatureCert", async (t) => {
|
|
835
|
+
var s;
|
|
836
|
+
return await ((s = this.coreInstance) == null ? void 0 : s.getCert(
|
|
837
|
+
{ CertType: kt },
|
|
838
|
+
t
|
|
839
|
+
));
|
|
840
|
+
});
|
|
841
|
+
c(this, "getEncryptionCert", async (t) => {
|
|
842
|
+
var s;
|
|
843
|
+
return await ((s = this.coreInstance) == null ? void 0 : s.getCert(
|
|
844
|
+
{ CertType: Bt },
|
|
845
|
+
t
|
|
846
|
+
));
|
|
847
|
+
});
|
|
848
|
+
c(this, "base64Encode", (t) => {
|
|
849
|
+
var e;
|
|
850
|
+
return (e = this.coreInstance) == null ? void 0 : e.base64Encode(t);
|
|
851
|
+
});
|
|
852
|
+
c(this, "base64Decode", (t) => {
|
|
853
|
+
var e;
|
|
854
|
+
return (e = this.coreInstance) == null ? void 0 : e.base64Decode(t);
|
|
855
|
+
});
|
|
856
|
+
c(this, "changeIsRememberPin", (t) => {
|
|
857
|
+
var e;
|
|
858
|
+
(e = this.coreInstance) == null || e.changeIsRememberPin(t);
|
|
859
|
+
});
|
|
860
|
+
c(this, "changePinPolicy", (t) => {
|
|
861
|
+
var e;
|
|
862
|
+
(e = this.coreInstance) == null || e.changePinPolicy(t);
|
|
863
|
+
});
|
|
864
|
+
c(this, "pkcs1Sign", async (t, e) => {
|
|
865
|
+
var r, o;
|
|
866
|
+
const s = await this.getSignatureCert(e), a = await ((r = this.coreInstance) == null ? void 0 : r.pkcs1Sign({
|
|
867
|
+
...t ?? {},
|
|
868
|
+
ContainerName: (s == null ? void 0 : s.ContainerName) ?? ""
|
|
869
|
+
}));
|
|
870
|
+
return (o = a == null ? void 0 : a[0]) == null ? void 0 : o.SignData;
|
|
871
|
+
});
|
|
872
|
+
c(this, "pkcs1VerifySignature", async (t) => {
|
|
873
|
+
var a;
|
|
874
|
+
const e = await this.appendCertBase64(t);
|
|
875
|
+
return !!await ((a = this.coreInstance) == null ? void 0 : a.pkcs1VerifySignature(e));
|
|
876
|
+
});
|
|
877
|
+
c(this, "pkcs1Base64Sign", async (t, e) => {
|
|
878
|
+
var o, i;
|
|
879
|
+
const s = await this.getSignatureCert(e), a = t.DataB64 ?? this.base64Encode(t.Data ?? ""), r = await ((o = this.coreInstance) == null ? void 0 : o.pkcs1Base64Sign({
|
|
880
|
+
ContainerName: (s == null ? void 0 : s.ContainerName) ?? "",
|
|
881
|
+
DataB64: a
|
|
882
|
+
}));
|
|
883
|
+
return (i = r == null ? void 0 : r[0]) == null ? void 0 : i.SignData;
|
|
884
|
+
});
|
|
885
|
+
c(this, "pkcs1Base64VerifySignature", async (t) => {
|
|
886
|
+
var r;
|
|
887
|
+
const e = t.DataB64 ?? this.base64Encode(t.Data ?? ""), s = await this.appendCertBase64(t);
|
|
888
|
+
return !!await ((r = this.coreInstance) == null ? void 0 : r.pkcs1Base64VerifySignature({
|
|
889
|
+
CertB64: s.CertB64,
|
|
890
|
+
DataB64: e,
|
|
891
|
+
SignData: s.SignData
|
|
892
|
+
}));
|
|
893
|
+
});
|
|
894
|
+
c(this, "getSealList", async () => {
|
|
895
|
+
var s;
|
|
896
|
+
const t = await this.getSignatureCert(), e = await ((s = this.coreInstance) == null ? void 0 : s.getSealList({
|
|
897
|
+
ContainerName: (t == null ? void 0 : t.ContainerName) ?? ""
|
|
898
|
+
}));
|
|
899
|
+
return {
|
|
900
|
+
cert: t,
|
|
901
|
+
sealList: e
|
|
902
|
+
};
|
|
903
|
+
});
|
|
904
|
+
c(this, "sm2SignPreprocess1", async (t) => {
|
|
905
|
+
var a, r;
|
|
906
|
+
const e = await this.appendCertBase64(t), s = await ((a = this.coreInstance) == null ? void 0 : a.sm2SignPreprocess1(e));
|
|
907
|
+
return (r = s == null ? void 0 : s[0]) == null ? void 0 : r.Z;
|
|
908
|
+
});
|
|
909
|
+
c(this, "sm2SignPreprocess2", async (t) => {
|
|
910
|
+
var r;
|
|
911
|
+
const e = this.base64Encode(t.Data), s = await this.appendCertBase64(t), a = await ((r = this.coreInstance) == null ? void 0 : r.sm2SignPreprocess2({
|
|
912
|
+
CertB64: s.CertB64,
|
|
913
|
+
DataB64: e
|
|
914
|
+
}));
|
|
915
|
+
return a == null ? void 0 : a[0].H;
|
|
916
|
+
});
|
|
917
|
+
c(this, "pkcs1HashSign", async (t, e) => {
|
|
918
|
+
var r, o;
|
|
919
|
+
const s = await this.getSignatureCert(e), a = await ((r = this.coreInstance) == null ? void 0 : r.pkcs1HashSign({
|
|
920
|
+
ContainerName: (s == null ? void 0 : s.ContainerName) ?? "",
|
|
921
|
+
DataB64: t.DataB64,
|
|
922
|
+
HashAlg: t.HashAlg ?? "sm3"
|
|
923
|
+
}));
|
|
924
|
+
return (o = a == null ? void 0 : a[0]) == null ? void 0 : o.SignData;
|
|
925
|
+
});
|
|
926
|
+
c(this, "pkcs1HashVerifySignature", async (t) => {
|
|
927
|
+
var a;
|
|
928
|
+
const e = await this.appendCertBase64(t);
|
|
929
|
+
return !!await ((a = this.coreInstance) == null ? void 0 : a.pkcs1HashVerifySignature({
|
|
930
|
+
...e,
|
|
931
|
+
HashAlg: e.HashAlg ?? "sm3"
|
|
932
|
+
}));
|
|
933
|
+
});
|
|
934
|
+
c(this, "pkcs7Sign", async (t, e) => {
|
|
935
|
+
var o, i;
|
|
936
|
+
const s = t.DataB64 ?? this.base64Encode(t.Data ?? ""), a = await this.getSignatureCert(e), r = await ((o = this.coreInstance) == null ? void 0 : o.pkcs7Sign({
|
|
937
|
+
IsDetached: t.IsDetached,
|
|
938
|
+
ContainerName: (a == null ? void 0 : a.ContainerName) ?? "",
|
|
939
|
+
DataB64: s
|
|
940
|
+
}));
|
|
941
|
+
return (i = r == null ? void 0 : r[0]) == null ? void 0 : i.SignData;
|
|
942
|
+
});
|
|
943
|
+
c(this, "pkcs7VerifySignature", async (t) => {
|
|
944
|
+
var a;
|
|
945
|
+
const e = t.DataB64 ?? this.base64Encode(t.Data ?? "");
|
|
946
|
+
return !!await ((a = this.coreInstance) == null ? void 0 : a.pkcs7VerifySignature({
|
|
947
|
+
DataB64: e,
|
|
948
|
+
SignData: t.SignData
|
|
949
|
+
}));
|
|
950
|
+
});
|
|
951
|
+
c(this, "sm3Hash", async (t) => {
|
|
952
|
+
var s, a;
|
|
953
|
+
const e = await ((s = this.coreInstance) == null ? void 0 : s.sm3Hash(t));
|
|
954
|
+
return (a = e == null ? void 0 : e[0]) == null ? void 0 : a.HashB64;
|
|
955
|
+
});
|
|
956
|
+
c(this, "sm3HexHash", async (t) => {
|
|
957
|
+
var s, a;
|
|
958
|
+
const e = await ((s = this.coreInstance) == null ? void 0 : s.sm3HexHash(t));
|
|
959
|
+
return (a = e == null ? void 0 : e[0]) == null ? void 0 : a.HashB64;
|
|
960
|
+
});
|
|
961
|
+
c(this, "sm3FileHash", async (t) => {
|
|
962
|
+
var s, a;
|
|
963
|
+
const e = await ((s = this.coreInstance) == null ? void 0 : s.sm3FileHash(t));
|
|
964
|
+
return (a = e == null ? void 0 : e[0]) == null ? void 0 : a.HashB64;
|
|
965
|
+
});
|
|
966
|
+
c(this, "sm3HashEncryption", async (t) => {
|
|
967
|
+
var r, o;
|
|
968
|
+
const e = t.DataB64 ?? this.base64Encode(t.Data ?? ""), s = t.KeyB64 ?? this.base64Encode(t.Key ?? ""), a = await ((r = this.coreInstance) == null ? void 0 : r.sm3HashEncryption({
|
|
969
|
+
dataB64: e,
|
|
970
|
+
keyB64: s,
|
|
971
|
+
alg: "sm3"
|
|
972
|
+
}));
|
|
973
|
+
return (o = a == null ? void 0 : a[0]) == null ? void 0 : o.DataB64;
|
|
974
|
+
});
|
|
975
|
+
c(this, "pkcs7Encryption", async (t) => {
|
|
976
|
+
var a, r;
|
|
977
|
+
if (!t.CertB64List) {
|
|
978
|
+
const o = await this.getEncryptionCert();
|
|
979
|
+
t.CertB64List = o == null ? void 0 : o.CertB64;
|
|
980
|
+
}
|
|
981
|
+
const e = t.DataB64 ?? this.base64Encode(t.Data ?? ""), s = await ((a = this.coreInstance) == null ? void 0 : a.pkcs7Encryption({
|
|
982
|
+
DataB64: e,
|
|
983
|
+
CertB64List: t.CertB64List
|
|
984
|
+
}));
|
|
985
|
+
return (r = s == null ? void 0 : s[0]) == null ? void 0 : r.DataB64;
|
|
986
|
+
});
|
|
987
|
+
c(this, "pkcs7Decryption", async (t) => {
|
|
988
|
+
var r, o;
|
|
989
|
+
const e = await this.getEncryptionCert(), s = await ((r = this.coreInstance) == null ? void 0 : r.pkcs7Decryption({
|
|
990
|
+
DataB64: t.DataB64,
|
|
991
|
+
ContainerName: e == null ? void 0 : e.ContainerName
|
|
992
|
+
})), a = (o = s == null ? void 0 : s[0]) == null ? void 0 : o.DataB64;
|
|
993
|
+
return t.shouldDecodeBase64 ? this.base64Decode(a) : a;
|
|
994
|
+
});
|
|
995
|
+
c(this, "asymmetricEncryption", async (t) => {
|
|
996
|
+
var a, r;
|
|
997
|
+
const e = await this.appendCertBase64(t, !1), s = await ((a = this.coreInstance) == null ? void 0 : a.asymmetricEncryption(e));
|
|
998
|
+
return (r = s == null ? void 0 : s[0]) == null ? void 0 : r.Data;
|
|
999
|
+
});
|
|
1000
|
+
c(this, "asymmetricDecryption", async (t) => {
|
|
1001
|
+
var a, r;
|
|
1002
|
+
const e = await this.getEncryptionCert(), s = await ((a = this.coreInstance) == null ? void 0 : a.asymmetricDecryption({
|
|
1003
|
+
Data: t.Data,
|
|
1004
|
+
ContainerName: e == null ? void 0 : e.ContainerName
|
|
1005
|
+
}));
|
|
1006
|
+
return (r = s == null ? void 0 : s[0]) == null ? void 0 : r.Data;
|
|
1007
|
+
});
|
|
1008
|
+
c(this, "sm4Encryption", async (t) => {
|
|
1009
|
+
var s;
|
|
1010
|
+
const e = await ((s = this.coreInstance) == null ? void 0 : s.sm4Encryption(t));
|
|
1011
|
+
return e == null ? void 0 : e[0];
|
|
1012
|
+
});
|
|
1013
|
+
c(this, "sm4Decryption", async (t) => {
|
|
1014
|
+
var s, a;
|
|
1015
|
+
const e = await ((s = this.coreInstance) == null ? void 0 : s.sm4Decryption(t));
|
|
1016
|
+
return (a = e == null ? void 0 : e[0]) == null ? void 0 : a.Data;
|
|
1017
|
+
});
|
|
1018
|
+
c(this, "getCertInfo", async () => {
|
|
1019
|
+
var s;
|
|
1020
|
+
const t = await this.getSignatureCert(), e = await ((s = this.coreInstance) == null ? void 0 : s.getCertInfo({
|
|
1021
|
+
CertB64: t == null ? void 0 : t.CertB64
|
|
1022
|
+
}));
|
|
1023
|
+
return {
|
|
1024
|
+
...(e == null ? void 0 : e[0]) ?? {},
|
|
1025
|
+
...t ?? {}
|
|
1026
|
+
};
|
|
1027
|
+
});
|
|
1028
|
+
c(this, "getCertInfoByOid", async (t) => {
|
|
1029
|
+
var a, r;
|
|
1030
|
+
const e = await this.getSignatureCert(), s = await ((a = this.coreInstance) == null ? void 0 : a.getCertInfoByOid({
|
|
1031
|
+
...t ?? {},
|
|
1032
|
+
CertB64: e == null ? void 0 : e.CertB64
|
|
1033
|
+
}));
|
|
1034
|
+
return (r = s == null ? void 0 : s[0]) == null ? void 0 : r.OidValue;
|
|
1035
|
+
});
|
|
1036
|
+
return P.instance ? P.instance : (this.createGwsCore(t), P.instance = this, this);
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
c(P, "instance", null);
|
|
1040
|
+
let ct = P;
|
|
1041
|
+
export {
|
|
1042
|
+
ct as GwsService
|
|
1043
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(m,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(m=typeof globalThis<"u"?globalThis:m||self,p(m.GZCA={}))})(this,function(m){"use strict";var ie=Object.defineProperty;var le=(m,p,_)=>p in m?ie(m,p,{enumerable:!0,configurable:!0,writable:!0,value:_}):m[p]=_;var c=(m,p,_)=>le(m,typeof p!="symbol"?p+"":p,_);const p=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",_="1",kt="2";var st=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(st||{}),j={};j.byteLength=St,j.toByteArray=$t,j.fromByteArray=Et;for(var B=[],w=[],Bt=typeof Uint8Array<"u"?Uint8Array:Array,W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=0,bt=W.length;L<bt;++L)B[L]=W[L],w[W.charCodeAt(L)]=L;w[45]=62,w[95]=63;function at(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=t);var s=e===t?0:4-e%4;return[e,s]}function St(n){var t=at(n),e=t[0],s=t[1];return(e+s)*3/4-s}function Dt(n,t,e){return(t+e)*3/4-e}function $t(n){var t,e=at(n),s=e[0],a=e[1],r=new Bt(Dt(n,s,a)),o=0,i=a>0?s-4:s,d;for(d=0;d<i;d+=4)t=w[n.charCodeAt(d)]<<18|w[n.charCodeAt(d+1)]<<12|w[n.charCodeAt(d+2)]<<6|w[n.charCodeAt(d+3)],r[o++]=t>>16&255,r[o++]=t>>8&255,r[o++]=t&255;return a===2&&(t=w[n.charCodeAt(d)]<<2|w[n.charCodeAt(d+1)]>>4,r[o++]=t&255),a===1&&(t=w[n.charCodeAt(d)]<<10|w[n.charCodeAt(d+1)]<<4|w[n.charCodeAt(d+2)]>>2,r[o++]=t>>8&255,r[o++]=t&255),r}function It(n){return B[n>>18&63]+B[n>>12&63]+B[n>>6&63]+B[n&63]}function At(n,t,e){for(var s,a=[],r=t;r<e;r+=3)s=(n[r]<<16&16711680)+(n[r+1]<<8&65280)+(n[r+2]&255),a.push(It(s));return a.join("")}function Et(n){for(var t,e=n.length,s=e%3,a=[],r=16383,o=0,i=e-s;o<i;o+=r)a.push(At(n,o,o+r>i?i:o+r));return s===1?(t=n[e-1],a.push(B[t>>2]+B[t<<4&63]+"==")):s===2&&(t=(n[e-2]<<8)+n[e-1],a.push(B[t>>10]+B[t>>4&63]+B[t<<2&63]+"=")),a.join("")}class _t{constructor(){c(this,"deps",new Map)}on(t,e){this.deps.set(t,e)}emit(t,e){const s=this.deps.get(t);s&&s(e)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")),document.head.appendChild(n)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var Lt=Object.defineProperty,Pt=(n,t,e)=>t in n?Lt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,rt=(n,t,e)=>Pt(n,typeof t!="symbol"?t+"":t,e);function J(){}function Tt(n,t){for(const e in t)n[e]=t[e];return n}function ot(n){return n()}function ct(){return Object.create(null)}function Z(n){n.forEach(ot)}function N(n){return typeof n=="function"}function it(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Ht(n){return Object.keys(n).length===0}function Mt(n,t,e,s){if(n){const a=lt(n,t,e,s);return n[0](a)}}function lt(n,t,e,s){return n[1]&&s?Tt(e.ctx.slice(),n[1](s(t))):e.ctx}function Gt(n,t,e,s){if(n[2]&&s){const a=n[2](s(e));if(t.dirty===void 0)return a;if(typeof a=="object"){const r=[],o=Math.max(t.dirty.length,a.length);for(let i=0;i<o;i+=1)r[i]=t.dirty[i]|a[i];return r}return t.dirty|a}return t.dirty}function Ft(n,t,e,s,a,r){if(a){const o=lt(t,e,s,r);n.p(o,a)}}function jt(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let s=0;s<e;s++)t[s]=-1;return t}return-1}function dt(n){return n??""}function g(n,t){n.appendChild(t)}function K(n,t,e){n.insertBefore(t,e||null)}function R(n){n.parentNode&&n.parentNode.removeChild(n)}function Zt(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function b(n){return document.createElement(n)}function S(n){return document.createTextNode(n)}function O(){return S(" ")}function Nt(){return S("")}function z(n,t,e,s){return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}function C(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function Ot(n){return Array.from(n.childNodes)}function P(n,t){t=""+t,n.data!==t&&(n.data=t)}let q;function V(n){q=n}const T=[],ut=[];let H=[];const ht=[],zt=Promise.resolve();let Q=!1;function Vt(){Q||(Q=!0,zt.then(gt))}function X(n){H.push(n)}const Y=new Set;let M=0;function gt(){if(M!==0)return;const n=q;do{try{for(;M<T.length;){const t=T[M];M++,V(t),Rt(t.$$)}}catch(t){throw T.length=0,M=0,t}for(V(null),T.length=0,M=0;ut.length;)ut.pop()();for(let t=0;t<H.length;t+=1){const e=H[t];Y.has(e)||(Y.add(e),e())}H.length=0}while(T.length);for(;ht.length;)ht.pop()();Q=!1,Y.clear(),V(n)}function Rt(n){if(n.fragment!==null){n.update(),Z(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(X)}}function Ut(n){const t=[],e=[];H.forEach(s=>n.indexOf(s)===-1?t.push(s):e.push(s)),e.forEach(s=>s()),H=t}const U=new Set;let Wt;function tt(n,t){n&&n.i&&(U.delete(n),n.i(t))}function ft(n,t,e,s){if(n&&n.o){if(U.has(n))return;U.add(n),Wt.c.push(()=>{U.delete(n)}),n.o(t)}}function pt(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Jt(n){n&&n.c()}function yt(n,t,e){const{fragment:s,after_update:a}=n.$$;s&&s.m(t,e),X(()=>{const r=n.$$.on_mount.map(ot).filter(N);n.$$.on_destroy?n.$$.on_destroy.push(...r):Z(r),n.$$.on_mount=[]}),a.forEach(X)}function mt(n,t){const e=n.$$;e.fragment!==null&&(Ut(e.after_update),Z(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Kt(n,t){n.$$.dirty[0]===-1&&(T.push(n),Vt(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function wt(n,t,e,s,a,r,o=null,i=[-1]){const d=q;V(n);const l=n.$$={fragment:null,ctx:[],props:r,update:J,not_equal:a,bound:ct(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(d?d.$$.context:[])),callbacks:ct(),dirty:i,skip_bound:!1,root:t.target||d.$$.root};o&&o(l.root);let f=!1;if(l.ctx=e?e(n,t.props||{},(u,v,...h)=>{const y=h.length?h[0]:v;return l.ctx&&a(l.ctx[u],l.ctx[u]=y)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](y),f&&Kt(n,u)),v}):[],l.update(),f=!0,Z(l.before_update),l.fragment=s?s(l.ctx):!1,t.target){if(t.hydrate){const u=Ot(t.target);l.fragment&&l.fragment.l(u),u.forEach(R)}else l.fragment&&l.fragment.c();t.intro&&tt(n.$$.fragment),yt(n,t.target,t.anchor),gt()}V(d)}class Ct{constructor(){rt(this,"$$"),rt(this,"$$set")}$destroy(){mt(this,1),this.$destroy=J}$on(t,e){if(!N(e))return J;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(e),()=>{const a=s.indexOf(e);a!==-1&&s.splice(a,1)}}$set(t){this.$$set&&!Ht(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const qt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(qt);function Qt(n){let t,e,s,a=(n[1]||"标题")+"",r,o,i,d,l,f,u=(n[4]||"取消")+"",v,h,y,A=(n[5]||"确认")+"",F,x,$,I;const nt=n[7].default,k=Mt(nt,n,n[6],null);return{c(){t=b("div"),e=b("div"),s=b("div"),r=S(a),o=O(),i=b("div"),k&&k.c(),d=O(),l=b("div"),f=b("button"),v=S(u),h=O(),y=b("button"),F=S(A),C(s,"class","model-title svelte-n1zwga"),C(i,"class","slot svelte-n1zwga"),C(f,"class","modal-btn svelte-n1zwga"),C(y,"class","modal-btn success svelte-n1zwga"),C(l,"class","modal-footer svelte-n1zwga"),C(e,"class","modal-content svelte-n1zwga"),C(t,"class","modal-background modal-visible svelte-n1zwga")},m(D,E){K(D,t,E),g(t,e),g(e,s),g(s,r),g(e,o),g(e,i),k&&k.m(i,null),g(e,d),g(e,l),g(l,f),g(f,v),g(l,h),g(l,y),g(y,F),x=!0,$||(I=[z(f,"click",function(){N(n[0])&&n[0].apply(this,arguments)}),z(y,"click",function(){N(n[2])&&n[2].apply(this,arguments)}),z(e,"click",Xt),z(t,"click",function(){N(n[3])&&n[3].apply(this,arguments)})],$=!0)},p(D,[E]){n=D,(!x||E&2)&&a!==(a=(n[1]||"标题")+"")&&P(r,a),k&&k.p&&(!x||E&64)&&Ft(k,nt,n,n[6],x?Gt(nt,n[6],E,null):jt(n[6]),null),(!x||E&16)&&u!==(u=(n[4]||"取消")+"")&&P(v,u),(!x||E&32)&&A!==(A=(n[5]||"确认")+"")&&P(F,A)},i(D){x||(tt(k,D),x=!0)},o(D){ft(k,D),x=!1},d(D){D&&R(t),k&&k.d(D),$=!1,Z(I)}}}const Xt=n=>n.stopPropagation();function Yt(n,t,e){let{$$slots:s={},$$scope:a}=t,{onCancel:r}=t,{title:o}=t,{onOk:i}=t,{onClose:d}=t,{cancelText:l}=t,{okText:f}=t;return n.$$set=u=>{"onCancel"in u&&e(0,r=u.onCancel),"title"in u&&e(1,o=u.title),"onOk"in u&&e(2,i=u.onOk),"onClose"in u&&e(3,d=u.onClose),"cancelText"in u&&e(4,l=u.cancelText),"okText"in u&&e(5,f=u.okText),"$$scope"in u&&e(6,a=u.$$scope)},[r,o,i,d,l,f,a,s]}class te extends Ct{constructor(t){super(),wt(this,t,Yt,Qt,it,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5})}}function vt(n,t,e){const s=n.slice();return s[10]=t[e],s[12]=e,s}function xt(n){let t,e,s=n[10].CN+"",a,r,o,i=n[10].DevClass+"",d,l,f=n[10].sn+"",u,v,h,y,A,F;function x(){return n[9](n[12])}return{c(){t=b("div"),e=b("span"),a=S(s),r=O(),o=b("span"),d=S(i),l=S("("),u=S(f),v=S(")"),h=O(),C(e,"class","svelte-jtc2v4"),C(o,"class","svelte-jtc2v4"),C(t,"class",y=dt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m($,I){K($,t,I),g(t,e),g(e,a),g(t,r),g(t,o),g(o,d),g(o,l),g(o,u),g(o,v),g(t,h),A||(F=z(t,"click",x),A=!0)},p($,I){n=$,I&1&&s!==(s=n[10].CN+"")&&P(a,s),I&1&&i!==(i=n[10].DevClass+"")&&P(d,i),I&1&&f!==(f=n[10].sn+"")&&P(u,f),I&16&&y!==(y=dt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&C(t,"class",y)},d($){$&&R(t),A=!1,F()}}}function ee(n){let t,e=pt(n[0]),s=[];for(let a=0;a<e.length;a+=1)s[a]=xt(vt(n,e,a));return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=Nt()},m(a,r){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(a,r);K(a,t,r)},p(a,r){if(r&17){e=pt(a[0]);let o;for(o=0;o<e.length;o+=1){const i=vt(a,e,o);s[o]?s[o].p(i,r):(s[o]=xt(i),s[o].c(),s[o].m(t.parentNode,t))}for(;o<s.length;o+=1)s[o].d(1);s.length=e.length}},d(a){a&&R(t),Zt(s,a)}}}function ne(n){let t,e;return t=new te({props:{onOk:n[6],onClose:n[1],onCancel:n[5],cancelText:n[2],okText:n[3],title:"选择证书",$$slots:{default:[ee]},$$scope:{ctx:n}}}),{c(){Jt(t.$$.fragment)},m(s,a){yt(t,s,a),e=!0},p(s,[a]){const r={};a&2&&(r.onClose=s[1]),a&4&&(r.cancelText=s[2]),a&8&&(r.okText=s[3]),a&8209&&(r.$$scope={dirty:a,ctx:s}),t.$set(r)},i(s){e||(tt(t.$$.fragment,s),e=!0)},o(s){ft(t.$$.fragment,s),e=!1},d(s){mt(t,s)}}}function se(n,t,e){let{certList:s=[]}=t,{onCancel:a}=t,{onOk:r}=t,{onClose:o}=t,{cancelText:i=""}=t,{okText:d=""}=t,l=0;const f=()=>{o==null||o()},u=()=>{r==null||r(s[l]),o==null||o()},v=h=>e(4,l=h);return n.$$set=h=>{"certList"in h&&e(0,s=h.certList),"onCancel"in h&&e(7,a=h.onCancel),"onOk"in h&&e(8,r=h.onOk),"onClose"in h&&e(1,o=h.onClose),"cancelText"in h&&e(2,i=h.cancelText),"okText"in h&&e(3,d=h.okText)},[s,o,i,d,l,f,u,a,r,v]}class ae extends Ct{constructor(t){super(),wt(this,t,se,ne,it,{certList:0,onCancel:7,onOk:8,onClose:1,cancelText:2,okText:3})}}class re{constructor(){c(this,"modalInstance",{current:null});c(this,"open",t=>new Promise((e,s)=>{this.modalInstance.current=new ae({target:document.body,props:{...t,onCancel:a=>{s()},onOk:a=>{e(a)},onClose:()=>{this.close()}}})}));c(this,"close",()=>{setTimeout(()=>{var t;(t=this.modalInstance.current)==null||t.$destroy()})})}}const oe=new re;class ce{constructor(t){c(this,"socketInstance",null);c(this,"eventBus",new _t);c(this,"isRememberPin",!1);c(this,"socketEvent");c(this,"pinPolicy");c(this,"getSocketReadyState",()=>{var t;return(t=this.socketInstance)==null?void 0:t.readyState});c(this,"destroy",()=>{var t;(t=this.socketInstance)==null||t.close()});c(this,"sendMessage",(t,e)=>new Promise((s,a)=>{var o,i;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){a({errCode:-1,message:"socket连接未建立"});return}const r={function:t,args:[e??{}]};(i=this.socketInstance)==null||i.send(JSON.stringify(r)),this.eventBus.on(t,d=>{d.success?s(d.data):a(d)})}));c(this,"handleEventData",async t=>{var e,s,a,r;if(t.data instanceof Blob){const o=await t.data.arrayBuffer(),d=new TextDecoder("gbk").decode(o),l=JSON.parse(d);this.eventBus.emit((e=l.result)==null?void 0:e.function,{data:l.data,success:(s=l.result)==null?void 0:s.success,msg:(a=l.result)==null?void 0:a.msg,errCode:(r=l.result)==null?void 0:r.errCode})}});c(this,"base64Encode",t=>{const e=new TextEncoder().encode(t);return j.fromByteArray(e)});c(this,"base64Decode",t=>{const e=j.toByteArray(t);return new TextDecoder().decode(e)});c(this,"changeIsRememberPin",async t=>{this.isRememberPin=t});c(this,"changePinPolicy",async t=>{this.pinPolicy=t});c(this,"checkCertIsLogin",async t=>await this.sendMessage("GZCA_IsLogin",t));c(this,"certLogin",async t=>{const e=await this.checkCertIsLogin({ContainerName:t});e!=null&&e[0].isLogin||await this.sendMessage("GZCA_Login",{ContainerName:t,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy})});c(this,"getCert",async(t,e)=>{const s=e??await this.chooseCert(t);return await this.certLogin(s.ContainerName),s});c(this,"getCertList",async t=>await this.sendMessage("GZCA_GetCertList",t));c(this,"chooseCert",async t=>{const e=await this.getCertList(t);return(e==null?void 0:e.length)===1?e[0]:await oe.open({certList:e})});c(this,"pkcs1Sign",async t=>await this.sendMessage("GZCA_Pkcs1SignData",{...t,IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}));c(this,"pkcs1Base64Sign",async t=>await this.sendMessage("GZCA_Pkcs1SignDataEx",{...t,IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}));c(this,"pkcs1VerifySignature",async t=>await this.sendMessage("GZCA_Pkcs1VerifySign",t));c(this,"pkcs1Base64VerifySignature",async t=>await this.sendMessage("GZCA_Pkcs1VerifySignEx",t));c(this,"getSealList",async t=>await this.sendMessage("GZCA_EnumSeals",{...t,IsLogin:this.getIsLogin()}));c(this,"sm2SignPreprocess1",async t=>await this.sendMessage("GZCA_PrepareSm2SignStep1",t));c(this,"sm2SignPreprocess2",async t=>await this.sendMessage("GZCA_PrepareSm2SignStep2",t));c(this,"pkcs1HashSign",async t=>await this.sendMessage("GZCA_Pkcs1SignDataForHash",{...t??{},IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}));c(this,"pkcs1HashVerifySignature",async t=>await this.sendMessage("GZCA_Pkcs1VerifySignForHash",t));c(this,"pkcs7Sign",async t=>await this.sendMessage("GZCA_Pkcs7SignData",{...t,IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy}));c(this,"pkcs7VerifySignature",async t=>await this.sendMessage("GZCA_Pkcs7VerifySign",t));c(this,"sm3Hash",async t=>await this.sendMessage("GZCA_HashData",t));c(this,"sm3HexHash",async t=>await this.sendMessage("GZCA_HashDataEx",t));c(this,"sm3FileHash",async t=>await this.sendMessage("GZCA_HashFile",t));c(this,"sm3HashEncryption",async t=>await this.sendMessage("GZCA_HMac",t));c(this,"pkcs7Encryption",async t=>await this.sendMessage("GZCA_Pkcs7EncryptData",t));c(this,"pkcs7Decryption",async t=>await this.sendMessage("GZCA_Pkcs7DecryptData",{...t,IsLogin:this.getIsLogin()}));c(this,"asymmetricEncryption",async t=>await this.sendMessage("GZCA_AsymEncryptData",t));c(this,"asymmetricDecryption",async t=>await this.sendMessage("GZCA_AsymDecryptData",{...t,IsLogin:this.getIsLogin()}));c(this,"sm4Encryption",async t=>await this.sendMessage("GZCA_EncryptDataEx",t));c(this,"sm4Decryption",async t=>await this.sendMessage("GZCA_DecryptDataEx",t));c(this,"getCertInfo",async t=>await this.sendMessage("GZCA_GetCertInfo",t));c(this,"getCertInfoByOid",async t=>await this.sendMessage("GZCA_GetCertInfoByOid",t));this.socketInstance=this.createSocket(t),this.isRememberPin=t.isRememberPin??!1,this.pinPolicy=t.pinPolicy??st.MIN}createSocket(t){const e=new WebSocket(t.url);return e.onerror=s=>{var a;(a=t.onError)==null||a.call(t,s)},e.onopen=s=>{var a;(a=t.onOpen)==null||a.call(t,s)},e.onmessage=s=>{this.handleEventData(s)},e.onclose=s=>{var a;(a=t.onClose)==null||a.call(t,s)},e}getIsLogin(){return this.isRememberPin?"Y":"N"}}const G=class G{constructor(t){c(this,"coreInstance",null);c(this,"gwsConfig",{});c(this,"createGwsCore",t=>{this.gwsConfig=t??{},this.coreInstance=new ce({...t??{},url:p})});c(this,"appendCertBase64",async(t,e=!0)=>{if(t.CertB64)return t;const s=e?await this.getSignatureCert():await this.getEncryptionCert();return{...t??{},CertB64:s==null?void 0:s.CertB64}});c(this,"destroy",()=>{var t;(t=this.coreInstance)==null||t.destroy(),this.coreInstance=null});c(this,"restart",t=>{this.coreInstance&&this.destroy(),this.gwsConfig=t??this.gwsConfig,this.createGwsCore(t)});c(this,"getSocketReadyState",()=>{var t;return(t=this.coreInstance)==null?void 0:t.getSocketReadyState()});c(this,"getSignatureCert",async t=>{var s;return await((s=this.coreInstance)==null?void 0:s.getCert({CertType:_},t))});c(this,"getEncryptionCert",async t=>{var s;return await((s=this.coreInstance)==null?void 0:s.getCert({CertType:kt},t))});c(this,"base64Encode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Encode(t)});c(this,"base64Decode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Decode(t)});c(this,"changeIsRememberPin",t=>{var e;(e=this.coreInstance)==null||e.changeIsRememberPin(t)});c(this,"changePinPolicy",t=>{var e;(e=this.coreInstance)==null||e.changePinPolicy(t)});c(this,"pkcs1Sign",async(t,e)=>{var r,o;const s=await this.getSignatureCert(e),a=await((r=this.coreInstance)==null?void 0:r.pkcs1Sign({...t??{},ContainerName:(s==null?void 0:s.ContainerName)??""}));return(o=a==null?void 0:a[0])==null?void 0:o.SignData});c(this,"pkcs1VerifySignature",async t=>{var a;const e=await this.appendCertBase64(t);return!!await((a=this.coreInstance)==null?void 0:a.pkcs1VerifySignature(e))});c(this,"pkcs1Base64Sign",async(t,e)=>{var o,i;const s=await this.getSignatureCert(e),a=t.DataB64??this.base64Encode(t.Data??""),r=await((o=this.coreInstance)==null?void 0:o.pkcs1Base64Sign({ContainerName:(s==null?void 0:s.ContainerName)??"",DataB64:a}));return(i=r==null?void 0:r[0])==null?void 0:i.SignData});c(this,"pkcs1Base64VerifySignature",async t=>{var r;const e=t.DataB64??this.base64Encode(t.Data??""),s=await this.appendCertBase64(t);return!!await((r=this.coreInstance)==null?void 0:r.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:e,SignData:s.SignData}))});c(this,"getSealList",async()=>{var s;const t=await this.getSignatureCert(),e=await((s=this.coreInstance)==null?void 0:s.getSealList({ContainerName:(t==null?void 0:t.ContainerName)??""}));return{cert:t,sealList:e}});c(this,"sm2SignPreprocess1",async t=>{var a,r;const e=await this.appendCertBase64(t),s=await((a=this.coreInstance)==null?void 0:a.sm2SignPreprocess1(e));return(r=s==null?void 0:s[0])==null?void 0:r.Z});c(this,"sm2SignPreprocess2",async t=>{var r;const e=this.base64Encode(t.Data),s=await this.appendCertBase64(t),a=await((r=this.coreInstance)==null?void 0:r.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:e}));return a==null?void 0:a[0].H});c(this,"pkcs1HashSign",async(t,e)=>{var r,o;const s=await this.getSignatureCert(e),a=await((r=this.coreInstance)==null?void 0:r.pkcs1HashSign({ContainerName:(s==null?void 0:s.ContainerName)??"",DataB64:t.DataB64,HashAlg:t.HashAlg??"sm3"}));return(o=a==null?void 0:a[0])==null?void 0:o.SignData});c(this,"pkcs1HashVerifySignature",async t=>{var a;const e=await this.appendCertBase64(t);return!!await((a=this.coreInstance)==null?void 0:a.pkcs1HashVerifySignature({...e,HashAlg:e.HashAlg??"sm3"}))});c(this,"pkcs7Sign",async(t,e)=>{var o,i;const s=t.DataB64??this.base64Encode(t.Data??""),a=await this.getSignatureCert(e),r=await((o=this.coreInstance)==null?void 0:o.pkcs7Sign({IsDetached:t.IsDetached,ContainerName:(a==null?void 0:a.ContainerName)??"",DataB64:s}));return(i=r==null?void 0:r[0])==null?void 0:i.SignData});c(this,"pkcs7VerifySignature",async t=>{var a;const e=t.DataB64??this.base64Encode(t.Data??"");return!!await((a=this.coreInstance)==null?void 0:a.pkcs7VerifySignature({DataB64:e,SignData:t.SignData}))});c(this,"sm3Hash",async t=>{var s,a;const e=await((s=this.coreInstance)==null?void 0:s.sm3Hash(t));return(a=e==null?void 0:e[0])==null?void 0:a.HashB64});c(this,"sm3HexHash",async t=>{var s,a;const e=await((s=this.coreInstance)==null?void 0:s.sm3HexHash(t));return(a=e==null?void 0:e[0])==null?void 0:a.HashB64});c(this,"sm3FileHash",async t=>{var s,a;const e=await((s=this.coreInstance)==null?void 0:s.sm3FileHash(t));return(a=e==null?void 0:e[0])==null?void 0:a.HashB64});c(this,"sm3HashEncryption",async t=>{var r,o;const e=t.DataB64??this.base64Encode(t.Data??""),s=t.KeyB64??this.base64Encode(t.Key??""),a=await((r=this.coreInstance)==null?void 0:r.sm3HashEncryption({dataB64:e,keyB64:s,alg:"sm3"}));return(o=a==null?void 0:a[0])==null?void 0:o.DataB64});c(this,"pkcs7Encryption",async t=>{var a,r;if(!t.CertB64List){const o=await this.getEncryptionCert();t.CertB64List=o==null?void 0:o.CertB64}const e=t.DataB64??this.base64Encode(t.Data??""),s=await((a=this.coreInstance)==null?void 0:a.pkcs7Encryption({DataB64:e,CertB64List:t.CertB64List}));return(r=s==null?void 0:s[0])==null?void 0:r.DataB64});c(this,"pkcs7Decryption",async t=>{var r,o;const e=await this.getEncryptionCert(),s=await((r=this.coreInstance)==null?void 0:r.pkcs7Decryption({DataB64:t.DataB64,ContainerName:e==null?void 0:e.ContainerName})),a=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return t.shouldDecodeBase64?this.base64Decode(a):a});c(this,"asymmetricEncryption",async t=>{var a,r;const e=await this.appendCertBase64(t,!1),s=await((a=this.coreInstance)==null?void 0:a.asymmetricEncryption(e));return(r=s==null?void 0:s[0])==null?void 0:r.Data});c(this,"asymmetricDecryption",async t=>{var a,r;const e=await this.getEncryptionCert(),s=await((a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:t.Data,ContainerName:e==null?void 0:e.ContainerName}));return(r=s==null?void 0:s[0])==null?void 0:r.Data});c(this,"sm4Encryption",async t=>{var s;const e=await((s=this.coreInstance)==null?void 0:s.sm4Encryption(t));return e==null?void 0:e[0]});c(this,"sm4Decryption",async t=>{var s,a;const e=await((s=this.coreInstance)==null?void 0:s.sm4Decryption(t));return(a=e==null?void 0:e[0])==null?void 0:a.Data});c(this,"getCertInfo",async()=>{var s;const t=await this.getSignatureCert(),e=await((s=this.coreInstance)==null?void 0:s.getCertInfo({CertB64:t==null?void 0:t.CertB64}));return{...(e==null?void 0:e[0])??{},...t??{}}});c(this,"getCertInfoByOid",async t=>{var a,r;const e=await this.getSignatureCert(),s=await((a=this.coreInstance)==null?void 0:a.getCertInfoByOid({...t??{},CertB64:e==null?void 0:e.CertB64}));return(r=s==null?void 0:s[0])==null?void 0:r.OidValue});return G.instance?G.instance:(this.createGwsCore(t),G.instance=this,this)}};c(G,"instance",null);let et=G;m.GwsService=et,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gws-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"description": "gws client",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite",
|
|
10
|
+
"build": "vite build",
|
|
11
|
+
"preview": "vite preview"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"base64-js": "^1.5.1",
|
|
15
|
+
"gws-widget": "workspace:^"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
]
|
|
20
|
+
}
|