{"id":21384684,"url":"https://github.com/p2panda/shirokuma","last_synced_at":"2025-07-13T14:31:40.671Z","repository":{"id":104337339,"uuid":"526180866","full_name":"p2panda/shirokuma","owner":"p2panda","description":"TypeScript SDK to easily write p2panda applications","archived":false,"fork":false,"pushed_at":"2024-12-06T14:22:21.000Z","size":1186,"stargazers_count":19,"open_issues_count":8,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-11T04:39:13.372Z","etag":null,"topics":["framework","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://p2panda.github.io/shirokuma/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p2panda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-18T11:23:32.000Z","updated_at":"2025-06-30T06:59:45.000Z","dependencies_parsed_at":"2024-01-17T16:05:30.537Z","dependency_job_id":"b2c99c00-4bb7-46ae-80e3-d10888e99d41","html_url":"https://github.com/p2panda/shirokuma","commit_stats":{"total_commits":77,"total_committers":3,"mean_commits":"25.666666666666668","dds":"0.16883116883116878","last_synced_commit":"200adb77cb610a6ece59f753f9e93c55f7ac81e4"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/p2panda/shirokuma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2panda%2Fshirokuma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2panda%2Fshirokuma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2panda%2Fshirokuma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2panda%2Fshirokuma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p2panda","download_url":"https://codeload.github.com/p2panda/shirokuma/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2panda%2Fshirokuma/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923080,"owners_count":23683716,"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":["framework","sdk","typescript"],"created_at":"2024-11-22T11:42:36.426Z","updated_at":"2025-07-13T14:31:40.662Z","avatar_url":"https://github.com/p2panda.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eshirokuma\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/p2panda/.github/main/assets/rainbow.gif\" width=\"auto\" height=\"30px\"\u003e\n  \u003cstrong\u003eTypeScript framework to easily write p2panda applications\u003c/strong\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/p2panda/.github/main/assets/rainbow.gif\" width=\"auto\" height=\"30px\"\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- CI status --\u003e\n  \u003ca href=\"https://github.com/p2panda/shirokuma/actions\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/checks-status/p2panda/shirokuma/main?style=flat-square\" alt=\"CI Status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- NPM version --\u003e\n  \u003ca href=\"https://www.npmjs.com/package/shirokuma\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/shirokuma?style=flat-square\" alt=\"NPM version\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch3\u003e\n    \u003ca href=\"https://github.com/p2panda/shirokuma#installation\"\u003e\n      Installation\n    \u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://github.com/p2panda/shirokuma/releases\"\u003e\n      Releases\n    \u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://aquadoggo.p2panda.org/about/contribute/\"\u003e\n      Contributing\n    \u003c/a\u003e\n  \u003c/h3\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\nThis library provides all tools required to write an [`p2panda`] application in TypeScript, running in any modern web browser.\n\n[`p2panda`]: https://aquadoggo.p2panda.org/\n\n## Installation\n\nTo install `shirokuma` run:\n\n```\nnpm i shirokuma\n```\n\n## Example\n\n```typescript\nimport { KeyPair, Session, initWebAssembly } from 'shirokuma';\n\n// This method needs to be run once before to initialise the embedded\n// WebAssembly code in this package\nawait initWebAssembly();\n\n// This example uses the \"chat\" schema at which this hash is pointing\nconst CHAT_SCHEMA =\n  'chat_message_0020a654068b26617ebd6574b1b03853193ccab2295a983bc85a5891793422832655';\n\n// Create a key pair\nconst keyPair = new KeyPair();\n\n// Open a long running connection to a p2panda node and configure it so all\n// calls in this session are executed using that key pair\nconst session = new Session('http://localhost:2020/graphql').setKeyPair(keyPair);\n\n// Compose your operation payload, according to chosen schema\nconst fields = {\n  message: 'Hi there',\n};\n\n// Create and send a new chat message to the node\nawait session.create(fields, { schemaId: CHAT_SCHEMA });\n```\n\n## Usage\n\n`shirokuma` runs both in NodeJS and web browsers and comes as a ES and CommonJS\nmodule. It can easily be integrated into Webpack, Rollup or other tools.\n\nSince `shirokuma` contains WebAssembly code, it is necessary to initialise it\nbefore using the methods in the Browser. This initialisation step is not\nrequired in NodeJS contexts.\n\nTo make this step a little bit easier `shirokuma` inlines the WebAssembly code\nas a base64 string which gets decoded automatically during initialisation. For\nmanual initialisation the package also comes with \"slim\" versions where you\nneed to provide a path to the \".wasm\" file yourself.\n\n### Browser\n\nTo quickly get started, you can run `shirokuma` in any modern browser as an ES module like that. Note that this uses the bundled version, with all 3rd party dependencies included plus the WebAssembly code itself:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { initWebAssembly, KeyPair } from 'https://cdn.jsdelivr.net/npm/shirokuma@0.1.3/lib/esm-bundle/index.min.js';\n\n  initWebAssembly().then(() =\u003e {\n    const keyPair = new KeyPair();\n    console.log(keyPair.publicKey());\n  });\n\u003c/script\u003e\n```\n\n### NodeJS\n\n```javascript\nimport { KeyPair } from 'shirokuma';\nconst keyPair = new KeyPair();\nconsole.log(keyPair.publicKey());\n```\n\n### Bundlers\n\n```javascript\nimport { initWebAssembly, KeyPair } from 'shirokuma';\n\n// This only needs to be done once before using all `shirokuma` methods\nawait initWebAssembly();\n\nconst keyPair = new KeyPair();\nconsole.log(keyPair.publicKey());\n```\n\n### Manually load `.wasm`\n\nRunning `shirokuma` automatically inlines the WebAssembly inside the JavaScript\nfile, encoded as a base64 string. While this works for most developers, it also\ndoubles the size of the imported file. To avoid larger payloads and decoding\ntimes you can load the `.wasm` file manually by using a \"slim\" version. For\nthis you need to initialise the module by passing the path to the file into\n`initWebAssembly`:\n\n```javascript\n// Import from `slim` module to manually initialise WebAssembly code\nimport { initWebAssembly, KeyPair } from 'shirokuma/slim';\nimport wasm from 'shirokuma/p2panda.wasm';\n\n// When running shirokuma in the browser, this method needs to run once\n// before using all other methods\nawait initWebAssembly(wasm);\n\nconst keyPair = new KeyPair();\nconsole.log(keyPair.publicKey());\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Check code formatting\nnpm run lint\n\n# Run tests\nnpm test\n\n# Bundle js package\nnpm run build\n```\n\n### Documentation\n\n```bash\n# Generate documentation\nnpm run docs\n\n# Show documentation in browser\nnpx serve ./docs\n```\n\n## License\n\nGNU Affero General Public License v3.0 [`AGPL-3.0-or-later`](LICENSE)\n\n## Supported by\n\n\u003cimg src=\"https://raw.githubusercontent.com/p2panda/.github/main/assets/ngi-logo.png\" width=\"auto\" height=\"80px\"\u003e\u003cbr /\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/p2panda/.github/main/assets/nlnet-logo.svg\" width=\"auto\" height=\"80px\"\u003e\u003cbr /\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/p2panda/.github/main/assets/eu-flag-logo.png\" width=\"auto\" height=\"80px\"\u003e\n\n*This project has received funding from the European Union’s Horizon 2020\nresearch and innovation programme within the framework of the NGI-POINTER\nProject funded under grant agreement No 871528*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2panda%2Fshirokuma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp2panda%2Fshirokuma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2panda%2Fshirokuma/lists"}