@cedarjs/auth-dbauth-setup 2.4.1 → 2.4.2-next.143
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.
package/dist/setupData.js
CHANGED
|
@@ -35,6 +35,6 @@ model User {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// any notes to print out when the job is done
|
|
38
|
-
const notes = exports.notes = [`${_cliHelpers.colors.warning('Done! But you have a little more work to do:')}\n`, 'You will need to add a couple of fields to your User table in order', 'to store a hashed password and salt:', '', ' model User {', ' id String @id @default(uuid())', ' email String @unique', ' hashedPassword String // <─┐', ' salt String // <─┼─ add these lines', ' resetToken String? // <─┤', ' resetTokenExpiresAt DateTime? // <─┘', ' }', '', 'If you already have existing user records you will need to provide', 'a default value for `hashedPassword` and `salt` or Prisma complains, so', 'change those to: ', '', ' hashedPassword String @default("")', ' salt String @default("")', '', 'If you expose any of your user data via GraphQL be sure to exclude', '`hashedPassword` and `salt` (or whatever you named them) from the', 'SDL file that defines the fields for your user.', '', "You'll need to let
|
|
38
|
+
const notes = exports.notes = [`${_cliHelpers.colors.warning('Done! But you have a little more work to do:')}\n`, 'You will need to add a couple of fields to your User table in order', 'to store a hashed password and salt:', '', ' model User {', ' id String @id @default(uuid())', ' email String @unique', ' hashedPassword String // <─┐', ' salt String // <─┼─ add these lines', ' resetToken String? // <─┤', ' resetTokenExpiresAt DateTime? // <─┘', ' }', '', 'If you already have existing user records you will need to provide', 'a default value for `hashedPassword` and `salt` or Prisma complains, so', 'change those to: ', '', ' hashedPassword String @default("")', ' salt String @default("")', '', 'If you expose any of your user data via GraphQL be sure to exclude', '`hashedPassword` and `salt` (or whatever you named them) from the', 'SDL file that defines the fields for your user.', '', "You'll need to let Cedar know what fields you're using for your users'", "`id` and `username` fields. In this case we're using `id` and `email`,", 'so update those in the `authFields` config in', `\`${_shared.functionsPath}/auth.js\`. This is also the place to tell Cedar if`, 'you used a different name for the `hashedPassword`, `salt`,', '`resetToken` or `resetTokenExpiresAt`, fields:`', '', ' authFields: {', " id: 'id',", " username: 'email',", " hashedPassword: 'hashedPassword',", " salt: 'salt',", " resetToken: 'resetToken',", " resetTokenExpiresAt: 'resetTokenExpiresAt',", ' },', '', "To get the actual user that's logged in, take a look at `getCurrentUser()`", `in \`${_shared.libPath}/auth.js\`. We default it to something simple, but you may`, 'use different names for your model or unique ID fields, in which case you', 'need to update those calls (instructions are in the comment above the code).', '', 'Finally, we created a SESSION_SECRET environment variable for you in', `${_path.default.join((0, _cliHelpers.getPaths)().base, '.env')}. This value should NOT be checked`, 'into version control and should be unique for each environment you', 'deploy to. If you ever need to log everyone out of your app at once', 'change this secret to a new value and deploy. To create a new secret, run:', '', ' yarn cedar generate secret', ''];
|
|
39
39
|
const notesCreatedUserModel = exports.notesCreatedUserModel = [`${_cliHelpers.colors.warning('Done! But you have a little more work to do:')}\n`, 'If you expose any of your user data via GraphQL be sure to exclude', '`hashedPassword` and `salt` (or whatever you named them) from the', 'SDL file that defines the fields for your user.', '', "To get the actual user that's logged in, take a look at `getCurrentUser()`", `in \`${_shared.libPath}/auth.js\`. We default it to something simple, but you may`, 'use different names for your model or unique ID fields, in which case you', 'need to update those calls (instructions are in the comment above the code).', '', 'Finally, we created a SESSION_SECRET environment variable for you in', `${_path.default.join((0, _cliHelpers.getPaths)().base, '.env')}. This value should NOT be checked`, 'into version control and should be unique for each environment you', 'deploy to. If you ever need to log everyone out of your app at once', 'change this secret to a new value and deploy. To create a new secret, run:', '', ' yarn cedar generate secret', '', "A new User model was added to your schema. Don't forget to migrate your db", 'before you try using dbAuth:', '', ' yarn cedar prisma migrate dev', ''];
|
|
40
40
|
const noteGenerate = exports.noteGenerate = ['', "Need simple Login, Signup and Forgot Password pages? We've got a generator", 'for those as well:', '', ' yarn cedar generate dbAuth'];
|
package/dist/shared.js
CHANGED
|
@@ -80,7 +80,7 @@ function generateAuthPagesTask(generatingUserModel) {
|
|
|
80
80
|
title: 'Adding dbAuth pages...',
|
|
81
81
|
task: async () => {
|
|
82
82
|
const rwjsPaths = (0, _cliHelpers.getPaths)();
|
|
83
|
-
const args = ['
|
|
83
|
+
const args = ['cedar', 'g', 'dbAuth'];
|
|
84
84
|
if (generatingUserModel) {
|
|
85
85
|
args.push('--username-label', 'username', '--password-label', 'password');
|
|
86
86
|
}
|
|
@@ -110,7 +110,7 @@ export const handler = async (
|
|
|
110
110
|
UserType,
|
|
111
111
|
UserAttributes
|
|
112
112
|
>['signup'] = {
|
|
113
|
-
// Whatever you want to happen to your data on new user signup.
|
|
113
|
+
// Whatever you want to happen to your data on new user signup. Cedar will
|
|
114
114
|
// check for duplicate usernames before calling this handler. At a minimum
|
|
115
115
|
// you need to save the `username`, `hashedPassword` and `salt` to your
|
|
116
116
|
// user table. `userAttributes` contains any additional object members that
|
|
@@ -101,7 +101,7 @@ export const handler = async (
|
|
|
101
101
|
UserType,
|
|
102
102
|
UserAttributes
|
|
103
103
|
>['signup'] = {
|
|
104
|
-
// Whatever you want to happen to your data on new user signup.
|
|
104
|
+
// Whatever you want to happen to your data on new user signup. Cedar will
|
|
105
105
|
// check for duplicate usernames before calling this handler. At a minimum
|
|
106
106
|
// you need to save the `username`, `hashedPassword` and `salt` to your
|
|
107
107
|
// user table. `userAttributes` contains any additional object members that
|
|
@@ -202,7 +202,7 @@ export const handler = async (
|
|
|
202
202
|
// *must* re-enter username and password to authenticate (WebAuthn will
|
|
203
203
|
// then be re-enabled for this amount of time).
|
|
204
204
|
expires: 60 * 60 * 24 * 365 * 10,
|
|
205
|
-
name: '
|
|
205
|
+
name: 'Cedar Application',
|
|
206
206
|
domain:
|
|
207
207
|
process.env.NODE_ENV === 'development' ? 'localhost' : 'server.com',
|
|
208
208
|
origin:
|
|
@@ -58,5 +58,5 @@ model UserCredential {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
// any notes to print out when the job is done
|
|
61
|
-
const notes = exports.notes = [`${_cliHelpers.colors.warning('Done! But you have a little more work to do:')}\n`, 'You will need to add a couple of fields to your User table in order', 'to store a hashed password, salt, reset token, and to connect it to', 'a new UserCredential model to keep track of any devices used with', 'WebAuthn authentication:', '', ' model User {', ' id String @id @default(uuid())', ' email String @unique', ' hashedPassword String', ' salt String', ' resetToken String?', ' resetTokenExpiresAt DateTime?', ' webAuthnChallenge String? @unique', ' credentials UserCredential[]', ' }', '', ' model UserCredential {', ' id String @id', ' userId String', ' user User @relation(fields: [userId], references: [id])', ' publicKey Bytes', ' transports String?', ' counter BigInt', ' }', '', 'If you already have existing user records you will need to provide', 'a default value for `hashedPassword` and `salt` or Prisma complains, so', 'change those to: ', '', ' hashedPassword String @default("")', ' salt String @default("")', '', 'If you expose any of your user data via GraphQL be sure to exclude', '`hashedPassword` and `salt` (or whatever you named them) from the', 'SDL file that defines the fields for your user.', '', "You'll need to let
|
|
61
|
+
const notes = exports.notes = [`${_cliHelpers.colors.warning('Done! But you have a little more work to do:')}\n`, 'You will need to add a couple of fields to your User table in order', 'to store a hashed password, salt, reset token, and to connect it to', 'a new UserCredential model to keep track of any devices used with', 'WebAuthn authentication:', '', ' model User {', ' id String @id @default(uuid())', ' email String @unique', ' hashedPassword String', ' salt String', ' resetToken String?', ' resetTokenExpiresAt DateTime?', ' webAuthnChallenge String? @unique', ' credentials UserCredential[]', ' }', '', ' model UserCredential {', ' id String @id', ' userId String', ' user User @relation(fields: [userId], references: [id])', ' publicKey Bytes', ' transports String?', ' counter BigInt', ' }', '', 'If you already have existing user records you will need to provide', 'a default value for `hashedPassword` and `salt` or Prisma complains, so', 'change those to: ', '', ' hashedPassword String @default("")', ' salt String @default("")', '', 'If you expose any of your user data via GraphQL be sure to exclude', '`hashedPassword` and `salt` (or whatever you named them) from the', 'SDL file that defines the fields for your user.', '', "You'll need to let Cedar know what fields you're using for your users'", "`id` and `username` fields. In this case we're using `id` and `email`,", 'so update those in the `authFields` config in', `\`${_shared.functionsPath}/auth.js\`. This is also the place to tell Cedar if`, 'you used a different name for the `hashedPassword`, `salt`,', '`resetToken` or `resetTokenExpiresAt`, fields:`', '', ' authFields: {', " id: 'id',", " username: 'email',", " hashedPassword: 'hashedPassword',", " salt: 'salt',", " resetToken: 'resetToken',", " resetTokenExpiresAt: 'resetTokenExpiresAt',", " challenge: 'webAuthnChallenge'", ' },', '', "To get the actual user that's logged in, take a look at `getCurrentUser()`", `in \`${_shared.libPath}/auth.js\`. We default it to something simple, but you may`, 'use different names for your model or unique ID fields, in which case you', 'need to update those calls (instructions are in the comment above the code).', '', 'Finally, we created a SESSION_SECRET environment variable for you in', `${_path.default.join((0, _cliHelpers.getPaths)().base, '.env')}. This value should NOT be checked`, 'into version control and should be unique for each environment you', 'deploy to. If you ever need to log everyone out of your app at once', 'change this secret to a new value and deploy. To create a new secret, run:', '', ' yarn cedar generate secret', ''];
|
|
62
62
|
const noteGenerate = exports.noteGenerate = ['', 'Need simple Login, Signup, Forgot Password pages and WebAuthn prompts?', "We've got a generator for those as well:", '', ' yarn cedar generate dbAuth'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/auth-dbauth-setup",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2-next.143+b69a4494c",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"test:watch": "yarn test --watch"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@babel/runtime-corejs3": "7.28.
|
|
28
|
-
"@cedarjs/cli-helpers": "2.4.
|
|
29
|
-
"@prisma/internals": "6.19.
|
|
27
|
+
"@babel/runtime-corejs3": "7.28.6",
|
|
28
|
+
"@cedarjs/cli-helpers": "2.4.2-next.143+b69a4494c",
|
|
29
|
+
"@prisma/internals": "6.19.2",
|
|
30
30
|
"@simplewebauthn/browser": "9.0.1",
|
|
31
|
-
"core-js": "3.
|
|
31
|
+
"core-js": "3.48.0",
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"termi-link": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@babel/cli": "7.28.
|
|
36
|
+
"@babel/cli": "7.28.6",
|
|
37
37
|
"@babel/core": "^7.26.10",
|
|
38
38
|
"@simplewebauthn/types": "9.0.1",
|
|
39
39
|
"@types/yargs": "17.0.35",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b69a4494c40b0a4807f6b492ae65d0596f374e8a"
|
|
48
48
|
}
|