Socket
Socket
Sign inDemoInstall

amazon-cognito-identity-js

Package Overview
Dependencies
Maintainers
13
Versions
1619
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amazon-cognito-identity-js - npm Package Compare versions

Comparing version 6.3.2-unstable.4d389da.18 to 6.3.2-unstable.50675e7.0

src/internals/InternalCognitoUser.js

22

__tests__/CognitoUser.test.js

@@ -206,3 +206,3 @@ import CognitoUser from '../src/CognitoUser';

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);
});

@@ -216,3 +216,3 @@

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);

@@ -222,3 +222,3 @@ user.setAuthenticationFlowType('CUSTOM_AUTH');

expect(spyon).toHaveBeenCalledWith(authDetails, callback);
expect(spyon).toHaveBeenCalledWith(authDetails, callback, undefined);
});

@@ -316,3 +316,4 @@

userSpy3.mock.calls[0][1],
callback
callback,
undefined
);

@@ -762,3 +763,4 @@ expect(userSpy3.mock.results[0].value).toBe('test return value');

expect.any(AuthenticationHelper),
callback
callback,
undefined
);

@@ -1184,3 +1186,3 @@ });

test('happy path should callback onSuccess', () => {
test('confirmPassword happy path should callback onSuccess', () => {
netRequestMockSuccess(true);

@@ -1191,3 +1193,3 @@ cognitoUser.confirmPassword(...confirmPasswordDefaults);

test('client request throws an error', () => {
test('confirmPassword client request throws an error', () => {
netRequestMockSuccess(false);

@@ -1198,3 +1200,3 @@ cognitoUser.confirmPassword(...confirmPasswordDefaults);

test('happy path should callback onSuccess', () => {
test('forgotPassword happy path should callback onSuccess', () => {
callback.inputVerificationCode = null;

@@ -1206,3 +1208,3 @@ netRequestMockSuccess(true);

test('inputVerification code is a function should callback inputVerificationCode', () => {
test('forgotPassword inputVerification code is a function should callback inputVerificationCode', () => {
callback.inputVerificationCode = jest.fn();

@@ -1214,3 +1216,3 @@ netRequestMockSuccess(true);

test('client returning an error should call onFailure', () => {
test('forgotPassword client returning an error should call onFailure', () => {
netRequestMockSuccess(false);

@@ -1217,0 +1219,0 @@ cognitoUser.forgotPassword(...forgotPasswordDefaults);

@@ -9,2 +9,3 @@ import * as exported from '../src/internals/index';

"addFrameworkToCognitoUserAgent",
"InternalCognitoUser",
]

@@ -11,0 +12,0 @@ `);

@@ -0,1 +1,2 @@

import { InternalCognitoUser } from './internals';
declare module 'amazon-cognito-identity-js' {

@@ -92,15 +93,3 @@ //import * as AWS from "aws-sdk";

export class CognitoUser {
constructor(data: ICognitoUserData);
challengeName?: ChallengeName;
public setSignInUserSession(signInUserSession: CognitoUserSession): void;
public getSignInUserSession(): CognitoUserSession | null;
public getUsername(): string;
public getAuthenticationFlowType(): string;
public setAuthenticationFlowType(authenticationFlowType: string): string;
public getCachedDeviceKeyAndPassword(): void;
export class CognitoUser extends InternalCognitoUser {
public getSession(

@@ -107,0 +96,0 @@ callback:

@@ -0,2 +1,268 @@

import {
NodeCallback,
UpdateAttributesNodeCallback,
ClientMetadata,
IAuthenticationCallback,
IMfaSettings,
AuthenticationDetails,
ICognitoUserData,
GetSessionOptions,
ChallengeName,
CognitoUserSession,
CognitoRefreshToken,
CognitoUserAttribute,
ICognitoUserAttributeData,
MFAOption,
UserData,
} from 'amazon-cognito-identity-js';
export const addAuthCategoryToCognitoUserAgent: () => void;
export const addFrameworkToCognitoUserAgent: (content: string) => void;
export class InternalCognitoUser {
constructor(data: ICognitoUserData);
challengeName?: ChallengeName;
public setSignInUserSession(signInUserSession: CognitoUserSession): void;
public getSignInUserSession(): CognitoUserSession | null;
public getUsername(): string;
public getAuthenticationFlowType(): string;
public setAuthenticationFlowType(authenticationFlowType: string): string;
public getCachedDeviceKeyAndPassword(): void;
public getSession(
callback:
| ((error: Error, session: null) => void)
| ((error: null, session: CognitoUserSession) => void),
options?: GetSessionOptions,
userAgentValue?: string
): void;
public refreshSession(
refreshToken: CognitoRefreshToken,
callback: NodeCallback<any, any>,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public authenticateUser(
authenticationDetails: AuthenticationDetails,
callbacks: IAuthenticationCallback,
userAgentValue?: string
): void;
public initiateAuth(
authenticationDetails: AuthenticationDetails,
callbacks: IAuthenticationCallback,
userAgentValue?: string
): void;
public confirmRegistration(
code: string,
forceAliasCreation: boolean,
callback: NodeCallback<any, any>,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public sendCustomChallengeAnswer(
answerChallenge: any,
callback: IAuthenticationCallback,
clientMetaData?: ClientMetadata,
userAgentValue?: string
): void;
public resendConfirmationCode(
callback: NodeCallback<Error, any>,
clientMetaData?: ClientMetadata,
userAgentValue?: string
): void;
public changePassword(
oldPassword: string,
newPassword: string,
callback: NodeCallback<Error, 'SUCCESS'>,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public forgotPassword(
callbacks: {
onSuccess: (data: any) => void;
onFailure: (err: Error) => void;
inputVerificationCode?: (data: any) => void;
},
clientMetaData?: ClientMetadata,
userAgentValue?: string
): void;
public confirmPassword(
verificationCode: string,
newPassword: string,
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
},
clientMetaData?: ClientMetadata,
userAgentValue?: string
): void;
public setDeviceStatusRemembered(
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: any) => void;
},
userAgentValue?: string
): void;
public setDeviceStatusNotRemembered(
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: any) => void;
},
userAgentValue?: string
): void;
public getDevice(
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): any;
public forgetDevice(
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public forgetSpecificDevice(
deviceKey: string,
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public sendMFACode(
confirmationCode: string,
callbacks: {
onSuccess: (
session: CognitoUserSession,
userConfirmationNecessary?: boolean
) => void;
onFailure: (err: any) => void;
},
mfaType?: string,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public listDevices(
limit: number,
paginationToken: string | null,
callbacks: {
onSuccess: (data: any) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public completeNewPasswordChallenge(
newPassword: string,
requiredAttributeData: any,
callbacks: IAuthenticationCallback,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public signOut(callback?: () => void, userAgentValue?: string): void;
public globalSignOut(
callbacks: {
onSuccess: (msg: string) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public verifyAttribute(
attributeName: string,
confirmationCode: string,
callbacks: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public getUserAttributes(
callback: NodeCallback<Error, CognitoUserAttribute[]>,
userAgentValue?: string
): void;
public updateAttributes(
attributes: (CognitoUserAttribute | ICognitoUserAttributeData)[],
callback: UpdateAttributesNodeCallback<Error, string, any>,
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public deleteAttributes(
attributeList: string[],
callback: NodeCallback<Error, string>,
userAgentValue?: string
): void;
public getAttributeVerificationCode(
name: string,
callback: {
onSuccess: (success: string) => void;
onFailure: (err: Error) => void;
inputVerificationCode?: (data: string) => void | null;
},
clientMetadata?: ClientMetadata,
userAgentValue?: string
): void;
public deleteUser(
callback: NodeCallback<Error, string>,
userAgentValue?: string
): void;
public enableMFA(
callback: NodeCallback<Error, string>,
userAgentValue?: string
): void;
public disableMFA(
callback: NodeCallback<Error, string>,
userAgentValue?: string
): void;
public getMFAOptions(
callback: NodeCallback<Error, MFAOption[]>,
userAgentValue?: string
): void;
public getUserData(
callback: NodeCallback<Error, UserData>,
params?: any,
userAgentValue?: string
): void;
public associateSoftwareToken(
callbacks: {
associateSecretCode: (secretCode: string) => void;
onFailure: (err: any) => void;
},
userAgentValue?: string
): void;
public verifySoftwareToken(
totpCode: string,
friendlyDeviceName: string,
callbacks: {
onSuccess: (session: CognitoUserSession) => void;
onFailure: (err: Error) => void;
},
userAgentValue?: string
): void;
public setUserMfaPreference(
smsMfaSettings: IMfaSettings | null,
softwareTokenMfaSettings: IMfaSettings | null,
callback: NodeCallback<Error, string>,
userAgentValue?: string
): void;
public sendMFASelectionAnswer(
answerChallenge: string,
callbacks: {
onSuccess: (session: CognitoUserSession) => void;
onFailure: (err: any) => void;
mfaRequired?: (
challengeName: ChallengeName,
challengeParameters: any
) => void;
totpRequired?: (
challengeName: ChallengeName,
challengeParameters: any
) => void;
},
userAgentValue?: string
): void;
}
{
"name": "amazon-cognito-identity-js",
"description": "Amazon Cognito Identity Provider JavaScript SDK",
"version": "6.3.2-unstable.4d389da.18+4d389da22",
"version": "6.3.2-unstable.50675e7.0+50675e7",
"author": {

@@ -46,3 +46,2 @@ "name": "Amazon Web Services",

"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:umd",
"doc": "jsdoc src -d docs",
"generate-version": "genversion src/Platform/version.ts --es6 --semi",

@@ -78,3 +77,3 @@ "lint": "eslint src",

"@babel/preset-react": "^7.0.0",
"@react-native-async-storage/async-storage": "1.15.17",
"@react-native-async-storage/async-storage": "^1.17.12",
"babel-loader": "^8.0.6",

@@ -91,3 +90,2 @@ "cross-env": "^3.1.4",

"genversion": "^2.2.0",
"jsdoc": "3.4.0",
"react": "^16.0.0",

@@ -98,3 +96,3 @@ "rimraf": "^2.5.4",

},
"gitHead": "4d389da22c9f39d5a5d7cd6df9116327a9d6a04e"
"gitHead": "50675e72606af5503b08b96f051d82afe0d936fe"
}

@@ -35,17 +35,22 @@ import 'isomorphic-unfetch';

*/
promisifyRequest(operation, params) {
promisifyRequest(operation, params, userAgentValue) {
return new Promise((resolve, reject) => {
this.request(operation, params, (err, data) => {
if (err) {
reject(
new CognitoError(err.message, err.code, err.name, err.statusCode)
);
} else {
resolve(data);
}
});
this.request(
operation,
params,
(err, data) => {
if (err) {
reject(
new CognitoError(err.message, err.code, err.name, err.statusCode)
);
} else {
resolve(data);
}
},
userAgentValue
);
});
}
requestWithRetry(operation, params, callback) {
requestWithRetry(operation, params, callback, userAgentValue) {
const MAX_DELAY_IN_MILLIS = 5 * 1000;

@@ -56,9 +61,14 @@

new Promise((res, rej) => {
this.request(operation, p, (error, result) => {
if (error) {
rej(error);
} else {
res(result);
}
});
this.request(
operation,
p,
(error, result) => {
if (error) {
rej(error);
} else {
res(result);
}
},
userAgentValue
);
}),

@@ -80,7 +90,7 @@ [params],

*/
request(operation, params, callback) {
request(operation, params, callback, userAgentValue) {
const headers = {
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': `AWSCognitoIdentityProviderService.${operation}`,
'X-Amz-User-Agent': getAmplifyUserAgent(),
'X-Amz-User-Agent': userAgentValue || getAmplifyUserAgent(),
'Cache-Control': 'no-store',

@@ -87,0 +97,0 @@ };

@@ -5,1 +5,3 @@ export {

} from '../UserAgent';
export { InternalCognitoUser } from './InternalCognitoUser';

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc