{"id":47963014,"url":"https://github.com/forgesworn/shamir-core","last_synced_at":"2026-04-04T10:03:50.161Z","repository":{"id":347323104,"uuid":"1193619204","full_name":"forgesworn/shamir-core","owner":"forgesworn","description":"GF(256) Shamir's Secret Sharing — split and reconstruct secrets with threshold schemes","archived":false,"fork":false,"pushed_at":"2026-03-27T12:50:54.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T23:28:26.555Z","etag":null,"topics":["cryptography","gf256","key-splitting","secret-sharing","shamir","threshold","typescript"],"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/forgesworn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2026-03-27T12:16:56.000Z","updated_at":"2026-03-27T12:50:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/forgesworn/shamir-core","commit_stats":null,"previous_names":["forgesworn/shamir-core"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/forgesworn/shamir-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgesworn%2Fshamir-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgesworn%2Fshamir-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgesworn%2Fshamir-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgesworn%2Fshamir-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forgesworn","download_url":"https://codeload.github.com/forgesworn/shamir-core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgesworn%2Fshamir-core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31395450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T09:13:02.600Z","status":"ssl_error","status_checked_at":"2026-04-04T09:13:01.683Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["cryptography","gf256","key-splitting","secret-sharing","shamir","threshold","typescript"],"created_at":"2026-04-04T10:03:49.542Z","updated_at":"2026-04-04T10:03:50.144Z","avatar_url":"https://github.com/forgesworn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @forgesworn/shamir-core\n\nGF(256) Shamir's Secret Sharing for TypeScript. Split a secret into threshold-of-n shares and reconstruct from any threshold-sized subset.\n\n**Zero runtime dependencies.** Pure TypeScript, Web Crypto only.\n\n## Install\n\n```bash\nnpm install @forgesworn/shamir-core\n```\n\n## Quick Start\n\n```typescript\nimport { splitSecret, reconstructSecret } from '@forgesworn/shamir-core';\n\n// Split a 32-byte key into 5 shares, any 3 can reconstruct\nconst secret = crypto.getRandomValues(new Uint8Array(32));\nconst shares = splitSecret(secret, 3, 5);\n\n// Reconstruct from any 3 shares\nconst recovered = reconstructSecret([shares[0], shares[2], shares[4]], 3);\n// recovered is identical to secret\n```\n\n## API\n\n### `splitSecret(secret, threshold, shares)`\n\nSplit a secret into Shamir shares.\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `secret` | `Uint8Array` | The secret bytes to split (any length) |\n| `threshold` | `number` | Minimum shares needed to reconstruct (2--255) |\n| `shares` | `number` | Total shares to create (threshold--255) |\n\nReturns `ShamirShare[]`. Each share has `{ id, threshold, data }`.\n\n### `reconstructSecret(shares, threshold)`\n\nReconstruct a secret from shares using Lagrange interpolation.\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `shares` | `ShamirShare[]` | At least `threshold` shares |\n| `threshold` | `number` | The threshold used during splitting |\n\nReturns `Uint8Array` (the reconstructed secret).\n\nOnly the first `threshold` shares are used. Extra shares are ignored.\n\n### `ShamirShare`\n\n```typescript\ninterface ShamirShare {\n  id: number;        // 1--255 (GF(256) evaluation point)\n  threshold: number; // 2--255 (minimum shares to reconstruct)\n  data: Uint8Array;  // Share data (same length as original secret)\n}\n```\n\n### Error Classes\n\n- `ShamirError` -- base class\n- `ShamirValidationError` -- invalid parameters\n- `ShamirCryptoError` -- internal crypto errors\n\n## Why This Library\n\n- **Zero dependencies.** No transitive supply chain. Only Web Crypto (`crypto.getRandomValues`).\n- **GF(256) log/exp table lookup.** O(1) field multiplication, same polynomial as AES (0x11b).\n- **Memory zeroing.** Polynomial coefficients are zeroed after use (defence-in-depth).\n- **Strict validation.** Duplicate share IDs, threshold mismatches, and malformed inputs are caught with typed errors.\n- **No secret length limit.** Split any size secret. The maths has no ceiling.\n- **TypeScript-first.** Strict mode, `noUncheckedIndexedAccess`, full type declarations.\n\n## Ecosystem\n\n| Package | Purpose |\n|---------|---------|\n| [`@forgesworn/shamir-words`](https://github.com/forgesworn/shamir-words) | BIP-39 word encoding for shares (depends on this package) |\n| [`dominion-protocol`](https://github.com/forgesworn/dominion) | Epoch-based encrypted access control (depends on this package) |\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforgesworn%2Fshamir-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforgesworn%2Fshamir-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforgesworn%2Fshamir-core/lists"}