@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,319 @@
1
+ import { DbPool } from './dbconnection';
2
+ import { UserStorage, KeyStorage, UserStorageGetOptions, UserStorageOptions, OAuthClientStorage, OAuthClientStorageOptions, OAuthAuthorizationStorage } from '../storage';
3
+ import { User, UserSecrets, Key, UserInputFields, UserSecretsInputFields, OAuthClient } from '@crossauth/common';
4
+
5
+ /**
6
+ * Optional parameters for {@link DbUserStorage}.
7
+ *
8
+ * See {@link DbUserStorage.constructor} for definitions.
9
+ */
10
+ export interface DbUserStorageOptions extends UserStorageOptions {
11
+ /** Name of user table. Default `users` */
12
+ userTable?: string;
13
+ /** Name of user secrets table Default `usersecrets` */
14
+ userSecretsTable?: string;
15
+ /** Name of the id column in the user table. Can be set to `username` if that is your primary key.
16
+ * Default `id`.
17
+ */
18
+ idColumn?: string;
19
+ /** Name of the user id column in the user secrets.
20
+ * Default `userid`.
21
+ */
22
+ useridForeignKeyColumn?: string;
23
+ /**
24
+ * This works around a Fastify and Sveltekit limitation. If the id passed to
25
+ * getUserById() is a string but is numeric, first try forcing it to
26
+ * a number before selecting. If that fails, try it as the string.
27
+ * Default true.
28
+ */
29
+ forceIdToNumber?: boolean;
30
+ }
31
+ /**
32
+ * Implementation of {@link UserStorage} where username and password is stored
33
+ * in two database tables: one for non secret fields, one for secret fields.
34
+ *
35
+ * The database engine is abstracted out. Instead of using this class,
36
+ * use a subclass such as {@link PostgresUserTable}, etc.
37
+ *
38
+ * By default, the table is called `users` It must have at least these fields:
39
+ * * `username String \@unique`
40
+ * * `username_normalized String \@unique`
41
+ * * `state String`
42
+ * It must also contain an ID column, which is either an integer or string type, eg
43
+ * * `id serial primary key`
44
+ * Alternatively you can set it to `username` if you don't have a separate ID field.
45
+ *
46
+ * You can optionally check if the `state` field is set to `awaitingemailverification` when validating users.
47
+ * If the username is not the email address,
48
+ * it must contain these extra two fields:
49
+ * * `email String \@unique`
50
+ * * `email_normalized String \@unique`
51
+ *
52
+ * You can optionally check if a `passwordReset` field is set to `true` when validating users. Enabling this requires
53
+ * the user table to also have a `passwordReset Boolean` field. Use this if you want to require your user to change his/her password.
54
+ *
55
+ * If `normalizeUsername` is true, getting a user by username will match on normalized (converting dialetics)
56
+ * and lowercased username. This is not true of matching by id, even if the id columns is the same as the username column.
57
+ *
58
+ * If `normalitzEmail` is true, getting a user by username will matched on normalized, lowercase username.
59
+ *
60
+ * Some database engines are case insensitve by default whereas Typescript isn't. If you
61
+ * create your tables with case-sensitive names, these will be returned as-is.
62
+ * If you create them with case insensitive names (the default) but you have
63
+ * the name with a different case in your input, it will be returned as
64
+ * lowercase from the database. Therefore if you do not explicitly create
65
+ * your tables with uppercase columns, make sure any field you pass in the
66
+ * {@link @crossauth/common!User} or {@link @crossauth/common!UserSecrets} is
67
+ * lowercase.
68
+ */
69
+ export declare class DbUserStorage extends UserStorage {
70
+ private userTable;
71
+ private userSecretsTable;
72
+ private idColumn;
73
+ private useridForeignKeyColumn;
74
+ private forceIdToNumber;
75
+ private dbPool;
76
+ /**
77
+ * Creates a DbUserStorage object, optionally overriding defaults.
78
+ * @param dbPool the instance of the Posrgres client.
79
+ * @param options see {@link DbUserStorageOptions}.
80
+ */
81
+ constructor(dbPool: DbPool, options?: DbUserStorageOptions);
82
+ /**
83
+ * Returns user matching the given id, or throws an exception.
84
+ *
85
+ * @param id the id to return the user of
86
+ * @param options optionally turn off checks. Used internally
87
+ * @throws CrossauthException with ErrorCode either `UserNotExist` or whatever pg throws
88
+ */
89
+ getUserById(id: string | number, options?: UserStorageGetOptions): Promise<{
90
+ user: User;
91
+ secrets: UserSecrets;
92
+ }>;
93
+ /**
94
+ * Returns user matching the given username, or throws an exception.
95
+ *
96
+ * Matches on the normalized username if `normalizeUsername` is true.
97
+ * @param username the username to return the user of
98
+ * @param options optionally turn off checks. Used internally
99
+ * @throws CrossauthException with ErrorCode either `UserNotExist` or whatever pg throws
100
+ */
101
+ getUserByUsername(username: string, options?: UserStorageGetOptions): Promise<{
102
+ user: User;
103
+ secrets: UserSecrets;
104
+ }>;
105
+ /**
106
+ * Returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance matching the given email address, or throws an Exception.
107
+ *
108
+ * If there is no email field in the user, the username is assumed to contain the email
109
+ *
110
+ * @param email the email address to look up
111
+ * @returns a {@link @crossauth/common!User} and {@link @crossauth/common!UserSecrets} instance, ie including the password hash.
112
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist` or whatever pg throwsa.
113
+ */
114
+ getUserByEmail(email: string, options?: UserStorageGetOptions): Promise<{
115
+ user: User;
116
+ secrets: UserSecrets;
117
+ }>;
118
+ private getUser;
119
+ /**
120
+ * Returns all users, regardless of their status, ordered by username
121
+ * @param skip limit to this many records returned
122
+ * @param take skip this nuber of records from the start
123
+ * @returns
124
+ */
125
+ getUsers(skip?: number, take?: number): Promise<User[]>;
126
+ /**
127
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
128
+ * exist, throw a CreossauthError with InvalidKey.
129
+ *
130
+ * Warning: the fields in `user` and `secrets` are not validated so, before calling this,
131
+ * you should check they are in `userEditableFields`.
132
+ *
133
+ * @param user the user to update. The id to update is taken from this obkect, which must be present. All other attributes are optional.
134
+ */
135
+ updateUser(user: Partial<User>, secrets?: Partial<UserSecrets>): Promise<void>;
136
+ /**
137
+ * Create a user
138
+ *
139
+ * Warning: the fields in `user` and `secrets` are not validated so, before calling this,
140
+ * you should check they are in `userEditableFields`.
141
+ *
142
+ * @param user
143
+ * @param secrets
144
+ */
145
+ createUser(user: UserInputFields, secrets?: UserSecretsInputFields): Promise<User>;
146
+ deleteUserByUsername(username: string): Promise<void>;
147
+ deleteUserById(id: string | number): Promise<void>;
148
+ private deleteUserById_internal;
149
+ }
150
+ /**
151
+ * Optional parameters for {@link DbKeyStorage}.
152
+ *
153
+ * See {@link DbKeyStorage.constructor} for definitions.
154
+ */
155
+ export interface DbKeyStorageOptions {
156
+ keyTable?: string;
157
+ useridForeignKeyColumn?: string;
158
+ }
159
+ /**
160
+ * Implementation of {@link KeyStorage } where keys stored in a database managed by
161
+ * a database engine.
162
+ *
163
+ * This is an abstract class. Instantiate a subclass instead,
164
+ * eg {@link PostgresKeyStorage}.
165
+ *
166
+ * By default, table is called `key`. It must have at least three fields:
167
+ * * `value string type unique`
168
+ * * `userid String type or integer`
169
+ * * `created timestamp`
170
+ * * `expires timestamp`
171
+ * `key` must have `\@unique`. It may also contain an ID column, which is not used. If in the schema,
172
+ * it must be autoincrement. THe `userid` may be a `String` or `Int`. If a database table is used for
173
+ * user storage (eg {@link PostgresUserStorage} this should be a foreign key to the user table), in which case there
174
+ * should also be a `user` field (see Prisma documentation on foreign keys).
175
+ *
176
+ * In returned {@link @crossauth/common!Key} objects, userid is camelcase. By
177
+ * default Postgres is case-insensitive. If the columns is `userid` in lowercase,
178
+ * it is converted to `userid` when returned. Vice versa when saving to the database.
179
+ */
180
+ export declare class DbKeyStorage extends KeyStorage {
181
+ private keyTable;
182
+ private dbPool;
183
+ private useridForeignKeyColumn;
184
+ /**
185
+ * Constructor with user storage object to use plus optional parameters.
186
+ *
187
+ * @param dbPool the instance of the Posrgres client.
188
+ * @param options See {@link PrismaKeyStorageOptions}
189
+ */
190
+ constructor(dbPool: DbPool, options?: DbKeyStorageOptions);
191
+ getKey(key: string): Promise<Key>;
192
+ private getKeyInTransaction;
193
+ private makeKey;
194
+ /**
195
+ * Saves a key in the session table.
196
+ *
197
+ * @param userid user ID to store with the session key. See {@link PrismaUserStorage} for how this may differ from `username`.
198
+ * @param value the value of the key to store.
199
+ * @param created the date/time the key was created.
200
+ * @param expires the date/time the key expires.
201
+ * @param extraFields these will be stored in the key table row
202
+ * @throws {@link @crossauth/common!CrossauthError } if the key could not be stored.
203
+ */
204
+ saveKey(userid: string | number | undefined, value: string, created: Date, expires: Date | undefined, data?: string, extraFields?: {
205
+ [key: string]: any;
206
+ }): Promise<void>;
207
+ deleteKey(value: string): Promise<void>;
208
+ deleteAllForUser(userid: string | number | undefined, prefix: string, except?: string): Promise<void>;
209
+ deleteMatching(key: Partial<Key>): Promise<void>;
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 updateKeyInTransaction;
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 DbOAuthClientStorageOptions extends OAuthClientStorageOptions {
240
+ /** Table name of the OAuth Client table. Default oauthclient */
241
+ clientTable?: string;
242
+ /** Table name of the OAuth Redirect Uri table. Default oauthclientredirecturi */
243
+ redirectUriTable?: string;
244
+ /** Prisma name of the OAuth valid flows table. Default oauthclientvalidflow */
245
+ validFlowTable?: string;
246
+ /** Name of the user id column in the client table.
247
+ * Default `userid`.
248
+ */
249
+ useridForeignKeyColumn?: string;
250
+ }
251
+ /**
252
+ * Implementation of {@link OAuthClientStorage } where clients stored in a database managed by
253
+ * the Prisma ORM.
254
+ */
255
+ export declare class DbOAuthClientStorage extends OAuthClientStorage {
256
+ private clientTable;
257
+ private redirectUriTable;
258
+ private validFlowTable;
259
+ private dbPool;
260
+ private useridForeignKeyColumn;
261
+ /**
262
+ * Constructor with user storage object to use plus optional parameters.
263
+ *
264
+ * @param options See {@link PrismaOAuthClientStorageOptions}
265
+ */
266
+ constructor(dbPool: DbPool, options?: DbOAuthClientStorageOptions);
267
+ getClientById(client_id: string): Promise<OAuthClient>;
268
+ getClientByName(name: string, userid?: string | number | null): Promise<OAuthClient[]>;
269
+ private makeClient;
270
+ private getClientWithTransaction;
271
+ /**
272
+ * Saves a key in the session table.
273
+ *
274
+ * @param client fields for the client to create
275
+ * @throws {@link @crossauth/common!CrossauthError } if the client could not be stored.
276
+ */
277
+ createClient(client: OAuthClient): Promise<OAuthClient>;
278
+ private createClientWithTransaction;
279
+ /**
280
+ *
281
+ * @param client_id the client to delete
282
+ * @throws {@link @crossauth/common!CrossauthError } if the key could not be deleted.
283
+ */
284
+ deleteClient(client_id: string): Promise<void>;
285
+ private deleteClientWithTransaction;
286
+ /**
287
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
288
+ * exist, throw a CreossauthError with InvalidKey.
289
+ * @param client the client to update. It will be searched on its client_id, which cannot be updated.
290
+ */
291
+ updateClient(client: Partial<OAuthClient>): Promise<void>;
292
+ private updateClientWithTransaction;
293
+ getClients(skip?: number, take?: number, userid?: string | number | null): Promise<OAuthClient[]>;
294
+ }
295
+ /**
296
+ * Optional parameters for {@link DbOAuthAuthorizationStorage}.
297
+ */
298
+ export interface DbOAuthAuthorizationStorageOptions extends OAuthClientStorageOptions {
299
+ /** Prisma name of the OAuth Authorization table. Default oAuthAuthorization */
300
+ authorizationTable?: string;
301
+ useridForeignKeyColumn?: string;
302
+ }
303
+ /**
304
+ * Implementation of {@link OAuthAuthorizationStorage } where authorizations are stored in a database.
305
+ */
306
+ export declare class DbOAuthAuthorizationStorage extends OAuthAuthorizationStorage {
307
+ private authorizationTable;
308
+ private useridForeignKeyColumn;
309
+ private dbPool;
310
+ /**
311
+ * Constructor with user storage object to use plus optional parameters.
312
+ *
313
+ * @param options See {@link PrismaOAuthClientStorageOptions}
314
+ */
315
+ constructor(dbPool: DbPool, options?: DbOAuthClientStorageOptions);
316
+ getAuthorizations(client_id: string, userid: string | number | undefined): Promise<(string | null)[]>;
317
+ updateAuthorizations(client_id: string, userid: string | number | null, scopes: string[]): Promise<void>;
318
+ }
319
+ //# sourceMappingURL=dbstorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dbstorage.d.ts","sourceRoot":"","sources":["../../src/storage/dbstorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACH,WAAW,EACX,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACH,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,GAAG,EACR,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EACJ,MAAM,mBAAmB,CAAC;AAQ1C;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC5D,2CAA2C;IAC3C,SAAS,CAAC,EAAG,MAAM,CAAC;IAEpB,uDAAuD;IACvD,gBAAgB,CAAC,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAG,MAAM,CAAC;IAEnB;;OAEG;IACH,sBAAsB,CAAC,EAAG,MAAM,CAAC;IAEjC;;;;;OAKG;IACH,eAAe,CAAC,EAAG,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC1C,OAAO,CAAC,SAAS,CAAoB;I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M,GAAC,SAAS,GAAI,OAAO,CAAC,CAAC,MAAM,GAAC,IAAI,CAAC,EAAE,CAAC;IA0BlG,oBAAoB,CAAC,SAAS,EAAG,MAAM,EAAE,MAAM,EAAG,MAAM,GAAC,MAAM,GAAC,IAAI,EAAE,MAAM,EAAG,MAAM,EAAE,GAAI,OAAO,CAAC,IAAI,CAAC;CAyCjH"}
@@ -0,0 +1,225 @@
1
+ import { UserStorage, KeyStorage, UserStorageGetOptions, UserStorageOptions, OAuthClientStorage, OAuthClientStorageOptions, OAuthAuthorizationStorage, OAuthAuthorizationStorageOptions } from '../storage';
2
+ import { User, UserSecrets, Key, UserInputFields, UserSecretsInputFields, OAuthClient } from '@crossauth/common';
3
+
4
+ /**
5
+ * Optional parameters for {@link InMemoryUserStorage}.
6
+ *
7
+ * See {@link InMemoryUserStorage.constructor} for definitions.
8
+ */
9
+ export interface InMemoryUserStorageOptions extends UserStorageOptions {
10
+ }
11
+ /**
12
+ * Implementation of {@link UserStorage} where username and password is stored in memory. It is really only
13
+ * intended for testing and is not thread safe.
14
+ *
15
+ * There is no separate ID field - it is set to username.
16
+ *
17
+ * You can optionally check if the state field is set to `awaitingemailverification` when validating users,
18
+ */
19
+ export declare class InMemoryUserStorage extends UserStorage {
20
+ usersByUsername: {
21
+ [key: string]: User;
22
+ };
23
+ usersByEmail: {
24
+ [key: string]: User;
25
+ };
26
+ secretsByUsername: {
27
+ [key: string]: UserSecretsInputFields;
28
+ };
29
+ secretsByEmail: {
30
+ [key: string]: UserSecretsInputFields;
31
+ };
32
+ /**
33
+ * Creates a InMemoryUserStorage object, optionally overriding defaults.
34
+ * @param options @see {@link InMemoryUserStorageOptions}
35
+ */
36
+ constructor(options?: InMemoryUserStorageOptions);
37
+ /**
38
+ * Create a user
39
+ * @param user the user to save
40
+ * @param secrets optionally, secrets to save
41
+ */
42
+ createUser(user: UserInputFields, secrets?: UserSecretsInputFields): Promise<User>;
43
+ /**
44
+ * Returns a {@link User }and {@link UserSecrets } instance matching the given username, or throws an Exception.
45
+ *
46
+ * @param username the username to look up
47
+ * @returns a {@link User } and {@link UserSecrets }instance
48
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist`.
49
+ */
50
+ getUserByUsername(username: string, options?: UserStorageGetOptions): Promise<{
51
+ user: User;
52
+ secrets: UserSecrets;
53
+ }>;
54
+ /**
55
+ * Returns a {@link User } and {@link UserSecrets } instance matching the given email address, or throws an Exception.
56
+ *
57
+ * @param email the emaila ddress to look up
58
+ * @returns a {@link User } and {@link UserSecrets } instance, ie including the password hash.
59
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist`.
60
+ */
61
+ getUserByEmail(email: string, options?: UserStorageGetOptions): Promise<{
62
+ user: User;
63
+ secrets: UserSecrets;
64
+ }>;
65
+ /**
66
+ * Same as {@link getUserByUsername } - userid is the username in this model,
67
+ * @param id the user ID to match
68
+ * @returns a {@link @crossauth/common!User} and
69
+ * {@link @crossauth/common!UserSecrets}instance, ie including
70
+ * the password hash.
71
+ * @throws {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to either `UserNotExist` or `Connection`.
72
+ */
73
+ getUserById(id: string, options?: UserStorageGetOptions): Promise<{
74
+ user: User;
75
+ secrets: UserSecrets;
76
+ }>;
77
+ /**
78
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
79
+ * exist, throw a CreossauthError with InvalidKey.
80
+ * @param user the user to update. The id to update is taken from this obkect, which must be present. All other attributes are optional.
81
+ */
82
+ updateUser(user: Partial<User>, secrets?: Partial<UserSecrets>): Promise<void>;
83
+ /**
84
+ * Deletes the given user
85
+ * @param username username of user to delete
86
+ */
87
+ deleteUserByUsername(username: string): Promise<void>;
88
+ /**
89
+ * Deletes the given user
90
+ * @param id id of user to delete
91
+ */
92
+ deleteUserById(id: string | number): Promise<void>;
93
+ getUsers(skip?: number, take?: number): Promise<User[]>;
94
+ }
95
+ /**
96
+ * Implementation of {@link KeyStorage } where keys stored in memory. Intended for testing.
97
+ */
98
+ export declare class InMemoryKeyStorage extends KeyStorage {
99
+ private keys;
100
+ private keysByUserId;
101
+ private nonUserKeys;
102
+ /**
103
+ * Constructor
104
+ */
105
+ constructor();
106
+ /**
107
+ * Returns the matching key recortd, with additional, or throws an exception.
108
+ * @param key the key to look up in the key storage.
109
+ * @returns the matching Key record
110
+ * @throws a {@link @crossauth/common!CrossauthError } instance with {@link @crossauth/common!ErrorCode} of `InvalidKey`, `UserNotExist` or `Connection`
111
+ */
112
+ getKey(key: string): Promise<Key>;
113
+ /**
114
+ * Saves a session key in the session table.
115
+ *
116
+ * @param userid user ID to store with the session key. See {@link InMemoryUserStorage} for how this may differ from `username`.
117
+ * @param keyValue the value of session key to store.
118
+ * @param dateCreated the date/time the key was created.
119
+ * @param expires the date/time the key expires.
120
+ * @param extraFields these will also be stored in the key table row
121
+ */
122
+ saveKey(userid: string | number | undefined, keyValue: string, dateCreated: Date, expires: Date | undefined, data?: string, extraFields?: {
123
+ [key: string]: any;
124
+ }): Promise<void>;
125
+ /**
126
+ *
127
+ * @param keyValue the value of key to delete
128
+ */
129
+ deleteKey(keyValue: string): Promise<void>;
130
+ /**
131
+ * Deletes all keys from storage for the given user ID
132
+ *
133
+ * @param userid : user ID to delete keys for
134
+ */
135
+ deleteAllForUser(userid: string | number | undefined | null, prefix: string, except?: string | undefined): Promise<void>;
136
+ getAllForUser(userid: string | number | undefined): Promise<Key[]>;
137
+ deleteMatching(key: Partial<Key>): Promise<void>;
138
+ /**
139
+ * If the given session key exist in the database, update it with the passed values. If it doesn't
140
+ * exist, throw a CreossauthError with InvalidKey.
141
+ * @param key
142
+ */
143
+ updateKey(key: Partial<Key>): Promise<void>;
144
+ /**
145
+ * See {@link KeyStorage}.
146
+ */
147
+ updateData(keyName: string, dataName: string, value: any | undefined): Promise<void>;
148
+ /**
149
+ * See {@link KeyStorage}.
150
+ */
151
+ updateManyData(keyName: string, dataArray: {
152
+ dataName: string;
153
+ value: any | undefined;
154
+ }[]): Promise<void>;
155
+ /**
156
+ * See {@link KeyStorage}.
157
+ */
158
+ deleteData(keyName: string, dataName: string): Promise<void>;
159
+ }
160
+ /**
161
+ * Implementation of {@link KeyStorage } where keys stored in memory. Intended for testing.
162
+ */
163
+ export declare class InMemoryOAuthClientStorage extends OAuthClientStorage {
164
+ private clients;
165
+ private clientsByName;
166
+ /**
167
+ * Constructor
168
+ */
169
+ constructor(_options?: OAuthClientStorageOptions);
170
+ /**
171
+ * Returns the matching client record or throws an exception.
172
+ * @param client_id the client to look up in the key storage.
173
+ * @returns the matching client record
174
+ * @throws a {@link @crossauth/common!CrossauthError } instance with {@link @crossauth/common!ErrorCode} of `InvalidKey`, `UserNotExist` or `Connection`
175
+ */
176
+ getClientById(client_id: string): Promise<OAuthClient>;
177
+ /**
178
+ * Returns the matching client record or throws an exception.
179
+ * @param name the client to look up in the key storage.
180
+ * @returns the matching client record
181
+ * @throws a {@link @crossauth/common!CrossauthError } instance with {@link @crossauth/common!ErrorCode} of `InvalidKey`, `UserNotExist` or `Connection`
182
+ */
183
+ getClientByName(name: string, userid?: string | number | null): Promise<OAuthClient[]>;
184
+ /**
185
+ * Saves a client in the client table.
186
+ *
187
+ * @param client the client to save.
188
+ */
189
+ createClient(client: OAuthClient): Promise<OAuthClient>;
190
+ /**
191
+ *
192
+ * @param client_id the client to delete
193
+ */
194
+ deleteClient(client_id: string): Promise<void>;
195
+ /**
196
+ * If the given client exists in the database, update it with the passed values.
197
+ *
198
+ * @param client the fields to update. This must include `client_id` for search purposes, but this field is not updated.
199
+ * @throws {@link @crossauth/common!CrossauthError} with `InvalidClientId` if the client id doesn't exist}
200
+ */
201
+ updateClient(client: Partial<OAuthClient>): Promise<void>;
202
+ getClients(skip?: number, take?: number, userid?: string | number | null): Promise<OAuthClient[]>;
203
+ }
204
+ /**
205
+ * Implementation of {@link KeyStorage } where keys stored in memory. Intended for testing.
206
+ */
207
+ export declare class InMemoryOAuthAuthorizationStorage extends OAuthAuthorizationStorage {
208
+ private byClientAndUser;
209
+ private byClient;
210
+ /**
211
+ * Constructor
212
+ */
213
+ constructor(_options?: OAuthAuthorizationStorageOptions);
214
+ getAuthorizations(client_id: string, userid: string | number | undefined): Promise<string[]>;
215
+ /**
216
+ * Saves a client in the client table.
217
+ *
218
+ * @param client_id the client to save.
219
+ * @param userid the user Id to associate with the client. Undefined means
220
+ * not associated with a user
221
+ * @param scopes the scopes that have been authorized for the client
222
+ */
223
+ updateAuthorizations(client_id: string, userid: string | number | null, scopes: string[]): Promise<void>;
224
+ }
225
+ //# sourceMappingURL=inmemorystorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inmemorystorage.d.ts","sourceRoot":"","sources":["../../src/storage/inmemorystorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAChO,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI/I;;;;GAIG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;CACrE;AAOD;;;;;;;EAOE;AACF,qBAAa,mBAAoB,SAAQ,WAAW;IAChD,eAAe,EAAG;QAAE,CAAC,GAAG,EAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAM;IAChD,YAAY,EAAG;QAAE,CAAC,GAAG,EAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAM;IAC7C,iBAAiB,EAAG;QAAE,CAAC,GAAG,EAAG,MAAM,GAAG,sBAAsB,CAAA;KAAE,CAAM;IACpE,cAAc,EAAG;QAAE,CAAC,GAAG,EAAG,MAAM,GA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