{"id":18237499,"url":"https://github.com/Crittora/qripton-sdk-js","last_synced_at":"2025-04-04T05:33:33.488Z","repository":{"id":260937724,"uuid":"882768514","full_name":"Crittora/crittora-sdk-js","owner":"Crittora","description":"A secure SDK for data encryption, decryption, and digital signatures using AWS Cognito authentication. Provides enterprise-grade cryptographic operations with simple API integration.","archived":false,"fork":false,"pushed_at":"2024-11-03T18:00:16.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-03T18:30:29.941Z","etag":null,"topics":["api-client","authentication","aws-cognito","cryptography","data-encryption","decryption","digital-signature","encryption","enterprise-security","node-js","npm-package","sdk","security","typescript"],"latest_commit_sha":null,"homepage":"https://www.crittora.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Crittora.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-11-03T17:57:06.000Z","updated_at":"2024-11-03T18:04:48.000Z","dependencies_parsed_at":"2024-11-03T18:40:39.075Z","dependency_job_id":null,"html_url":"https://github.com/Crittora/crittora-sdk-js","commit_stats":null,"previous_names":["crittora/crittora-sdk-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crittora%2Fcrittora-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crittora%2Fcrittora-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crittora%2Fcrittora-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crittora%2Fcrittora-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Crittora","download_url":"https://codeload.github.com/Crittora/crittora-sdk-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223100261,"owners_count":17087388,"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":["api-client","authentication","aws-cognito","cryptography","data-encryption","decryption","digital-signature","encryption","enterprise-security","node-js","npm-package","sdk","security","typescript"],"created_at":"2024-11-05T02:04:49.197Z","updated_at":"2025-04-04T05:33:28.172Z","avatar_url":"https://github.com/Crittora.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crittora SDK\n\nCrittora SDK provides secure methods for encrypting, decrypting, signing, verifying, and combining these operations on data. It uses AWS Cognito for authentication and the Fetch API for HTTP requests.\n\n## Table of Contents\n\n- [Crittora SDK](#crittora-sdk)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n    - [Environment Variables](#environment-variables)\n    - [Environment Configuration](#environment-configuration)\n  - [Usage](#usage)\n    - [Authentication](#authentication)\n    - [Encryption](#encryption)\n    - [Decryption](#decryption)\n    - [Decrypt-Verify](#decrypt-verify)\n  - [Demo Project](#demo-project)\n  - [Error Handling](#error-handling)\n  - [Types](#types)\n  - [Contributing](#contributing)\n  - [License](#license)\n\n## Installation\n\nTo install the Crittora SDK, run:\n\n```bash\nnpm install @wutif/crittora\n```\n\n## Configuration\n\n### Environment Variables\n\n```dotenv\n# Required API keys\nAPI_KEY=your_api_key\nACCESS_KEY=your_access_key\nSECRET_KEY=your_secret_key\n```\n\n### Environment Configuration\n\nThe SDK currently uses the following configuration:\n\n- Cognito Endpoint: https://cognito-idp.us-east-1.amazonaws.com/\n- Base URL: https://api.crittoraapis.com\n- User Pool ID: us-east-1_Tmljk4Uiw\n- Client ID: 5cvaao4qgphfp38g433vi5e82u\n\nTo use different configuration values, you can set them via environment variables (coming soon).\n\n## Usage\n\n### Authentication\n\n```typescript\nimport { Crittora } from \"@wutif/crittora\";\n\nconst crittora = new Crittora();\n\nconst username = \"your_username\";\nconst password = \"your_password\";\n\ncrittora\n  .authenticate(username, password)\n  .then((response) =\u003e {\n    console.log(\"Authentication successful\");\n    // Store these tokens securely\n    const { IdToken, AccessToken, RefreshToken } = response;\n  })\n  .catch((error) =\u003e {\n    console.error(\"Authentication failed:\", error);\n  });\n```\n\n### Encryption\n\n```typescript\nconst idToken = \"your_id_token\"; // from authentication\nconst data = \"sensitive data\";\nconst permissions = [\"permission1\", \"permission2\"]; // optional\n\ncrittora\n  .encrypt(idToken, data, permissions)\n  .then((encryptedData) =\u003e {\n    console.log(\"Encrypted data:\", encryptedData);\n  })\n  .catch((error) =\u003e {\n    console.error(\"Encryption failed:\", error);\n  });\n```\n\n### Decryption\n\n```typescript\nconst idToken = \"your_id_token\"; // from authentication\nconst encryptedData = \"encrypted_string\";\nconst permissions = [\"permission1\", \"permission2\"]; // optional\n\ncrittora\n  .decrypt(idToken, encryptedData, permissions)\n  .then((decryptedData) =\u003e {\n    console.log(\"Decrypted data:\", decryptedData);\n  })\n  .catch((error) =\u003e {\n    console.error(\"Decryption failed:\", error);\n  });\n```\n\n### Decrypt-Verify\n\n```typescript\nconst idToken = \"your_id_token\"; // from authentication\nconst encryptedData = \"encrypted_string\";\nconst permissions = [\"permission1\", \"permission2\"]; // optional\n\ncrittora\n  .decryptVerify(idToken, encryptedData, permissions)\n  .then((response) =\u003e {\n    console.log(\"Decrypted data:\", response.decrypted_data);\n    console.log(\"Signature valid:\", response.is_valid_signature);\n  })\n  .catch((error) =\u003e {\n    console.error(\"Decrypt-verify failed:\", error);\n  });\n```\n\n## Demo Project\n\nFor a complete implementation example, check out our [demo project](https://github.com/Crittora/crittora-demo). This project demonstrates:\n\n- Authentication with AWS Cognito\n- Environment variable management\n- Integration with Crittora's encryption services\n- Basic API endpoints for encryption/decryption\n- Frontend implementation examples\n\nThe demo includes a full web application structure:\n\n```\ncrittora-demo/\n├── public/\n│   ├── css/\n│   ├── js/\n│   └── index.html\n├── test.js\n├── server.js\n├── .env\n└── package.json\n```\n\nTo get started with the demo:\n\n```bash\ngit clone https://github.com/Crittora/crittora-demo.git\ncd crittora-demo\nnpm install\n```\n\nConfigure your environment variables and run:\n\n```bash\nnpm start\n```\n\n## Error Handling\n\nThe SDK provides specific error types for different scenarios:\n\n```typescript\n// Base error type\nCrittoraError: General SDK errors with code and status\n\n// Specific error types\nAuthenticationError: Authentication-related failures\nEncryptionError: Encryption operation failures\nDecryptionError: Decryption operation failures\n```\n\nExample error handling:\n\n```typescript\ntry {\n  await crittora.encrypt(idToken, data);\n} catch (error) {\n  if (error instanceof AuthenticationError) {\n    // Handle authentication issues\n  } else if (error instanceof EncryptionError) {\n    // Handle encryption failures\n  } else {\n    // Handle other errors\n  }\n}\n```\n\n## Types\n\nThe SDK exports the following TypeScript interfaces:\n\n```typescript\n// Authentication\ninterface AuthResponse {\n  IdToken: string;\n  AccessToken: string;\n  RefreshToken: string;\n}\n\n// Configuration\ninterface CrittoraConfig {\n  cognito_endpoint?: string;\n  base_url?: string;\n  user_pool_id?: string;\n  client_id?: string;\n}\n\n// Operations\ninterface EncryptResponse {\n  encrypted_data: string;\n}\n\ninterface DecryptResponse {\n  decrypted_data: string;\n}\n\ninterface DecryptVerifyResponse {\n  decrypted_data: string;\n  is_valid_signature: boolean;\n}\n\n// Permissions\ninterface Permission {\n  partner_id: string;\n  permissions: string[];\n}\n\n// Parameters\ninterface BaseParams {\n  data: string;\n  requested_actions: string[];\n  permissions?: Permission[];\n}\n\ninterface DecryptParams {\n  encrypted_data: string;\n  transactionId?: string;\n  requested_actions?: string[];\n}\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any bugs or features.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCrittora%2Fqripton-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCrittora%2Fqripton-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCrittora%2Fqripton-sdk-js/lists"}