File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
packages/credential-provider-cognito-identity/src Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { GetCredentialsForIdentityCommand } from "@aws-sdk/client-cognito-identity" ;
2
2
import { ProviderError } from "@aws-sdk/property-provider" ;
3
- import { CredentialProvider , Credentials } from "@aws-sdk/types" ;
3
+ import { Credentials , Provider } from "@aws-sdk/types" ;
4
4
5
5
import { CognitoProviderParameters } from "./CognitoProviderParameters" ;
6
6
import { resolveLogins } from "./resolveLogins" ;
@@ -12,13 +12,15 @@ export interface CognitoIdentityCredentials extends Credentials {
12
12
identityId : string ;
13
13
}
14
14
15
+ export type CognitoIdentityCredentialProvider = Provider < CognitoIdentityCredentials > ;
16
+
15
17
/**
16
18
* Retrieves temporary AWS credentials using Amazon Cognito's
17
19
* `GetCredentialsForIdentity` operation.
18
20
*
19
21
* Results from this function call are not cached internally.
20
22
*/
21
- export function fromCognitoIdentity ( parameters : FromCognitoIdentityParameters ) : CredentialProvider {
23
+ export function fromCognitoIdentity ( parameters : FromCognitoIdentityParameters ) : CognitoIdentityCredentialProvider {
22
24
return async ( ) : Promise < CognitoIdentityCredentials > => {
23
25
const {
24
26
Credentials : {
Original file line number Diff line number Diff line change 1
1
import { GetIdCommand } from "@aws-sdk/client-cognito-identity" ;
2
2
import { ProviderError } from "@aws-sdk/property-provider" ;
3
- import { CredentialProvider } from "@aws-sdk/types" ;
4
3
5
4
import { CognitoProviderParameters } from "./CognitoProviderParameters" ;
6
- import { fromCognitoIdentity } from "./fromCognitoIdentity" ;
5
+ import { CognitoIdentityCredentialProvider , fromCognitoIdentity } from "./fromCognitoIdentity" ;
7
6
import { localStorage } from "./localStorage" ;
8
7
import { resolveLogins } from "./resolveLogins" ;
9
8
import { Storage } from "./Storage" ;
@@ -24,10 +23,10 @@ export function fromCognitoIdentityPool({
24
23
identityPoolId,
25
24
logins,
26
25
userIdentifier = ! logins || Object . keys ( logins ) . length === 0 ? "ANONYMOUS" : undefined ,
27
- } : FromCognitoIdentityPoolParameters ) : CredentialProvider {
26
+ } : FromCognitoIdentityPoolParameters ) : CognitoIdentityCredentialProvider {
28
27
const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${ identityPoolId } :${ userIdentifier } ` : undefined ;
29
28
30
- let provider : CredentialProvider = async ( ) => {
29
+ let provider : CognitoIdentityCredentialProvider = async ( ) => {
31
30
let identityId = cacheKey && ( await cache . getItem ( cacheKey ) ) ;
32
31
if ( ! identityId ) {
33
32
const { IdentityId = throwOnMissingId ( ) } = await client . send (
You can’t perform that action at this time.
0 commit comments