{"_id":"@buidlerlabs/citadel-sdk-js","name":"@buidlerlabs/citadel-sdk-js","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@buidlerlabs/citadel-sdk-js","private":false,"version":"0.1.0","type":"module","description":"The official Citadel Wallet SDK for all you JS hommies out there","homepage":"https://www.citadelwallet.io","repository":{"type":"git","url":"git+https://github.com/buidler-labs/citadel-sdk-js.git"},"bugs":{"url":"https://github.com/buidler-labs/citadel-sdk-js/issues"},"author":{"name":"Buidler Labs SRL"},"keywords":["blockchain","hardware wallet","citadel wallet","ecdsa","hedera","ledger","crypto","web3"],"license":"MIT","main":"./dist/citadel-sdk.cjs","module":"./dist/citadel-sdk.js","exports":{".":{"require":{"types":"./dist/index.d.ts","default":"./dist/citadel-sdk.cjs"},"import":{"types":"./dist/index.d.ts","default":"./dist/citadel-sdk.js"}}},"publishConfig":{"access":"public"},"devDependencies":{"@types/jest":"^29.5.11","@types/node":"^22.15.30","@types/w3c-web-usb":"^1.0.10","@types/web-bluetooth":"^0.0.21","jest":"^29.7.0","rollup-plugin-polyfill-node":"^0.13.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"~5.8.3","vite":"^6.3.5","vite-plugin-dts":"^4.5.4"},"dependencies":{"@abandonware/noble":"1.9.2-26","buffer":"^6.0.3","rxjs":"^7.8.2","usb":"^2.15.0"},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","test":"npx --node-options=--experimental-vm-modules jest","test:watch":"npx --node-options=--experimental-vm-modules jest --watch","test:coverage":"npx --experimental-vm-modules=--experimental-vm-modules jest --coverage"},"_id":"@buidlerlabs/citadel-sdk-js@0.1.0","types":"./dist/citadel-sdk.d.ts","_integrity":"sha512-v9QPRTFF41Q06+jS1TNO+0LhdFIK8BKQZxhjA4jduv6Xwc/G60GVEQlM3+GewYBScWtlBuHCJzsVpbU/OySAjQ==","_resolved":"/private/var/folders/8l/f_ks7vx55278f93l6mn2cycr0000gn/T/b519c10b3221ba9b36257243f5e044b3/buidlerlabs-citadel-sdk-js-0.1.0.tgz","_from":"file:buidlerlabs-citadel-sdk-js-0.1.0.tgz","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-v9QPRTFF41Q06+jS1TNO+0LhdFIK8BKQZxhjA4jduv6Xwc/G60GVEQlM3+GewYBScWtlBuHCJzsVpbU/OySAjQ==","shasum":"10a7daf53ba93b48b2bb23d52ef2238e8603adba","tarball":"https://registry.npmjs.org/@buidlerlabs/citadel-sdk-js/-/citadel-sdk-js-0.1.0.tgz","fileCount":16,"unpackedSize":99031,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAIiWsCT8qD8POHiaSU6kxXEMlyj9yqWZnq/5mytR3xSAiBPgL4sfEXIQyK035csu5i0nysfrx67Lf4eDAisWuRO4w=="}]},"_npmUser":{"name":"3nigma","email":"victor.adascalitei@3vs.ro","actor":{"name":"3nigma","email":"victor.adascalitei@3vs.ro","type":"user"}},"directories":{},"maintainers":[{"name":"3nigma","email":"victor.adascalitei@3vs.ro"},{"name":"victorholo","email":"victor.holotescu@gmail.com"},{"name":"vladuts","email":"vlad.oprisor95@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/citadel-sdk-js_0.1.0_1750839234246_0.6228852498011048"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-25T08:13:54.146Z","0.1.0":"2025-06-25T08:13:54.552Z","modified":"2025-06-25T08:13:54.882Z"},"maintainers":[{"name":"3nigma","email":"victor.adascalitei@3vs.ro"},{"name":"victorholo","email":"victor.holotescu@gmail.com"},{"name":"vladuts","email":"vlad.oprisor95@gmail.com"}],"description":"The official Citadel Wallet SDK for all you JS hommies out there","homepage":"https://www.citadelwallet.io","keywords":["blockchain","hardware wallet","citadel wallet","ecdsa","hedera","ledger","crypto","web3"],"repository":{"type":"git","url":"git+https://github.com/buidler-labs/citadel-sdk-js.git"},"author":{"name":"Buidler Labs SRL"},"bugs":{"url":"https://github.com/buidler-labs/citadel-sdk-js/issues"},"license":"MIT","readme":"# Citadel SDK, the JS edition\n\nA JS library for interacting with [Citadel Wallet](https://www.citadelwallet.io/) hardware devices through WebUSB and Bluetooth connections. This SDK provides a simple interface to connect, communicate, and perform cryptographic operations with Citadel hardware wallets.\n\n## Features\n\n- Support for multiple transport layers (WebUSB and Bluetooth)\n- Ability to retrieve the wallet's Public key\n- Ability to sign transactions with the wallet\n- Plays (hopefully) well with both Node and Web runtimes\n\n## Demo Application\n\nNeed more convincing or want to see the SDK in action?\nThe repository includes a `demo` sub-project that lets you test the Citadel SDK with a subset of decentralized applications (dapps) on the Hedera network. The demo provides a simple user interface to:\n\n- Connect to a Citadel hardware device\n- Perform various Hedera transactions\n- Test transaction signing with the hardware wallet\n\n### Running the Demo\nFirst create a `.env` file from the provided `demo/.env.example` one and fill in the required values. At a minimum, you'll need to fill in `VITE_HEDERA_ACCOUNT_ID`, `VITE_HEDERA_PUBLIC_KEY` and, possibly, `VITE_NETWORK` (which you'll most likely set it to `testnet`) with the Hedera account ID and public key of the account you want to use for testing.\n\nNote: the account must be registered on the Hedera network. You can use a soft-wallet such as [HashPack](https://www.hashpack.app/) to do so.\n\nAfter that, you can run the demo application by running the following commands (make sure you are within the `demo` directory):\n```bash\npnpm install\npnpm dev\n```\n\nThe demo application showcases real-world usage of the SDK and provides a reference implementation for integrating the Citadel SDK into your own applications.\n\n## Installation\n```bash\n# Using npm\nnpm install @buidlerlabs/citadel-sdk-js\n\n# Using yarn\nyarn add @buidlerlabs/citadel-sdk-js\n\n# Using pnpm\npnpm add @buidlerlabs/citadel-sdk-js\n```\n## Usage\n### Checking Supported Transports\n\nBefore creating a connection, you can check which transport methods are supported by the current browser environment:\n```typescript\nimport { CitadelLink } from '@buidlerlabs/citadel-sdk-js';\n\nconst supportedTransports = await CitadelLink.getSupportedTransports();\nconsole.log(supportedTransports);\n\n// Possible, self explanatory, output:\n// [\n//   { transport: TransportType.WebUsb, supported: true },\n//   { transport: TransportType.Bluetooth, supported: false }\n// ]\n```\n\n### Connecting to a Device\n```typescript\nimport { CitadelLink } from '@buidlerlabs/citadel-sdk-js';\n\n// Create a new CitadelLink instance using WebUSB\nconst citadelLink = new CitadelLink(TransportType.WebUsb);\n// Or using Bluetooth\n// const citadelLink = new CitadelLink(TransportType.Bluetooth);\n```\nNote: Bluetooth support hasn't been fully tested yet.\n\n### Getting the Wallet Public Key\n```typescript\ntry {\n  const publicKey = await citadelLink.getWalletPublicKey();\n  \n  console.log('Wallet Public Key:', publicKey.toString('hex'));\n} catch (error) {\n  console.error('Error getting wallet public key:', error);\n}\n```\n### Signing a Message with the Wallet Key\n```typescript\ntry {\n  const message = new Uint8Array([/* your message data here */]);\n  const signature = await citadelLink.signWithWalletKey(message);\n  \n  console.log('Signature:', Buffer.from(signature).toString('hex'));\n} catch (error) {\n  console.error('Error signing message:', error);\n}\n```\n### Closing the Connection\n\nIf you want to close the connection to the device, you can call the appropriately-called `close()` method:\n```typescript\nawait citadelLink.close();\n```\n## API Reference\n\n### `CitadelLink` Class\n\nThe main class for interacting with Citadel hardware devices.\n\n#### Static Methods\n\n##### `getSupportedTransports(): Promise<SupportedTransportResolution[]>`\n\nReturns an array of objects containing information about which transport methods are supported in the current environment.\n\n#### Constructor\n\n##### `constructor(transportType: TransportType)`\n\nCreates a new CitadelLink instance with the specified transport type.\n\n- `transportType`: The type of transport to use (WebUsb or Bluetooth)\n\n#### Instance Methods\n\n##### `close(): Promise<void>`\n\nCloses the connection to the device.\n\n##### `getWalletPublicKey(): Promise<Buffer>`\n\nRetrieves the wallet's public key from the device.\n\n##### `signWithWalletKey(msg: Uint8Array): Promise<Uint8Array>`\n\nSigns a message using the wallet's private key.\n\n- `msg`: The message to sign as a Uint8Array\n\n### `TransportType` Enum\n\nDefines the available transport types:\n\n- `WebUsb`: For USB connections\n- `Bluetooth`: For Bluetooth connections\n\n### `SupportedTransportResolution` Interface\n\nDescribes the support status of a transport type:\n```typescript\ninterface SupportedTransportResolution {\n  transport: TransportType;\n  supported: boolean;\n}\n```\n## Error Handling\n\nThe SDK throws errors in various scenarios:\n\n- When an unsupported transport type is specified\n- When connection to the device fails\n- When device operations fail\n\nAlways wrap your CitadelLink operations in try/catch blocks to handle these errors gracefully.\n","readmeFilename":"README.md","_rev":"1-0356d667cecd51fb1d6705666e8a72c4"}