{"id":26084150,"url":"https://github.com/capeprivacy/cape-js","last_synced_at":"2025-04-12T00:43:17.183Z","repository":{"id":56809409,"uuid":"500867720","full_name":"capeprivacy/cape-js","owner":"capeprivacy","description":"The Cape Privacy JavaScript SDK","archived":false,"fork":false,"pushed_at":"2025-02-20T08:00:48.000Z","size":1503,"stargazers_count":24,"open_issues_count":18,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T17:37:27.017Z","etag":null,"topics":["confidential-computing","enclaves","monorepo","nitro-enclaves","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://docs.capeprivacy.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capeprivacy.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-06-07T14:09:00.000Z","updated_at":"2024-11-19T01:23:13.000Z","dependencies_parsed_at":"2024-10-24T08:25:08.556Z","dependency_job_id":"418fb722-4d2a-404c-a645-4e7828bc3e7c","html_url":"https://github.com/capeprivacy/cape-js","commit_stats":{"total_commits":313,"total_committers":10,"mean_commits":31.3,"dds":0.5910543130990416,"last_synced_commit":"7eba41cb798b5d9ac3da0fc1244eaf19161cc8a8"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capeprivacy%2Fcape-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capeprivacy%2Fcape-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capeprivacy%2Fcape-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capeprivacy%2Fcape-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capeprivacy","download_url":"https://codeload.github.com/capeprivacy/cape-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031273,"owners_count":21036366,"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":["confidential-computing","enclaves","monorepo","nitro-enclaves","sdk","typescript"],"created_at":"2025-03-09T04:50:19.298Z","updated_at":"2025-04-12T00:43:17.148Z","avatar_url":"https://github.com/capeprivacy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cape Privacy SDK for JavaScript\n\n[![codecov](https://codecov.io/gh/capeprivacy/cape-js/branch/main/graph/badge.svg?token=faHLjMR1MK)](https://codecov.io/gh/capeprivacy/cape-js) ![build](https://github.com/capeprivacy/cape-js/actions/workflows/test.yml/badge.svg)\n\nThe Cape SDK for JavaScript is a library that provides a simple way to interact with the Cape Privacy API. Works in Node.js and the browser. Requires Node.js version 16+.\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#typescript\"\u003eTypeScript\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n## Installation\n\nUsing npm:\n\n```bash\nnpm install @capeprivacy/cape-sdk\n```\n\nUsing yarn:\n\n```bash\nyarn add @capeprivacy/cape-sdk\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n## Usage\n\nReplace `\u003cAUTH_TOKEN\u003e` and `\u003cFUNCTION_ID\u003e` with your values.\n\n### `run`\n\nRun is used to invoke a function once with a single input.\n\nExample [run.mjs](https://github.com/capeprivacy/cape-js/tree/main/packages/cape/examples/run.mjs):\n\n```js\nimport { Cape } from '@capeprivacy/cape-sdk';\n\nconst client = new Cape({ authToken: '\u003cAUTH_TOKEN\u003e' });\nawait client.run({ id: '\u003cFUNCTION_ID\u003e', data: 'my-data' });\n```\n\n### `invoke`\n\nInvoke is used to run a function repeatedly with a multiple inputs. It gives you more control over the lifecycle of\nthe function invocation.\n\nExample [invoke.mjs](https://github.com/capeprivacy/cape-js/tree/main/packages/cape/examples/invoke.mjs):\n\n```ts\nconst client = new Cape({ authToken: '\u003cAUTH_TOKEN\u003e' });\n\ntry {\n  await client.connect({ id: '\u003cFUNCTION_ID\u003e' });\n\n  const results = await Promise.all([\n    client.invoke({ data: 'my-data-1' }),\n    client.invoke({ data: 'my-data-2' }),\n    client.invoke({ data: 'my-data-3' }),\n  ]);\n  console.log('Cape run result:', results);\n} catch (err) {\n  console.error('Something went wrong.', err);\n} finally {\n  client.disconnect();\n}\n```\n\nPlease note that there is a 60-second inactivity timeout on the enclave connection. You may need to monitor the connection status and reconnect if there is a significant wait between inputs.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### `encrypt`\n\nEncrypt is used to encrypt an input in string format. The encrypted content can't be accessed anywhere except in the enclave. This command will retrieve a public key with which it will encrypt the data with.\n\n```ts\nconst input = '\u003cUSER_INPUT\u003e';\nconst functionToken = '\u003cFUNCTION_TOKEN\u003e';\n\nconst client = new Cape({ functionToken });\n\nconst encrypted = await client.encrypt(input);\n\n// Invoke with encrypted input.\nawait client.run({ id: '\u003cFUNCTION_ID\u003e', data: encrypted });\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n## TypeScript\n\nThe Cape SDK for JavaScript bundles TypeScript definitions to use in TypeScript projects.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\nRead more about how to contribute to the Cape SDK in [CONTRIBUTING](./CONTRIBUTING.md).\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n## License\n\n[Apache 2.0](https://github.com/capeprivacy/cape-js/blob/main/LICENSE)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapeprivacy%2Fcape-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapeprivacy%2Fcape-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapeprivacy%2Fcape-js/lists"}