{"versions":{"1.0.0":{"name":"@aws/bedrock-token-generator","version":"1.0.0","description":"A lightweight library for generating short-term bearer tokens for AWS Bedrock API authentication","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build","lint":"eslint src/**/*.ts","format":"prettier --write src/**/*.ts"},"keywords":["aws","bedrock","bearer-token","authentication","amazon","token-generator"],"author":{"name":"Amazon Web Services","email":"bedrock-token-generator@amazon.com"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/aws/aws-bedrock-token-generator-js.git"},"homepage":"https://github.com/aws/aws-bedrock-token-generator-js#readme","bugs":{"url":"https://github.com/aws/aws-bedrock-token-generator-js/issues"},"dependencies":{"@aws-sdk/util-format-url":">=3.525.0","@smithy/hash-node":">=2.1.3","@smithy/protocol-http":">=3.2.1","@smithy/signature-v4":">=2.1.3","@smithy/types":">=2.11.0"},"devDependencies":{"@types/jest":"^29.5.5","@types/node":"^20.6.0","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","eslint":"^8.49.0","jest":"^29.7.0","prettier":"^3.0.3","ts-jest":"^29.1.1","typescript":"^5.2.2"},"engines":{"node":">=16.0.0"},"_id":"@aws/bedrock-token-generator@1.0.0","gitHead":"c874c02050ccb0d084b777cb0bdf657ea0297e46","_nodeVersion":"18.20.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-VJTWZTMU6IP4Ae/LkppkpMggur4Qhr4/uFTX3Ee64ixQ2IIQYTuxlcZl3OJ6evjhCZ5hY+fbOlatJ7eGaj6/ww==","shasum":"b713d736c1fc3368e2a8959c1c5d602b0ba2ee61","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@aws/bedrock-token-generator/-/bedrock-token-generator-1.0.0.tgz","fileCount":12,"unpackedSize":25727,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQChpEaVKrB9W3FtqrJZDmqKFAm8mt+hxuYRVhSkadN0qAIhAIhDnpc8FNE44SMOsZgAln+HA6yTqEMC5R5uQCpivM0v"}],"size":8628},"_npmUser":{"name":"anonymous","email":"bedrock-token-generator@amazon.com","actor":{"name":"aws-bedrock-token-generator","email":"bedrock-token-generator@amazon.com","type":"user"}},"directories":{},"maintainers":[{"name":"anonymous","email":"bedrock-token-generator@amazon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bedrock-token-generator_1.0.0_1751337487368_0.9824211420700661"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-07-01T02:38:07.562Z","publish_time":1751337487562,"_source_registry_name":"default","contributors":[]},"1.1.0":{"name":"@aws/bedrock-token-generator","version":"1.1.0","description":"A lightweight library for generating short-term bearer tokens for AWS Bedrock API authentication","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build","lint":"eslint src/**/*.ts","format":"prettier --write src/**/*.ts","docs":"typedoc --options typedoc.json","postbuild":"npm run docs"},"keywords":["aws","bedrock","bearer-token","authentication","amazon","token-generator"],"author":{"name":"Amazon Web Services","email":"bedrock-token-generator@amazon.com"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/aws/aws-bedrock-token-generator-js.git"},"homepage":"https://github.com/aws/aws-bedrock-token-generator-js#readme","bugs":{"url":"https://github.com/aws/aws-bedrock-token-generator-js/issues"},"browser":{"./dist/runtimeConfig":"./dist/runtimeConfig.browser"},"dependencies":{"@aws-sdk/credential-providers":"^3.525.0","@aws-sdk/util-format-url":">=3.525.0","@smithy/config-resolver":"^4.1.4","@smithy/hash-node":">=2.1.3","@smithy/invalid-dependency":"^4.0.4","@smithy/node-config-provider":"^4.1.3","@smithy/protocol-http":">=3.2.1","@smithy/signature-v4":">=2.1.3","@smithy/types":">=2.11.0"},"devDependencies":{"@types/jest":"^29.5.5","@types/node":"^20.6.0","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","eslint":"^8.49.0","jest":"^29.7.0","prettier":"^3.0.3","ts-jest":"^29.1.1","typedoc":"^0.28.7","typedoc-plugin-markdown":"^4.7.0","typescript":"^5.2.2"},"engines":{"node":">=16.0.0"},"_id":"@aws/bedrock-token-generator@1.1.0","gitHead":"86277e1489354192c64ffc8f995601daacc1f715","_nodeVersion":"18.20.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-i+DkWnfdA4j4sffy9dI4k3OGoOWqN8CTGdtO4IZ3c0kpKYFr6KyqzqLQmoRNrF3ACFcWj6u+J6cbBQ97j9wx5w==","shasum":"412c776e990f14d406d9c90f5cbdd7f710d24373","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@aws/bedrock-token-generator/-/bedrock-token-generator-1.1.0.tgz","fileCount":60,"unpackedSize":97009,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBuA4KSxKC57lsjnX+7mdKI4EzeKqCyZz0dykUdc0b0JAiEA3VTuoA3T+pRtt5UnRw3avP/awln0niCdTPVTHlk+Jkk="}],"size":20204},"_npmUser":{"name":"anonymous","email":"bedrock-token-generator@amazon.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"bedrock-token-generator@amazon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bedrock-token-generator_1.1.0_1753383509168_0.6876163901590326"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-07-24T18:58:29.391Z","publish_time":1753383509391,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"1.1.0"},"name":"@aws/bedrock-token-generator","time":{"created":"2025-07-01T02:38:23.701Z","modified":"2025-07-24T18:58:49.810Z","1.0.0":"2025-07-01T02:38:07.562Z","1.1.0":"2025-07-24T18:58:29.391Z"},"readme":"# AWS Bedrock Token Generator for JavaScript/TypeScript\n\n[![npm version](https://badge.fury.io/js/aws-bedrock-token-generator.svg)](https://badge.fury.io/js/aws-bedrock-token-generator)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)\n[![Node.js Version](https://img.shields.io/node/v/aws-bedrock-token-generator.svg)](https://nodejs.org/)\n\nA lightweight library for generating short-term bearer tokens for AWS Bedrock API authentication.\n\n## Features\n\n- ✅ **Simple API**: Async functions that generate bearer tokens\n- ✅ **Secure**: Uses AWS SigV4 signing with configurable token expiration (up to 12 hours)\n- ✅ **AWS SDK Integration**: Seamlessly works with AWS credential providers\n- ✅ **Lightweight**: Minimal dependencies, focused functionality\n- ✅ **Well-tested**: Comprehensive unit tests with multiple scenarios\n- ✅ **TypeScript**: Full type definitions for better IDE experience\n\n## Installation\n\n```bash\nnpm install @aws/bedrock-token-generator\n```\n\n## Quick Start\n\n### Using Token Provider with Default Credential and Region Provider\n\n```typescript\nimport { getTokenProvider } from \"@aws/bedrock-token-generator\";\n\n// Create a token provider that uses default credentials and region providers.\n// You can configure it to use other credential providers.\nconst provideToken = getTokenProvider();\n\nasync function example() {\n    \n  const token = await provideToken();\n\n  // Use the token for API calls. The token has a default expiration of 12 hour.\n  // If the expiresInSeconds parameter is specified during token creation, the \n  // expiration can be configured up to a maximum of 12 hours. However, the actual \n  // token validity period will always be the minimum of the requested expiration \n  // time and the AWS credentials' expiry time\n  console.log(`Bearer Token: ${token}`);\n}\n```\n\n### Using Token Provider with Credential Provider and Region\n\nYou can find the supported credentials provider [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/).\n\n```typescript\nimport { getTokenProvider } from \"@aws/bedrock-token-generator\";\nimport { fromTemporaryCredentials } from \"@aws-sdk/credential-providers\";\n\nconst provideToken = getTokenProvider({\n  credentials: fromTemporaryCredentials({\n    params: {\n      RoleArn: \"arn:aws:iam::123456789012:role/BedrockRole\",\n    },\n  }),\n  region: \"us-east-1\",\n});\n\nasync function example() {\n    \n  const token = await provideToken();\n\n  // Use the token for API calls. The token has a default expiration of 12 hour.\n  // If the expiresInSeconds parameter is specified during token creation, the \n  // expiration can be configured up to a maximum of 12 hours. However, the actual \n  // token validity period will always be the minimum of the requested expiration \n  // time and the AWS credentials' expiry time\n  console.log(`Bearer Token: ${token}`);\n}\n```\n\n### Using Token Provider with Specific Credentials, Region and Expiry\n\n```typescript\nimport { getTokenProvider } from \"@aws/bedrock-token-generator\";\n\nconst credentials = {\n  accessKeyId: \"YOUR_ACCESS_KEY_ID\",\n  secretAccessKey: \"YOUR_SECRET_ACCESS_KEY\",\n  sessionToken: \"YOUR_SESSION_TOKEN\",\n};\n\nconst provideToken = getTokenProvider({\n  credentials,\n  region: \"us-east-1\",\n  expiresInSeconds: 7200,\n});\n\nasync function example() {\n  const token = await provideToken();\n\n  // Use the token for API calls. The token has an expiration of 2 hour. However, the actual token validity period\n  // will always be the minimum of the requested expiration time and the AWS credentials' expiry time\n  console.log(`Bearer Token: ${token}`);\n}\n```\n\n### Using Stateless Function with Specific Credentials, Region and Expiry\n\n```typescript\nimport { getToken } from \"@aws/bedrock-token-generator\";\n\nasync function example() {\n  const credentials = {\n    accessKeyId: \"YOUR_ACCESS_KEY_ID\",\n    secretAccessKey: \"YOUR_SECRET_ACCESS_KEY\",\n    sessionToken: \"YOUR_SESSION_TOKEN\",\n  };\n\n  const token = await getToken({\n    credentials,\n    region: \"us-east-1\",\n    expiresInSeconds: 7200,\n  });\n\n  // Use the token for API calls. The token has an expiration of 2 hour. However, the actual token validity period\n  // will always be the minimum of the requested expiration time and the AWS credentials' expiry time\n  console.log(`Bearer Token: ${token}`);\n}\n```\n\n## API Reference\n\n- [API Reference](apidocs/README.md) - Detailed API documentation\n\n## Token Format\n\nThe generated tokens follow this format:\n\n```\nbedrock-api-key-<base64-encoded-presigned-url>&Version=1\n```\n\n- **Prefix**: `bedrock-api-key-` identifies the token type\n- **Payload**: Base64-encoded presigned URL with embedded credentials\n- **Version**: `&Version=1` for future compatibility\n- **Expiration**: The token has a default expiration of 12 hour. If the expiresInSeconds parameter is specified during token creation, the expiration can be configured up to a maximum of 12 hours. However, the actual token validity period will always\n  be the minimum of the requested expiration time and the AWS credentials' expiry time.\n\n## Security Considerations\n\n- **Token Expiration**: The token has a default expiration of 12 hour. If the expiresInSeconds parameter is specified during token creation, the expiration can be configured up to a maximum of 12 hours. However, the actual token validity period will always\n  be the minimum of the requested expiration time and the AWS credentials' expiry time. The token must be generated again once it expires,\n  as it cannot be refreshed or extended.\n- **Secure Storage**: Store tokens securely and avoid logging them\n- **Credential Management**: Use IAM roles and temporary credentials when possible\n- **Network Security**: Always use HTTPS when transmitting tokens\n- **Principle of Least Privilege**: Ensure underlying credentials have minimal required permissions\n\n## Requirements\n\n- **Node.js**: 16.0.0 or later\n- **TypeScript**: 4.7.0 or later (for TypeScript users)\n\n## Development\n\n### Setting up Development Environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/aws/aws-bedrock-token-generator-js.git\ncd aws-bedrock-token-generator-js\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test\n```\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run linter\nnpm run lint\n\n# Format code\nnpm run format\n```\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n### Development Workflow\n\n1. **Fork the repository**\n2. **Create a feature branch**: `git checkout -b feature-name`\n3. **Make changes and add tests**\n4. **Run tests**: `npm test`\n5. **Format code**: `npm run format`\n6. **Submit a pull request**\n\n## Support\n\n- **Documentation**: [AWS Bedrock Documentation](https://docs.aws.amazon.com/bedrock/)\n- **Issues**: [GitHub Issues](https://github.com/aws/aws-bedrock-token-generator-js/issues)\n- **AWS Support**: [AWS Support Center](https://console.aws.amazon.com/support/)\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- [AWS SDK for JavaScript](https://github.com/aws/aws-sdk-js-v3)\n- [AWS Bedrock Token Generator for Java](https://github.com/aws/aws-bedrock-token-generator-java)\n- [AWS Bedrock Token Generator for Python](https://github.com/aws/aws-bedrock-token-generator-python)\n- [AWS Bedrock Documentation](https://docs.aws.amazon.com/bedrock/)\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.","users":{}}