{"_id":"@cyotee/boardgameio-crypto","_rev":"2-e046ce78596890e4dad58b392371998c","name":"@cyotee/boardgameio-crypto","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@cyotee/boardgameio-crypto","version":"0.1.0","license":"MIT","_id":"@cyotee/boardgameio-crypto@0.1.0","maintainers":[{"name":"cyotee","email":"not_cyotee@proton.me"}],"homepage":"https://github.com/cyotee/boardgameio-crypto#readme","bugs":{"url":"https://github.com/cyotee/boardgameio-crypto/issues"},"dist":{"shasum":"b7772d4f330a626b17b7a12446b5d24ebf87f321","tarball":"https://registry.npmjs.org/@cyotee/boardgameio-crypto/-/boardgameio-crypto-0.1.0.tgz","fileCount":119,"integrity":"sha512-QibUzSV8tw40VwTvv3CMkS2PdRGQ6MP5t5Qt4ei4KB9EZEgZ60dSCDNHObaaimk70ANkP23YKRH/2jHS0XC7Yw==","signatures":[{"sig":"MEYCIQDBR7R37YYuUlMdCkXseK9qfw3FVQhKO6tnNaOS1bXzqgIhANVshhDDhRKTt7rvbx8Acj54tR3miPYYKXZ+8AilBG+M","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":288724},"main":"./dist/index.js","type":"module","_from":"file:cyotee-boardgameio-crypto-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./zk":{"types":"./dist/zk/index.d.ts","default":"./dist/zk/index.js"},"./dleq":{"types":"./dist/dleq.d.ts","default":"./dist/dleq.js"},"./ecdsa":{"types":"./dist/ecdsa.d.ts","default":"./dist/ecdsa.js"},"./merkle":{"types":"./dist/merkle.d.ts","default":"./dist/merkle.js"},"./plugin":{"types":"./dist/plugin/index.d.ts","default":"./dist/plugin/index.js"},"./sha256":{"types":"./dist/sha256.d.ts","default":"./dist/sha256.js"},"./shamirs":{"types":"./dist/shamirs/index.d.ts","default":"./dist/shamirs/index.js"},"./keychain":{"types":"./dist/keychain/index.d.ts","default":"./dist/keychain/index.js"},"./paillier":{"types":"./dist/paillier.d.ts","default":"./dist/paillier.js"},"./secp256k1":{"types":"./dist/secp256k1.d.ts","default":"./dist/secp256k1.js"},"./feldman-dkg":{"types":"./dist/feldman-dkg.d.ts","default":"./dist/feldman-dkg.js"},"./stable-json":{"types":"./dist/stable-json.d.ts","default":"./dist/stable-json.js"},"./mental-poker":{"types":"./dist/mental-poker/index.d.ts","default":"./dist/mental-poker/index.js"},"./snarkjs-range":{"types":"./dist/snarkjs-range.d.ts","default":"./dist/snarkjs-range.js"},"./ec-elgamal-exp":{"types":"./dist/ec-elgamal-exp.d.ts","default":"./dist/ec-elgamal-exp.js"},"./mental-poker/*":{"types":"./dist/mental-poker/*.d.ts","default":"./dist/mental-poker/*.js"},"./range-proof-vkey":{"types":"./dist/range-proof-vkey.d.ts","default":"./dist/range-proof-vkey.js"},"./plugin/crypto-plugin":{"types":"./dist/plugin/crypto-plugin.d.ts","default":"./dist/plugin/crypto-plugin.js"},"./integration/setup-utils":{"types":"./dist/integration/setup-utils.d.ts","default":"./dist/integration/setup-utils.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json || test -f dist/index.js","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"cyotee","email":"not_cyotee@proton.me"},"_resolved":"/private/var/folders/28/y_7zd8pd2sl_jtwdj8y7hbb00000gn/T/grok-npm-publish-2595/cyotee-boardgameio-crypto-0.1.0.tgz","_integrity":"sha512-QibUzSV8tw40VwTvv3CMkS2PdRGQ6MP5t5Qt4ei4KB9EZEgZ60dSCDNHObaaimk70ANkP23YKRH/2jHS0XC7Yw==","repository":{"url":"git+https://github.com/cyotee/boardgameio-crypto.git","type":"git"},"_npmVersion":"12.0.1","description":"Cryptographic primitives for boardgame.io games — mental poker (SRA), Merkle commitments, EC ElGamal, Feldman DKG, DLEQ, ECDSA, Paillier HE, Shamir SSS, snarkjs ZK helpers, the boardgame.io crypto plugin, and setup-flow helpers.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"snarkjs":"^0.7.6","elliptic":"^6.5.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.1","typescript":"^5.6.2"},"peerDependencies":{"boardgame.io":"^0.50.2"},"_npmOperationalInternal":{"tmp":"tmp/boardgameio-crypto_0.1.0_1784365579646_0.046614746123509576","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@cyotee/boardgameio-crypto","version":"0.2.0","description":"Cryptographic primitives for boardgame.io games — mental poker (SRA), Merkle commitments, EC ElGamal, Feldman DKG, DLEQ, ECDSA, Paillier HE (demo), Shamir SSS, snarkjs ZK helpers, the boardgame.io crypto plugin, and setup-flow helpers.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./mental-poker":{"types":"./dist/mental-poker/index.d.ts","import":"./dist/mental-poker/index.js","default":"./dist/mental-poker/index.js"},"./mental-poker/*":{"types":"./dist/mental-poker/*.d.ts","import":"./dist/mental-poker/*.js","default":"./dist/mental-poker/*.js"},"./keychain":{"types":"./dist/keychain/index.d.ts","import":"./dist/keychain/index.js","default":"./dist/keychain/index.js"},"./plugin":{"types":"./dist/plugin/index.d.ts","import":"./dist/plugin/index.js","default":"./dist/plugin/index.js"},"./plugin/crypto-plugin":{"types":"./dist/plugin/crypto-plugin.d.ts","import":"./dist/plugin/crypto-plugin.js","default":"./dist/plugin/crypto-plugin.js"},"./shamirs":{"types":"./dist/shamirs/index.d.ts","import":"./dist/shamirs/index.js","default":"./dist/shamirs/index.js"},"./zk":{"types":"./dist/zk/index.d.ts","import":"./dist/zk/index.js","default":"./dist/zk/index.js"},"./sha256":{"types":"./dist/sha256.d.ts","import":"./dist/sha256.js","default":"./dist/sha256.js"},"./merkle":{"types":"./dist/merkle.d.ts","import":"./dist/merkle.js","default":"./dist/merkle.js"},"./stable-json":{"types":"./dist/stable-json.d.ts","import":"./dist/stable-json.js","default":"./dist/stable-json.js"},"./secp256k1":{"types":"./dist/secp256k1.d.ts","import":"./dist/secp256k1.js","default":"./dist/secp256k1.js"},"./ec-elgamal-exp":{"types":"./dist/ec-elgamal-exp.d.ts","import":"./dist/ec-elgamal-exp.js","default":"./dist/ec-elgamal-exp.js"},"./feldman-dkg":{"types":"./dist/feldman-dkg.d.ts","import":"./dist/feldman-dkg.js","default":"./dist/feldman-dkg.js"},"./dleq":{"types":"./dist/dleq.d.ts","import":"./dist/dleq.js","default":"./dist/dleq.js"},"./ecdsa":{"types":"./dist/ecdsa.d.ts","import":"./dist/ecdsa.js","default":"./dist/ecdsa.js"},"./paillier":{"types":"./dist/paillier.d.ts","import":"./dist/paillier.js","default":"./dist/paillier.js"},"./snarkjs-range":{"types":"./dist/snarkjs-range.d.ts","import":"./dist/snarkjs-range.js","default":"./dist/snarkjs-range.js"},"./range-proof-vkey":{"types":"./dist/range-proof-vkey.d.ts","import":"./dist/range-proof-vkey.js","default":"./dist/range-proof-vkey.js"},"./integration/setup-utils":{"types":"./dist/integration/setup-utils.d.ts","import":"./dist/integration/setup-utils.js","default":"./dist/integration/setup-utils.js"},"./package.json":"./package.json"},"sideEffects":false,"engines":{"node":">=18"},"keywords":["boardgame.io","mental-poker","sra","secp256k1","merkle","dkg","elgamal","shamir","crypto","p2p","fair-play"],"author":{"name":"cyotee"},"homepage":"https://github.com/cyotee/boardgameio-crypto#readme","bugs":{"url":"https://github.com/cyotee/boardgameio-crypto/issues"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/cyotee/boardgameio-crypto.git"},"license":"MIT","scripts":{"build":"rm -rf dist && tsc -p tsconfig.build.json","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run typecheck && npm test && npm run build","test":"vitest run","test:watch":"vitest","pack:check":"npm pack --dry-run"},"peerDependencies":{"boardgame.io":"^0.50.2"},"peerDependenciesMeta":{"boardgame.io":{"optional":true}},"dependencies":{"@noble/curves":"^1.9.7","snarkjs":"^0.7.6"},"devDependencies":{"boardgame.io":"portal:../boardgame.io","typescript":"^5.6.2","vitest":"^2.1.1"},"gitHead":"79843a79da62a11172da85679aaf8cac42ad02c6","_id":"@cyotee/boardgameio-crypto@0.2.0","_nodeVersion":"22.23.1","_npmVersion":"12.0.1","dist":{"integrity":"sha512-++FQFmA9BtaS4FNG9h5OB2YHuiEsmd+TAqIwtZHeBOcHJRhmB/DwZ9Ym0oaap9bGx0wJ9IQSWHWv+xsyl2UwWg==","shasum":"7d707e9c89fcee302dfddd3395bd12369568d482","tarball":"https://registry.npmjs.org/@cyotee/boardgameio-crypto/-/boardgameio-crypto-0.2.0.tgz","fileCount":121,"unpackedSize":304865,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICmAtZ6hpfn101qhAvqDXKcIDZ9ht76iy+4A+VbqFtqXAiA0zm7Qm9RYy/9ghi1JraU7CDEpFWtkB89bXUH2z72sDA=="}]},"_npmUser":{"name":"cyotee","email":"not_cyotee@proton.me"},"directories":{},"maintainers":[{"name":"cyotee","email":"not_cyotee@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/boardgameio-crypto_0.2.0_1784772707499_0.10171275072274133"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-18T09:06:19.410Z","modified":"2026-07-23T02:11:47.810Z","0.1.0":"2026-07-18T09:06:19.813Z","0.2.0":"2026-07-23T02:11:47.662Z"},"bugs":{"url":"https://github.com/cyotee/boardgameio-crypto/issues"},"license":"MIT","homepage":"https://github.com/cyotee/boardgameio-crypto#readme","repository":{"type":"git","url":"git+https://github.com/cyotee/boardgameio-crypto.git"},"description":"Cryptographic primitives for boardgame.io games — mental poker (SRA), Merkle commitments, EC ElGamal, Feldman DKG, DLEQ, ECDSA, Paillier HE (demo), Shamir SSS, snarkjs ZK helpers, the boardgame.io crypto plugin, and setup-flow helpers.","maintainers":[{"name":"cyotee","email":"not_cyotee@proton.me"}],"readme":"# @cyotee/boardgameio-crypto\n\nCryptographic primitives for [boardgame.io](https://boardgame.io/) games — mental poker (SRA), keychain admission, Merkle commitments, threshold ElGamal/DKG, ECDSA, Shamir secret sharing, and optional ZK helpers.\n\n**Package name on npm:** `@cyotee/boardgameio-crypto`  \n**Status:** `0.2.x` — Node ESM-ready leaf library. Read [SECURITY.md](./SECURITY.md) before shipping adversarial P2P fairness.\n\n## Install\n\n```bash\nnpm install @cyotee/boardgameio-crypto\n# or\nyarn add @cyotee/boardgameio-crypto\n```\n\n**Node:** `>=18`  \n**Peer (optional):** `boardgame.io` — only required if you use the `/plugin` integration.\n\n### Dependencies (published on npm)\n\n| Dependency | Role | Required when |\n|------------|------|----------------|\n| [`@noble/curves`](https://www.npmjs.com/package/@noble/curves) | secp256k1 EC ops (SRA, ECDSA, DKG, ECIES) | Always (runtime dep) |\n| [`snarkjs`](https://www.npmjs.com/package/snarkjs) | Groth16 verify / range wrappers | Importing `/zk` or `/snarkjs-range` |\n| [`boardgame.io`](https://www.npmjs.com/package/boardgame.io) | Game engine types + plugin host | Using `/plugin` only (optional peer) |\n\nAll of these are ordinary npm packages — no monorepo-only portals in the published tarball.\n\n## Quick start\n\n```ts\nimport {\n  generateKeyPair,\n  encrypt,\n  decrypt,\n  getCardPoint,\n  createKeychain,\n  keychainAdd,\n  MENTAL_POKER_KEYCHAIN_POLICY,\n} from \"@cyotee/boardgameio-crypto\";\n\nconst alice = generateKeyPair();\nconst bob = generateKeyPair();\n\n// Admit public keys (never private keys) into shared state\nlet chain = createKeychain();\nchain = keychainAdd(chain, \"0\", alice.publicKey, MENTAL_POKER_KEYCHAIN_POLICY).keychain!;\nchain = keychainAdd(chain, \"1\", bob.publicKey, MENTAL_POKER_KEYCHAIN_POLICY).keychain!;\n\nconst cardId = \"ace-of-spades\";\nconst layer1 = encrypt(cardId, alice.privateKey); // keep sk client-local\nconst layer2 = encrypt(layer1, bob.privateKey);\n\nconst peelBob = decrypt(layer2, bob.privateKey);\nconst plain = decrypt(peelBob, alice.privateKey);\nconsole.log(plain.layers === 0, plain.ciphertext === (await getCardPoint(cardId)));\n```\n\n## Entry points\n\n| Import | Contents |\n|--------|----------|\n| `@cyotee/boardgameio-crypto` | Barrel: mental poker, keychain, plugin, hashing, threshold primitives, ECDSA, ZK helpers |\n| `@cyotee/boardgameio-crypto/mental-poker` | SRA, commitments, shuffle proofs |\n| `@cyotee/boardgameio-crypto/keychain` | Public-key registry + admission policies |\n| `@cyotee/boardgameio-crypto/plugin` | boardgame.io crypto plugin |\n| `@cyotee/boardgameio-crypto/merkle` | Merkle tree commitments |\n| `@cyotee/boardgameio-crypto/secp256k1` | Point/scalar helpers |\n| `@cyotee/boardgameio-crypto/ec-elgamal-exp`, `/feldman-dkg`, `/dleq` | Threshold tally primitives |\n| `@cyotee/boardgameio-crypto/ecdsa`, `/sha256`, `/stable-json` | Signing + hashing |\n| `@cyotee/boardgameio-crypto/shamirs` | Shamir secret sharing + ECIES share wrap |\n| `@cyotee/boardgameio-crypto/paillier` | **Demo-only** Paillier HE (insecure parameters) |\n| `@cyotee/boardgameio-crypto/zk`, `/snarkjs-range` | snarkjs helpers (artifacts not shipped) |\n\n## Security highlights\n\n1. **Never** put private keys in shared `G` or multiplayer move args — submit ciphertexts / peels only.  \n2. Admit public keys via **keychain** (`MENTAL_POKER_KEYCHAIN_POLICY` for multi-party SRA).  \n3. Bind encrypt `sk` → published `pk` on the client (`requirePrivateKeyMatchesPublished`).  \n4. Shuffle proofs are **commit-and-reveal**, not ZK — see [SECURITY.md](./SECURITY.md).  \n5. **`/paillier` is educational only** (128-bit modulus). Do not use for real secrecy.\n\n## Scripts\n\n```bash\nyarn workspace @cyotee/boardgameio-crypto test\nyarn workspace @cyotee/boardgameio-crypto typecheck\nyarn workspace @cyotee/boardgameio-crypto build\nyarn workspace @cyotee/boardgameio-crypto pack:check\n```\n\n## Publishing (maintainers)\n\nDependencies are already on the public npm registry. This package publishes as `@cyotee/boardgameio-crypto`.\n\n```bash\n# From packages/boardgameio-crypto (or CI workflow)\nnpm run prepublishOnly   # typecheck + test + build\nnpm publish --access public\n```\n\nCI: `.github/workflows/publish-npm.yml` — tests on push, publishes when the version on npm is new (OIDC provenance preferred).\n\nVersion policy: bump `package.json` `version` before publish; see [CHANGELOG.md](./CHANGELOG.md).\n\n## License\n\nMIT — see [LICENSE](./LICENSE).\n","readmeFilename":"README.md","keywords":["boardgame.io","mental-poker","sra","secp256k1","merkle","dkg","elgamal","shamir","crypto","p2p","fair-play"],"author":{"name":"cyotee"}}