cognito_identity_credentials.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {Credentials} from '../credentials';
  2. import {AWSError} from '../error';
  3. import {ConfigurationOptions} from '../config-base';
  4. import CognitoIdentity = require('../../clients/cognitoidentity');
  5. import STS = require('../../clients/sts');
  6. export class CognitoIdentityCredentials extends Credentials {
  7. /**
  8. * Creates a new credentials object with optional configuration.
  9. */
  10. constructor(options: CognitoIdentityCredentials.CognitoIdentityOptions, clientConfig?: ConfigurationOptions);
  11. /**
  12. * Creates a new credentials object.
  13. */
  14. constructor(options?: CognitoIdentityCredentials.CognitoIdentityOptions);
  15. /**
  16. * Refreshes credentials using AWS.CognitoIdentity.getCredentialsForIdentity(), or AWS.STS.assumeRoleWithWebIdentity().
  17. */
  18. refresh(callback: (err?: AWSError) => void): void;
  19. /**
  20. * Clears the cached Cognito ID associated with the currently configured identity pool ID.
  21. */
  22. clearCachedId(): void;
  23. /**
  24. * The raw data response from the call to AWS.CognitoIdentity.getCredentialsForIdentity(), or AWS.STS.assumeRoleWithWebIdentity().
  25. */
  26. data: CognitoIdentity.Types.GetCredentialsForIdentityResponse|STS.Types.AssumeRoleWithWebIdentityResponse;
  27. /**
  28. * The Cognito ID returned by the last call to AWS.CognitoIdentity.getOpenIdToken().
  29. */
  30. identityId: string;
  31. /**
  32. * The map of params passed to AWS.CognitoIdentity.getId(), AWS.CognitoIdentity.getOpenIdToken(), and AWS.STS.assumeRoleWithWebIdentity().
  33. */
  34. params: CognitoIdentity.Types.GetIdInput|CognitoIdentity.Types.GetOpenIdTokenInput|STS.Types.AssumeRoleWithWebIdentityRequest;
  35. }
  36. // Needed to expose interfaces on the class
  37. declare namespace CognitoIdentityCredentials {
  38. export type CognitoIdentityCredentialsInputs = CognitoIdentity.GetIdInput|CognitoIdentity.GetCredentialsForIdentityInput|CognitoIdentity.GetOpenIdTokenInput|STS.AssumeRoleWithWebIdentityRequest;
  39. export type CognitoIdentityOptions = CognitoIdentityCredentialsInputs & {LoginId?: string};
  40. export type ClientConfiguration = ConfigurationOptions;
  41. }