1 line
63 KiB
Plaintext
1 line
63 KiB
Plaintext
{"version":3,"file":"index.mjs","sources":["../src/crypto.ts","../src/httpClient.ts","../src/wssocket.ts","../src/wsClient.ts"],"sourcesContent":["// export function aesDecrypt(data: base64) {\n// const dataAscii = cryptico.b64to256(data)\n// const encryptedBlocks = cryptico.string2bytes(dataAscii)\n// const exkey = global.aesKey.slice(0)\n// aes.ExpandKey(exkey)\n// aes.Decrypt(encryptedBlocks, exkey)\n// return cryptico.bytes2string(encryptedBlocks)\n// }\n\nimport type { AESKey } from '@daotl/cryptico'\nimport { aes, cryptico, RSAKey } from '@daotl/cryptico'\n\nexport function aesEncrypt(data: string, aesKey: AESKey): string {\n const exkey = aesKey.slice(0)\n aes.ExpandKey(exkey)\n let blocks = cryptico.string2bytes(data)\n blocks = cryptico.pad16(blocks)\n aes.Encrypt(blocks, exkey)\n let ciphertext = cryptico.bytes2string(blocks)\n ciphertext = cryptico.b256to64(ciphertext)\n return ciphertext\n}\n\nexport function rsaEncrypt(\n data: string,\n rsaKey: { n: string; e1: string },\n): string {\n const rsa = new RSAKey()\n rsa.setPublic(rsaKey.n, rsaKey.e1)\n return rsa.encrypt(data)\n}\n\nexport function loadRSAKey(rsaKey: string): RSAKey {\n const str = cryptico.b64to256(rsaKey)\n const strs = str.split(',')\n const key = new RSAKey()\n key.setPrivate(strs[0], strs[0], strs[0])\n return key\n}\n\n// function testRSA() {\n// pubKey = loadRSAKey(global.privKey)\n// reqContent = {}\n// reqContent.action = 'main'\n// reqContent.arg = '[{\"score\":20},{\"score\":20}]'\n// reqContent.contractID = 'abc'\n// eReq = encryptReq(reqContent, pubKey)\n// url =\n// 'http://localhost:8080/SCIDE/SCManager?action=executeContractEncrypted&contractRequest=' +\n// encodeURIComponent(JSON.stringify(eReq))\n// }\n\nexport function encryptReq(\n reqContent: { contractID: string },\n pubKey: RSAKey,\n): {\n action: string | null\n contractID: string\n arg: string\n requester: string\n} {\n const aes = {\n key: cryptico.generateAESKey(),\n }\n const aesObj = JSON.stringify(aes)\n const { contractID } = reqContent\n const reqContentNoId = { ...reqContent, contractID: undefined }\n const encrypedReq = {\n action: pubKey.decrypt(aesObj),\n contractID,\n arg: aesEncrypt(JSON.stringify(reqContentNoId), aes.key),\n requester: cryptico.b256to64(\n `${pubKey.n.toString(16)},${pubKey.e.toString(16)},0`,\n ),\n }\n return encrypedReq\n}\n","import { buildAxiosFetch } from '@lifeomic/axios-fetch'\nimport axios, { type AxiosRequestConfig } from 'axios'\nimport type { KeyPairHex } from 'sm-crypto'\nimport { sm2 } from 'sm-crypto'\n\nimport type {\n ClientResponse,\n ConfigNodeArgs,\n ExecuteContractArgs,\n ListAllUsersResponseData,\n ListNodesResponse,\n ListProjectPermissionRequest,\n ListProjectPermissionResponseData,\n LoadNodeConfigResponseData,\n ExecuteContractResponse,\n PingResponse,\n SaveFileRequest,\n StartContractByYpkRequest,\n} from './types'\n\nconst genUrlParamsFromObject = (obj: Record<string, unknown>): string => {\n return Object.entries(obj)\n .map(([key, value]) => `${key}=${String(value)}`)\n .join('&')\n}\n\nexport * from './types'\n\nexport class HttpClient {\n private fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n private baseUrl: string,\n private sm2Key: KeyPairHex,\n config = {} as AxiosRequestConfig,\n ) {\n const axiosInstance = axios.create({\n baseURL: 'https://some-domain.com/api/',\n timeout: 10000,\n // headers: {'X-Custom-Header': 'foobar'}\n ...config,\n })\n\n this.fetch = buildAxiosFetch(\n axiosInstance /* , function (config) {\n config.timeout = 1000;\n return config;\n } */,\n )\n }\n\n async requestWithSignature<Data>(\n path: string,\n init?: Partial<RequestInit>,\n sm2Key?: KeyPairHex,\n ): Promise<ClientResponse<Data>> {\n return new Promise<ClientResponse<Data>>((resolve, reject) => {\n const rawUrl = this.baseUrl + path\n const url = `${rawUrl}${path.includes('?') ? '&' : '?'}pubKey=${\n sm2Key?.publicKey ?? this.sm2Key.publicKey\n }`\n\n // console.log('privateKey:', this.sm2Key.privateKey)\n\n // console.log('publicKey:', this.sm2Key.publicKey)\n\n // console.log('to sign:', url.substring(url.indexOf('?') + 1))\n\n const sign = this.sign(\n url.substring(url.indexOf('?') + 1),\n sm2Key?.privateKey,\n )\n\n // console.log(\n // 'url:',\n // init?.method?.toLowerCase() === 'post'\n // ? rawUrl\n // : `${encodeURI(url)}&sign=${sign}`,\n // )\n\n this.fetch(\n init?.method?.toLowerCase() === 'post'\n ? rawUrl\n : `${encodeURI(url)}&sign=${sign}`,\n {\n ...init,\n ...(init?.method === 'POST'\n ? {\n body: {\n ...(init?.body as unknown as Record<string, string>),\n sign,\n } as unknown as Request['body'],\n }\n : {}),\n },\n )\n .then(async (res) => {\n // console.log(res.url,'请求成功')\n const clientRes = res as unknown as ClientResponse<Data>\n clientRes.data = (await res.text()) as Data\n // Workaround for the issue causing the 2nd consecutive request to fail:\n // https://github.com/nodejs/undici/issues/1415\n setTimeout(() => {\n resolve(clientRes)\n }, 1)\n })\n .catch((err) => {\n // const clientRes = err as unknown as ClientResponse<Data>\n // clientRes.data = (await err.text()) as Data\n // console.log(err,'errerrerrerrerrerrerrerrerrerrerrerrerrerrerr')\n setTimeout(() => {\n reject(err)\n }, 1)\n })\n })\n }\n\n async retryRequestWithSignature<Data>(retryTimes: number, path: string, init?: Partial<RequestInit>, sm2Key?: KeyPairHex ) {\n let err: Error = new Error()\n for (let i = 0; i<retryTimes; i++) {\n try{\n return await this.requestWithSignature<Data>(path, init, sm2Key)\n } catch (e) {\n if (i < retryTimes) {\n console.log('1')\n continue\n }\n err = e as Error\n }\n }\n throw err\n }\n\n sign(data: string, privateKey?: string): string {\n return sm2.doSignature(data, privateKey ?? this.sm2Key.privateKey, {\n hash: true,\n der: true,\n })\n }\n\n // ping\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id15\n ping(): Promise<PingResponse> {\n return this.requestWithSignature('/SCManager?action=ping')\n }\n\n // 启动合约\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id60\n startContract(code: string): Promise<ClientResponse<string>> {\n const params = { action: 'startContract', script: code }\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject(params)}`,\n )\n }\n\n // 启动合约\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id13\n startContractByYPK(\n _request: StartContractByYpkRequest,\n ): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'startContractByYPK',\n ..._request,\n owner: this.sm2Key.publicKey,\n aim: 'onStartContract',\n signature: sm2.doSignature(\n `Fixed|${_request.path}|${this.sm2Key.publicKey}`,\n this.sm2Key.privateKey,\n {\n hash: true,\n der: true,\n },\n ),\n })}`,\n )\n }\n\n // 调用合约\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id69\n executeContract(\n contractID: string,\n operation: string,\n arg: string,\n {\n method = 'POST',\n withDynamicAnalysis = false,\n withSignature = false,\n } = {} as ExecuteContractArgs,\n ): Promise<ClientResponse<ExecuteContractResponse<string>>> {\n let request = {}\n if (withDynamicAnalysis === undefined) {\n request = {\n action: 'executeContract',\n contractID,\n operation,\n arg,\n }\n } else {\n request = {\n action: 'executeContract',\n contractID,\n operation,\n withDynamicAnalysis,\n arg,\n }\n }\n if (withSignature) {\n request = {\n ...request,\n pubkey: this.sm2Key.publicKey,\n signature: this.sign(\n `${contractID}|${operation}|${arg ?? ''}|${this.sm2Key.publicKey}`,\n ),\n }\n }\n\n return this.retryRequestWithSignature(\n 3,\n `/SCManager${\n method === 'GET' ? `?${genUrlParamsFromObject(request)}` : ''\n }`,\n {\n method,\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n ...(method === 'POST' ? ({ body: request } as Request) : {}),\n },\n )\n }\n\n // 停止合约\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id122\n killContractProcess(\n contractID: string,\n requestID?: string,\n ): Promise<ClientResponse<string>> {\n const _request: Record<string, string> = {\n action: 'killContractProcess',\n id: contractID,\n }\n requestID && (_request.requestID = requestID!)\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject(_request)}`,\n )\n }\n\n // 停止所有合约\n // 地址 http://39.104.205.122:18010/SCIDE\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html#id131\n killAllContract(): Promise<ClientResponse<string>> {\n return this.requestWithSignature('/SCManager?action=killAllContract')\n }\n\n // 申请角色\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html\n applyNodeRole(\n role: string,\n ): Promise<ClientResponse<{ action: string; data: string; role?: string }>> {\n const _request = {\n action: 'applyNodeRole',\n role,\n }\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject(_request)}`,\n )\n }\n\n // 授权角色\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html\n authNodeRole(\n isAccept: boolean,\n authorizedPubKey: string,\n managerPair?: KeyPairHex,\n ): Promise<ClientResponse<{ action: string; data: string }>> {\n const _request = {\n action: 'authNodeRole',\n isAccept,\n authorizedPubKey,\n }\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject(_request)}`,\n undefined,\n managerPair,\n )\n }\n\n // https://public.internetapi.cn/docs/bdcontract/doc/ContractAPI.html\n // 用sse获取 问题未解决!!!\n distributeContract(\n nodeIDs: string,\n projectName: string,\n isPrivate: boolean,\n ): void {\n const signature = sm2.doSignature(\n `DistributeContract|${projectName}|${this.sm2Key.publicKey}`,\n this.sm2Key.privateKey,\n { hash: true, der: true },\n )\n\n const _request = {\n action: 'distributeContract',\n nodeIDs,\n projectName,\n isPrivate,\n signature,\n }\n\n const path = `/SCManager?${genUrlParamsFromObject(_request)}`\n const url = `${this.baseUrl + path}${\n path.includes('?') ? '&' : '?'\n }pubKey=${this.sm2Key.publicKey}`\n const sig = sm2.doSignature(\n url.substring(url.indexOf('?') + 1),\n this.sm2Key.privateKey,\n {\n hash: true,\n der: true,\n },\n )\n const source = new EventSource(\n `${this.baseUrl}${path}&pubKey=${this.sm2Key.publicKey}&sign=${sig}`,\n )\n source.addEventListener(\n 'message',\n function (_event) {\n // const data = event.data as DistributeContractResponse[]\n // console.log(data, 'dd')\n // handle message\n },\n false,\n )\n }\n\n saveFile(_request: SaveFileRequest): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'saveFile',\n ..._request,\n })}`,\n )\n }\n\n listProjectPermission(\n _request: ListProjectPermissionRequest,\n ): Promise<ClientResponse<ListProjectPermissionResponseData>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'listProjectPermission',\n ..._request,\n })}`,\n )\n }\n\n startContractMultiPoint(\n peersID: string,\n type: number,\n selectUnitNum: number,\n projectName: string,\n isPrivate: boolean,\n sponsorPeerID: string,\n ): Promise<ClientResponse<string>> {\n const _request = {\n // peerID是节点的公钥,以逗号间隔开\n peersID,\n type,\n selectUnitNum,\n projectName,\n isPrivate,\n sponsorPeerID,\n }\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'startContractMultiPoint',\n ..._request,\n })}`,\n )\n }\n\n // 获取节点配置信息\n async loadNodeConfig(): Promise<ClientResponse<LoadNodeConfigResponseData>> {\n const res = await this.requestWithSignature<string>(\n `/SCManager?${genUrlParamsFromObject({\n action: 'loadNodeConfig',\n })}`,\n )\n return { ...res, data: (res.status === 200 && res.data ? JSON.parse( res.data).data : {}) as LoadNodeConfigResponseData}\n }\n\n // 支持的key包括:{licence,projectDir,yjsPath,dataChain,doipConfig,nodeCenter,nodeName,masterAddress,resetNodeCenterWS}\n async updateConfig(\n key: string,\n val: string,\n ): Promise<ClientResponse<boolean>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'updateConfig',\n key,\n val,\n })}`,\n )\n }\n\n // 设置pubkey为node manager\n async resetNodeManager(): Promise<boolean> {\n const res = await this.requestWithSignature<string>(\n `/SCManager?${genUrlParamsFromObject({\n action: 'resetNodeManager',\n })}`,\n )\n if (!res.data) {\n return false\n }\n const parsed = JSON.parse(res.data)\n return parsed.data === 'success'\n }\n\n // 锁定某个用户的的私有目录编辑功能\n lockEdit(): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'lockEdit',\n })}`,\n )\n }\n\n // 解锁某个用户的的私有目录编辑功能\n unlockEdit(): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'unlockEdit',\n })}`,\n )\n }\n\n addNode(nodePubKey: string): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'addNode',\n nodePubKey,\n })}`,\n )\n }\n\n // 申请角色\n applyRole(role: string): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'applyRole',\n role,\n })}`,\n )\n }\n\n authNodeManager(\n isAccept: boolean,\n authorizedPubKey: string,\n ): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'authNodeManager',\n isAccept,\n authorizedPubKey,\n })}`,\n )\n }\n\n listAllUsers(): Promise<ClientResponse<ListAllUsersResponseData>> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'listAllUsers',\n })}`,\n )\n }\n\n // 查看节点列表\n listNodes(): Promise<ListNodesResponse> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'listNodes',\n })}`,\n ) as unknown as Promise<ListNodesResponse>\n }\n\n // 建立可信执行集群\n async createTrustUnit(\n data: { nodeName: string; pubkey: string }[],\n Msg: string,\n ): Promise<{ action: string; status: string }> {\n const toSign = `action=createTrustUnit&data=${JSON.stringify(\n data,\n )}&msg=${Msg}&pubKey=04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27`\n const sig = sm2.doSignature(toSign, this.sm2Key.privateKey, {\n hash: true,\n der: true,\n })\n\n const body = {\n action: 'createTrustUnit',\n data,\n msg: Msg,\n pubKey:\n '04303718771b9323c204e607639f14469f9a94e55b0964a408ad3b3864b0493b645d7070da0d550f0c54b934275a8e88dedc3024467b0566db5c1108b1baeaae27',\n sign: sig,\n }\n return (await this.requestWithSignature('', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n })) as unknown as { action: string; status: string }\n }\n\n // 查看可信执行集群列表\n listTrustUnits(): Promise<ClientResponse<{ key: string; value: string }[]>> {\n return this.requestWithSignature(\n `?${genUrlParamsFromObject({\n action: 'listTrustUnits',\n })}`,\n )\n }\n\n // listContractProcess 查询合约实例列表\n listContractProcess(): Promise<ClientResponse<string>> {\n return this.requestWithSignature(\n `/SCManager?${genUrlParamsFromObject({\n action: 'listContractProcess',\n })}`,\n )\n }\n\n // 下载合约\n downloadContract(\n projectName: string,\n isPrivate: boolean,\n timestamp: number\n ): Promise<ClientResponse<string>> {\n const _request = {\n action: 'downloadContract',\n projectName,\n isPrivate,\n timestamp,\n }\n return this.requestWithSignature(\n `/CMManager?${genUrlParamsFromObject(_request)}`)\n }\n\n // 配置合约引擎节点,若节点没有设置过node manager,将当前key设置为node manager\n async configNode(\n args: ConfigNodeArgs,\n ): Promise<boolean> {\n if (!(await this.resetNodeManager())) {\n return false\n }\n\n const kvs: [string, string][] = Object.entries(args).filter(([_k, v]) => v) as [string, string][]\n\n await Promise.all([\n ...kvs.map(([k, v]) => this.updateConfig(k, v!)),\n this.applyNodeRole('ContractProvider'),\n this.applyNodeRole('ContractUser'),\n this.applyNodeRole('ContractInstanceManager'),\n this.authNodeRole(true, this.sm2Key.publicKey),\n ])\n\n const config = (await this.loadNodeConfig()).data\n if (!config) {\n return false\n }\n\n return kvs.every(([k, v]) => config[remapNodeConfigKey(k)] === v)\n }\n}\n\nfunction remapNodeConfigKey(k: string) {\n switch (k) {\n case 'dataChain':\n return 'bdledger'\n default:\n return k\n }\n}\n","/* eslint-disable no-console,no-cond-assign */\n\nexport interface WsEvent {\n data: string\n}\n\nexport type OnOpenHandler = (this: WebSocket, ev: Event) => void\nexport type WsHandler = (ev: WsEvent, ws?: WebSocket) => void\n\ninterface SegmentData {\n action: 'sendSeg'\n cid: string\n data: string\n}\n\nexport class WsSocket {\n private handlerList: WsHandler[] = []\n private toSend = ''\n private isSending = false\n private sendList: string[] = []\n private toReceive = ''\n private wssocket: WebSocket\n\n constructor(wsurl: string, onopen: OnOpenHandler, handler?: WsHandler) {\n console.log(`[createWS.js] createWssocket : ${wsurl}`)\n if (handler) {\n this.handlerList.push(handler)\n }\n\n // TODO: we don't need monitor at all?\n this.monitor()\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n\n const wssocket = (this.wssocket = new WebSocket(wsurl))\n wssocket.onerror = function (error): void {\n console.log(error)\n }\n wssocket.onopen = onopen\n\n const onmessage = function (this: WebSocket, event: MessageEvent): void {\n const obj = JSON.parse(event.data as string) as { action: string }\n switch (obj.action) {\n case 'sendNextSegment':\n that.sendNextSegment()\n break\n case 'sendSeg':\n that.receiveSeg(obj as SegmentData)\n break\n default:\n that.handlerList.forEach((h) => h(event, this))\n }\n }\n wssocket.onmessage = onmessage\n\n const reconnect = function (): void {\n setTimeout(() => {\n console.log('[createWS.js] try to reconnect')\n const wssocket = (that.wssocket = new WebSocket(wsurl))\n wssocket.onclose = reconnect\n wssocket.onmessage = onmessage\n wssocket.onopen = onopen\n }, 1000)\n }\n wssocket.onclose = reconnect\n }\n\n status(): WebSocket['CLOSED' | 'CLOSING' | 'CONNECTING' | 'OPEN'] {\n return this.wssocket.readyState\n }\n\n sendNextSegment(): void {\n const str = this.toSend\n if (str.length > 1024) {\n this.toSend = str.substr(1024)\n const obj = {\n isSegment: true,\n data: str.substr(0, 1024),\n }\n this.wssocket.send(JSON.stringify(obj))\n } else {\n this.toSend = ''\n const obj = {\n isSegment: false,\n data: str,\n }\n this.wssocket.send(JSON.stringify(obj))\n this.isSending = false\n let data\n if ((data = this.sendList.pop())) {\n this.send(data)\n }\n }\n }\n\n receiveSeg(obj: SegmentData): void {\n if (obj.cid === 'start') {\n this.toReceive = ''\n }\n this.toReceive += obj.data\n if (obj.cid === 'done') {\n console.log(`[receiveSeg] Received AllData:${this.toReceive}`)\n const event: WsEvent = {\n data: this.toReceive,\n }\n this.toReceive = ''\n this.handlerList.forEach((h) => h(event, this.wssocket))\n }\n }\n\n monitor(): void {\n if (!this.isSending) {\n let data\n if ((data = this.sendList.pop())) {\n this.send(data)\n }\n }\n setTimeout(() => this.monitor(), 1000)\n }\n\n send(data: string): void {\n if (this.isSending) {\n this.sendList.push(data)\n return\n }\n if (data.length > 1024) {\n this.isSending = true\n this.toSend = data.substr(1024)\n const obj = {\n isSegment: true,\n data: data.substr(0, 1024),\n }\n this.wssocket.send(JSON.stringify(obj))\n } else {\n this.wssocket.send(data)\n }\n }\n\n addHandler(handler: WsHandler): void {\n this.handlerList.push(handler)\n }\n}\n","/* eslint-disable no-cond-assign */\n\nimport type { KeyPairHex } from 'sm-crypto'\nimport { sm2 } from 'sm-crypto'\n\nimport type { OnOpenHandler, WsHandler } from './wssocket'\nimport { WsSocket } from './wssocket'\n\ninterface ResponseData {\n action: string\n responseID?: string\n status: true | false | string // 'Success' | 'Exception' | 'Error' | 'failed: no session'\n result?: unknown\n data: string\n [K: string]: unknown\n}\n\n// interface ListResponseData {\n// action: string\n// data: string\n// status: true | false\n// }\n\ninterface PromiseCallbackPair {\n resolve: (value: ResponseData | PromiseLike<ResponseData>) => void\n reject: (reason?: unknown) => void\n}\n\nexport class WsClient {\n private readonly sm2Key: KeyPairHex\n private readonly wssocket: WsSocket\n private readonly promiseCallbackPairs: Record<string, PromiseCallbackPair> =\n {}\n\n private readonly sessionPromise: Promise<string>\n private sessionResolve!: (value: string | PromiseLike<string>) => void\n private readonly loginPromise: Promise<boolean>\n private loginResolve!: (value: boolean | PromiseLike<boolean>) => void\n\n constructor(\n url: string,\n onopen: OnOpenHandler,\n handler: WsHandler,\n sm2Key: KeyPairHex = sm2.generateKeyPairHex(),\n ) {\n this.sm2Key = sm2Key\n this.sessionPromise = new Promise((resolve, _reject) => {\n this.sessionResolve = resolve\n })\n this.loginPromise = new Promise((resolve, _reject) => {\n this.loginResolve = resolve\n })\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n this.wssocket = new WsSocket(url, onopen, function (\n this: WebSocket,\n event,\n _,\n ) {\n const data = JSON.parse(event.data) as ResponseData\n\n switch (data.action) {\n case 'onSessionID':\n that.sessionResolve(data.session as string)\n break\n case 'onLogin':\n {\n const failed =\n typeof data.status === 'string' &&\n data.status.toLowerCase().includes('failed')\n that.loginResolve(!failed)\n }\n break\n }\n\n const reqId = data.responseID\n let pc: PromiseCallbackPair | undefined\n if (reqId && (pc = that.promiseCallbackPairs[reqId])) {\n if (data) {\n pc.resolve(data)\n } else {\n pc.reject(data)\n }\n }\n handler(event, this)\n })\n }\n\n status(): WebSocket['CLOSED' | 'CLOSING' | 'CONNECTING' | 'OPEN'] {\n return this.wssocket.status()\n }\n\n sessionReceived(): Promise<string> {\n return this.sessionPromise\n }\n\n async login(): Promise<boolean> {\n const session = await this.sessionPromise\n const request = {\n action: 'login',\n pubKey: this.sm2Key.publicKey,\n signature: sm2.doSignature(session, this.sm2Key.privateKey, {\n hash: true,\n der: true,\n }),\n }\n this.wssocket.send(JSON.stringify(request))\n return this.loginPromise\n }\n\n loggedIn(): Promise<boolean> {\n return this.loginPromise\n }\n\n matchCID(contractID: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'matchCID',\n contractID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMetabyCID(contractID: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMetabyCID',\n contractID,\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMetabyReadme(\n keyword: string,\n page?: string,\n pageSize?: string,\n ): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMetabyReadme',\n page,\n pageSize,\n keyword,\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMetabyPubkey(pubkey: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMetabyPubkey',\n pubkey,\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n segmentWord(words: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n words,\n action: 'segmentWord',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMetabyOwner(\n owner: string,\n page?: string,\n pageSize?: string,\n ): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMetabyOwner',\n owner,\n page,\n pageSize,\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getDependentContract(contractName: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getDependentContract',\n requestID,\n contractName,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n queryContractLogByDate(start: number): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'queryContractLogByDate',\n requestID,\n start,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n queryDataByHash(hash: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'queryDataByHash',\n requestID,\n hash,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n executeContract(\n contractID: string,\n method: string,\n arg: unknown,\n ): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const argStr = (typeof arg) == 'object' ? JSON.stringify(arg):arg+\"\";\n const request = {\n action: 'executeContract',\n requestID,\n contractID,\n operation: method,\n arg: arg,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${method}|${argStr}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getSessionID(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getSessionID',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n listTheContractProcess(contractID: string): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'listTheContractProcess',\n requestID,\n contractID,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n this.wssocket.send(JSON.stringify(request))\n\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMask(\n contractID: string,\n // operation: string,\n ): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMask',\n requestID,\n contractID,\n // operation,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n setMask(\n contractID: string,\n operation: string,\n arg: string,\n ): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'setMask',\n requestID,\n contractID,\n operation,\n arg,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getMock(\n contractID: string,\n // operation: string,\n ): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getMock',\n requestID,\n contractID,\n // operation,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n setMock(\n contractID: string,\n operation: string,\n arg: string,\n ): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'setMock',\n requestID,\n contractID,\n operation,\n arg,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(\n `${contractID}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n : {}),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n queryHashByOffset(offset: number, count: number): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'queryHashByOffset',\n requestID,\n offset,\n count,\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n /* signature: sm2.doSignature(\n id + '|' + sm2Key.publicKey,\n sm2Key.privateKey,\n { hash: true, der: true },\n ), */\n }\n : {}),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n loadNodeConfig(): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'loadNodeConfig',\n requestID,\n\n ...(sm2Key\n ? {\n pubkey: sm2Key.publicKey,\n signature: sm2.doSignature(sm2Key.publicKey, sm2Key.privateKey, {\n hash: true,\n der: true,\n }),\n }\n : {}),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n queryUserStat(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'queryUserStat',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n listNodes(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'listNodes',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n killContractProcess(id: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'killContractProcess',\n requestID,\n id,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n distributeYPK(projectName: string, nodeIDs: string): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'distributeYPK',\n requestID,\n pubKey: sm2Key.publicKey,\n projectName,\n nodeIDs,\n signature: sm2.doSignature(\n `DistributeYPK|${projectName}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n { hash: true, der: true },\n ),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n listYPKs(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'listYPKs',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n deleteFile(file: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'deleteFile',\n requestID,\n file,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n startContractByYPK(project: string): Promise<ResponseData> {\n const sm2Key = this.sm2Key\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'startContractByYPK',\n isPrivate: true,\n requestID,\n owner: sm2Key.publicKey,\n path: `/${project}`,\n signature: sm2.doSignature(\n `Fixed|${project}|${sm2Key.publicKey}`,\n sm2Key.privateKey,\n ),\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n initBDServer(\n host: string,\n username: string,\n password: string,\n name: string,\n clusterHost: string,\n ): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'initBDServer',\n requestID,\n host,\n username,\n password,\n name,\n sm2Key: JSON.stringify(this.sm2Key),\n clusterHost,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n initBDCluster(\n host: string,\n username: string,\n password: string,\n name: string,\n sm2Key: string,\n agents: [],\n ): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'initBDCluster',\n requestID,\n host,\n username,\n password,\n name,\n sm2Key,\n agents,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n listCompiledFiles(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'listCompiledFiles',\n requestID,\n isPrivate: true,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getManagerPubkey(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getManagerPubkey',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n getClusterName(): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'getClusterName',\n requestID,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n\n setClusterName(name: string): Promise<ResponseData> {\n const requestID = `${new Date().getTime()}_${Math.floor(\n Math.random() * 10000,\n )}`\n const request = {\n action: 'setClusterName',\n requestID,\n name,\n }\n this.wssocket.send(JSON.stringify(request))\n return new Promise((resolve, reject) => {\n this.promiseCallbackPairs[requestID] = { resolve, reject }\n })\n }\n}\n"],"names":["aesEncrypt","data","aesKey","exkey","slice","aes","ExpandKey","blocks","cryptico","string2bytes","pad16","Encrypt","ciphertext","bytes2string","b256to64","rsaEncrypt","rsaKey","rsa","RSAKey","setPublic","n","e1","encrypt","loadRSAKey","strs","b64to256","split","key","setPrivate","encryptReq","reqContent","pubKey","generateAESKey","aesObj","JSON","stringify","contractID","reqContentNoId","undefined","action","decrypt","arg","requester","toString","e","genUrlParamsFromObject","obj","Object","entries","map","value","String","join","HttpClient","baseUrl","sm2Key","fetch","constructor","config","this","axiosInstance","axios","create","baseURL","timeout","buildAxiosFetch","async","path","init","Promise","resolve","reject","rawUrl","url","includes","publicKey","sign","substring","indexOf","privateKey","method","toLowerCase","encodeURI","body","then","res","clientRes","text","setTimeout","catch","err","retryTimes","Error","i","requestWithSignature","console","log","sm2","doSignature","hash","der","ping","startContract","code","params","script","startContractByYPK","_request","owner","aim","signature","executeContract","operation","withDynamicAnalysis","withSignature","request","pubkey","retryRequestWithSignature","killContractProcess","requestID","id","killAllContract","applyNodeRole","role","authNodeRole","isAccept","authorizedPubKey","managerPair","distributeContract","nodeIDs","projectName","isPrivate","sig","EventSource","addEventListener","_event","saveFile","listProjectPermission","startContractMultiPoint","peersID","type","selectUnitNum","sponsorPeerID","status","parse","val","lockEdit","unlockEdit","addNode","nodePubKey","applyRole","authNodeManager","listAllUsers","listNodes","Msg","toSign","msg","headers","listTrustUnits","listContractProcess","downloadContract","timestamp","args","resetNodeManager","kvs","filter","_k","v","all","k","updateConfig","loadNodeConfig","every","remapNodeConfigKey","WsSocket","handlerList","toSend","isSending","sendList","toReceive","wssocket","wsurl","onopen","handler","push","monitor","that","WebSocket","onerror","error","onmessage","event","sendNextSegment","receiveSeg","forEach","h","reconnect","onclose","readyState","str","length","substr","isSegment","send","pop","cid","addHandler","WsClient","promiseCallbackPairs","sessionPromise","sessionResolve","loginPromise","loginResolve","generateKeyPairHex","_reject","_","session","failed","reqId","responseID","pc","sessionReceived","loggedIn","matchCID","Date","getTime","Math","floor","random","getMetabyCID","getMetabyReadme","keyword","page","pageSize","getMetabyPubkey","segmentWord","words","getMetabyOwner","getDependentContract","contractName","queryContractLogByDate","start","queryDataByHash","argStr","getSessionID","listTheContractProcess","getMask","setMask","getMock","setMock","queryHashByOffset","offset","count","queryUserStat","distributeYPK","listYPKs","deleteFile","file","project","initBDServer","host","username","password","name","clusterHost","initBDCluster","agents","listCompiledFiles","getManagerPubkey","getClusterName","setClusterName"],"mappings":"6KAYgB,SAAAA,EAAWC,EAAcC,GACvC,MAAMC,EAAQD,EAAOE,MAAM,GAC3BC,EAAIC,UAAUH,GACd,IAAII,EAASC,EAASC,aAAaR,GACnCM,EAASC,EAASE,MAAMH,GACxBF,EAAIM,QAAQJ,EAAQJ,GACpB,IAAIS,EAAaJ,EAASK,aAAaN,GAEvC,OADAK,EAAaJ,EAASM,SAASF,GACxBA,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