@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,117 @@
1
+ import { User, Key, UserSecretsInputFields, UserInputFields } from '@crossauth/common';
2
+ import { Authenticator, AuthenticationParameters, AuthenticationOptions } from '../auth.ts';
3
+
4
+ /**
5
+ * Authenticator for Time-Based One-Time Passwords (TOTP), eg
6
+ * Google Authenticator
7
+ */
8
+ export declare class TotpAuthenticator extends Authenticator {
9
+ private appName;
10
+ /**
11
+ * Constructor
12
+ * @param appName this forms part of the QR code that users scan into
13
+ * their authenticator app. The name will appear in their app
14
+ * @param options See {@link AuthenticationOptions}.
15
+ */
16
+ constructor(appName: string, options?: AuthenticationOptions);
17
+ /**
18
+ * Used by the OAuth password_mfa grant type.
19
+ */
20
+ mfaType(): "none" | "oob" | "otp";
21
+ /**
22
+ * Used by the OAuth password_mfa grant type.
23
+ */
24
+ mfaChannel(): "none" | "email" | "sms";
25
+ private createSecret;
26
+ private getSecretFromSession;
27
+ /**
28
+ * Creates a shared secret and returns it, along with image data for the QR
29
+ * code to display.
30
+ * @param user the `username` is expected to be present. All other fields
31
+ * are ignored.
32
+ * @returns `userData` containing `username`, `totpsecret`, `factor2` and
33
+ * `qr`.
34
+ * `sessionData` containing the same except `qr`.
35
+ */
36
+ prepareConfiguration(user: UserInputFields): Promise<{
37
+ userData: {
38
+ [key: string]: any;
39
+ };
40
+ sessionData: {
41
+ [key: string]: any;
42
+ };
43
+ } | undefined>;
44
+ /**
45
+ * For cases when the 2FA page was closed without completing. Returns the
46
+ * same data as `prepareConfiguration`, without generating a new secret.
47
+ * @param username user to return this for
48
+ * @param sessionKey the session key, which should cantain the
49
+ * `sessionData` from `prepareConfiguration`,
50
+ * @returns `userData` containing `totpsecret`, `factor2` and `qr`.
51
+ * `secrets` containing `totpsecret`.
52
+ * `newSessionData` containing the same except `qr`.
53
+ */
54
+ reprepareConfiguration(username: string, sessionKey: Key): Promise<{
55
+ userData: {
56
+ [key: string]: any;
57
+ };
58
+ secrets: Partial<UserSecretsInputFields>;
59
+ newSessionData: {
60
+ [key: string]: any;
61
+ } | undefined;
62
+ } | undefined>;
63
+ /**
64
+ * Authenticates the user using the saved TOTP parameters and the passed
65
+ * code.
66
+ * @param _user ignored
67
+ * @param secrets should contain `totpsecret` that was saved in the session
68
+ * data.
69
+ * @param params should contain `otp`.
70
+ */
71
+ authenticateUser(_user: UserInputFields | undefined, secrets: UserSecretsInputFields, params: AuthenticationParameters): Promise<void>;
72
+ /**
73
+ * Creates and returns a `totpsecret`
74
+ *
75
+ * `allowEmptySecrets` is ignored.
76
+ *
77
+ * @param username the user to create these for
78
+ * @param _params ignored
79
+ * @param _repeatParams ignored
80
+ * @returns the `totpsecret` field will be populated.
81
+ */
82
+ createPersistentSecrets(username: string, _params: AuthenticationParameters, _repeatParams?: AuthenticationParameters): Promise<Partial<UserSecretsInputFields>>;
83
+ /**
84
+ * Does nothing for this class
85
+ */
86
+ createOneTimeSecrets(_user: User): Promise<Partial<UserSecretsInputFields>>;
87
+ /**
88
+ * @returns true - this class can create users
89
+ */
90
+ canCreateUser(): boolean;
91
+ /**
92
+ * @returns true - this class can update users
93
+ */
94
+ canUpdateUser(): boolean;
95
+ /**
96
+ * @returns false - users cannot update secrets
97
+ */
98
+ canUpdateSecrets(): boolean;
99
+ /**
100
+ * @returns `totpsecret`
101
+ */
102
+ secretNames(): string[];
103
+ /**
104
+ * @returns `totpsecret`
105
+ */
106
+ transientSecretNames(): string[];
107
+ /**
108
+ * Does nothing for this class
109
+ */
110
+ validateSecrets(_params: AuthenticationParameters): string[];
111
+ /**
112
+ * @returns false - if email verification is enabled, it should be used
113
+ * for this class
114
+ */
115
+ skipEmailVerificationOnSignup():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S,CAAC;IAUpB;;;;;;;OAOG;IACG,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,EACrD,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC;IAajB;;;;;;;;;OASG;IACG,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAC1C,OAAO,EAAE,wBAAwB,EACjC,aAAa,CAAC,EAAE,wBAAwB,GACxC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAK5C;;OAEG;IACG,oBAAoB,CAAC,KAAK,EAAG,IAAI,GACnC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAI5C;;OAEG;IACH,aAAa,IAAK,OAAO;IAKzB;;OAEG;IACH,aAAa,IAAK,OAAO;IAIzB;;OAEG;IACH,gBAAgB,IAAK,OAAO;IAI5B;;OAEG;IACH,WAAW,IAAK,MAAM,EAAE;IAIxB;;OAEG;IACH,oBAAoB,IAAK,MAAM,EAAE;IAIjC;;OAEG;IACH,eAAe,CAAC,OAAO,EAAG,wBAAwB,GAAI,MAAM,EAAE;IAI9D;;;OAGG;IACH,6BAA6B,IAAK,OAAO;CAG5C"}
@@ -0,0 +1,29 @@
1
+ import { SmsAuthenticator, SmsAuthenticatorOptions } from './smsauth';
2
+
3
+ /**
4
+ * This authenticator creates a one-time code and sends it in an sms using
5
+ * Twilio
6
+ */
7
+ export declare class TwilioAuthenticator extends SmsAuthenticator {
8
+ private accountSid;
9
+ private authToken;
10
+ /**
11
+ * Constructor
12
+ *
13
+ * To call this, you must have `TWILIO_ACCOUNT_SID` and
14
+ * `TWILIO_AUTH_TOKEN` environment variables set.
15
+ *
16
+ * @param options see {@link SmsAuthenticatorOptions}
17
+ * @throws {@link @crossauth/common!CrossauthError} with
18
+ * {@link @crossauth/common!ErrorCode} of `Configuration`.
19
+ */
20
+ constructor(options?: SmsAuthenticatorOptions);
21
+ /**
22
+ * Uses Twilio to send an SMS
23
+ * @param to number to send SMS to (starting with `+`)
24
+ * @param body text to send
25
+ * @returns the send message ID
26
+ */
27
+ protected sendSms(to: string, body: string): Promise<string>;
28
+ }
29
+ //# sourceMappingURL=twilioauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilioauth.d.ts","sourceRoot":"","sources":["../../src/authenticators/twilioauth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAG3E;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;IAErD,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,SAAS,CAAU;IAE3B;;;;;;;;;OASG;gBACS,OAAO,GAAG,uBAA4B;IAUlD;;;;;OAKG;cACa,OAAO,CAAC,EAAE,EAAG,MAAM,EAAE,IAAI,EAAG,MAAM,GAAI,OAAO,CAAC,MAAM,CAAC;CAkBxE"}
@@ -0,0 +1,269 @@
1
+ import { User, Key } from '@crossauth/common';
2
+ import { UserStorage, KeyStorage, UserStorageGetOptions } from './storage';
3
+ import { TokenEmailerOptions } from './emailtokens.ts';
4
+ import { CookieSerializeOptions } from 'cookie';
5
+
6
+ /**
7
+ * Optional parameters when setting cookies,
8
+ *
9
+ * These match the HTTP cookie parameters of the same name.
10
+ */
11
+ export interface CookieOptions {
12
+ domain?: string;
13
+ expires?: Date;
14
+ maxAge?: number;
15
+ httpOnly?: boolean;
16
+ path?: string;
17
+ secure?: boolean;
18
+ sameSite?: boolean | "lax" | "strict" | "none" | undefined;
19
+ }
20
+ export declare function toCookieSerializeOptions(options: CookieOptions): CookieSerializeOptions & {
21
+ path: string;
22
+ };
23
+ /**
24
+ * Object encapsulating a cookie name, value and options.
25
+ */
26
+ export interface Cookie {
27
+ name: string;
28
+ value: string;
29
+ options: CookieOptions;
30
+ }
31
+ /**
32
+ * Options for double-submit csrf tokens
33
+ */
34
+ export interface DoubleSubmitCsrfTokenOptions extends CookieOptions {
35
+ /** Name of cookie. Defaults to "CSRFTOKEN" */
36
+ cookieName?: string;
37
+ /** Name of header. Defaults to X-CROSSAUTH-CSRF */
38
+ headerName?: string;
39
+ /** The app secret used to sign the cookie */
40
+ secret?: string;
41
+ }
42
+ /**
43
+ * Class for creating and validating CSRF tokens according to the double-submit cookie pattern.
44
+ *
45
+ * CSRF token is send as a cookie plus either a header or a hidden form field.
46
+ */
47
+ export declare class DoubleSubmitCsrfToken {
48
+ /** name of the CRSF HTTP header */
49
+ readonly headerName: string;
50
+ /** Name of the CSRF Cookie */
51
+ readonly cookieName: string;
52
+ readonly domain: string | undefined;
53
+ readonly httpOnly: boolean;
54
+ readonly path: string;
55
+ readonly secure: boolean;
56
+ readonly sameSite: boolean | "lax" | "strict" | "none" | undefined;
57
+ private secret;
58
+ /**
59
+ * Constructor.
60
+ *
61
+ * @param options configurable options. See {@link DoubleSubmitCsrfTokenOptions}. The
62
+ * expires and maxAge options are ignored (cookies are session-only).
63
+ */
64
+ constructor(options?: DoubleSubmitCsrfTokenOptions);
65
+ /**
66
+ * Creates a session key and saves in storage
67
+ *
68
+ * Date created is the current date/time on the server.
69
+ *
70
+ * @returns a random CSRF token.
71
+ */
72
+ createCsrfToken(): string;
73
+ /**
74
+ * Returns a {@link Cookie } object with the given session key.
75
+ *
76
+ * This class is compatible, for example, with Express.
77
+ *
78
+ * @param token the value of the csrf token, with signature
79
+ * @returns a {@link Cookie } object,
80
+ */
81
+ makeCsrfCookie(token: string): Cookie;
82
+ makeCsrfFormOrHeaderToken(token: string): string;
83
+ unsignCookie(cookieValue: string): string;
84
+ /**
85
+ * Takes a session ID and creates a string representation of the cookie (value of the HTTP `Cookie` header).
86
+ *
87
+ * @param cookieValue the value to put in the cookie
88
+ * @returns a string representation of the cookie and options.
89
+ */
90
+ makeCsrfCookieString(cookieValue: string): string;
91
+ private maskCsrfToken;
92
+ private unmaskCsrfToken;
93
+ /**
94
+ * Validates the passed CSRF token.
95
+ *
96
+ * To be valid:
97
+ * * The signature in the cookie must match the token in the cookie
98
+ * * The token in the cookie must matched the value in the form or header after unmasking
99
+ *
100
+ * @param cookieValue the CSRDF cookie value to validate.
101
+ * @param formOrHeaderValue the value from the csrfToken form header or the X-CROSSAUTH-CSRF header.
102
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} of `InvalidKey`
103
+ */
104
+ validateDoubleSubmitCsrfToken(cookieValue: string, formOrHeaderValue: string): void;
105
+ /**
106
+ * Validates the passed CSRF cookie (doesn't check it matches the token, just that the cookie is valid).
107
+ *
108
+ * To be valid:
109
+ * * The signature in the cookie must match the token in the cookie
110
+ * * The token in the cookie must matched the value in the form or header after unmasking
111
+ *
112
+ * @param cookieValue the CSRF cookie value to validate.
113
+ * @throws {@link @crossauth/common!CrossauthError} with {@link @crossauth/common!ErrorCode} of `InvalidKey`
114
+ */
115
+ validateCsrfCookie(cookieValue: string): any;
116
+ }
117
+ /**
118
+ * Options for double-submit csrf tokens
119
+ */
120
+ export interface SessionCookieOptions extends CookieOptions, TokenEmailerOptions {
121
+ /**
122
+ * If user login is enabled, you must provide the user storage class
123
+ */
124
+ userStorage?: UserStorage;
125
+ /** Name of cookie. Defaults to "CSRFTOKEN" */
126
+ cookieName?: string;
127
+ /** If true, session IDs are stored in hashed form in the key storage. Default false. */
128
+ hashSessionId?: boolean;
129
+ /** If non zero, sessions will time out after this number of seconds have elapsed without activity. Default 0 (no timeout) */
130
+ idleTimeout?: number;
131
+ /** If true, sessions cookies will be persisted between browser sessions. Default true */
132
+ persist?: boolean;
133
+ /** App secret */
134
+ secret?: string;
135
+ /**
136
+ * This will be called with the session key to filter sessions
137
+ * before returning. Function should return true if the session is valid or false otherwise.
138
+ */
139
+ filterFunction?: (sessionKey: Key) => boolean;
140
+ }
141
+ /**
142
+ * Class for session management using a session id cookie.
143
+ */
144
+ export declare class SessionCookie {
145
+ private userStorage?;
146
+ private keyStorage;
147
+ /** This is set from input options. Number of seconds before an
148
+ * idle session will time out
149
+ */
150
+ readonly idleTimeout: number;
151
+ private persist;
152
+ private filterFunction?;
153
+ /** Name of the CSRF Cookie, set from input options */
154
+ readonly cookieName: string;
155
+ readonly maxAge: number;
156
+ readonly domain: string | undefined;
157
+ readonly httpOnly: boolean;
158
+ readonly path: string;
159
+ readonly secure: boolean;
160
+ readonly sameSite: boolean | "lax" | "strict" | "none" | undefined;
161
+ private secret;
162
+ /**
163
+ * Constructor.
164
+ *
165
+ * @param keyStorage where to put session IDs
166
+ * @param options configurable options. See {@link SessionCookieOptions}. The
167
+ * expires option is ignored (cookies are session-only).
168
+ */
169
+ constructor(keyStorage: KeyStorage, options?: SessionCookieOptions);
170
+ private expiry;
171
+ /**
172
+ * Returns a hash of a session ID, with the session ID prefix for storing
173
+ * in the storage table.
174
+ * @param sessionId the session ID to hash
175
+ * @returns a base64-url-encoded string that can go into the storage
176
+ */
177
+ static hashSessionId(sessionId: string): string;
178
+ /**
179
+ * Creates a session key and saves in storage
180
+ *
181
+ * Date created is the current date/time on the server.
182
+ *
183
+ * In the unlikely event of the key already existing, it is retried up to 10 times before throwing
184
+ * an error with ErrorCode.KeyExists
185
+ *
186
+ * @param userid the user ID to store with the session key.
187
+ * @param extraFields Any fields in here will also be added to the session
188
+ * record
189
+ * @returns the new session key
190
+ * @throws {@link @crossauth/common!CrossauthError} with
191
+ * {@link @crossauth/common!ErrorCode} `KeyExists` if maximum
192
+ * attempts exceeded trying to create a unique session id
193
+ */
194
+ createSessionKey(userid: string | number | undefined, extraFields?: {
195
+ [key: string]: any;
196
+ }): Promise<Key>;
197
+ /**
198
+ * Returns a {@link Cookie } object with the given session key.
199
+ *
200
+ * This class is compatible, for example, with Express.
201
+ *
202
+ * @param sessionKey the value of the session key
203
+ * @param persist if passed, overrides the persistSessionId setting
204
+ * @returns a {@link Cookie } object,
205
+ */
206
+ makeCookie(sessionKey: Key, persist?: boolean): Cookie;
207
+ /**
208
+ * Takes a session ID and creates a string representation of the cookie
209
+ * (value of the HTTP `Cookie` header).
210
+ *
211
+ * @param cookie the cookie vlaues to make a string from
212
+ * @returns a string representation of the cookie and options.
213
+ */
214
+ makeCookieString(cookie: Cookie): string;
215
+ /**
216
+ * Updates a session record in storage
217
+ * @param sessionKey the fields to update. `value` must be set, and
218
+ * will not be updated. All other defined fields will be updated.
219
+ * @throws {@link @crossauth/common!CrossauthError} if the session does
220
+ * not exist.
221
+ */
222
+ updateSessionKey(sessionKey: Partial<Key>): Promise<void>;
223
+ /**
224
+ * Unsigns a cookie and returns the original value.
225
+ * @param cookieValue the signed cookie value
226
+ * @returns the unsigned value
227
+ * @throws {@link @crossauth/common!CrossauthError} if the signature
228
+ * is invalid.
229
+ */
230
+ unsignCookie(cookieValue: string): string;
231
+ /**
232
+ * Returns the user matching the given session key in session storage, or throws an exception.
233
+ *
234
+ * Looks the user up in the {@link UserStorage} instance passed to the constructor.
235
+ *
236
+ * Undefined will also fail is CookieAuthOptions.filterFunction is defined and returns false,
237
+ *
238
+ * @param sessionId the value in the session cookie
239
+ * @param options See {@link UserStorageGetOptions}
240
+ * @returns a {@link @crossauth/common!User } object, with the password hash removed, and the {@link @crossauth/common!Key } with the unhashed
241
+ * sessionId
242
+ * @throws a {@link @crossauth/common!CrossauthError } with {@link @crossauth/common!ErrorCode } set to `InvalidSessionId` or `Expired`.
243
+ */
244
+ getUserForSessionId(sessionId: string, options?: UserStorageGetOptions): Promise<{
245
+ user: User | undefined;
246
+ key: Key;
247
+ }>;
248
+ /**
249
+ * Returns the user matching the given session key in session storage, or throws an exception.
250
+ *
251
+ * Looks the user up in the {@link UserStorage} instance passed to the constructor.
252
+ *
253
+ * Undefined will also fail is CookieAuthOptions.filterFunction is defined and returns false,
254
+ *
255
+ * @param sessionId the unsigned value of the session cookie
256
+ * @returns a {@link User } object, with the password hash removed.
257
+ * @throws a {@link @crossauth/common!CrossauthError } with
258
+ * {@link @crossauth/common!ErrorCode } set to `InvalidSessionId`,
259
+ * `Expired` or `UserNotExist`.
260
+ */
261
+ getSessionKey(sessionId: string): Promise<Key>;
262
+ /**
263
+ * Deletes all keys for the given user
264
+ * @param userid the user to delete keys for
265
+ * @param except if defined, don't delete this key
266
+ */
267
+ deleteAllForUser(userid: string | number, except: string | undefined): Promise<void>;
268
+ }
269
+ //# sourceMappingURL=cookieauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookieauth.d.ts","sourceRoot":"","sources":["../src/cookieauth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAKhD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAE1B,MAAM,CAAC,EAAG,MAAM,CAAC;IACjB,OAAO,CAAC,EAAG,IAAI,CAAC;IAChB,MAAM,CAAC,EAAG,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAG,OAAO,CAAC;IACpB,IAAI,CAAC,EAAG,MAAM,CAAC;IACf,MAAM,CAAC,EAAG,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;CAC/D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAG,aAAa,GAAI,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;CAAE,CAM7G;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,IAAI,EAAG,MAAM,CAAC;IACd,KAAK,EAAG,MAAM,CAAC;IACf,OAAO,EAAG,aAAa,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IAE/D,+CAA+C;IAC/C,UAAU,CAAC,EAAG,MAAM,CAAC;IAErB,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,MAAM,GAAG,SAAS,EACtD,WAAW,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAO,GAAI,OAAO,CAAC,GAAG,CAAC;IAuC5D;;;;;;;;OAQG;IACH,UAAU,CAAC,UAAU,EAAG,GAAG,EAAE,OAAO,CAAC,EAAG,OAAO,GAAI,MAAM;IA2BzD;;;;;;OAMG;IACH,gBAAgB,CAAC,MAAM,EAAG,MAAM,GAAI,MAAM;IAqB1C;;;;;;OAMG;IACG,gBAAgB,CAAC,UAAU,EAAG,OAAO,CAAC,GAAG,CAAC,GAAI,OAAO,CAAC,IAAI,CAAC;IAMjE;;;;;;OAMG;IACH,YAAY,CAAC,WAAW,EAAG,MAAM,GAAI,MAAM;IAI3C;;;;;;;;;;;;OAYG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAG,qBAAqB,GAAI,OAAO,CAAC;QAAC,IAAI,EAAE,IAAI,GAAC,SAAS,CAAC;QAAC,GAAG,EAAG,GAAG,CAAA;KAAC,CAAC;IAW3H;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAI,OAAO,CAAC,GAAG,CAAC;IA0BrD;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAG,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAC,SAAS;CAM5E"}
@@ -0,0 +1,196 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * An object that contains all components of a hashed password. Hashing is done with PBKDF2
4
+ */
5
+ export interface PasswordHash {
6
+ /** The actual hashed password in Base64 format */
7
+ hashedPassword: string;
8
+ /** The random salt used to create the hashed password */
9
+ salt: string;
10
+ /** Number of iterations for PBKDF2*/
11
+ iterations: number;
12
+ /** If true, secret (application secret) is also used to hash the password*/
13
+ useSecret: boolean;
14
+ /** The key length parameter passed to PBKDF2 - hash will be this number of characters long */
15
+ keyLen: number;
16
+ /** The digest algorithm to use, eg `sha512` */
17
+ digest: string;
18
+ }
19
+ /**
20
+ * Option parameters for {@link Crypto.passwordHash}
21
+ */
22
+ export interface HashOptions {
23
+ /** A salt to prepend to the message before hashing */
24
+ salt?: string;
25
+ /** Whether to Base64-URL-encode the result */
26
+ encode?: boolean;
27
+ /** A secret to append to the salt when hashing, or undefined for no secret */
28
+ secret?: string;
29
+ /** Number of PBKDF2 iterations */
30
+ iterations?: number;
31
+ /** Length (before Base64-encoding) of the PBKDF2 key being generated */
32
+ keyLen?: number;
33
+ /** PBKDF2 digest method */
34
+ digest?: string;
35
+ }
36
+ /**
37
+ * Provides cryptographic functions
38
+ */
39
+ export declare class Crypto {
40
+ /**
41
+ * Returns true if the plaintext password, when hashed, equals the one in the hash, using
42
+ * it's hasher settings
43
+ * @param plaintext the plaintext password
44
+ * @param encodedHash the previously-hashed version
45
+ * @param secret if `useHash`in `encodedHash` is true, uses as a pepper for the hasher
46
+ * @returns true if they are equal, false otherwise
47
+ */
48
+ static passwordsEqual(plaintext: string, encodedHash: string, secret?: string): Promise<boolean>;
49
+ /**
50
+ * Decodes a string from base64 to UTF-89
51
+ * @param encoded base64-encoded text
52
+ * @returns URF-8 text
53
+ */
54
+ static base64Decode(encoded: string): string;
55
+ /**
56
+ * Base64-encodes UTF-8 text
57
+ * @param text UTF-8 text
58
+ * @returns Base64 text
59
+ */
60
+ static base64Encode(text: string): string;
61
+ /**
62
+ * Splits a hashed password into its component parts. Return it as a {@link PasswordHash }.
63
+ *
64
+ * The format of the hash should be
65
+ * ```
66
+ * digest:keyLen:iterations:useSecret:salt:hashedPassword
67
+ * ```
68
+ * The hashed password part is the Base64 encoding of the PBKDF2 password.
69
+ * @param hash the hassed password to decode. See above for format
70
+ * @returns {@link PasswordHash} object containing the deecoded hash components
71
+ */
72
+ static decodePasswordHash(hash: string): PasswordHash;
73
+ /**
74
+ * Encodes a hashed password into the string format it is stored as.
75
+ *
76
+ * See {@link decodePasswordHash } for the format it is stored in.
77
+ *
78
+ * @param hashedPassword the Base64-encoded PBKDF2 hash of the password
79
+ * @param salt the salt used for the password.
80
+ * @param useSecret whether or not to use the application secret as part
81
+ * of the hash.
82
+ * @param iterations the number of PBKDF2 iterations
83
+ * @param keyLen the key length PBKDF2 parameter - results in a hashed password this length, before Base64,
84
+ * @param digest The digest algorithm, eg `pbkdf2`
85
+ * @returns a string encode the above parameters.
86
+ */
87
+ static encodePasswordHash(hashedPassword: string, salt: string, useSecret: boolean, iterations: number, keyLen: number, digest: string): string;
88
+ /**
89
+ * Creates a random salt
90
+ * @returns random salt as a base64 encoded string
91
+ */
92
+ static randomSalt(): string;
93
+ /**
94
+ * Creates a random string encoded as in base64url
95
+ * @param length length of the string to create
96
+ * @returns the random value as a string. Number of bytes will be greater as it is base64 encoded.
97
+ */
98
+ static randomValue(length: number): string;
99
+ static Base32: string[];
100
+ /**
101
+ * Creates a random base-23 string
102
+ * @param length length of the string to create
103
+ * @returns the random value as a string. Number of bytes will be greater as it is base64 encoded.
104
+ */
105
+ static randomBase32(length: number, dashEvery?: number): string;
106
+ /**
107
+ * Creates a UUID
108
+ */
109
+ static uuid(): string;
110
+ /**
111
+ * Standard hash using SHA256 (not PBKDF2 or HMAC)
112
+ *
113
+ * @param plaintext text to hash
114
+ * @returns the string containing the hash
115
+ */
116
+ static hash(plaintext: string): string;
117
+ /**
118
+ * Standard hash using SHA256 (not PBKDF2 or HMAC)
119
+ *
120
+ * @param plaintext text to hash
121
+ * @returns the string containing the hash
122
+ */
123
+ static sha256(plaintext: string): string;
124
+ /**
125
+ * Hashes a password and returns it as a base64 or base64url encoded string
126
+ * @param plaintext password to hash
127
+ * @param options
128
+ * - `salt`: salt to use. Make a random one if not passed
129
+ * - `secret`: optional application secret password to apply as a pepper
130
+ * - `encode`: if true, returns the full string as it should be stored in the database.
131
+ * @returns the string containing the hash and the values to decode it
132
+ */
133
+ static passwordHash(plaintext: string, options?: HashOptions): Promise<string>;
134
+ /**
135
+ * For creating non-JWT tokens (eg password reset tokens.) The
136
+ * hash is of a JSON containing the payload, timestamp and optionally
137
+ * a salt.
138
+ * @param payload the payload to hash
139
+ * @param salt optional salt (use if the payload is small)
140
+ * @param timestamp time the token will expire
141
+ * @returns a Base64-URL-encoded string that can be hashed.
142
+ */
143
+ static signableToken(payload: {
144
+ [key: string]: any;
145
+ }, salt?: string, timestamp?: number): string;
146
+ /**
147
+ * Signs a JSON payload by creating a hash, using a secret and
148
+ * optionally also a salt and timestamp
149
+ *
150
+ * @param payload object to sign (will be stringified as a JSON)
151
+ * @param secret secret key, which must be a string
152
+ * @param salt optionally, a salt to concatenate with the payload (must be a string)
153
+ * @param timestamp optionally, a timestamp to include in the signed date as a Unix date
154
+ * @returns Base64-url encoded hash
155
+ */
156
+ static sign(payload: {
157
+ [key: string]: any;
158
+ } | string, secret: string, salt?: string, timestamp?: number): string;
159
+ /**
160
+ * Validates a signature and, if valid, return the unstringified payload
161
+ * @param signedMessage signed message (base64-url encoded)
162
+ * @param secret secret key, which must be a string
163
+ * @param expiry if set, validation will fail if the timestamp in the payload is after this date
164
+ * @returns if signature is valid, the payload as an object
165
+ * @throws {@link @crossauth/common!CrossauthError} with
166
+ * {@link @crossauth/common!ErrorCode} of `InvalidKey` if signature
167
+ * is invalid or has expired.
168
+ */
169
+ static unsign(signedMessage: string, secret: string, expiry?: number): {
170
+ [key: string]: any;
171
+ };
172
+ /**
173
+ * XOR's two arrays of base64url-encoded strings
174
+ * @param value to XOR
175
+ * @param mask mask to XOR it with
176
+ * @return an XOR'r string
177
+ */
178
+ static xor(value: string, mask: string): string;
179
+ /**
180
+ * Symmetric encryption using a key that must be a string
181
+ *
182
+ * @param plaintext Text to encrypt
183
+ * @param keyString the symmetric key
184
+ * @returns Encrypted text Base64-url encoded.
185
+ */
186
+ static symmetricEncrypt(plaintext: string, keyString: string, iv?: Buffer | undefined): string;
187
+ /**
188
+ * Symmetric decryption using a key that must be a string
189
+ *
190
+ * @param ciphertext Base64-url encoded ciphertext
191
+ * @param keyString the symmetric key
192
+ * @returns Decrypted text
193
+ */
194
+ static symmetricDecrypt(ciphertext: string, keyString: string): string;
195
+ }
196
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";AAaA;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,kDAAkD;IAClD,cAAc,EAAG,MAAM,CAAC;IAExB,yDAAyD;IACzD,IAAI,EAAG,MAAM,CAAC;IAEd,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IAEnB,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;IAEnB,8FAA8F;IAC9F,MAAM,EAAG,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,MAAM,EAAG,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAExB,sDAAsD;IACtD,IAAI,CAAC,EAAG,MAAM,CAAC;IAEf,8CAA8C;IAC9C,MAAM,CAAC,EAAG,OAAO,CAAC;IAElB,8EAA8E;IAC9E,MAAM,CAAC,EAAG,MAAM,CAAC;IAEjB,kCAAkC;IAClC,UAAU,CAAC,EAAG,MAAM,CAAC;IAErB,wEAAwE;IACxE,MAAM,CAAC,EAAG,MAAM,CAAC;IAEjB,2BAA2B;IAC3B,MAAM,CAAC,EAAG,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,MAAM;IAEf;;;;;;;OAOG;WACU,cAAc,CAAC,SAAS,EAAG,MAAM,EAAE,WAAW,EAAG,MAAM,EAAE,MAAM,CAAC,EAAG,MAAM,GAAI,OAAO,CAAC,OAAO,CAAC;IAgB1G;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAG,MAAM,GAAI,MAAM;IAG9C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAG,MAAM,GAAI,MAAM;IAI3C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAG,M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