Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

firebase-admin

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firebase-admin - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

104

lib/auth/auth-api-request.js

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -18,2 +18,3 @@ "use strict";

'Content-Type': 'application/json',
'X-Client-Version': 'Node/Admin/4.1.1',
};

@@ -138,67 +139,7 @@ /** Firebase Auth request timeout duration in milliseconds. */

/**
* Instantiates the uploadAccount endpoint settings for creating a new user with uid
* specified.
* Instantiates the signupNewUser endpoint settings for creating a new user with or without
* uid being specified. The backend will create a new one if not provided and return it.
*/
exports.FIREBASE_AUTH_UPLOAD_ACCOUNT = new api_request_1.ApiSettings('uploadAccount', 'POST')
.setRequestValidator(function (request) {
var validKeys = {
users: true,
// Required to throw an error when a user already exists with the provided uid.
allowOverwrite: true,
// Required to throw an error if the email is already in use by another account.
sanityCheck: true,
};
// Remove unsupported properties.
for (var key in request) {
if (!(key in validKeys)) {
delete request[key];
}
}
// Required uploadAccount parameter.
if (typeof request.users === 'undefined' ||
request.users == null ||
!request.users.length) {
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Invalid uploadAccount request. No users provider.');
}
// Validate each user within users.
for (var _i = 0, _a = request.users; _i < _a.length; _i++) {
var user = _a[_i];
// localId is a required parameter.
if (typeof user.localId === 'undefined') {
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Server request is missing user identifier');
}
// Validate user.
validateCreateEditRequest(user);
}
})
.setResponseValidator(function (response) {
// Return the first error. UploadAccount is used to upload multiple accounts.
// If an error occurs in any account to be upload, an array of errors is
// returned.
if (typeof response.error !== 'undefined' &&
response.error.length &&
typeof response.error[0].message === 'string') {
// Get error description.
if (response.error[0].message.indexOf('can not overwrite') !== -1) {
// Duplicate user error.
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.UID_ALREADY_EXISTS, response.error[0].message);
}
else if (response.error[0].message.indexOf('email exists') !== -1) {
// Email exists error.
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.EMAIL_ALREADY_EXISTS, response.error[0].message);
}
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: ' + response.error[0].message);
}
});
/**
* Instantiates the signupNewUser endpoint settings for creating a new user without
* uid being specified. The backend will create a new one and return it.
*/
exports.FIREBASE_AUTH_SIGN_UP_NEW_USER = new api_request_1.ApiSettings('signupNewUser', 'POST')
.setRequestValidator(function (request) {
// localId should not be specified.
// This should not occur as when the uid is provided, uploadAccount is used instead.
if (typeof request.localId !== 'undefined') {
throw new error_2.FirebaseAuthError(error_2.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: User identifier must not be specified');
}
validateCreateEditRequest(request);

@@ -329,6 +270,4 @@ })

FirebaseAuthRequestHandler.prototype.createNewAccount = function (properties) {
// Build the signupNewUser/uploadAccount request.
// Build the signupNewUser request.
var request = deep_copy_1.deepCopy(properties);
var finalRequest;
var apiSettings;
// Rewrite photoURL to photoUrl.

@@ -339,34 +278,11 @@ if (typeof request.photoURL !== 'undefined') {

}
// Rewrite uid to localId if it exists.
if (typeof request.uid !== 'undefined') {
request.localId = request.uid;
// If uid specified, use uploadAccount endpoint.
apiSettings = exports.FIREBASE_AUTH_UPLOAD_ACCOUNT;
// This endpoint takes a hashed password.
// To pass a plain text password, pass it via rawPassword field.
if (typeof request.password !== 'undefined') {
request.rawPassword = request.password;
delete request.password;
}
// Construct uploadAccount request.
finalRequest = {
users: [request],
// Do not overwrite existing users.
allowOverwrite: false,
// Do not allow duplicate emails.
// This will force the backend to throw an error when an email is
// already in use by another existing account.
sanityCheck: true,
};
delete request.uid;
}
else {
// If uid not specified, use signupNewUser endpoint.
apiSettings = exports.FIREBASE_AUTH_SIGN_UP_NEW_USER;
finalRequest = request;
}
return this.invokeRequestHandler(apiSettings, finalRequest)
return this.invokeRequestHandler(exports.FIREBASE_AUTH_SIGN_UP_NEW_USER, request)
.then(function (response) {
// Return the user id. It is returned in the setAccountInfo and signupNewUser
// endpoints but not the uploadAccount endpoint. In that case return the same
// one in request.
return (response.localId || request.localId);
// Return the user id.
return response.localId;
});

@@ -373,0 +289,0 @@ };

2

lib/auth/auth.js

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -102,2 +102,6 @@ "use strict";

Certificate.fromPath = function (path) {
// Node bug encountered in v6.x. fs.readFileSync hangs when path is a 0 or 1.
if (typeof path !== 'string') {
throw new Error('Failed to parse certificate key file: TypeError: path must be a string');
}
try {

@@ -104,0 +108,0 @@ return new Certificate(JSON.parse(fs.readFileSync(path, 'utf8')));

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -198,3 +198,3 @@ "use strict";

this.credential = firebaseCredential;
this.SDK_VERSION = '4.1.0';
this.SDK_VERSION = '4.1.1';
/* tslint:disable */

@@ -201,0 +201,0 @@ // TODO(jwenger): Database is the only consumer of firebase.Promise. We should update it to use

@@ -1,3 +0,3 @@

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */
"use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -8,2 +8,4 @@ declare namespace admin {

stack: string;
toJSON(): Object;
}

@@ -40,6 +42,7 @@

interface AppOptions {
credential?: admin.credential.Credential;
databaseAuthVariableOverride?: Object;
databaseURL?: string;
credential?: admin.credential.Credential;
serviceAccount?: string|admin.ServiceAccount;
databaseAuthVariableOverride?: Object;
storageBucket?: string;
}

@@ -268,2 +271,3 @@

collapseKey?: string;
mutableContent?: boolean;
contentAvailable?: boolean;

@@ -270,0 +274,0 @@ restrictedPackageName?: string;

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -16,2 +16,3 @@ "use strict";

'Content-Type': 'application/json',
'Sdk-Version': 'Node/Admin/4.1.1',
access_token_auth: 'true',

@@ -18,0 +19,0 @@ };

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -22,2 +22,3 @@ "use strict";

collapseKey: 'collapse_key',
mutableContent: 'mutable_content',
contentAvailable: 'content_available',

@@ -424,2 +425,7 @@ restrictedPackageName: 'restricted_package_name',

}
else if ('mutable_content' in optionsCopy && !validator.isBoolean(optionsCopy.mutable_content)) {
var keyName = ('mutableContent' in options) ? 'mutableContent' : 'mutable_content';
throw new error_1.FirebaseMessagingError(error_1.MessagingClientErrorCode.INVALID_OPTIONS, "Messaging options contains an invalid value for the \"" + keyName + "\" property. Value must " +
'be a boolean.');
}
return optionsCopy;

@@ -426,0 +432,0 @@ };

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

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

/*! firebase-admin v4.1.0
/*! firebase-admin v4.1.1
https://firebase.google.com/terms/ */

@@ -3,0 +3,0 @@ "use strict";

{
"name": "firebase-admin",
"version": "4.1.0",
"version": "4.1.1",
"dependencies": {

@@ -11,5 +11,5 @@ "@types/jsonwebtoken": {

"@types/node": {
"version": "7.0.4",
"version": "7.0.5",
"from": "@types/node@*",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.4.tgz"
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.5.tgz"
},

@@ -16,0 +16,0 @@ "base64url": {

{
"name": "firebase-admin",
"version": "4.1.0",
"version": "4.1.1",
"description": "Firebase admin SDK for Node.js",

@@ -5,0 +5,0 @@ "author": "Firebase (https://firebase.google.com/)",

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