{"id":18707628,"url":"https://github.com/descartesnetwork/sen-connector","last_synced_at":"2025-11-09T09:30:27.116Z","repository":{"id":44459167,"uuid":"495245253","full_name":"DescartesNetwork/sen-connector","owner":"DescartesNetwork","description":"🤝 Senhub Connector to power your DApps with Senhub Platform","archived":false,"fork":false,"pushed_at":"2022-10-10T16:12:28.000Z","size":482,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-28T18:16:20.317Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://connector.sentre.io","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/DescartesNetwork.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}},"created_at":"2022-05-23T03:26:53.000Z","updated_at":"2022-07-15T11:54:35.000Z","dependencies_parsed_at":"2023-01-19T19:46:18.461Z","dependency_job_id":null,"html_url":"https://github.com/DescartesNetwork/sen-connector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DescartesNetwork%2Fsen-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DescartesNetwork%2Fsen-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DescartesNetwork%2Fsen-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DescartesNetwork%2Fsen-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DescartesNetwork","download_url":"https://codeload.github.com/DescartesNetwork/sen-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239571542,"owners_count":19661164,"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","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":"2024-11-07T12:19:07.290Z","updated_at":"2025-11-09T09:30:27.059Z","avatar_url":"https://github.com/DescartesNetwork.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤝 Senhub Connector\n\n[![https://img.shields.io/npm/v/@sentre/connector](https://img.shields.io/npm/v/@sentre/connector)](https://www.npmjs.com/package/@sentre/connector)\n[![https://img.shields.io/npm/dw/@sentre/connector](https://img.shields.io/npm/dm/@sentre/connector)](https://www.npmjs.com/package/@sentre/connector)\n[![https://img.shields.io/bundlephobia/min/@sentre/connector](https://img.shields.io/bundlephobia/min/@sentre/connector)](https://www.npmjs.com/package/@sentre/connector)\n[![https://img.shields.io/github/issues-raw/descartesnetwork/sen-connector](https://img.shields.io/github/issues-raw/descartesnetwork/sen-connector)](https://github.com/DescartesNetwork/sen-connector)\n[![https://img.shields.io/github/license/descartesnetwork/sen-connector](https://img.shields.io/github/license/descartesnetwork/sen-connector)](https://github.com/DescartesNetwork/sen-connector)\n\n[![https://img.shields.io/twitter/follow/SentreProtocol?style=social](https://img.shields.io/twitter/follow/SentreProtocol?style=social)](https://twitter.com/SentreProtocol)\n\nBy the integration, your DApps can fully communicate with Senhub platform.\n\n## Installation\n\n```bash\nnpm i @sentre/connector\n```\n\nor,\n\n```bash\nyarn add @sentre/connector\n```\n\n## To use\n\n### With [@solana/wallet-adapter](https://solana-labs.github.io/wallet-adapter/)\n\n```ts\nimport {\n  PhantomWalletAdapter,\n  SlopeWalletAdapter,\n} from '@solana/wallet-adapter-wallets'\nimport { SentreWalletAdapter } from '@sentre/connector'\n\n// Add SentreWalletAdapter with your provided app id to @solana/wallet-adapter\n// Example: https://solana-labs.github.io/wallet-adapter/\n\nconst appId = 'my-app-id'\nconst wallets = [\n  new SentreWalletAdapter({ appId }),\n  new PhantomWalletAdapter(),\n  new SlopeWalletAdapter(),\n  // Other wallets\n]\n```\n\n### Manual integration\n\n```ts\nimport { WalletConnector } from '@sentre/connector'\n\nconst wallet = new WalletConnector('my_app_id')\nconst isConnected = await wallet.isConnected()\nif (isConnected) {\n  // Get the address\n  const address = await wallet.getAddress()\n  // Sign a transaction\n  const signedTransaction = await wallet.signTransaction(transaction)\n  // Sign multiple transactions\n  const signedTransactions = await wallet.signAllTransactions(transactions)\n  // Sign a message\n  const { signature, address, message } = await wallet.signMessage(\n    'the message needs to be signed',\n  )\n}\n```\n\n### Testing\n\n👉 Test your DApps locally by [Senhub Connector Tester](https://hub.sentre.io/app/connector_tester?autoInstall=true).\n\n[![action](https://github.com/DescartesNetwork/sen-connector/blob/master/button.png?raw=true)](https://hub.sentre.io/app/connector_tester?autoInstall=true)\n\n## OAuth\n\nThis module is heavily inspired by [JWT](https://www.npmjs.com/package/jsonwebtoken). However, JST (Json Solana Token) adopted Solana wallet adapter standard as the main cryptography mechanism.\n\n### Usage\n\n```ts\nimport { OAuth } from '@sentre/connector'\n\nconst jst = OAuth.issue({ issuer: 'hub.sentre.io' }) // Default at one month of expiration\n\n// On client side\n// To sign the jst to get bearer\nconst bearer = await OAuth.sign(jst, signer)\n\n// On server side\n// To verify the bearer\nconst ok = OAuth.verify(bearer)\n// If you want to catch error messages\ntry {\n  OAuth.verify(bearer, true)\n} catch (er: any) {\n  console.log(`Verify failed because: ${er.message}`)\n}\n\n// To read bearer details\nconst { publicKey, signature, jst } = OAuth.parse(bearer)\n```\n\n### Examples\n\n👉 [Authenticate with Keypair](https://github.com/DescartesNetwork/sen-connector/blob/master/tests/oauth.test.ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdescartesnetwork%2Fsen-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdescartesnetwork%2Fsen-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdescartesnetwork%2Fsen-connector/lists"}