@crossauth/backend 0.0.2

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.
Files changed (109) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +14 -0
  3. package/dist/apikey.d.ts +100 -0
  4. package/dist/apikey.d.ts.map +1 -0
  5. package/dist/auth.d.ts +131 -0
  6. package/dist/auth.d.ts.map +1 -0
  7. package/dist/authenticators/dummyfactor2.d.ts +129 -0
  8. package/dist/authenticators/dummyfactor2.d.ts.map +1 -0
  9. package/dist/authenticators/emailauth.d.ts +176 -0
  10. package/dist/authenticators/emailauth.d.ts.map +1 -0
  11. package/dist/authenticators/ldapauth.d.ts +89 -0
  12. package/dist/authenticators/ldapauth.d.ts.map +1 -0
  13. package/dist/authenticators/passwordauth.d.ts +159 -0
  14. package/dist/authenticators/passwordauth.d.ts.map +1 -0
  15. package/dist/authenticators/smsauth.d.ts +160 -0
  16. package/dist/authenticators/smsauth.d.ts.map +1 -0
  17. package/dist/authenticators/tests/ldapauth.test.d.ts +2 -0
  18. package/dist/authenticators/tests/ldapauth.test.d.ts.map +1 -0
  19. package/dist/authenticators/totpauth.d.ts +117 -0
  20. package/dist/authenticators/totpauth.d.ts.map +1 -0
  21. package/dist/authenticators/twilioauth.d.ts +29 -0
  22. package/dist/authenticators/twilioauth.d.ts.map +1 -0
  23. package/dist/cookieauth.d.ts +269 -0
  24. package/dist/cookieauth.d.ts.map +1 -0
  25. package/dist/crypto.d.ts +196 -0
  26. package/dist/crypto.d.ts.map +1 -0
  27. package/dist/emailtokens.d.ts +178 -0
  28. package/dist/emailtokens.d.ts.map +1 -0
  29. package/dist/index.cjs +9107 -0
  30. package/dist/index.d.ts +46 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +9090 -0
  33. package/dist/oauth/authserver.d.ts +490 -0
  34. package/dist/oauth/authserver.d.ts.map +1 -0
  35. package/dist/oauth/client.d.ts +72 -0
  36. package/dist/oauth/client.d.ts.map +1 -0
  37. package/dist/oauth/clientmanager.d.ts +73 -0
  38. package/dist/oauth/clientmanager.d.ts.map +1 -0
  39. package/dist/oauth/resserver.d.ts +43 -0
  40. package/dist/oauth/resserver.d.ts.map +1 -0
  41. package/dist/oauth/tests/common.d.ts +58 -0
  42. package/dist/oauth/tests/common.d.ts.map +1 -0
  43. package/dist/oauth/tests/oauthauthserver_authzcode.test.d.ts +2 -0
  44. package/dist/oauth/tests/oauthauthserver_authzcode.test.d.ts.map +1 -0
  45. package/dist/oauth/tests/oauthauthserver_clientcred.test.d.ts +2 -0
  46. package/dist/oauth/tests/oauthauthserver_clientcred.test.d.ts.map +1 -0
  47. package/dist/oauth/tests/oauthauthserver_device.test.d.ts +2 -0
  48. package/dist/oauth/tests/oauthauthserver_device.test.d.ts.map +1 -0
  49. package/dist/oauth/tests/oauthauthserver_mfa.test.d.ts +5 -0
  50. package/dist/oauth/tests/oauthauthserver_mfa.test.d.ts.map +1 -0
  51. package/dist/oauth/tests/oauthauthserver_password.test.d.ts +2 -0
  52. package/dist/oauth/tests/oauthauthserver_password.test.d.ts.map +1 -0
  53. package/dist/oauth/tests/oauthclient.test.d.ts +2 -0
  54. package/dist/oauth/tests/oauthclient.test.d.ts.map +1 -0
  55. package/dist/oauth/tests/oauthresserver.test.d.ts +2 -0
  56. package/dist/oauth/tests/oauthresserver.test.d.ts.map +1 -0
  57. package/dist/oauth/tokenconsumer.d.ts +80 -0
  58. package/dist/oauth/tokenconsumer.d.ts.map +1 -0
  59. package/dist/session.d.ts +491 -0
  60. package/dist/session.d.ts.map +1 -0
  61. package/dist/storage/dbconnection.d.ts +19 -0
  62. package/dist/storage/dbconnection.d.ts.map +1 -0
  63. package/dist/storage/dbstorage.d.ts +319 -0
  64. package/dist/storage/dbstorage.d.ts.map +1 -0
  65. package/dist/storage/inmemorystorage.d.ts +225 -0
  66. package/dist/storage/inmemorystorage.d.ts.map +1 -0
  67. package/dist/storage/ldapstorage.d.ts +143 -0
  68. package/dist/storage/ldapstorage.d.ts.map +1 -0
  69. package/dist/storage/postgresconnection.d.ts +27 -0
  70. package/dist/storage/postgresconnection.d.ts.map +1 -0
  71. package/dist/storage/postgresstorage.d.ts +83 -0
  72. package/dist/storage/postgresstorage.d.ts.map +1 -0
  73. package/dist/storage/prismastorage.d.ts +361 -0
  74. package/dist/storage/prismastorage.d.ts.map +1 -0
  75. package/dist/storage/sqliteconnection.d.ts +35 -0
  76. package/dist/storage/sqliteconnection.d.ts.map +1 -0
  77. package/dist/storage/sqlitestorage.d.ts +83 -0
  78. package/dist/storage/sqlitestorage.d.ts.map +1 -0
  79. package/dist/storage/tests/dbtests.d.ts +5 -0
  80. package/dist/storage/tests/dbtests.d.ts.map +1 -0
  81. package/dist/storage/tests/inmemorystorage.test.d.ts +5 -0
  82. package/dist/storage/tests/inmemorystorage.test.d.ts.map +1 -0
  83. package/dist/storage/tests/inmemorytestdata.d.ts +4 -0
  84. package/dist/storage/tests/inmemorytestdata.d.ts.map +1 -0
  85. package/dist/storage/tests/ldapstorage.test.d.ts +2 -0
  86. package/dist/storage/tests/ldapstorage.test.d.ts.map +1 -0
  87. package/dist/storage/tests/postgresstorage.test.d.ts +2 -0
  88. package/dist/storage/tests/postgresstorage.test.d.ts.map +1 -0
  89. package/dist/storage/tests/prismastorage.test.d.ts +4 -0
  90. package/dist/storage/tests/prismastorage.test.d.ts.map +1 -0
  91. package/dist/storage/tests/sqlitestorage.test.d.ts +2 -0
  92. package/dist/storage/tests/sqlitestorage.test.d.ts.map +1 -0
  93. package/dist/storage.d.ts +411 -0
  94. package/dist/storage.d.ts.map +1 -0
  95. package/dist/tests/cookieauth.test.d.ts +4 -0
  96. package/dist/tests/cookieauth.test.d.ts.map +1 -0
  97. package/dist/tests/crypto.test.d.ts +2 -0
  98. package/dist/tests/crypto.test.d.ts.map +1 -0
  99. package/dist/tests/email.test.d.ts +4 -0
  100. package/dist/tests/email.test.d.ts.map +1 -0
  101. package/dist/tests/password.test.d.ts +5 -0
  102. package/dist/tests/password.test.d.ts.map +1 -0
  103. package/dist/tests/tmp.test.d.ts +2 -0
  104. package/dist/tests/tmp.test.d.ts.map +1 -0
  105. package/dist/tests/utils.test.d.ts +2 -0
  106. package/dist/tests/utils.test.d.ts.map +1 -0
  107. package/dist/utils.d.ts +41 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/package.json +71 -0
