@auth/dynamodb-adapter 1.4.0 → 1.5.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  ISC License
2
2
 
3
- Copyright (c) 2022-2023, Balázs Orbán
3
+ Copyright (c) 2022-2024, Balázs Orbán
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
package/index.d.ts CHANGED
@@ -80,6 +80,48 @@ export interface DynamoDBAdapterOptions {
80
80
  *
81
81
  * (AWS secrets start with `NEXT_AUTH_` in order to not conflict with [Vercel's reserved environment variables](https://vercel.com/docs/environment-variables#reserved-environment-variables).)
82
82
  *
83
+ * ## AWS Credentials
84
+ *
85
+ * :::note
86
+ * Always follow the **principle of least privilege** when giving access to AWS
87
+ * services/resources -> identities should only be permitted to perform the
88
+ * smallest set of actions necessary to fulfill a specific task.
89
+ * :::
90
+ *
91
+ * 1. Open the [AWS console](https://console.aws.amazon.com/) and go to "IAM", then "Users".
92
+ * 2. Create a new user. The purpose of this user is to give programmatic access to DynamoDB.
93
+ * 3. Create an Access Key and then copy Key ID and Secret to your `.env`/`.env.local` file.
94
+ * 4. Select "Add Permission" and "Create Inline Policy".
95
+ * 5. Copy the JSON below into the JSON input and replace `region`, `account_id` and `table_name` with your values.
96
+ *
97
+ * ```json
98
+ * {
99
+ * "Version": "2012-10-17",
100
+ * "Statement": [
101
+ * {
102
+ * "Sid": "DynamoDBAccess",
103
+ * "Effect": "Allow",
104
+ * "Action": [
105
+ * "dynamodb:BatchGetItem",
106
+ * "dynamodb:BatchWriteItem",
107
+ * "dynamodb:Describe*",
108
+ * "dynamodb:List*",
109
+ * "dynamodb:PutItem",
110
+ * "dynamodb:DeleteItem",
111
+ * "dynamodb:GetItem",
112
+ * "dynamodb:Scan",
113
+ * "dynamodb:Query",
114
+ * "dynamodb:UpdateItem"
115
+ * ],
116
+ * "Resource": [
117
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}",
118
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}/index/GSI1"
119
+ * ]
120
+ * }
121
+ * ]
122
+ * }
123
+ * ```
124
+ *
83
125
  * ## Advanced usage
84
126
  *
85
127
  * ### Default schema
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EACV,OAAO,EAKR,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsII;AACJ,wBAAgB,eAAe,CAC7B,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CA+ST;AASD,QAAA,MAAM,MAAM;IACV,8EAA8E;eACnE,OAAO,MAAM,EAAE,GAAG,CAAC;IAY9B,sEAAsE;+CAC3B,OAAO,MAAM,EAAE,GAAG,CAAC;CAsB/D,CAAA;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC9D,gBAAgB,EAAE,MAAM,CAAA;IACxB,wBA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wB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChD,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnD,CAgBA;AAED,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAA"}
package/index.js CHANGED
@@ -70,6 +70,48 @@
70
70
  *
71
71
  * (AWS secrets start with `NEXT_AUTH_` in order to not conflict with [Vercel's reserved environment variables](https://vercel.com/docs/environment-variables#reserved-environment-variables).)
72
72
  *
73
+ * ## AWS Credentials
74
+ *
75
+ * :::note
76
+ * Always follow the **principle of least privilege** when giving access to AWS
77
+ * services/resources -> identities should only be permitted to perform the
78
+ * smallest set of actions necessary to fulfill a specific task.
79
+ * :::
80
+ *
81
+ * 1. Open the [AWS console](https://console.aws.amazon.com/) and go to "IAM", then "Users".
82
+ * 2. Create a new user. The purpose of this user is to give programmatic access to DynamoDB.
83
+ * 3. Create an Access Key and then copy Key ID and Secret to your `.env`/`.env.local` file.
84
+ * 4. Select "Add Permission" and "Create Inline Policy".
85
+ * 5. Copy the JSON below into the JSON input and replace `region`, `account_id` and `table_name` with your values.
86
+ *
87
+ * ```json
88
+ * {
89
+ * "Version": "2012-10-17",
90
+ * "Statement": [
91
+ * {
92
+ * "Sid": "DynamoDBAccess",
93
+ * "Effect": "Allow",
94
+ * "Action": [
95
+ * "dynamodb:BatchGetItem",
96
+ * "dynamodb:BatchWriteItem",
97
+ * "dynamodb:Describe*",
98
+ * "dynamodb:List*",
99
+ * "dynamodb:PutItem",
100
+ * "dynamodb:DeleteItem",
101
+ * "dynamodb:GetItem",
102
+ * "dynamodb:Scan",
103
+ * "dynamodb:Query",
104
+ * "dynamodb:UpdateItem"
105
+ * ],
106
+ * "Resource": [
107
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}",
108
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}/index/GSI1"
109
+ * ]
110
+ * }
111
+ * ]
112
+ * }
113
+ * ```
114
+ *
73
115
  * ## Advanced usage
74
116
  *
75
117
  * ### Default schema
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@auth/dynamodb-adapter",
3
3
  "repository": "https://github.com/nextauthjs/next-auth",
4
- "version": "1.4.0",
4
+ "version": "1.5.1",
5
5
  "description": "AWS DynamoDB adapter for next-auth.",
6
6
  "keywords": [
7
7
  "next-auth",
@@ -44,7 +44,7 @@
44
44
  "@aws-sdk/lib-dynamodb": "^3.36.1"
45
45
  },
46
46
  "dependencies": {
47
- "@auth/core": "0.27.0"
47
+ "@auth/core": "0.28.1"
48
48
  },
49
49
  "scripts": {
50
50
  "test:default": "vitest -c ../utils/vitest.config.ts",
package/src/index.ts CHANGED
@@ -92,6 +92,48 @@ export interface DynamoDBAdapterOptions {
92
92
  *
93
93
  * (AWS secrets start with `NEXT_AUTH_` in order to not conflict with [Vercel's reserved environment variables](https://vercel.com/docs/environment-variables#reserved-environment-variables).)
94
94
  *
95
+ * ## AWS Credentials
96
+ *
97
+ * :::note
98
+ * Always follow the **principle of least privilege** when giving access to AWS
99
+ * services/resources -> identities should only be permitted to perform the
100
+ * smallest set of actions necessary to fulfill a specific task.
101
+ * :::
102
+ *
103
+ * 1. Open the [AWS console](https://console.aws.amazon.com/) and go to "IAM", then "Users".
104
+ * 2. Create a new user. The purpose of this user is to give programmatic access to DynamoDB.
105
+ * 3. Create an Access Key and then copy Key ID and Secret to your `.env`/`.env.local` file.
106
+ * 4. Select "Add Permission" and "Create Inline Policy".
107
+ * 5. Copy the JSON below into the JSON input and replace `region`, `account_id` and `table_name` with your values.
108
+ *
109
+ * ```json
110
+ * {
111
+ * "Version": "2012-10-17",
112
+ * "Statement": [
113
+ * {
114
+ * "Sid": "DynamoDBAccess",
115
+ * "Effect": "Allow",
116
+ * "Action": [
117
+ * "dynamodb:BatchGetItem",
118
+ * "dynamodb:BatchWriteItem",
119
+ * "dynamodb:Describe*",
120
+ * "dynamodb:List*",
121
+ * "dynamodb:PutItem",
122
+ * "dynamodb:DeleteItem",
123
+ * "dynamodb:GetItem",
124
+ * "dynamodb:Scan",
125
+ * "dynamodb:Query",
126
+ * "dynamodb:UpdateItem"
127
+ * ],
128
+ * "Resource": [
129
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}",
130
+ * "arn:aws:dynamodb:{region}:{account_id}:table/{table_name}/index/GSI1"
131
+ * ]
132
+ * }
133
+ * ]
134
+ * }
135
+ * ```
136
+ *
95
137
  * ## Advanced usage
96
138
  *
97
139
  * ### Default schema