{"library":"serverless-tencent-auth-tool","title":"Tencent Cloud Serverless Authentication Utility","description":"This package, `serverless-tencent-auth-tool`, simplifies authentication and credential management for applications deployed on Tencent Cloud's Serverless Framework. It streamlines processes such as automatic login, obtaining Tencent Cloud AppIds, and verifying real-name authentication status, which are critical for operating services within the Chinese cloud ecosystem. As of version 2.0.1, it provides a utility class to interact with Tencent Cloud's authentication mechanisms from within a Serverless environment. While a specific release cadence isn't clearly documented, the version number indicates active development. It serves as a practical tool for developers to integrate Tencent Cloud's strict identity and access management requirements into their serverless applications, differentiating itself by abstracting complex auth flows.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install serverless-tencent-auth-tool"],"cli":null},"imports":["const tencentAuth = require('serverless-tencent-auth-tool');","const auth = new tencentAuth();"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const tencentAuth = require('serverless-tencent-auth-tool');\n\n// In a Serverless Framework context (e.g., within a custom plugin or component):\nasync function authenticateTencentCloud(context) {\n  const auth = new tencentAuth();\n\n  // Mimic Serverless Framework's context object structure for credentials\n  const mockContext = {\n    credentials: {\n      tencent: {\n        SecretId: process.env.TENCENT_SECRET_ID ?? '',\n        SecretKey: process.env.TENCENT_SECRET_KEY ?? '',\n        Token: process.env.TENCENT_TOKEN ?? '' // Optional, for temporary credentials\n      }\n    },\n    // Or if credentials are in instance state (e.g., after initial deployment)\n    instance: {\n      state: {\n        status: {\n          tencent: {\n            SecretId: process.env.TENCENT_SECRET_ID ?? '',\n            SecretKey: process.env.TENCENT_SECRET_KEY ?? ''\n          }\n        }\n      }\n    }\n  };\n\n  // Use provided context or mock if running standalone\n  const actualContext = context || mockContext;\n\n  // Perform authentication and update credentials\n  actualContext.credentials.tencent = actualContext.credentials.tencent\n    ? await auth.doAuth(actualContext.credentials.tencent)\n    : await auth.doAuth(actualContext.instance.state.status.tencent);\n\n  console.log('Tencent Cloud credentials updated:', actualContext.credentials.tencent);\n  return actualContext.credentials.tencent;\n}\n\n// Example usage (replace with your actual Serverless Framework context)\nauthenticateTencentCloud(null).catch(console.error);","lang":"javascript","description":"Demonstrates how to import the `tencentAuth` class, instantiate it, and use `doAuth` to manage Tencent Cloud credentials within a Serverless Framework context, including placeholders for environment variables.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}