@@ -0,0 +1,143 @@
1
+ import { UserStorage, UserStorageGetOptions, UserStorageOptions } from '../storage';
2
+ import { User, UserSecrets, UserInputFields, UserSecretsInputFields } from '@crossauth/common';
3
+
4
+ /**
5
+ * A user returned by an LDAP server
6
+ */
7
+ export interface LdapUser {
8
+ /** The user's dn in LDAP */
9
+ dn: string;
10
+ /** Optional additional fields from LDAP */
11
+ [key: string]: string | string[];
12
+ }
13
+ /**
14
+ * Optional parameters for {@link LdapUserStorage}.
15
+ */
16
+ export interface LdapUserStorageOptions extends UserStorageOptions {
17
+ /** Utl running LDAP server. eg ldap://ldap.example.com or ldaps://ldap,example.com:1636
18
+ * No default (required)
19
+ */
20
+ ldapUrls?: string[];
21
+ /** Search base, for user queries, eg `ou=users,dc=example,dc=com`. Default empty */
22
+ ldapUserSearchBase?: string;
23
+ /** Username attribute for searches. Default "cn".
24
+ */
25
+ ldapUsernameAttribute?: string;
26
+ /** A function to create a user object given the entry in LDAP and additional fields.
27
+ * The additional fields might be useful for attributes that aren't in LDAP and the
28
+ * user needs to be prompted for, for example email address.
29
+ * The default function sets `username` to `uid` from `ldapUser`,
30
+ * `state` to `active` and takes every field for `user` (overriding `status`
31
+ * and `username` if present).
32
+ */
33
+ createUserFn?: (user: Partial<User>, ldapUser: LdapUser) => UserInputFields;
34
+ }
35
+ /**
36
+ * Wraps another user storage but with the authentication done in LDAP.
37
+ *
38
+ * This class still needs a user to be created in another database, with
39
+ * for example a user id that can be referenced in key storage, and a state
40
+ * variable.
41
+ *
42
+ * An admin account is not used. Searches are done as the user, with the user's
43
+ * password.
44
+ */
45
+ export declare class LdapUserStorage extends UserStorage {
46
+ private localStorage;
47
+ private ldapUrls;
48
+ private ldapUserSearchBase;
49
+ private ldapUsernameAttribute;
50
+ private createUserFn;
51
+ /**
52
+ * Constructor.
53
+ * @param localStorage the underlying storage where users are kept (without passwords)
54
+ * @param options see {@link LdapUserStorageOptions}
55
+ */
56
+ constructor(localStorage: UserStorage, options?: LdapUserStorageOptions);
57
+ /**
58
+ * Authenticates the user in LDAP and, if valid, creates a user in local
59
+ * storage.
60
+ *
61
+ * @param user passed to the default `createUserFn` to create the user object. `username` field is used for LDAP authentication
62
+ * @param secrets `password` for LDAP expected to be set here.
63
+ * @returns the created user object, as it appears in local storage
64
+ */
65
+ createUser(user: UserInputFields, secrets?: UserSecretsInputFields): Promise<User>;
66
+ /**
67
+ * Gets a user from the local storage. Does not check LDAP.
68
+ * @param username the username to fetch
69
+ * @param options passed to `localStorage`'s `getUserByUsername()`
70
+ * @returns the user
71
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} `UsernameOrPasswordInvalid` or `Connection`
72
+ */
73
+ getUserByUsername(username: string, options?: UserStorageGetOptions): Promise<{
74
+ user: User;
75
+ secrets: UserSecrets;
76
+ }>;
77
+ /**
78
+ * Gets a user from the local storage. Does not check LDAP.
79
+ * @param id the user id to fetch
80
+ * @param options passed to `localStorage`'s `getUserByUsername()`
81
+ * @returns the user
82
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} `UsernameOrPasswordInvalid` or `Connection`
83
+ */
84
+ getUserById(id: string | number, options?: UserStorageGetOptions): Promise<{
85
+ user: User;
86
+ secrets: UserSecrets;
87
+ }>;
88
+ /**
89
+ * Gets a user from the local storage. Does not check LDAP.
90
+ * @param email the email address to fetch user by
91
+ * @param options passed to `localStorage`'s `getUserByUsername()`
92
+ * @returns the user
93
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} `UsernameOrPasswordInvalid` or `Connection`
94
+ */
95
+ getUserByEmail(email: string | number, options?: UserStorageGetOptions): Promise<{
96
+ user: User;
97
+ secrets: UserSecrets;
98
+ }>;
99
+ getUsers(skip?: number, take?: number): Promise<User[]>;
100
+ /**
101
+ * Updates a user in local storage. Does not do an LDAP update.
102
+ * @param user new fields for the user, plus `id` to match the user by
103
+ * @param _secrets ignored as secrets cannot be updated
104
+ * @returns
105
+ */
106
+ updateUser(user: Partial<User>, _secrets?: Partial<UserSecrets>): Promise<void>;
107
+ /**
108
+ * Deletes a user from local storage (not from LDAP)
109
+ * @param username username to delete
110
+ */
111
+ deleteUserByUsername(username: string): Promise<void>;
112
+ /**
113
+ * Deletes a user from local storage (not from LDAP)
114
+ * @param id ID of the user to delete
115
+ */
116
+ deleteUserById(id: string | number): Promise<void>;
117
+ /**
118
+ * Gets the user from LDAP. Does not check local storage.
119
+ *
120
+ * If the user doesn't exist or authentication fails, an exception is thrown
121
+ * @param username the username to fetch
122
+ * @param password the LDAP password
123
+ * @returns the matching {@link LdapUser}
124
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} `UsernameOrPasswordInvalid` or `Connection`
125
+ */
126
+ getLdapUser(username: string, password: string): Promise<LdapUser>;
127
+ private ldapBind;
128
+ private searchUser;
129
+ private static searchResultToUser;
130
+ /**
131
+ * Sanitises an LDAP dn for passing to bind (escaping special characters)
132
+ * @param dn the dn to sanitise
133
+ * @returns a sanitized dn
134
+ */
135
+ static sanitizeLdapDn(dn: string): string;
136
+ /**
137
+ * Sanitises an LDAP dn for passing to searches (escaping special characters)
138
+ * @param dn the dn to sanitise
139
+ * @returns a sanitized dn
140
+ */
141
+ static sanitizeLdapDnForSerach(dn: string): string;
142
+ }
143
+ //# sourceMappingURL=ldapstorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ldapstorage.d.ts","sourceRoot":"","sources":["../../src/storage/ldapstorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,qBAAqB,EAAE,KAAK,kB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bPool, DbConnection, DbParameter } from './dbconnection';
3
+
4
+ export declare class PostgresPool extends DbPool {
5
+ private pgPool;
6
+ constructor(pgPool: pg.Pool);
7
+ connect(): Promise<DbConnection>;
8
+ parameters(): DbParameter;
9
+ }
10
+ export declare class PostgresConnection extends DbConnection {
11
+ private pgClient;
12
+ constructor(pgClient: pg.PoolClient);
13
+ private crossauthErrorFromPostgresError;
14
+ execute(query: string, values?: any[]): Promise<{
15
+ [key: string]: any;
16
+ }[]>;
17
+ release(): void;
18
+ startTransaction(): Promise<void>;
19
+ commit(): Promise<void>;
20
+ rollback(): Promise<void>;
21
+ }
22
+ export declare class PostgresParameter extends DbParameter {
23
+ private nextParam;
24
+ constructor();
25
+ nextParameter(): string;
26
+ }
27
+ //# sourceMappingURL=postgresconnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgresconnection.d.ts","sourceRoot":"","sources":["../../src/storage/postgresconnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGnE,qBAAa,YAAa,SAAQ,MAAM;IACpC,OAAO,CAAC,MAAM,CAAW;gBAEb,MAAM,EAAG,EAAE,CAAC,IAAI;IAMtB,OAAO,IAAK,OAAO,CAAC,YAAY,CAAC;IAMvC,UAAU,IAAK,WAAW;CAI7B;AAED,qBAAa,kBAAmB,SAAQ,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAiB;gBAErB,QAAQ,EAAG,EAAE,CAAC,UAAU;IAKpC,OAAO,CAAC,+BAA+B;IAmBjC,OAAO,CAAC,KAAK,EAAG,MAAM,EAAE,MAAM,GAAG,GAAG,EAAO,GAAI,OAAO,CAAC;QAAC,CAAC,GAAG,EAAC,MAAM,GAAE,GAAG,CAAA;KAAC,EAAE,CAAC;IAYlF,OAAO,IAAK,IAAI;IAMV,gBAAgB,IAAK,OAAO,CAAC,IAAI,CAAC;IAMlC,MAAM,IAAK,OAAO,CAAC,IAAI,CAAC;IAMxB,QAAQ,IAAK,OAAO,CAAC,IAAI,CAAC;CAKnC;AAGD,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C,OAAO,CAAC,SAAS,CAAK;;IAMtB,aAAa,IAAK,MAAM;CAG3B"}
@@ -0,0 +1,83 @@
1
+ import { default as pg } from 'pg';
2
+ import { DbUserStorage, DbKeyStorage, DbOAuthClientStorage, DbOAuthAuthorizationStorage, DbUserStorageOptions, DbKeyStorageOptions, DbOAuthClientStorageOptions, DbOAuthAuthorizationStorageOptions } from './dbstorage';
3
+
4
+ /**
5
+ * Optional parameters for {@link PostgresUserStorage}.
6
+ *
7
+ * See {@link PostgresUserStorage.constructor} for definitions.
8
+ */
9
+ export interface PostgresUserStorageOptions extends DbUserStorageOptions {
10
+ }
11
+ /**
12
+ * Implementation of {@link UserStorage} where username and password is stored
13
+ * in two Postgres tables: one for non secret fields, one for secret fields.
14
+ *
15
+ * The `pg` package module is used to access the database.
16
+ *
17
+ */
18
+ export declare class PostgresUserStorage extends DbUserStorage {
19
+ /**
20
+ * Creates a PostgresUserStorage object, optionally overriding defaults.
21
+ * @param pgPool the instance of the Posrgres client.
22
+ * @param options see {@link PostgresUserStorageOptions}.
23
+ */
24
+ constructor(pgPool: pg.Pool, options?: PostgresUserStorageOptions);
25
+ }
26
+ /**
27
+ * Optional parameters for {@link PostgresKeyStorage}.
28
+ *
29
+ * See {@link PostgresKeyStorage.constructor} for definitions.
30
+ */
31
+ export interface PostgresKeyStorageOptions extends DbKeyStorageOptions {
32
+ }
33
+ /**
34
+ * Implementation of {@link KeyStorage } where keys stored in a
35
+ * Postgres database.
36
+ */
37
+ export declare class PostgresKeyStorage extends DbKeyStorage {
38
+ /**
39
+ * Creates a PostgresKeyStorage object, optionally overriding defaults.
40
+ * @param pgPool the instance of the Posrgres client.
41
+ * @param options see {@link PostgresKeyStorageOptions}.
42
+ */
43
+ constructor(pgPool: pg.Pool, options?: PostgresKeyStorageOptions);
44
+ }
45
+ /**
46
+ * Optional parameters for {@link PostgresOAuthClientStorage}.
47
+ *
48
+ * See {@link PostgresOAuthClientStorage.constructor} for definitions.
49
+ */
50
+ export interface PostgresOAuthClientStorageOptions extends DbOAuthClientStorageOptions {
51
+ }
52
+ /**
53
+ * Implementation of {@link OAuthClientStorage } where keys stored in a
54
+ * Postgres database.
55
+ */
56
+ export declare class PostgresOAuthClientStorage extends DbOAuthClientStorage {
57
+ /**
58
+ * Creates a PostgresOAuthClientStorage object, optionally overriding defaults.
59
+ * @param pgPool the instance of the Posrgres client.
60
+ * @param options see {@link PostgresOAuthStorageOptions}.
61
+ */
62
+ constructor(pgPool: pg.Pool, options?: PostgresOAuthClientStorageOptions);
63
+ }
64
+ /**
65
+ * Optional parameters for {@link PostgresOAuthAuthorizationStorage}.
66
+ *
67
+ * See {@link PostgresOAuthClientStorage.constructor} for definitions.
68
+ */
69
+ export interface PostgresOAuthAuthorizationStorageOptions extends DbOAuthAuthorizationStorageOptions {
70
+ }
71
+ /**
72
+ * Implementation of {@link OAuthAuthorizationStorage } where keys stored in a
73
+ * Postgres database.
74
+ */
75
+ export declare class PostgresOAuthAuthorizationStorage extends DbOAuthAuthorizationStorage {
76
+ /**
77
+ * Creates a PostgresOAuthStorage object, optionally overriding defaults.
78
+ * @param pgPool the instance of the Posrgres client.
79
+ * @param options see {@link PostgresOAuthAuthorizationStorageOptions}.
80
+ */
81
+ constructor(pgPool: pg.Pool, options?: PostgresOAuthAuthorizationStorageOptions);
82
+ }
83
+ //# sourceMappingURL=postgresstorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgresstorage.d.ts","sourceRoot":"","sources":["../../src/storage/postgresstorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AAM9I;;;;GAIG;AACH,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;CACvE;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IAElD;;;;OAIG;gBACS,MAAM,EAAG,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,0BAA+B;CAG1E;AAKD;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;CACrE;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAEhD;;;;OAIG;gBACS,MAAM,EAAG,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,yBAA8B;CAGzE;AAKD;;;;GAIG;AACH,MAAM,WAAW,iCAAkC,SAAQ,2BAA2B;CACrF;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,oBAAoB;IAEhE;;;;OAIG;gBACS,MAAM,EAAG,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,iCAAsC;CAGjF;AAKD;;;;GAIG;AACH,MAAM,WAAW,wCAAyC,SAAQ,kCAAkC;CACnG;AAED;;;GAGG;AACH,qBAAa,iCAAkC,SAAQ,2BAA2B;IAE9E;;;;OAIG;gBACS,MAAM,EAAG,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,wCAA6C;CAGxF"}
@@ -0,0 +1,361 @@
1
+ import { UserStorage, KeyStorage, UserStorageGetOptions, UserStorageOptions, OAuthClientStorage, OAuthClientStorageOptions, OAuthAuthorizationStorage } from '../storage';
2
+ import { User, UserSecrets, UserInputFields, UserSecretsInputFields, Key, OAuthClient } from '@crossauth/common';
3
+
4
+ /**
5
+ * Optional parameters for {@link PrismaUserStorage}.
6
+ *
7
+ * See {@link PrismaUserStorage.constructor} for definitions.
8
+ */
9
+ export interface PrismaUserStorageOptions extends UserStorageOptions {
10
+ /** Name of user table (to Prisma, ie lowercase). Default `user` */
11
+ userTable?: string;
12
+ /** Name of user secrets table (to Prisma, ie lowercase). Default `userSecrets` */
13
+ userSecretsTable?: string;
14
+ /** Name of the id column in the user table. Can be set to `username` if that is your primary key.
15
+ * Default `id`.
16
+ */
17
+ idColumn?: string;
18
+ /** Name of the user id column in the user secrets.
19
+ * Default `userid`.
20
+ */
21
+ useridForeignKeyColumn?: string;
22
+ /** The prisma client instanfce. Leave this out to have Crossauth create a default one */
23
+ prismaClient?: any;
24
+ includes?: string[];
25
+ /**
26
+ * This works around a Fastify and Sveltekit limitation. If the id passed to
27
+ * getUserById() is a string but is numeric, first try forcing it to
28
+ * a number before selecting. If that fails, try it as the string,
29
+ * Default true.
30
+ */
31
+ forceIdToNumber?: boolean;
32
+ }
33
+ /**
34
+ * Implementation of {@link UserStorage} where username and password is stored in a database managed by
35
+ * the Prisma ORM.
36
+ *
37
+ * By default, the Prisma name (ie the lowercased version) is called `user`. It must have at least these fields:
38
+ * * `username String \@unique`
39
+ * * `username_normalized String \@unique`
40
+ * * `state String`
41
+ * It must also contain an ID column, which is either an `Int` or `String`, eg
42
+ * * `id Int \@id \@unique \@default(autoincrement())
43
+ * Alternatively you can set it to `username` if you don't have a separate ID field.
44
+ *
45
+ * You can optionally check if the `state` field is set to `awaitingemailverification` when validating users.
46
+ * If the username is not the email address,
47
+ * it must contain these extra two fields:
48
+ * * `email String \@unique`
49
+ * * `email_normalized String \@unique`
50
+ *
51
+ * You can optionally check if a `passwordReset` field is set to `true` when validating users. Enabling this requires
52
+ * the user table to also have a `passwordReset Boolean` field. Use this if you want to require your user to change his/her password.
53
+ *
54
+ * If `normalizeUsername` is true, getting a user by username will match on normalized (converting dialetics)
55
+ * and lowercased username. This is not true of matching by id, even if the id columns is the same as the username column.
56
+ *
57
+ * If `normalizeEmail` is true, getting a user by username will matched on normalized, lowercase username.
58
+ */
59
+ export declare class PrismaUserStorage extends UserStorage {
60
+ private userTable;
61
+ private userSecretsTable;
62
+ private idColumn;
63
+ private useridForeignKeyColumn;
64
+ private prismaClient;
65
+ private includes;
66
+ private includesObject;
67
+ private forceIdToNumber;
68
+ /**
69
+ * Creates a PrismaUserStorage object, optionally overriding defaults.
70
+ * @param options see {@link PrismaUserStorageOptions}
71
+ */
72
+ constructor(options?: PrismaUserStorageOptions);
73
+ private getUser;
74
+ /**
75
+ * Returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance matching the given username, or throws an Exception.
76
+ * @param username the username to look up
77
+ * @returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance, ie including the password hash.
78
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist` or `Connection`.
79
+ */
80
+ getUserByUsername(username: string, options?: UserStorageGetOptions): Promise<{
81
+ user: User;
82
+ secrets: UserSecrets;
83
+ }>;
84
+ /**
85
+ * Returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance matching the given email address, or throws an Exception.
86
+ *
87
+ * If there is no email field in the user, the username is assumed to contain the email
88
+ *
89
+ * @param email the email address to look up
90
+ * @returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance, ie including the password hash.
91
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist` or `Connection`.
92
+ */
93
+ getUserByEmail(email: string, options?: UserStorageGetOptions): Promise<{
94
+ user: User;
95
+ secrets: UserSecrets;
96
+ }>;
97
+ /**
98
+ * Same as {@link getUserByUsername } but matching user ID,
99
+ * @param id the user ID to match
100
+ * @returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance, ie including the password hash.
101
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist` or `Connection`.
102
+ */
103
+ getUserById(id: string | number, options?: UserStorageGetOptions): Promise<{
104
+ user: User;
105
+ secrets: UserSecrets;
106
+ }>;
107
+ /**
108
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
109
+ * exist, throw a CreossauthError with InvalidKey.
110
+ *
111
+ * Warning: the fields in `user` and `secrets` are not validated so, before calling this,
112
+ * you should check they are in `userEditableFields`.
113
+ *
114
+ * @param user the user to update. The id to update is taken from this obkect, which must be present. All other attributes are optional.
115
+ */
116
+ updateUser(user: Partial<User>, secrets?: Partial<UserSecrets>): Promise<void>;
117
+ /**
118
+ * Create a user
119
+ *
120
+ * Warning: the fields in `user` and `secrets` are not validated so, before calling this,
121
+ * you should check they are in `userEditableFields`.
122
+ *
123
+ * @param user
124
+ * @param secrets
125
+ */
126
+ createUser(user: UserInputFields, secrets?: UserSecretsInputFields): Promise<User>;
127
+ deleteUserByUsername(username: string): Promise<void>;
128
+ deleteUserById(id: string | number): Promise<void>;
129
+ private deleteUserById_internal;
130
+ getUsers(skip?: number, take?: number): Promise<User[]>;
131
+ }
132
+ /**
133
+ * Optional parameters for {@link PrismaKeyStorage}.
134
+ *
135
+ * See {@link PrismaKeyStorage.constructor} for definitions.
136
+ */
137
+ export interface PrismaKeyStorageOptions {
138
+ keyTable?: string;
139
+ prismaClient?: any;
140
+ transactionTimeout?: number;
141
+ /** Name of the user id column in the user secrets.
142
+ * Default `userid`.
143
+ */
144
+ useridForeignKeyColumn?: string;
145
+ }
146
+ /**
147
+ * Implementation of {@link KeyStorage } where keys stored in a database managed by
148
+ * the Prisma ORM.
149
+ *
150
+ * By default, the Prisma name (ie the lowercased version) is called `key`. It must have at least three fields:
151
+ * * `value String \@unique`
152
+ * * `userid String or Int`
153
+ * * `created DateTime`
154
+ * * `expires DateTime`
155
+ * `key` must have `\@unique`. It may also contain an ID column, which is not used. If in the schema,
156
+ * it must be autoincrement. THe `userid` may be a `String` or `Int`. If a database table is used for
157
+ * user storage (eg {@link PrismaUserStorage} this should be a foreign key to the user table), in which case there
158
+ * should also be a `user` field (see Prisma documentation on foreign keys).
159
+ */
160
+ export declare class PrismaKeyStorage extends KeyStorage {
161
+ private keyTable;
162
+ private prismaClient;
163
+ private transactionTimeout;
164
+ private useridForeignKeyColumn;
165
+ /**
166
+ * Constructor with user storage object to use plus optional parameters.
167
+ *
168
+ * @param options See {@link PrismaKeyStorageOptions}
169
+ */
170
+ constructor(options?: PrismaKeyStorageOptions);
171
+ getKey(key: string): Promise<Key>;
172
+ /**
173
+ * Returns the matching Key record, or throws an exception if it doesn't exist
174
+ * @param key the session key to look up in the session storage.
175
+ * @returns the {@link User } object for the user with the given session key, with the password hash removed, as well as the expiry date/time of the key.
176
+ * @throws a {@link @crossauth/common!CrossauthError } instance with {@link @crossauth/common!ErrorCode} of `InvalidSession`, `UserNotExist` or `Connection`
177
+ */
178
+ private getKeyWithTransaction;
179
+ /**
180
+ * Saves a key in the session table.
181
+ *
182
+ * @param userid user ID to store with the session key. See {@link PrismaUserStorage} for how this may differ from `username`.
183
+ * @param value the value of the key to store.
184
+ * @param created the date/time the key was created.
185
+ * @param expires the date/time the key expires.
186
+ * @param extraFields these will be stored in the key table row
187
+ * @throws {@link @crossauth/common!CrossauthError } if the key could not be stored.
188
+ */
189
+ saveKey(userid: string | number | undefined, value: string, created: Date, expires: Date | undefined, data?: string, extraFields?: {
190
+ [key: string]: any;
191
+ }): Promise<void>;
192
+ /**
193
+ *
194
+ * @param value the value of the key to delete
195
+ * @throws {@link @crossauth/common!CrossauthError } if the key could not be deleted.
196
+ */
197
+ deleteKey(value: string): Promise<void>;
198
+ /**
199
+ * Deletes all keys from storage for the given user ID
200
+ *
201
+ * @param userid : user ID to delete keys for
202
+ */
203
+ deleteAllForUser(userid: string | number | undefined, prefix: string, except?: string): Promise<void>;
204
+ deleteMatching(key: Partial<Key>): Promise<void>;
205
+ /**
206
+ * Deletes all keys with the given prefix
207
+ *
208
+ * @param userid : user ID to delete keys for
209
+ */
210
+ deleteWithPrefix(userid: string | number | undefined, prefix: string): Promise<void>;
211
+ getAllForUser(userid: string | number | undefined): Promise<Key[]>;
212
+ /**
213
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
214
+ * exist, throw a CreossauthError with InvalidKey.
215
+ * @param key the new values of the key. `value` must be set and will not be updated.
216
+ * any other fields set (not undefined) will be updated.
217
+ */
218
+ updateKey(key: Partial<Key>): Promise<void>;
219
+ private updateKeyWithTransaction;
220
+ /**
221
+ * See {@link KeyStorage}.
222
+ */
223
+ updateData(keyName: string, dataName: string, value: any | undefined): Promise<void>;
224
+ /**
225
+ * See {@link KeyStorage}.
226
+ */
227
+ updateManyData(keyName: string, dataArray: [{
228
+ dataName: string;
229
+ value: any | undefined;
230
+ }]): Promise<void>;
231
+ /**
232
+ * See {@link KeyStorage}.
233
+ */
234
+ deleteData(keyName: string, dataName: string): Promise<void>;
235
+ }
236
+ /**
237
+ * Optional parameters for {@link PrismaOAuthClientStorage}.
238
+ */
239
+ export interface PrismaOAuthClientStorageOptions extends OAuthClientStorageOptions {
240
+ /** Prisma name of the OAuth Client table. Default oAuthClient */
241
+ clientTable?: string;
242
+ /** Prisma name of the OAuth valid flows table. Default oClientValidFlow */
243
+ validFlowTable?: string;
244
+ /** Prisma name of the OAuth Redirect Uri table. Default oAuthClientRedirectUri */
245
+ redirectUriTable?: string;
246
+ /** A Prisma client to use. If not provided, one will be created */
247
+ prismaClient?: any;
248
+ /** In milliseconds.. Default 5000 */
249
+ transactionTimeout?: number;
250
+ /**
251
+ * This is to work around a Prisma bug. SQLite returns an error
252
+ * when updating a client if inside a transaction.
253
+ * - `Update` `OAuthClient` table is updated, `OAuthClientAuthorization`
254
+ * and `OAuthValidFlow` are updated with a delete and insert.
255
+ * Doesn't work with SQLite.
256
+ * - `DeleteAndInsert` updated to the `OAuthClient`,
257
+ * `OAuthClientAuthorization` and `OAuthValidFlow` are
258
+ * all done as a delete then an insert. Works for
259
+ * SQLite but if you have cascading dependencies on
260
+ * the `OAuthClient` table, dependent rows will be
261
+ * deleted.
262
+ * Our recommendation is to use `DeleteAndInsert` for SQLite and
263
+ * `Update` otherwise.
264
+ *
265
+ * Default `DeleteAndInsert`
266
+ */
267
+ updateMode?: "Update" | "DeleteAndInsert";
268
+ /** Name of the user id column in the user secrets.
269
+ * Default `userid`.
270
+ */
271
+ useridForeignKeyColumn?: string;
272
+ }
273
+ /**
274
+ * Implementation of {@link OAuthClientStorage } where clients stored in a database managed by
275
+ * the Prisma ORM.
276
+ */
277
+ export declare class PrismaOAuthClientStorage extends OAuthClientStorage {
278
+ private clientTable;
279
+ private redirectUriTable;
280
+ private validFlowTable;
281
+ private prismaClient;
282
+ private transactionTimeout;
283
+ private updateMode;
284
+ private useridForeignKeyColumn;
285
+ /**
286
+ * Constructor with user storage object to use plus optional parameters.
287
+ *
288
+ * @param options See {@link PrismaOAuthClientStorageOptions}
289
+ */
290
+ constructor(options?: PrismaOAuthClientStorageOptions);
291
+ getClientById(client_id: string): Promise<OAuthClient>;
292
+ getClientByName(name: string, userid?: string | number | null): Promise<OAuthClient[]>;
293
+ private getClientWithTransaction;
294
+ /**
295
+ * Saves a key in the session table.
296
+ *
297
+ * @param client fields for the client to create
298
+ * @throws {@link @crossauth/common!CrossauthError } if the client could not be stored.
299
+ */
300
+ createClient(client: OAuthClient): Promise<OAuthClient>;
301
+ private createClientWithTransaction;
302
+ /**
303
+ *
304
+ * @param client_id the client to delete
305
+ * @throws {@link @crossauth/common!CrossauthError } if the key could not be deleted.
306
+ */
307
+ deleteClient(client_id: string): Promise<void>;
308
+ private deleteClientWithTransaction;
309
+ /**
310
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
311
+ * exist, throw a CreossauthError with InvalidKey.
312
+ * @param client the client to update. It will be searched on its client_id, which cannot be updated.
313
+ */
314
+ updateClient(client: Partial<OAuthClient>): Promise<void>;
315
+ private updateClientWithTransaction_update;
316
+ private updateClientWithTransaction_deleteAndInsert;
317
+ getClients(skip?: number, take?: number, userid?: string | number | null): Promise<OAuthClient[]>;
318
+ }
319
+ /**
320
+ * Optional parameters for {@link PrismaOAuthAuthorizationStorage}.
321
+ */
322
+ export interface PrismaOAuthAuthorizationStorageOptions extends OAuthClientStorageOptions {
323
+ /** Prisma name of the OAuth Authorization table. Default oAuthAuthorization */
324
+ authorizationTable?: string;
325
+ /** A Prisma client to use. If not provided, one will be created */
326
+ prismaClient?: any;
327
+ transactionTimeout?: number;
328
+ /** Name of the user id column in the user secrets.
329
+ * Default `userid`.
330
+ */
331
+ useridForeignKeyColumn?: string;
332
+ }
333
+ /**
334
+ * Implementation of {@link OAuthAuthorizationStorage } where authorizations are stored in a database managed by
335
+ * the Prisma ORM.
336
+ */
337
+ export declare class PrismaOAuthAuthorizationStorage extends OAuthAuthorizationStorage {
338
+ private authorizationTable;
339
+ private prismaClient;
340
+ private transactionTimeout;
341
+ private useridForeignKeyColumn;
342
+ /**
343
+ * Constructor with user storage object to use plus optional parameters.
344
+ *
345
+ * @param options See {@link PrismaOAuthClientStorageOptions}
346
+ */
347
+ constructor(options?: PrismaOAuthClientStorageOptions);
348
+ getAuthorizations(client_id: string, userid: string | number | undefined): Promise<(string | null)[]>;
349
+ updateAuthorizations(client_id: string, userid: string | number | null, scopes: string[]): Promise<void>;
350
+ /**
351
+ * Saves a key in the session table.
352
+ *
353
+ * @param client_id the client to update
354
+ * @param userid the user ID to associate with the client, or undefined
355
+ * for a client not associated with a user
356
+ * @param scopes the scopes that are authorized (new plus existing)
357
+ * @throws {@link @crossauth/common!CrossauthError } if the client could not be stored.
358
+ */
359
+ private updateAuthorizationsWithTransaction;
360
+ }
361
+ //# sourceMappingURL=prismastorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prismastorage.d.ts","sourceRoot":"","sources":["../../src/storage/prismastorage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACzL,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,KAAK,GAAG,EAAE,K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