@groton/authjs-firestore-adapter 1.0.4 → 1.1.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/CHANGELOG.md CHANGED
@@ -2,24 +2,40 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.1.1](https://github.com/groton-school/authjs/compare/firestore-adapter/1.1.0...firestore-adapter/1.1.1) (2026-11-26)
6
+
7
+ ### Bug fixes
8
+
9
+ - bump @battis/lazy-fireetore
10
+
11
+ ## [1.1.0](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.4...firestore-adapter/1.1.0) (2026-11-26)
12
+
13
+ ### Features
14
+
15
+ - optionally encrypt access and refresh tokens ([c7a1869](https://github.com/groton-school/authjs/commit/c7a1869c4413693233ce8e7983329208b277d158))
16
+
5
17
  ## [1.0.4](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.3...firestore-adapter/1.0.4) (2026-11-23)
6
18
 
7
19
  ### Bug Fixes
8
20
 
9
- * undo over-zealous object clean-up ([e6a782c](https://github.com/groton-school/authjs/commit/e6a782c88f57f309bf0c8ad6d30a9aeb3999cf42))
21
+ - undo over-zealous object clean-up ([e6a782c](https://github.com/groton-school/authjs/commit/e6a782c88f57f309bf0c8ad6d30a9aeb3999cf42))
22
+
10
23
  ## [1.0.3](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.1...firestore-adapter/1.0.3) (2026-11-15)
11
24
 
12
25
  ### Bug Fixes
13
26
 
14
- * nullify undefined properties on creation, delete undefined properties on update ([9ce52cc](https://github.com/groton-school/authjs/commit/9ce52ccccc7be4bf6391bbbdc758391e377e8fed))
27
+ - nullify undefined properties on creation, delete undefined properties on update ([9ce52cc](https://github.com/groton-school/authjs/commit/9ce52ccccc7be4bf6391bbbdc758391e377e8fed))
28
+
15
29
  ## [1.0.2](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.1...firestore-adapter/1.0.2) (2026-11-15)
16
30
 
17
31
  ### Bug Fixes
18
32
 
19
- * nullify undefined properties on creation, delete undefined properties on update ([9ce52cc](https://github.com/groton-school/authjs/commit/9ce52ccccc7be4bf6391bbbdc758391e377e8fed))
33
+ - nullify undefined properties on creation, delete undefined properties on update ([9ce52cc](https://github.com/groton-school/authjs/commit/9ce52ccccc7be4bf6391bbbdc758391e377e8fed))
34
+
20
35
  ## [1.0.1](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.0...firestore-adapter/1.0.1) (2026-11-15)
21
36
 
22
37
  ### Bug Fixes
23
38
 
24
- * implement getAccount() ([d326ea5](https://github.com/groton-school/authjs/commit/d326ea5783d4489407147a9e7b1a6820ffa3c2b6))
39
+ - implement getAccount() ([d326ea5](https://github.com/groton-school/authjs/commit/d326ea5783d4489407147a9e7b1a6820ffa3c2b6))
40
+
25
41
  ## 1.0.0 (2026-11-12)
@@ -1,13 +1,19 @@
1
1
  import { AdapterAccount, AdapterUser } from '@auth/core/adapters';
2
2
  import { Collection, CollectionOptions } from '@battis/lazy-firestore';
3
+ interface Options extends CollectionOptions {
4
+ password?: string;
5
+ salt?: string;
6
+ }
3
7
  export declare class Accounts extends Collection<AdapterAccount> {
4
8
  static readonly DEFAULT: {
5
9
  path: string;
6
10
  };
11
+ constructor({ path, password, salt, converter, ...options }?: Options);
7
12
  }
8
- export declare function AccountsAdapter({ path, ...options }?: CollectionOptions): {
13
+ export declare function AccountsAdapter({ path, ...options }?: Options): {
9
14
  linkAccount: (account: AdapterAccount) => Promise<AdapterAccount | null>;
10
15
  getAccount: (providerAccountId: AdapterAccount['providerAccountId'], provider: AdapterAccount['provider']) => Promise<AdapterAccount | null>;
11
16
  getUserByAccount: ({ provider, providerAccountId }: Pick<AdapterAccount, 'provider' | 'providerAccountId'>) => Promise<AdapterUser | null>;
12
17
  unlinkAccount: (account: Pick<AdapterAccount, 'provider' | 'providerAccountId'>) => Promise<AdapterAccount | undefined>;
13
18
  };
19
+ export {};
@@ -1,8 +1,24 @@
1
1
  import { Collection } from '@battis/lazy-firestore';
2
+ import { EncryptedString } from '@battis/lazy-firestore/converters/EncryptedString';
2
3
  import { requireUnique } from '@battis/lazy-firestore/directives/requireUnique';
3
4
  import { users } from './Users.js';
4
5
  export class Accounts extends Collection {
5
6
  static DEFAULT = { path: 'accounts' };
7
+ constructor({ path = Accounts.DEFAULT.path, password, salt, converter, ...options } = Accounts.DEFAULT) {
8
+ super({
9
+ path,
10
+ ...options,
11
+ converter: {
12
+ ...converter,
13
+ ...(password && salt
14
+ ? {
15
+ access_token: EncryptedString({ password, salt }),
16
+ refresh_token: EncryptedString({ password, salt })
17
+ }
18
+ : {})
19
+ }
20
+ });
21
+ }
6
22
  }
7
23
  export function AccountsAdapter({ path = Accounts.DEFAULT.path, ...options } = Accounts.DEFAULT) {
8
24
  const accounts = new Accounts({ path, ...options });
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ interface Options extends Omit<CollectionOptions, 'path'> {
7
7
  sessionsPath?: string;
8
8
  verificationTokensPath?: string;
9
9
  authenticatorsPath?: string;
10
+ password?: string;
11
+ salt?: string;
10
12
  }
11
- export declare function FirestoreAdapter({ db, databaseId, basePath, usersPath, accountsPath, sessionsPath, verificationTokensPath, authenticatorsPath, firestore }?: Options): Adapter;
13
+ export declare function FirestoreAdapter({ db, databaseId, basePath, usersPath, accountsPath, password, salt, sessionsPath, verificationTokensPath, authenticatorsPath, firestore }?: Options): Adapter;
12
14
  export {};
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { AuthenticatorsAdapter } from './Collections/Authenticators.js';
5
5
  import { Sessions, SessionsAdapter } from './Collections/Sessions.js';
6
6
  import { Users, UsersAdapter } from './Collections/Users.js';
7
7
  import { VerificationTokens, VerificationTokensAdapter } from './Collections/VerificationTokens.js';
8
- export function FirestoreAdapter({ db, databaseId, basePath = '.', usersPath, accountsPath, sessionsPath, verificationTokensPath, authenticatorsPath, firestore } = {}) {
8
+ export function FirestoreAdapter({ db, databaseId, basePath = '.', usersPath, accountsPath, password, salt, sessionsPath, verificationTokensPath, authenticatorsPath, firestore } = {}) {
9
9
  db = db || new Firestore({ databaseId, ...firestore });
10
10
  return {
11
11
  ...UsersAdapter({
@@ -16,7 +16,9 @@ export function FirestoreAdapter({ db, databaseId, basePath = '.', usersPath, ac
16
16
  ...AccountsAdapter({
17
17
  db,
18
18
  path: path.join(
19
- /*turbopackIgnore: true*/ basePath, accountsPath || Accounts.DEFAULT.path)
19
+ /*turbopackIgnore: true*/ basePath, accountsPath || Accounts.DEFAULT.path),
20
+ password,
21
+ salt
20
22
  }),
21
23
  ...SessionsAdapter({
22
24
  db,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groton/authjs-firestore-adapter",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "homepage": "https://github.com/groton-school/authjs/tree/main/packages/firestore-adapter#readme",
5
5
  "repository": {
6
6
  "type": "github",
@@ -24,12 +24,12 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "dependencies": {
27
- "@battis/lazy-firestore": "^1.1.0"
27
+ "@battis/lazy-firestore": "^1.2.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@battis/workspace": "^0.0.12",
31
31
  "@tsconfig/node-lts": "^24.0.1",
32
- "@types/node": "^24.19.2",
32
+ "@types/node": "^24.19.4",
33
33
  "del-cli": "^8.0.1",
34
34
  "npm-run-all": "^4.1.5",
35
35
  "typescript": "^7.0.2"