@brightnkhoma/auth 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signIn.d.ts","sourceRoot":"","sources":["../../../src/authentication/aggregates/signIn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD,qBAAa,MAAO,SAAQ,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAG,MAAM,EAE1C;IACD,SAAS,
|
|
1
|
+
{"version":3,"file":"signIn.d.ts","sourceRoot":"","sources":["../../../src/authentication/aggregates/signIn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD,qBAAa,MAAO,SAAQ,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAG,MAAM,EAE1C;IACD,SAAS,WAMR;IACK,iBAAiB,mBAYtB;IACK,OAAO,mBAEZ;IAGD,MAAM,CAAC,QAAQ,UACY,OAAO,OAAQ,QAAQ,mBAcjD;IACD,MAAM,CAAC,EAAE,UACkB,OAAO,OAAQ,QAAQ,mBAUjD;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signUp.d.ts","sourceRoot":"","sources":["../../../src/authentication/aggregates/signUp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAC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Z;IAGD,MAAM,CAAC,QAAQ,UACY,OAAO,OAAQ,QAAQ,mBAiBjD;IACD,MAAM,CAAC,SAAS,UACW,OAAO,OAAQ,QAAQ,mBAgBjD;CAWJ"}
|
package/dist/index.js
CHANGED
|
@@ -4023,8 +4023,10 @@ var SignIn = class _SignIn extends UserDomain {
|
|
|
4023
4023
|
}
|
|
4024
4024
|
token;
|
|
4025
4025
|
getSecret() {
|
|
4026
|
-
const
|
|
4027
|
-
if (!
|
|
4026
|
+
const cred = (0, import_credentials.getDB)();
|
|
4027
|
+
if (!cred) throw new Error("Auth server Error");
|
|
4028
|
+
const secret = cred.jwtSecret;
|
|
4029
|
+
if (!secret) throw new Error("Server token auth error");
|
|
4028
4030
|
return secret;
|
|
4029
4031
|
}
|
|
4030
4032
|
async verifyUserIdToken() {
|
|
@@ -4105,10 +4107,10 @@ var SignUp = class _SignUp extends UserDomain {
|
|
|
4105
4107
|
if (!this.otp) throw new Error("OTP missing");
|
|
4106
4108
|
return this.otp;
|
|
4107
4109
|
}
|
|
4108
|
-
verifyEmail()
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
}
|
|
4110
|
+
// verifyEmail(){
|
|
4111
|
+
// const {email} = this.props;
|
|
4112
|
+
// if(!email.toLowerCase().trim().endsWith("@theanchoragegroup.com")) throw new Error("Email has to be compnay email ending with @theanchoragegroup.com")
|
|
4113
|
+
// }
|
|
4112
4114
|
async checkIfUserExists() {
|
|
4113
4115
|
const email = this.props.name.toLocaleLowerCase().trim();
|
|
4114
4116
|
const users = await this.userDomain.getByFied("email", email);
|
|
@@ -4118,8 +4120,10 @@ var SignUp = class _SignUp extends UserDomain {
|
|
|
4118
4120
|
this.otp = import_crypto.default.randomInt(1e5, 1e6).toString();
|
|
4119
4121
|
}
|
|
4120
4122
|
getSecret() {
|
|
4121
|
-
const
|
|
4122
|
-
if (!
|
|
4123
|
+
const cred = (0, import_credentials3.getDB)();
|
|
4124
|
+
if (!cred) throw new Error("Auth server Error");
|
|
4125
|
+
const secret = cred.jwtSecret;
|
|
4126
|
+
if (!secret) throw new Error("Server token auth error");
|
|
4123
4127
|
return secret;
|
|
4124
4128
|
}
|
|
4125
4129
|
signjwt(otp) {
|
|
@@ -4170,7 +4174,6 @@ NOTE: This OTP expires after 20 minutes`, this.props.email);
|
|
|
4170
4174
|
return await this.userDomain.add(user);
|
|
4171
4175
|
}
|
|
4172
4176
|
async initialize() {
|
|
4173
|
-
this.verifyEmail();
|
|
4174
4177
|
await this.checkIfUserExists();
|
|
4175
4178
|
this.generateOTP();
|
|
4176
4179
|
this.generateOTP();
|
package/dist/index.mjs
CHANGED
|
@@ -4012,8 +4012,10 @@ var SignIn = class _SignIn extends UserDomain {
|
|
|
4012
4012
|
}
|
|
4013
4013
|
token;
|
|
4014
4014
|
getSecret() {
|
|
4015
|
-
const
|
|
4016
|
-
if (!
|
|
4015
|
+
const cred = getDB();
|
|
4016
|
+
if (!cred) throw new Error("Auth server Error");
|
|
4017
|
+
const secret = cred.jwtSecret;
|
|
4018
|
+
if (!secret) throw new Error("Server token auth error");
|
|
4017
4019
|
return secret;
|
|
4018
4020
|
}
|
|
4019
4021
|
async verifyUserIdToken() {
|
|
@@ -4094,10 +4096,10 @@ var SignUp = class _SignUp extends UserDomain {
|
|
|
4094
4096
|
if (!this.otp) throw new Error("OTP missing");
|
|
4095
4097
|
return this.otp;
|
|
4096
4098
|
}
|
|
4097
|
-
verifyEmail()
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
}
|
|
4099
|
+
// verifyEmail(){
|
|
4100
|
+
// const {email} = this.props;
|
|
4101
|
+
// if(!email.toLowerCase().trim().endsWith("@theanchoragegroup.com")) throw new Error("Email has to be compnay email ending with @theanchoragegroup.com")
|
|
4102
|
+
// }
|
|
4101
4103
|
async checkIfUserExists() {
|
|
4102
4104
|
const email = this.props.name.toLocaleLowerCase().trim();
|
|
4103
4105
|
const users = await this.userDomain.getByFied("email", email);
|
|
@@ -4107,8 +4109,10 @@ var SignUp = class _SignUp extends UserDomain {
|
|
|
4107
4109
|
this.otp = crypto.randomInt(1e5, 1e6).toString();
|
|
4108
4110
|
}
|
|
4109
4111
|
getSecret() {
|
|
4110
|
-
const
|
|
4111
|
-
if (!
|
|
4112
|
+
const cred = getDB3();
|
|
4113
|
+
if (!cred) throw new Error("Auth server Error");
|
|
4114
|
+
const secret = cred.jwtSecret;
|
|
4115
|
+
if (!secret) throw new Error("Server token auth error");
|
|
4112
4116
|
return secret;
|
|
4113
4117
|
}
|
|
4114
4118
|
signjwt(otp) {
|
|
@@ -4159,7 +4163,6 @@ NOTE: This OTP expires after 20 minutes`, this.props.email);
|
|
|
4159
4163
|
return await this.userDomain.add(user);
|
|
4160
4164
|
}
|
|
4161
4165
|
async initialize() {
|
|
4162
|
-
this.verifyEmail();
|
|
4163
4166
|
await this.checkIfUserExists();
|
|
4164
4167
|
this.generateOTP();
|
|
4165
4168
|
this.generateOTP();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightnkhoma/auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A module that automates CRUD functionality and routing and helps you follow DDD(Domain Driven Design) with ease using firebase, express and typescript",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|