{"id":13746677,"url":"https://github.com/holochain/holochain-client-js","last_synced_at":"2026-01-17T21:37:18.728Z","repository":{"id":37886443,"uuid":"255460619","full_name":"holochain/holochain-client-js","owner":"holochain","description":"A JavaScript client for the Holochain Conductor API","archived":false,"fork":false,"pushed_at":"2026-01-13T19:43:48.000Z","size":10428,"stargazers_count":262,"open_issues_count":19,"forks_count":18,"subscribers_count":13,"default_branch":"main","last_synced_at":"2026-01-13T21:42:56.795Z","etag":null,"topics":["browser","conductor-api","holochain","javascript","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holochain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-13T23:07:43.000Z","updated_at":"2026-01-13T18:07:28.000Z","dependencies_parsed_at":"2022-07-09T10:31:21.847Z","dependency_job_id":"f59d4caf-8480-4994-b8af-06e2ec07f62d","html_url":"https://github.com/holochain/holochain-client-js","commit_stats":{"total_commits":586,"total_committers":30,"mean_commits":"19.533333333333335","dds":0.6843003412969284,"last_synced_commit":"7a76a2ae2038e6374e73556df8a10bb57fae68c4"},"previous_names":["holochain/holochain-conductor-api"],"tags_count":139,"template":false,"template_full_name":null,"purl":"pkg:github/holochain/holochain-client-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holochain","download_url":"https://codeload.github.com/holochain/holochain-client-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holochain%2Fholochain-client-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28518644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["browser","conductor-api","holochain","javascript","nodejs","typescript"],"created_at":"2024-08-03T06:00:58.462Z","updated_at":"2026-01-17T21:37:18.700Z","avatar_url":"https://github.com/holochain.png","language":"TypeScript","funding_links":[],"categories":["Libraries","Web 3.0"],"sub_categories":[],"readme":"[![Project](https://img.shields.io/badge/Project-Holochain-blue.svg?style=flat-square)](http://holochain.org/)\n[![Discord](https://img.shields.io/badge/Discord-DEV.HC-blue.svg?style=flat-square)](https://discord.gg/k55DS5dmPH)\n[![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)\n[![Integration Tests](https://github.com/holochain/holochain-client-js/actions/workflows/integration-test.yml/badge.svg?branch=main)](https://github.com/holochain/holochain-client-js/actions/workflows/integration-test.yml)\n[![Bundling Tests](https://github.com/holochain/holochain-client-js/actions/workflows/bundling-test.yml/badge.svg?branch=main)](https://github.com/holochain/holochain-client-js/actions/workflows/bundling-test.yml)\n[![Twitter Follow](https://img.shields.io/twitter/follow/holochain.svg?style=social\u0026label=Follow)](https://x.com/holochain)\n\n# Holochain Client - JavaScript\n\nA JavaScript client for the Holochain Conductor API (works with browsers as well as Nodejs).\n\n## API Reference\n\n[Complete API reference](./docs/client.md)\n\n## Installation\n\n**JS client v0.21.x** is compatible with **Holochain v0.7.x**.\n\n**JS client v0.20.x** is compatible with **Holochain v0.6.x**.\n\n**JS client v0.19.x** is compatible with **Holochain v0.5.x**.\n\nTo install from NPM, run\n```bash\nnpm install --save-exact @holochain/client\n```\n\n\u003e This code is under beta development and you may wish to lock to an exact version of the library for that reason, as shown in the above command.\n\n## Sample usage\n\n### Use AppWebsocket with implicit zome call signing\n```typescript\nimport {\n  AdminWebsocket,\n  AppWebsocket,\n  CellType,\n  type ActionHash,\n  type CallZomeRequest,\n} from \"./lib/index.js\";\n\nconst adminWs = await AdminWebsocket.connect({\n  url: new URL(\"ws://127.0.0.1:65000\"),\n  wsClientOptions: { origin: \"my-happ\" },\n});\nconst agent_key = await adminWs.generateAgentPubKey();\nconst role_name = \"foo\";\nconst installed_app_id = \"test-app\";\nconst appInfo = await adminWs.installApp({\n  source: {\n    type: \"path\",\n    value: \"./test/e2e/fixture/test.happ\",\n  },\n  agent_key,\n  installed_app_id,\n});\nawait adminWs.enableApp({ installed_app_id });\nif (appInfo.cell_info[role_name][0].type !== CellType.Provisioned) {\n  throw new Error(`No cell found under role name ${role_name}`);\n}\nconst { cell_id } = appInfo.cell_info[role_name][0].value;\nawait adminWs.authorizeSigningCredentials(cell_id);\nawait adminWs.attachAppInterface({ port: 65001, allowed_origins: \"my-happ\" });\nconst issuedToken = await adminWs.issueAppAuthenticationToken({\n  installed_app_id,\n});\nconst appWs = await AppWebsocket.connect({\n  url: new URL(\"ws://127.0.0.1:65001\"),\n  token: issuedToken.token,\n  wsClientOptions: { origin: \"my-happ\" },\n});\n\nconst zomeCallPayload: CallZomeRequest = {\n  cell_id,\n  zome_name: \"foo\",\n  fn_name: \"foo\",\n  provenance: agent_key,\n  payload: null,\n};\n\nconst response: ActionHash = await appWs.callZome(zomeCallPayload, 30000);\nconsole.log(\"zome call response is\", response);\n\nawait appWs.client.close();\nawait adminWs.client.close();\n```\n\n### Subscribe to signals\n```typescript\nimport { AdminWebsocket, AppWebsocket, CellType } from \"./lib/index.js\";\n\nconst adminWs = await AdminWebsocket.connect({\n  url: new URL(\"ws://127.0.0.1:65000\"),\n  wsClientOptions: { origin: \"my-happ\" },\n});\nconst agent_key = await adminWs.generateAgentPubKey();\nconst role_name = \"foo\";\nconst installed_app_id = \"test-app\";\nconst appInfo = await adminWs.installApp({\n  source: {\n    type: \"path\",\n    value: \"./test/e2e/fixture/test.happ\",\n  },\n  agent_key,\n  installed_app_id,\n});\nawait adminWs.enableApp({ installed_app_id });\nif (appInfo.cell_info[role_name][0].type !== CellType.Provisioned) {\n  throw new Error(`No cell found under role name ${role_name}`);\n}\nconst { cell_id } = appInfo.cell_info[role_name][0].value;\nawait adminWs.authorizeSigningCredentials(cell_id);\nawait adminWs.attachAppInterface({ port: 65001, allowed_origins: \"my-happ\" });\nconst issuedToken = await adminWs.issueAppAuthenticationToken({\n  installed_app_id,\n});\nconst appWs = await AppWebsocket.connect({\n  url: new URL(\"ws://127.0.0.1:65001\"),\n  token: issuedToken.token,\n  wsClientOptions: { origin: \"my-happ\" },\n});\n\nlet signalCb;\nconst signalReceived = new Promise\u003cvoid\u003e((resolve) =\u003e {\n  signalCb = (signal) =\u003e {\n    console.log(\"signal received\", signal);\n    // act on signal\n    resolve();\n  };\n});\n\nappWs.on(\"signal\", signalCb);\n\n// trigger an emit_signal\nawait appWs.callZome({\n  cell_id,\n  zome_name: \"foo\",\n  fn_name: \"emitter\",\n  provenance: agent_key,\n  payload: null,\n});\nawait signalReceived;\n\nawait appWs.client.close();\nawait adminWs.client.close();\n```\n\n### Managing zome call signing credentials in a pure JavaScript browser application\n\nHere is a pattern to manage signing keys for signing zome calls when running pure JavaScript web hApps in a web browser:\n```typescript\nconst cellIdB64 =\n    encodeHashToBase64(cell_id[0]) + encodeHashToBase64(cell_id[1]);\n// in case the zome call signing credentials are stored locally in the browser\nconst signingCredentialsJson = localStorage.getItem(cellIdB64);\nlet signingCredentials: SigningCredentials | null =\n  signingCredentialsJson \u0026\u0026 JSON.parse(signingCredentialsJson);\n\nif (!signingCredentials) {\n  const [keyPair, signingKey] = generateSigningKeyPair();\n  const capSecret = await admin.grantSigningKey(\n    cell_id,\n    { [GrantedFunctionsType.All]: null },\n    signingKey\n  );\n  signingCredentials = {\n    capSecret,\n    keyPair,\n    signingKey,\n  };\n}\nsetSigningCredentials(cell_id, signingCredentials);\n// possibly store the zome call signing credentials locally in the browser\nlocalStorage.setItem(cellIdB64, JSON.stringify(signingCredentials));\n```\n\n## Running tests\n\nYou need a version (`stable` toolchain) of Rust available.\n\nYou need `holochain` and `hc` on your path, best to get them from nix with `nix-shell`.\n\nTo perform the pre-requisite DNA compilation steps, and run the Nodejs test, run:\n\n```bash\nnix develop\n./build-fixture.sh\nnpm run test\n```\n\n## Contribute\n\nHolochain is an open source project.  We welcome all sorts of participation and are actively working on increasing surface area to accept it.  Please see our [contribution guidelines](/CONTRIBUTING.md) for our general practices and protocols on participating in the community, as well as specific expectations around things like code formatting, testing practices, continuous integration, etc.\n\n* Connect with us on [Discord](https://discord.gg/k55DS5dmPH)\n\n## License\n\n [![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)\n\nCopyright (C) 2020-2024, Holochain Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the license\nprovided in the LICENSE file (CAL-1.0).  This program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\nPURPOSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholochain%2Fholochain-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholochain%2Fholochain-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholochain%2Fholochain-client-js/lists"}