@groton/authjs-firestore-adapter 1.0.4 → 1.1.0

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,6 +2,11 @@
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.0](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.4...firestore-adapter/1.1.0) (2026-11-26)
6
+
7
+ ### Features
8
+
9
+ * optionally encrypt access and refresh tokens ([c7a1869](https://github.com/groton-school/authjs/commit/c7a1869c4413693233ce8e7983329208b277d158))
5
10
  ## [1.0.4](https://github.com/groton-school/authjs/compare/firestore-adapter/1.0.3...firestore-adapter/1.0.4) (2026-11-23)
6
11
 
7
12
  ### Bug Fixes
@@ -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.0",
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.1"
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"