Closed rianwouters closed 6 years ago
Did some analysis on AWS SDK.
This commit removed the randomBytes function. https://github.com/aws/aws-sdk-js/commit/0638060402931f572f9f75d77a12bd6c529b0424
As util.crypto.lib.randomBytes is not a published AWS SDK interface, I believe the randomBytes function should be separately required by cognito-identity
Addressed this here: https://github.com/aws/amazon-cognito-identity-js/issues/667
This has been solved in the new version 2.0.0 located on NPM and we will continue development of this library as part of AWS Amplfiy https://github.com/aws/aws-amplify/tree/master/packages/amazon-cognito-identity-js
When using AWS SDK > 2.178.0 I get:
TypeError: o.util.crypto.lib.randomBytes is not a function at e.generateRandomSmallA (amazon-cognito-identity.min.js:17) at new e (amazon-cognito-identity.min.js:17) at e.authenticateUser (amazon-cognito-identity.min.js:33)
generateRandomSmallA calls _global.util.crypto.lib.randomBytes(128).toString('hex');
apparently AWS SDK is no longer exposing that function
Seems to work fine with all lower versions.