bdcontract-sdk-javascript/lib/index.js.map
2023-03-15 01:15:57 +08:00

1 line
63 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"index.js","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包括{licenceprojectDiryjsPathdataChaindoipConfignodeCenternodeNamemasterAddressresetNodeCenterWS}\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","genUrlParamsFromObject","obj","Object","entries","map","key","value","String","join","WsSocket","handlerList","toSend","isSending","sendList","toReceive","wssocket","constructor","wsurl","onopen","handler","console","log","this","push","monitor","that","WebSocket","onerror","error","onmessage","event","JSON","parse","action","sendNextSegment","receiveSeg","forEach","h","reconnect","setTimeout","onclose","status","readyState","str","length","substr","isSegment","send","stringify","pop","cid","addHandler","baseUrl","sm2Key","fetch","config","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","catch","err","retryTimes","Error","i","requestWithSignature","e","sm2","doSignature","hash","der","ping","startContract","code","params","script","startContractByYPK","_request","owner","aim","signature","executeContract","contractID","operation","arg","withDynamicAnalysis","withSignature","request","undefined","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","val","lockEdit","unlockEdit","addNode","nodePubKey","applyRole","authNodeManager","listAllUsers","listNodes","Msg","toSign","msg","pubKey","headers","listTrustUnits","listContractProcess","downloadContract","timestamp","args","resetNodeManager","kvs","filter","_k","v","all","k","updateConfig","loadNodeConfig","every","remapNodeConfigKey","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","reqContent","generateAESKey","aesObj","reqContentNoId","decrypt","requester","n","toString","rsaKey","strs","b64to256","split","RSAKey","setPrivate","rsa","setPublic","e1","encrypt"],"mappings":"whBAYgB,SAAAA,EAAWC,EAAcC,GACvC,MAAMC,EAAQD,EAAOE,MAAM,GAC3BC,MAAIC,UAAUH,GACd,IAAII,EAASC,EAAAA,SAASC,aAAaR,GACnCM,EAASC,EAAQA,SAACE,MAAMH,GACxBF,EAAAA,IAAIM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