{"id":19317202,"url":"https://github.com/bithyve/cktap-protocol-react-native","last_synced_at":"2026-01-22T12:51:51.008Z","repository":{"id":46885121,"uuid":"481183069","full_name":"bithyve/cktap-protocol-react-native","owner":"bithyve","description":"coinkite's tap protocol to support Tapcards and Satcards in javascript","archived":false,"fork":false,"pushed_at":"2024-10-09T05:59:37.000Z","size":324,"stargazers_count":7,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-12T13:51:35.845Z","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/bithyve.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,"zenodo":null}},"created_at":"2022-04-13T11:10:22.000Z","updated_at":"2025-03-05T13:23:44.000Z","dependencies_parsed_at":"2025-04-12T13:49:26.873Z","dependency_job_id":"bfa597a0-4565-4c49-98c6-fee0127d8056","html_url":"https://github.com/bithyve/cktap-protocol-react-native","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bithyve/cktap-protocol-react-native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithyve%2Fcktap-protocol-react-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithyve%2Fcktap-protocol-react-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithyve%2Fcktap-protocol-react-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithyve%2Fcktap-protocol-react-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bithyve","download_url":"https://codeload.github.com/bithyve/cktap-protocol-react-native/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bithyve%2Fcktap-protocol-react-native/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28663624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":"2024-11-10T01:14:12.598Z","updated_at":"2026-01-22T12:51:50.992Z","avatar_url":"https://github.com/bithyve.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native\n\n## Coinkite Tap Protocol library\n\nA React Native JS library to enable easy communication\nwith **TAPSIGNER\u003csup\u003e\u0026trade;\u003c/sup\u003e** and **SATSCARD\u003csup\u003e\u0026trade;\u003c/sup\u003e**.\n\n**-==[Request card development samples [here](https://coinkite.cards/dev)]==-**\n\n## Documentation Links\n\nSee [the python library by Coinkite](https://github.com/coinkite/coinkite-tap-proto) for protocol specifications.\n\n# Installation\n\n`yarn add coinkite-tap-protocol`\n\n## Supporting node core modules\n\nThis library uses a few node core modules like secp256k1, buffer, crypto etc. which react native doesn't support because they probably use C++ code bundled with the Node JS binary, not Javascript.\n\nWe suggest using [rn-nodify](https://github.com/tradle/rn-nodeify) to enable using node core modules after `yarn add coinkite-tap-protocol`\n\n## Metro Plugin\n\nrn-nodify needs stream-browserify for browser support.\n\n`metro.config.js`\n\n```sh\n...\nresolver: {\n    extraNodeModules: {\n      stream: require.resolve('stream-browserify'),\n    },\n  },\ntransformer: {\n    ...\n  },\n...\n```\n\n## Peer dependencies\n\n[react-native-nfc-manager](https://github.com/revtel/react-native-nfc-manager) is used for the NFC communications with the cards. Please refer to their docs for nfc integration.\n\n## ~TDLR\n\n1. add the post install script in your package.json\n   `\"postinstall\": \"rn-nodeify --install fs,dgram,process,path,console,crypto --hack\"`\n\n2. install the required modules\n   `yarn add coinkite-tap-protocol rn-nodify stream-browserify react-native-nfc-manager`\n\n3. update metro config resolver\n\n```sh\nextraNodeModules: {\n    stream: require.resolve('stream-browserify'),\n}\n```\n\n4. install respoective cocopod dependencies\n   `cd ios \u0026\u0026 pod install`\n\n\n# Usage\n\nCreate a Protocol calss to interact with the TAPSIGNER/SATSCARD.\n```tsx\nimport { CKTapCard } from 'cktap-protocol-react-native';\n.\n.\n.\nconst card: CKTapCard = useRef(new CKTapCard()).current;\n```\n\n\nThe library provides a wrapper to initialte NFC and make batch calls to the TAPSIGNER/SATSCARD with a single NFC scan.\n```tsx\nconst cardStatus = await card.nfcWrapper(async () =\u003e {\n    // interact with the card here\n    return card.first_look(); // scans the card for basic details and initialises with it\n});\n```\n\n\nYou can also batch commands in a single NFC scan\n```tsx\nconst initiatedCard = await card.nfcWrapper(async () =\u003e {\n    const cardStatus = await card.first_look();\n    const isCardLegit = await card.certificate_check();\n    if (isCardLegit) {\n        // run the setup command just once\n        await card.setup(cvc); // setup the card with the CVC at the back of the card (don't forget to prompt the user to change it later)\n    }\n    return card;\n});\n```\n\n\nFetch the xpub, derivation path and fingerprint post setup\n```tsx\nconst initiatedCard = await card.nfcWrapper(async () =\u003e {\n    const cardStatus = await card.first_look();\n    if (status.path) {\n        const xpub = await card.get_xpub(cvc);\n        const fingerprint = await card.get_xfp(cvc);\n        return { xpub, derivationPath: cardStatus.path, fingerprint: fingerprint.toString('hex') };\n    } else {\n        await card.setup(cvc);\n        const cardStatus = await card.first_look();\n        const xpub = await card.get_xpub(cvc);\n        const fingerprint = await card.get_xfp(cvc);\n        return { xpub, derivationPath: cardStatus.path, fingerprint: fingerprint.toString('hex') };\n    }\n});\n```\n\n### Android specific usage\n* Make sure you call the following command on **android** once the interactions with the card is completed. This is specifically done in android as we do not end the nfc after the wrapper has executed the commands but which is not the case with iOS. \n    This behaviour is different for different platforms since the NFC interaction is blocking in iOS (system dialog) and non-blocking in android. Hence the user can manually add NFC dialogs/interactions in case of android when the communication with the card is done (optionally).\n```tsx\n// Android-only\nawait card.endNfcSession(); // either call is on component unmount or post card.nfcWrapper\n```\n\n\n**NOTE**\n* Place the card for the NFC scan before **card.nfcWrapper** is called. There is no need to remove the card until the wrapper completes the callback.\n* iOS has it's own system NFC interaction to let the user know that the NFC is active.\n* Android has no interaction as such. You can use your own modal/interaction which can open and close before/after the callback to card.nfcWrapper.\n* [Demo app with detailed usage of the library](https://github.com/bithyve/Cktap-Demo).\n\n## TEST\nRun test suits for the library with\n```zsh\nyarn test\n```\n\n## LINT\nLint the library with\n```zsh\nyarn lint\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbithyve%2Fcktap-protocol-react-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbithyve%2Fcktap-protocol-react-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbithyve%2Fcktap-protocol-react-native/lists"}