{"id":31744977,"url":"https://github.com/dotbithq/connect-did-sdk","last_synced_at":"2025-10-09T12:28:29.230Z","repository":{"id":176819313,"uuid":"658804253","full_name":"dotbitHQ/connect-did-sdk","owner":"dotbitHQ","description":"A Connect DID Authorization Center SDK that allows any hardware device to become a DID identity authentication device, providing a secure and convenient method for identity verification.","archived":false,"fork":false,"pushed_at":"2024-03-11T08:25:17.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-20T04:41:35.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotbitHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-26T14:19:56.000Z","updated_at":"2023-06-26T14:28:27.000Z","dependencies_parsed_at":"2023-06-28T11:32:14.360Z","dependency_job_id":"2c98bd45-aa44-4aa0-a991-053fc949b094","html_url":"https://github.com/dotbitHQ/connect-did-sdk","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.03125,"last_synced_commit":"cf880cdbeefe8072d6bba8f5b0c0a03a03b1383d"},"previous_names":["dotbithq/connect-did-sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dotbitHQ/connect-did-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fconnect-did-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fconnect-did-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fconnect-did-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fconnect-did-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotbitHQ","download_url":"https://codeload.github.com/dotbitHQ/connect-did-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotbitHQ%2Fconnect-did-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001445,"owners_count":26083078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-09T12:28:16.120Z","updated_at":"2025-10-09T12:28:29.216Z","avatar_url":"https://github.com/dotbitHQ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eConnect-DID SDK\u003c/h2\u003e\n\u003cp align=\"center\"\u003eA Connect DID Authorization Center SDK that allows any hardware device to become a DID identity authentication device, providing a secure and convenient method for identity verification.\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n\n![NPM](https://img.shields.io/npm/l/connect-did-sdk) ![npm](https://img.shields.io/npm/v/connect-did-sdk)\n\u003c/div\u003e\n\n## Table of Contents\n- [Getting Started](#getting-started)\n- [API Documentation](#api-documentation)\n- [CHANGELOG](#changelog)\n- [FAQ](#faq)\n- [Get Help](#get-help)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Getting Started\n\nFirst, you need to install `connect-did-sdk` using [`npm`](https://www.npmjs.com/package/connect-did-sdk)\n```bash\nnpm install connect-did-sdk --save\n```\nor [`yarn`](https://yarnpkg.com/package/connect-did-sdk).\n```bash\nyarn add connect-did-sdk\n```\n\nThen, you need to import Connect-DID SDK in your code and create an instance before interacting with it:\n```ts\n// For CommonJS\nconst { ConnectDID } = require('connect-did-sdk');\nconst connectDID = new ConnectDID();\n```\n\n```ts\n// For ES Module\nimport { ConnectDID } from 'connect-did-sdk'\nconst connectDID = new ConnectDID()\n```\n\nNow you could perform various operations using Connect-DID SDK. \n\n## CHANGELOG\nTBD\n\n## API Documentation\n### Table of Contents\n- [constructor(isTestNet?: boolean, isDebug?: boolean;)](#constructoristestnet-boolean-isdebug-boolean)\n- [requestNewDeviceData()](#requestnewdevicedata)\n- [requestDeviceData()](#requestdevicedata)\n- [requestSignData(data: {msg: string})](#requestsigndatadata-msg-string)\n- [requestDeviceSignData(data: {msg: string})](#requestdevicesigndatadata-msg-string)\n- [requestRecoverDeviceData()](#requestrecoverdevicedata)\n- [requestBackupData(data: {ckbAddr: string;isOpen?: boolean;})](#requestbackupdatadata-ckbaddr-stringisopen-boolean)\n- [decodeQRCode(data: string)](#decodeqrcodedata-string)\n- [requestWaitingPage(onError: (error: IData\u003cany\u003e) =\u003e void)](#requestwaitingpageonerror-error-idata--void)\n\n#### constructor(isTestNet?: boolean, isDebug?: boolean)\nCreate an instance of ConectDID SDK.\n##### Parameter\n- `isTestNet`: network type. default `false`.\n  - `false`: Main Net\n  - `true`: Test Net.\n- `isDebug`: debug mode. default `false`.\n##### Return Value\nConnectDID instance\n\n##### Example\n```ts\nconst connectDID = new ConnectDID();\n```\n\n#### requestNewDeviceData()\nPopup to open a new device credential.\n##### Parameter\nN/A\n##### Return Value\nDevice Data\n```ts\ninterface IData\u003cIDeviceData\u003e {\n    code: number;\n    message: string;\n    data: IDeviceData;\n}\n\ninterface IDeviceData {\n  name: string;\n  credential: ICredential;\n  publicKey: IPublicKey;\n  ckbAddr: string;\n}\n```\n\n##### Example\n```ts\nconst deviceData = await connectDID.requestNewDeviceData();\n```\n\n#### requestDeviceData()\nPopup to open a connection window for the current device.\n##### Parameter\nN/A\n##### Return Value\nDevice Data\n```ts\ninterface IData\u003cIDeviceData\u003e {\n    code: number;\n    message: string;\n    data: IDeviceData;\n}\n\ninterface IDeviceData {\n  name: string;\n  credential: ICredential;\n  publicKey: IPublicKey;\n  ckbAddr: string;\n}\n```\n\n##### Example\n```ts\nconst deviceData = await connectDID.requestDeviceData();\n```\n\n#### requestSignData(data: {msg: string})\nPopup to open a window for signing a specified string data using the current hardware device authenticator.\n##### Parameter\n- `data`: \n  - `msg`: String to be signed.\n\n##### Return Value\nSigned hexadecimal string.\n```ts\ninterface IData\u003cstring\u003e {\n    code: number;\n    message: string;\n    data: string;\n}\n```\n\n##### Example\n```ts\nconst signData = await connectDID.requestSignData({\n  msg: \"From .bit: e7343fdebaa9ec5aca009af3acb9c0664c94066f136f4d31b7b325dacf24f77c\",\n});\n```\n\n#### requestDeviceSignData(data: {msg: string})\nPopup to open a window for signing a specified string data using the current hardware device authenticator. \n\nConnection will be established before each signing operation.\n##### Parameter\n- `data`:\n  - `msg`: String to be signed.\n\n##### Return Value\nSigned hexadecimal string.\n```ts\ninterface IData\u003cISignDeviceData\u003e {\n    code: number;\n    message: string;\n    data: ISignDeviceData;\n}\n\ninterface ISignDeviceData {\n  deviceData: IDeviceData;\n  signData: string;\n}\n```\n\n##### Example\n```ts\nconst signDeviceData = await connectDID.requestDeviceSignData({\n  msg: \"From .bit: e7343fdebaa9ec5aca009af3acb9c0664c94066f136f4d31b7b325dacf24f77c\",\n});\n```\n\n#### requestRecoverDeviceData()\nPopup to guide the user in recovering locally stored data that has been cleared due to clearing browser cache.\n##### Parameter\nN/A\n##### Return Value\nDevice Data\n```ts\ninterface IData\u003cIDeviceData\u003e {\n    code: number;\n    message: string;\n    data: IDeviceData;\n}\n\ninterface IDeviceData {\n  name: string;\n  credential: ICredential;\n  publicKey: IPublicKey;\n  ckbAddr: string;\n}\n```\n##### Example\n```ts\nconst result = await connectDID.requestRecoverDeviceData();\n```\n\n#### requestBackupData(data: {ckbAddr: string;isOpen?: boolean;})\nPopup to guide the user in performing multi-device backup.\nDecoding requires the use of the [`decodeQRCode`](#decodeqrcodedata-string) method to obtain data of type `{ name: string; ckbAddr: string }`.\n##### Parameter\n- `isOpen`: `boolean` Whether to directly open the backup operation popup. default `true`. If set to `false`, it will return the URL of the backup page.\n-  `ckbAddr`: `string` CKB address of the old device for the purpose of backup on a new device.\n\n##### Return Value\nURL string\n\n##### Example\n```ts\nconst url = await tabCaller.requestBackupData({\n  isOpen: false,\n  ckbAddr: \"ckt1qqexmutxu0c2jq9q4msy8cc6fh4q7q02xvr7dc347zw3ks3qka0m6qggqus2789zvyms45khp275rfgz5lvcl09e9yyqwg90rj3xzdc26tts402p55p20kv0hjujjjhadjy\",\n});\n\n// the QR code contains the following information：  \n{ \n  name: string; // usename\n  ckbAddr:string // ckb address\n}\n```\n\n#### decodeQRCode(data: string)\nDecode the specified formatted data.\n##### Parameter\n- `data`: `string`\n\n##### Return Value\nDecoded data.\n##### Example\n```ts\nconst result = tabCaller.decodeQRCode(\"a4646e616d65724368726f6d652d646f746269742d3036\")\n```\n\n#### requestWaitingPage(onError: (error: IData) =\u003e void)\nA waiting page has emerged. This approach proves valuable in situations where the timing of a delayed pop-up window is crucial, as such delayed pop-ups are often intercepted by web browsers as malicious behavior. This method offers a solution: when a delayed pop-up is necessary, a waiting window is prompted directly, and subsequent redirection of the window is controlled through the provided method.\n##### Parameter\n- `onError`: `(error: IData\u003cany\u003e) =\u003e void`, The described function is a void function that takes an error parameter. It is invoked when an error occurs on the waiting page after it appears, and subsequent operations are terminated.\n    * `error`: `IData\u003cany\u003e`,`{code: number, message: string, data: any}` \n\n##### Return Value\n\n- `onNext`: `({method, params}: {method: EnumRequestMethods, params: any}) =\u003e Promise\u003cIData\u003cany\u003e\u003e`, The next page that needs to be redirected to.\n- `onFailed`: `() =\u003e Promise\u003cIData\u003cany\u003e\u003e`, Directly redirecting to the failed pop-up page.\n- `onClose`: `() =\u003e Promise\u003cvoid\u003e`, Close the current page.\n##### Example\n```ts\nconst onError = (err: IData\u003cany\u003e) =\u003e {\n  console.log(err);\n};\nconst result = await tabCaller.requestWaitingPage(onError);\n\n// const failedData = await result.onFailed();\n// console.log(failedData);\n\n// Close the window\n// await result.onClose();\n\nconst signData = await result.onNext({\n  method: EnumRequestMethods.REQUEST_SIGN_DATA,\n  params: {\n    msg: \"e7debaa9009af3acb9c06f77c\",\n  }\n});\nconsole.log(signData);\n```\n\n#### ConnectDIDError\nConnect-DID SDK Error\n##### Return Value\nError Object.\n```ts\nexport enum ActionErrorCode {\n  ABORT = 1000,  // user reject\n  NOT_FOUND = 3001, // cid not found\n  NOT_EXIST = 3002, // cid not exist\n  ERROR = 5000, // internal error\n  UNKNOWN = 9999,\n\n  SUCCESS = 2000,\n}\n```\n##### Example\n```ts\ntry {\n  const result = tabCaller.decodeQRCode(\"{a: 232302323}\")\n} catch (e) {\n  console.log(e)  //{code: 9999, message: \"unknown error\"}:\n}\n```\n\n## FAQ\nTBA\n\n## Get Help\nIf you have questions or need help with Connect-DID SDK, there are several ways to get assistance:\n- Join the .bit community on [Discord channel](https://discord.gg/fVppR7z4ht).\n- File [issues](https://github.com/dotbitHQ/connect-did-sdk/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) on the GitHub repository for Connect-DID SDK.\n\n## Contribute\nWe welcome contributions to Connect-DID SDK! If you are interested in helping to improve the project, there are several ways you can contribute:\n- Report bugs or suggest improvements by opening an [issue](https://github.com/dotbitHQ/connect-did-sdk/issues) on the GitHub repository.\n- Submit a pull request with your changes to the code.\n\nPlease note that Connect-DID SDK is still under development, so any contribution (including pull requests) is welcome.\n\n## License\nConnect-DID SDK (including **all** dependencies) is protected under the [MIT License](LICENSE). This means that you are free to use, modify, and distribute the software as long as you include the original copyright and license notice. Please refer to the license for the full terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotbithq%2Fconnect-did-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotbithq%2Fconnect-did-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotbithq%2Fconnect-did-sdk/lists"}