@wrcb/cb-common 1.0.258 → 1.0.260

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.
@@ -13,22 +13,15 @@ function signUpReturnCookie(id, overrides) {
13
13
  // Build a JWT payload
14
14
  const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.User, language: country_1.Language.Português, country: country_1.Country.Brasil, isKycDone: true, isEmailVerified: false, isPhoneNumberVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
15
15
  );
16
- // Create the JWT
17
- const token = jsonwebtoken_1.default.sign(payload, process.env.JWT_KEY);
18
- // Build session object {jwt: MY_JWT}
19
- const session = { jwt: token };
20
- // Turn that session into JSON
21
- const sessionJSON = JSON.stringify(session);
22
- // Take JSON and encode it as base64
23
- const base64 = Buffer.from(sessionJSON).toString('base64');
24
- // return a string that the cookie with the encoded data
25
- const cookieString = [`session=${base64}`];
26
- return cookieString;
16
+ return buildCookie(payload);
27
17
  }
28
18
  function signUpReturnCookieAdmin(id, overrides) {
29
19
  // Build a JWT payload
30
20
  const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Admin, isKycDone: true, language: country_1.Language.Português, country: country_1.Country.Brasil, isEmailVerified: false, isPhoneNumberVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
31
21
  );
22
+ return buildCookie(payload);
23
+ }
24
+ function buildCookie(payload) {
32
25
  // Create the JWT
33
26
  const token = jsonwebtoken_1.default.sign(payload, process.env.JWT_KEY);
34
27
  // Build session object {jwt: MY_JWT}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.258",
3
+ "version": "1.0.260",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",