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

@genezio/auth

Package Overview
Dependencies
Maintainers
5
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@genezio/auth - npm Package Compare versions

Comparing version 2.0.16-dev to 2.0.17-dev

18

lib/authService.sdk.d.ts

@@ -6,3 +6,3 @@ /**

import { Remote } from "genezio-remote";
import { UserLoginResponse, User } from "./models/UserTypes";
import { UserLoginResponse, User, UpdateUserDetailsInput } from "./models/UserTypes";
export interface Storage {

@@ -65,2 +65,4 @@ setItem(key: string, value: string): void;

* @param {string} name The user's name. Optional.
* @param {string} profilePictureUrl The user's profile picture URL. Optional.
* @param {Object} customInfo An object containing custom information about the user. Optional.
*

@@ -79,3 +81,5 @@ * @returns {Promise<UserLoginResponse>} An object containing the user's information.

* */
register(email: string, password: string, name?: string): Promise<UserLoginResponse>;
register(email: string, password: string, name?: string, profilePictureUrl?: string, customInfo?: {
[key: string]: string;
}): Promise<UserLoginResponse>;
/**

@@ -106,2 +110,10 @@ * @method login

/**
* @method updateUserDetails
* @description Updates the user's details.
* @param {string} token - The user's token.
* @param {UpdateUserDetailsInput} input - An object containing the user's new details.
* @returns {Promise<User>} An object containing the user's information.
*/
updateUserDetails(token: string, input: UpdateUserDetailsInput): Promise<User>;
/**
* @method emailConfirmation

@@ -172,3 +184,5 @@ * @description Confirms the user's email address. This method should be called after the user clicks on the link

logout(): Promise<void>;
web3GetNonce(address: string): Promise<string>;
web3Login(address: string, signature: string): Promise<UserLoginResponse>;
}
export { Remote };

@@ -137,2 +137,4 @@ "use strict";

* @param {string} name The user's name. Optional.
* @param {string} profilePictureUrl The user's profile picture URL. Optional.
* @param {Object} customInfo An object containing custom information about the user. Optional.
*

@@ -151,3 +153,3 @@ * @returns {Promise<UserLoginResponse>} An object containing the user's information.

* */
AuthService.prototype.register = function (email, password, name) {
AuthService.prototype.register = function (email, password, name, profilePictureUrl, customInfo) {
return __awaiter(this, void 0, void 0, function () {

@@ -163,3 +165,3 @@ return __generator(this, function (_a) {

}
return [4 /*yield*/, this.remote.call("AuthService.register", email, password, name)];
return [4 /*yield*/, this.remote.call("AuthService.register", email, password, name, profilePictureUrl, customInfo)];
case 1: return [2 /*return*/, _a.sent()];

@@ -231,2 +233,26 @@ }

/**
* @method updateUserDetails
* @description Updates the user's details.
* @param {string} token - The user's token.
* @param {UpdateUserDetailsInput} input - An object containing the user's new details.
* @returns {Promise<User>} An object containing the user's information.
*/
AuthService.prototype.updateUserDetails = function (token, input) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.remote) {
if (this.serverSide) {
throw new Error(AuthService.notLoggedInErrorMessage);
}
throw new Error(AuthService.notInitializedErrorMessage);
}
return [4 /*yield*/, this.remote.call("AuthService.updateUserDetails", token, input)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* @method emailConfirmation

@@ -410,2 +436,30 @@ * @description Confirms the user's email address. This method should be called after the user clicks on the link

};
AuthService.prototype.web3GetNonce = function (address) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.remote.call("AuthService.web3GetNonce", address)];
});
});
};
AuthService.prototype.web3Login = function (address, signature) {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.remote || !this.storage) {
if (this.serverSide) {
throw new Error(AuthService.notLoggedInErrorMessage);
}
throw new Error(AuthService.notInitializedErrorMessage);
}
return [4 /*yield*/, this.remote.call("AuthService.web3Login", address, signature)];
case 1:
response = _a.sent();
this.storage.setItem("token", response.token);
return [2 /*return*/, response];
}
});
});
};
AuthService.notInitializedErrorMessage = "The AuthService class was not initialized. Call AuthService.getInstance().setTokenAndRegion(token, region) with the values provided in genezio dashboard. Check <link> for more information.";

@@ -412,0 +466,0 @@ AuthService.notLoggedInErrorMessage = "You must be logged in to test the Auth Service locally. Please run 'genezio login' to test the Auth Service locally.";

@@ -5,9 +5,21 @@ /**

*/
export type UpdateUserDetailsInput = {
name?: string;
profilePictureUrl?: string;
customInfo?: {
[key: string]: any;
};
};
export type User = {
email: string;
email?: string;
userId: string;
authProvider: string;
createdAt: Date;
verified: boolean;
verified?: boolean;
name?: string;
address?: string;
profilePictureUrl?: string;
customInfo?: {
[key: string]: string;
};
};

@@ -37,3 +49,4 @@ export declare enum ErrorCode {

PASSWORD_MUST_HAVE_AT_LEAST_ONE_UPPERCASE_LETTER = 21,
EMAIL_NOT_VERIFIED = 22
EMAIL_NOT_VERIFIED = 22,
USER_NOT_FOUND = 23
}

@@ -40,0 +53,0 @@ export type UserLoginResponse = {

@@ -33,3 +33,4 @@ "use strict";

ErrorCode[ErrorCode["EMAIL_NOT_VERIFIED"] = 22] = "EMAIL_NOT_VERIFIED";
ErrorCode[ErrorCode["USER_NOT_FOUND"] = 23] = "USER_NOT_FOUND";
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
;

2

package.json
{
"name": "@genezio/auth",
"version": "2.0.16-dev",
"version": "2.0.17-dev",
"description": "SDK for accessing genezio authentication system.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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