@ttoss/auth-postgresdb 0.3.5 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +19 -26
- package/dist/index.d.mts +19 -26
- package/dist/index.mjs +2 -2
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -306,13 +306,13 @@ var createPostgresdbOAuthStores = ({
|
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
//#endregion
|
|
309
|
-
//#region \0@oxc-project+runtime@0.
|
|
309
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateMetadata.js
|
|
310
310
|
function __decorateMetadata(k, v) {
|
|
311
311
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region \0@oxc-project+runtime@0.
|
|
315
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
316
316
|
function __decorate(decorators, target, key, desc) {
|
|
317
317
|
var c = arguments.length,
|
|
318
318
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
@@ -496,25 +496,25 @@ var oauthModels = {
|
|
|
496
496
|
};
|
|
497
497
|
|
|
498
498
|
//#endregion
|
|
499
|
-
Object.defineProperty(exports,
|
|
499
|
+
Object.defineProperty(exports, "OAuthAuthCode", {
|
|
500
500
|
enumerable: true,
|
|
501
501
|
get: function () {
|
|
502
502
|
return OAuthAuthCode;
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
|
-
Object.defineProperty(exports,
|
|
505
|
+
Object.defineProperty(exports, "OAuthClient", {
|
|
506
506
|
enumerable: true,
|
|
507
507
|
get: function () {
|
|
508
508
|
return OAuthClient;
|
|
509
509
|
}
|
|
510
510
|
});
|
|
511
|
-
Object.defineProperty(exports,
|
|
511
|
+
Object.defineProperty(exports, "OAuthConsent", {
|
|
512
512
|
enumerable: true,
|
|
513
513
|
get: function () {
|
|
514
514
|
return OAuthConsent;
|
|
515
515
|
}
|
|
516
516
|
});
|
|
517
|
-
Object.defineProperty(exports,
|
|
517
|
+
Object.defineProperty(exports, "OAuthRefreshToken", {
|
|
518
518
|
enumerable: true,
|
|
519
519
|
get: function () {
|
|
520
520
|
return OAuthRefreshToken;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { AuthCodeStore, ClientStore, ConsentGrant, ConsentGrantStore, RefreshTokenStore } from "@ttoss/auth-core";
|
|
3
3
|
import { Model } from "@ttoss/postgresdb";
|
|
4
|
-
|
|
5
4
|
//#region src/models/OAuthAuthCode.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* A short-lived authorization code with its bound PKCE challenge.
|
|
@@ -10,7 +9,7 @@ import { Model } from "@ttoss/postgresdb";
|
|
|
10
9
|
* travels through a browser redirect and a client's URL bar, so storing it in
|
|
11
10
|
* plaintext would make a database dump yield replayable codes.
|
|
12
11
|
*/
|
|
13
|
-
declare class OAuthAuthCode extends Model {
|
|
12
|
+
export declare class OAuthAuthCode extends Model {
|
|
14
13
|
/** SHA-256 hash (hex) of the authorization code. */
|
|
15
14
|
codeHash: string;
|
|
16
15
|
/** The `client_id` the code was issued to. */
|
|
@@ -35,7 +34,7 @@ declare class OAuthAuthCode extends Model {
|
|
|
35
34
|
* indexed; any additional metadata a client submits is kept verbatim in
|
|
36
35
|
* `metadata`, because `OAuthClientMetadata` is an open shape.
|
|
37
36
|
*/
|
|
38
|
-
declare class OAuthClient extends Model {
|
|
37
|
+
export declare class OAuthClient extends Model {
|
|
39
38
|
/** The `client_id` issued by the authorization server. */
|
|
40
39
|
clientId: string;
|
|
41
40
|
/**
|
|
@@ -77,7 +76,7 @@ declare class OAuthClient extends Model {
|
|
|
77
76
|
* not a durable "user X trusts client Y" grant, which is an app-level
|
|
78
77
|
* authorization decision and belongs in the app's own schema.
|
|
79
78
|
*/
|
|
80
|
-
declare class OAuthConsent extends Model {
|
|
79
|
+
export declare class OAuthConsent extends Model {
|
|
81
80
|
/** The PKCE `code_challenge` the consent was recorded against. */
|
|
82
81
|
codeChallenge: string;
|
|
83
82
|
/** The authenticated end-user subject identifier. */
|
|
@@ -98,7 +97,7 @@ declare class OAuthConsent extends Model {
|
|
|
98
97
|
* which is why the store adapter must report a live token's `consumedAt` as
|
|
99
98
|
* absent rather than as `null`.
|
|
100
99
|
*/
|
|
101
|
-
declare class OAuthRefreshToken extends Model {
|
|
100
|
+
export declare class OAuthRefreshToken extends Model {
|
|
102
101
|
/** SHA-256 hash (hex) of the opaque refresh token. */
|
|
103
102
|
tokenHash: string;
|
|
104
103
|
/** The `client_id` the token was issued to. */
|
|
@@ -127,7 +126,7 @@ declare class OAuthRefreshToken extends Model {
|
|
|
127
126
|
* export const db = await initialize({ models: { ...oauthModels, User } });
|
|
128
127
|
* ```
|
|
129
128
|
*/
|
|
130
|
-
declare const oauthModels: {
|
|
129
|
+
export declare const oauthModels: {
|
|
131
130
|
OAuthAuthCode: typeof OAuthAuthCode;
|
|
132
131
|
OAuthClient: typeof OAuthClient;
|
|
133
132
|
OAuthConsent: typeof OAuthConsent;
|
|
@@ -156,10 +155,9 @@ interface PostgresdbConsentStore extends ConsentGrantStore {
|
|
|
156
155
|
* write the consent page performs. Grants are single-use — the `onAuthorize`
|
|
157
156
|
* hook deletes each one as it consumes it.
|
|
158
157
|
*/
|
|
159
|
-
declare const createConsentStore: ({
|
|
160
|
-
model
|
|
161
|
-
|
|
162
|
-
/** The `OAuthConsent` model class, taken from the app's `db` handle. */model: typeof OAuthConsent;
|
|
158
|
+
export declare const createConsentStore: ({ model }: {
|
|
159
|
+
/** The `OAuthConsent` model class, taken from the app's `db` handle. */
|
|
160
|
+
model: typeof OAuthConsent;
|
|
163
161
|
}) => PostgresdbConsentStore;
|
|
164
162
|
//#endregion
|
|
165
163
|
//#region src/createPostgresdbOAuthStores.d.ts
|
|
@@ -193,9 +191,7 @@ interface PostgresdbOAuthStores {
|
|
|
193
191
|
* createPostgresdbOAuthStores({ db });
|
|
194
192
|
* ```
|
|
195
193
|
*/
|
|
196
|
-
declare const createPostgresdbOAuthStores: ({
|
|
197
|
-
db
|
|
198
|
-
}: {
|
|
194
|
+
export declare const createPostgresdbOAuthStores: ({ db }: {
|
|
199
195
|
/**
|
|
200
196
|
* The handle returned by `@ttoss/postgresdb`'s `initialize`, with
|
|
201
197
|
* `oauthModels` among its registered models.
|
|
@@ -214,10 +210,9 @@ declare const createPostgresdbOAuthStores: ({
|
|
|
214
210
|
* adapter hashes to find the row and echoes the presented value back, and a
|
|
215
211
|
* database dump yields no replayable codes.
|
|
216
212
|
*/
|
|
217
|
-
declare const createAuthCodeStore: ({
|
|
218
|
-
model
|
|
219
|
-
|
|
220
|
-
/** The `OAuthAuthCode` model class, taken from the app's `db` handle. */model: typeof OAuthAuthCode;
|
|
213
|
+
export declare const createAuthCodeStore: ({ model }: {
|
|
214
|
+
/** The `OAuthAuthCode` model class, taken from the app's `db` handle. */
|
|
215
|
+
model: typeof OAuthAuthCode;
|
|
221
216
|
}) => AuthCodeStore;
|
|
222
217
|
//#endregion
|
|
223
218
|
//#region src/stores/createClientStore.d.ts
|
|
@@ -234,10 +229,9 @@ declare const createAuthCodeStore: ({
|
|
|
234
229
|
* `register` upserts, so re-registering an existing `client_id` replaces the
|
|
235
230
|
* stored document rather than failing on the primary key.
|
|
236
231
|
*/
|
|
237
|
-
declare const createClientStore: ({
|
|
238
|
-
model
|
|
239
|
-
|
|
240
|
-
/** The `OAuthClient` model class, taken from the app's `db` handle. */model: typeof OAuthClient;
|
|
232
|
+
export declare const createClientStore: ({ model }: {
|
|
233
|
+
/** The `OAuthClient` model class, taken from the app's `db` handle. */
|
|
234
|
+
model: typeof OAuthClient;
|
|
241
235
|
}) => ClientStore;
|
|
242
236
|
//#endregion
|
|
243
237
|
//#region src/stores/createRefreshTokenStore.d.ts
|
|
@@ -246,10 +240,9 @@ declare const createClientStore: ({
|
|
|
246
240
|
* table, keyed by token hash and by the `(clientId, subject)` owner that
|
|
247
241
|
* `deleteByOwner` revokes on reuse detection.
|
|
248
242
|
*/
|
|
249
|
-
declare const createRefreshTokenStore: ({
|
|
250
|
-
model
|
|
251
|
-
|
|
252
|
-
/** The `OAuthRefreshToken` model class, taken from the app's `db` handle. */model: typeof OAuthRefreshToken;
|
|
243
|
+
export declare const createRefreshTokenStore: ({ model }: {
|
|
244
|
+
/** The `OAuthRefreshToken` model class, taken from the app's `db` handle. */
|
|
245
|
+
model: typeof OAuthRefreshToken;
|
|
253
246
|
}) => RefreshTokenStore;
|
|
254
247
|
//#endregion
|
|
255
|
-
export {
|
|
248
|
+
export type { OAuthModels, PostgresdbConsentStore, PostgresdbOAuthStores };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { AuthCodeStore, ClientStore, ConsentGrant, ConsentGrantStore, RefreshTokenStore } from "@ttoss/auth-core";
|
|
3
3
|
import { Model } from "@ttoss/postgresdb";
|
|
4
|
-
|
|
5
4
|
//#region src/models/OAuthAuthCode.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* A short-lived authorization code with its bound PKCE challenge.
|
|
@@ -10,7 +9,7 @@ import { Model } from "@ttoss/postgresdb";
|
|
|
10
9
|
* travels through a browser redirect and a client's URL bar, so storing it in
|
|
11
10
|
* plaintext would make a database dump yield replayable codes.
|
|
12
11
|
*/
|
|
13
|
-
declare class OAuthAuthCode extends Model {
|
|
12
|
+
export declare class OAuthAuthCode extends Model {
|
|
14
13
|
/** SHA-256 hash (hex) of the authorization code. */
|
|
15
14
|
codeHash: string;
|
|
16
15
|
/** The `client_id` the code was issued to. */
|
|
@@ -35,7 +34,7 @@ declare class OAuthAuthCode extends Model {
|
|
|
35
34
|
* indexed; any additional metadata a client submits is kept verbatim in
|
|
36
35
|
* `metadata`, because `OAuthClientMetadata` is an open shape.
|
|
37
36
|
*/
|
|
38
|
-
declare class OAuthClient extends Model {
|
|
37
|
+
export declare class OAuthClient extends Model {
|
|
39
38
|
/** The `client_id` issued by the authorization server. */
|
|
40
39
|
clientId: string;
|
|
41
40
|
/**
|
|
@@ -77,7 +76,7 @@ declare class OAuthClient extends Model {
|
|
|
77
76
|
* not a durable "user X trusts client Y" grant, which is an app-level
|
|
78
77
|
* authorization decision and belongs in the app's own schema.
|
|
79
78
|
*/
|
|
80
|
-
declare class OAuthConsent extends Model {
|
|
79
|
+
export declare class OAuthConsent extends Model {
|
|
81
80
|
/** The PKCE `code_challenge` the consent was recorded against. */
|
|
82
81
|
codeChallenge: string;
|
|
83
82
|
/** The authenticated end-user subject identifier. */
|
|
@@ -98,7 +97,7 @@ declare class OAuthConsent extends Model {
|
|
|
98
97
|
* which is why the store adapter must report a live token's `consumedAt` as
|
|
99
98
|
* absent rather than as `null`.
|
|
100
99
|
*/
|
|
101
|
-
declare class OAuthRefreshToken extends Model {
|
|
100
|
+
export declare class OAuthRefreshToken extends Model {
|
|
102
101
|
/** SHA-256 hash (hex) of the opaque refresh token. */
|
|
103
102
|
tokenHash: string;
|
|
104
103
|
/** The `client_id` the token was issued to. */
|
|
@@ -127,7 +126,7 @@ declare class OAuthRefreshToken extends Model {
|
|
|
127
126
|
* export const db = await initialize({ models: { ...oauthModels, User } });
|
|
128
127
|
* ```
|
|
129
128
|
*/
|
|
130
|
-
declare const oauthModels: {
|
|
129
|
+
export declare const oauthModels: {
|
|
131
130
|
OAuthAuthCode: typeof OAuthAuthCode;
|
|
132
131
|
OAuthClient: typeof OAuthClient;
|
|
133
132
|
OAuthConsent: typeof OAuthConsent;
|
|
@@ -156,10 +155,9 @@ interface PostgresdbConsentStore extends ConsentGrantStore {
|
|
|
156
155
|
* write the consent page performs. Grants are single-use — the `onAuthorize`
|
|
157
156
|
* hook deletes each one as it consumes it.
|
|
158
157
|
*/
|
|
159
|
-
declare const createConsentStore: ({
|
|
160
|
-
model
|
|
161
|
-
|
|
162
|
-
/** The `OAuthConsent` model class, taken from the app's `db` handle. */model: typeof OAuthConsent;
|
|
158
|
+
export declare const createConsentStore: ({ model }: {
|
|
159
|
+
/** The `OAuthConsent` model class, taken from the app's `db` handle. */
|
|
160
|
+
model: typeof OAuthConsent;
|
|
163
161
|
}) => PostgresdbConsentStore;
|
|
164
162
|
//#endregion
|
|
165
163
|
//#region src/createPostgresdbOAuthStores.d.ts
|
|
@@ -193,9 +191,7 @@ interface PostgresdbOAuthStores {
|
|
|
193
191
|
* createPostgresdbOAuthStores({ db });
|
|
194
192
|
* ```
|
|
195
193
|
*/
|
|
196
|
-
declare const createPostgresdbOAuthStores: ({
|
|
197
|
-
db
|
|
198
|
-
}: {
|
|
194
|
+
export declare const createPostgresdbOAuthStores: ({ db }: {
|
|
199
195
|
/**
|
|
200
196
|
* The handle returned by `@ttoss/postgresdb`'s `initialize`, with
|
|
201
197
|
* `oauthModels` among its registered models.
|
|
@@ -214,10 +210,9 @@ declare const createPostgresdbOAuthStores: ({
|
|
|
214
210
|
* adapter hashes to find the row and echoes the presented value back, and a
|
|
215
211
|
* database dump yields no replayable codes.
|
|
216
212
|
*/
|
|
217
|
-
declare const createAuthCodeStore: ({
|
|
218
|
-
model
|
|
219
|
-
|
|
220
|
-
/** The `OAuthAuthCode` model class, taken from the app's `db` handle. */model: typeof OAuthAuthCode;
|
|
213
|
+
export declare const createAuthCodeStore: ({ model }: {
|
|
214
|
+
/** The `OAuthAuthCode` model class, taken from the app's `db` handle. */
|
|
215
|
+
model: typeof OAuthAuthCode;
|
|
221
216
|
}) => AuthCodeStore;
|
|
222
217
|
//#endregion
|
|
223
218
|
//#region src/stores/createClientStore.d.ts
|
|
@@ -234,10 +229,9 @@ declare const createAuthCodeStore: ({
|
|
|
234
229
|
* `register` upserts, so re-registering an existing `client_id` replaces the
|
|
235
230
|
* stored document rather than failing on the primary key.
|
|
236
231
|
*/
|
|
237
|
-
declare const createClientStore: ({
|
|
238
|
-
model
|
|
239
|
-
|
|
240
|
-
/** The `OAuthClient` model class, taken from the app's `db` handle. */model: typeof OAuthClient;
|
|
232
|
+
export declare const createClientStore: ({ model }: {
|
|
233
|
+
/** The `OAuthClient` model class, taken from the app's `db` handle. */
|
|
234
|
+
model: typeof OAuthClient;
|
|
241
235
|
}) => ClientStore;
|
|
242
236
|
//#endregion
|
|
243
237
|
//#region src/stores/createRefreshTokenStore.d.ts
|
|
@@ -246,10 +240,9 @@ declare const createClientStore: ({
|
|
|
246
240
|
* table, keyed by token hash and by the `(clientId, subject)` owner that
|
|
247
241
|
* `deleteByOwner` revokes on reuse detection.
|
|
248
242
|
*/
|
|
249
|
-
declare const createRefreshTokenStore: ({
|
|
250
|
-
model
|
|
251
|
-
|
|
252
|
-
/** The `OAuthRefreshToken` model class, taken from the app's `db` handle. */model: typeof OAuthRefreshToken;
|
|
243
|
+
export declare const createRefreshTokenStore: ({ model }: {
|
|
244
|
+
/** The `OAuthRefreshToken` model class, taken from the app's `db` handle. */
|
|
245
|
+
model: typeof OAuthRefreshToken;
|
|
253
246
|
}) => RefreshTokenStore;
|
|
254
247
|
//#endregion
|
|
255
|
-
export {
|
|
248
|
+
export type { OAuthModels, PostgresdbConsentStore, PostgresdbOAuthStores };
|
package/dist/index.mjs
CHANGED
|
@@ -303,13 +303,13 @@ var createPostgresdbOAuthStores = ({
|
|
|
303
303
|
};
|
|
304
304
|
|
|
305
305
|
//#endregion
|
|
306
|
-
//#region \0@oxc-project+runtime@0.
|
|
306
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateMetadata.js
|
|
307
307
|
function __decorateMetadata(k, v) {
|
|
308
308
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
//#endregion
|
|
312
|
-
//#region \0@oxc-project+runtime@0.
|
|
312
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
313
313
|
function __decorate(decorators, target, key, desc) {
|
|
314
314
|
var c = arguments.length,
|
|
315
315
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/auth-postgresdb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Durable Postgres OAuth stores and models for @ttoss/auth-core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"jest": "^30.
|
|
36
|
-
"tsdown": "^0.
|
|
37
|
-
"@ttoss/
|
|
38
|
-
"@ttoss/
|
|
39
|
-
"@ttoss/config": "^
|
|
35
|
+
"jest": "^30.5.2",
|
|
36
|
+
"tsdown": "^0.23.1",
|
|
37
|
+
"@ttoss/postgresdb": "^0.16.0",
|
|
38
|
+
"@ttoss/auth-core": "^0.20.0",
|
|
39
|
+
"@ttoss/config": "^3.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@ttoss/
|
|
43
|
-
"@ttoss/
|
|
42
|
+
"@ttoss/auth-core": "^0.20.0",
|
|
43
|
+
"@ttoss/postgresdb": "^0.16.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public",
|