@tstdl/base 0.82.4 → 0.82.6
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/api/types.d.ts +2 -1
- package/api/types.js.map +1 -1
- package/authentication/authentication-credentials.repository.d.ts +5 -0
- package/authentication/{authentication-credentials.service.js → authentication-credentials.repository.js} +6 -6
- package/authentication/authentication-credentials.repository.js.map +1 -0
- package/authentication/authentication-session.repository.d.ts +13 -4
- package/authentication/authentication-session.repository.js +2 -13
- package/authentication/authentication-session.repository.js.map +1 -1
- package/authentication/authentication.api.d.ts +28 -0
- package/authentication/authentication.api.js +53 -0
- package/authentication/authentication.api.js.map +1 -0
- package/authentication/authentication.service.d.ts +13 -13
- package/authentication/authentication.service.js +50 -25
- package/authentication/authentication.service.js.map +1 -1
- package/authentication/models/authentication-credentials.model.d.ts +7 -5
- package/authentication/models/authentication-credentials.model.js +28 -7
- package/authentication/models/authentication-credentials.model.js.map +1 -1
- package/authentication/models/authentication-session.model.d.ts +13 -6
- package/authentication/models/authentication-session.model.js +47 -9
- package/authentication/models/authentication-session.model.js.map +1 -1
- package/authentication/models/index.d.ts +1 -0
- package/authentication/models/index.js +1 -0
- package/authentication/models/index.js.map +1 -1
- package/authentication/models/token-payload-base.model.d.ts +5 -0
- package/{orm/test.js → authentication/models/token-payload-base.model.js} +19 -10
- package/authentication/models/token-payload-base.model.js.map +1 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.d.ts +25 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.js +65 -0
- package/authentication/mongo/mongo-authentication-credentials.repository.js.map +1 -0
- package/authentication/mongo/mongo-authentication-session.repository.d.ts +26 -0
- package/authentication/mongo/mongo-authentication-session.repository.js +64 -0
- package/authentication/mongo/mongo-authentication-session.repository.js.map +1 -0
- package/database/mongo/model/document.d.ts +0 -1
- package/database/mongo/model/document.js +1 -10
- package/database/mongo/model/document.js.map +1 -1
- package/database/mongo/module.js +0 -3
- package/database/mongo/module.js.map +1 -1
- package/database/mongo/query-converter.js.map +1 -1
- package/database/query.d.ts +1 -1
- package/examples/mail/basic.js +3 -3
- package/examples/mail/templates/hello-name.js +7 -2
- package/examples/mail/templates/hello-name.js.map +1 -1
- package/examples/pdf/basic.js +3 -3
- package/examples/pdf/templates/hello-name.js +1 -1
- package/examples/pdf/templates/hello-name.js.map +1 -1
- package/examples/template/basic.js +13 -7
- package/examples/template/basic.js.map +1 -1
- package/examples/template/templates/hello-jsx.d.ts +2 -0
- package/examples/template/templates/hello-jsx.js +15 -0
- package/examples/template/templates/hello-jsx.js.map +1 -0
- package/examples/template/templates/hello-name.js +1 -1
- package/examples/template/templates/hello-name.js.map +1 -1
- package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
- package/http/types.d.ts +3 -3
- package/mail/mail.service.d.ts +4 -3
- package/mail/mail.service.js +5 -8
- package/mail/mail.service.js.map +1 -1
- package/mail/models/mail-log.model.d.ts +1 -1
- package/mail/models/mail-template.model.d.ts +1 -1
- package/mail/models/mail-template.model.js +2 -1
- package/mail/models/mail-template.model.js.map +1 -1
- package/notification/models/notification.model.d.ts +23 -5
- package/notification/models/notification.model.js +47 -3
- package/notification/models/notification.model.js.map +1 -1
- package/notification/notification.repository.d.ts +5 -0
- package/notification/notification.repository.js +7 -0
- package/notification/notification.repository.js.map +1 -0
- package/notification/notification.service.d.ts +2 -2
- package/notification/notification.service.js +4 -4
- package/notification/notification.service.js.map +1 -1
- package/package.json +6 -4
- package/pdf/pdf.service.d.ts +5 -4
- package/pdf/pdf.service.js +7 -6
- package/pdf/pdf.service.js.map +1 -1
- package/schema/schemas/assign.d.ts +3 -3
- package/schema/utils/schema.js.map +1 -1
- package/templates/providers/{file.provider-template.d.ts → file.template-provider.d.ts} +1 -1
- package/templates/providers/{file.provider-template.js → file.template-provider.js} +2 -2
- package/templates/providers/file.template-provider.js.map +1 -0
- package/templates/providers/memory.template-provider.d.ts +1 -1
- package/templates/providers/memory.template-provider.js +1 -1
- package/templates/providers/memory.template-provider.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/renderers/jsx.template-renderer.d.ts +16 -0
- package/templates/renderers/jsx.template-renderer.js +40 -0
- package/templates/renderers/jsx.template-renderer.js.map +1 -0
- package/templates/renderers/mjml.template-renderer.d.ts +1 -1
- package/templates/renderers/string.template-renderer.d.ts +2 -2
- package/templates/renderers/string.template-renderer.js +1 -1
- package/templates/renderers/string.template-renderer.js.map +1 -1
- package/templates/resolvers/file.template-resolver.d.ts +2 -2
- package/templates/resolvers/jsx.template-resolver.d.ts +15 -0
- package/templates/resolvers/jsx.template-resolver.js +45 -0
- package/templates/resolvers/jsx.template-resolver.js.map +1 -0
- package/templates/resolvers/string.template-resolver.d.ts +1 -1
- package/templates/resolvers/string.template-resolver.js +1 -1
- package/templates/resolvers/string.template-resolver.js.map +1 -1
- package/templates/template.model.d.ts +3 -1
- package/templates/template.model.js +8 -1
- package/templates/template.model.js.map +1 -1
- package/templates/template.provider.d.ts +1 -1
- package/templates/template.renderer.d.ts +5 -2
- package/templates/template.renderer.js +6 -1
- package/templates/template.renderer.js.map +1 -1
- package/templates/template.resolver.d.ts +2 -2
- package/templates/template.service.d.ts +3 -2
- package/templates/template.service.js +6 -1
- package/templates/template.service.js.map +1 -1
- package/templates/tokens.d.ts +1 -1
- package/text/localization.service.js +1 -1
- package/text/localization.service.js.map +1 -1
- package/tsconfig.json +5 -0
- package/types.d.ts +6 -32
- package/utils/jwt.js +2 -2
- package/utils/jwt.js.map +1 -1
- package/utils/object/object.d.ts +1 -1
- package/utils/object/object.js +6 -5
- package/utils/object/object.js.map +1 -1
- package/authentication/authentication-credentials.service.d.ts +0 -6
- package/authentication/authentication-credentials.service.js.map +0 -1
- package/orm/decorators.d.ts +0 -26
- package/orm/decorators.js +0 -172
- package/orm/decorators.js.map +0 -1
- package/orm/entity-definition.model.d.ts +0 -51
- package/orm/entity-definition.model.js +0 -27
- package/orm/entity-definition.model.js.map +0 -1
- package/orm/index.d.ts +0 -1
- package/orm/index.js +0 -18
- package/orm/index.js.map +0 -1
- package/orm/models/entity.d.ts +0 -22
- package/orm/models/entity.js +0 -87
- package/orm/models/entity.js.map +0 -1
- package/orm/models/index.d.ts +0 -1
- package/orm/models/index.js +0 -18
- package/orm/models/index.js.map +0 -1
- package/orm/repository/mongo/classes.d.ts +0 -25
- package/orm/repository/mongo/classes.js +0 -33
- package/orm/repository/mongo/classes.js.map +0 -1
- package/orm/repository/mongo/module.d.ts +0 -8
- package/orm/repository/mongo/module.js +0 -88
- package/orm/repository/mongo/module.js.map +0 -1
- package/orm/repository/mongo/mongo-repository.d.ts +0 -11
- package/orm/repository/mongo/mongo-repository.js +0 -55
- package/orm/repository/mongo/mongo-repository.js.map +0 -1
- package/orm/repository/mongo/mongo-transaction.d.ts +0 -10
- package/orm/repository/mongo/mongo-transaction.js +0 -28
- package/orm/repository/mongo/mongo-transaction.js.map +0 -1
- package/orm/repository/repository.d.ts +0 -75
- package/orm/repository/repository.js +0 -182
- package/orm/repository/repository.js.map +0 -1
- package/orm/repository/transaction.d.ts +0 -26
- package/orm/repository/transaction.js +0 -65
- package/orm/repository/transaction.js.map +0 -1
- package/orm/sql/sql-repository.d.ts +0 -6
- package/orm/sql/sql-repository.js +0 -15
- package/orm/sql/sql-repository.js.map +0 -1
- package/orm/test.d.ts +0 -1
- package/orm/test.js.map +0 -1
- package/orm/types/definition.d.ts +0 -19
- package/orm/types/definition.js +0 -55
- package/orm/types/definition.js.map +0 -1
- package/orm/types/index.d.ts +0 -3
- package/orm/types/index.js +0 -20
- package/orm/types/index.js.map +0 -1
- package/orm/types/options.d.ts +0 -36
- package/orm/types/options.js +0 -5
- package/orm/types/options.js.map +0 -1
- package/orm/types/query.d.ts +0 -110
- package/orm/types/query.js +0 -10
- package/orm/types/query.js.map +0 -1
- package/templates/providers/file.provider-template.js.map +0 -1
package/api/types.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export type ApiEndpointDefinition = {
|
|
|
67
67
|
data?: any;
|
|
68
68
|
cors?: ApiEndpointDefinitionCors;
|
|
69
69
|
};
|
|
70
|
+
export type ApiEndpointsDefinition = Record<string, ApiEndpointDefinition | (() => ApiEndpointDefinition)>;
|
|
70
71
|
export type ApiDefinition = {
|
|
71
72
|
/**
|
|
72
73
|
* Default root resource for endpoints.
|
|
@@ -76,7 +77,7 @@ export type ApiDefinition = {
|
|
|
76
77
|
* Endpoint prefix. Overwrites default from gateway.
|
|
77
78
|
*/
|
|
78
79
|
prefix?: string | null;
|
|
79
|
-
endpoints:
|
|
80
|
+
endpoints: ApiEndpointsDefinition;
|
|
80
81
|
};
|
|
81
82
|
export type ApiEndpointKeys<T extends ApiDefinition> = keyof T['endpoints'];
|
|
82
83
|
export type NormalizedApiEndpoints<T extends ApiDefinition['endpoints']> = {
|
package/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../source/api/types.ts"],"names":[],"mappings":";;;AAIA,mDAAsD;AACtD,sDAAiD;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../source/api/types.ts"],"names":[],"mappings":";;;AAIA,mDAAsD;AACtD,sDAAiD;AAoJjD,SAAgB,SAAS,CAA0B,UAAa;IAC9D,OAAO,UAAU,CAAC;AACpB,CAAC;AAFD,8BAEC;AAEM,KAAK,UAAU,8BAA8B,CAAI,OAA0B,EAAE,OAAoC,EAAE,QAAoC;IAC5J,IAAI,IAAA,wBAAU,EAAC,QAAQ,CAAC,EAAE;QACxB,OAAO,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACnC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAND,wEAMC;AAED,SAAgB,gCAAgC,CAAuC,sBAAyB;IAC9G,MAAM,OAAO,GAAG,uCAAuC,CAAC,sBAAsB,CAAC,CAAC;IAChF,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAA8B,CAAC;AAClE,CAAC;AAHD,4EAGC;AAED,SAAgB,uCAAuC,CAAuC,aAAgB;IAC5G,OAAO,IAAA,sBAAa,EAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAmC,EAAE,CAAC,CAAC,GAAa,EAAE,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3I,CAAC;AAFD,0FAEC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AuthenticationCredentials, NewAuthenticationCredentials } from './models';
|
|
2
|
+
export declare abstract class AuthenticationCredentialsRepository {
|
|
3
|
+
abstract tryLoad(subject: string): Promise<AuthenticationCredentials | undefined>;
|
|
4
|
+
abstract save(credentials: NewAuthenticationCredentials | AuthenticationCredentials): Promise<void>;
|
|
5
|
+
}
|
|
@@ -6,12 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.AuthenticationCredentialsRepository = void 0;
|
|
10
10
|
const reflection_1 = require("../reflection");
|
|
11
|
-
let
|
|
11
|
+
let AuthenticationCredentialsRepository = class AuthenticationCredentialsRepository {
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
AuthenticationCredentialsRepository = __decorate([
|
|
14
14
|
(0, reflection_1.Class)()
|
|
15
|
-
],
|
|
16
|
-
exports.
|
|
17
|
-
//# sourceMappingURL=authentication-credentials.
|
|
15
|
+
], AuthenticationCredentialsRepository);
|
|
16
|
+
exports.AuthenticationCredentialsRepository = AuthenticationCredentialsRepository;
|
|
17
|
+
//# sourceMappingURL=authentication-credentials.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-credentials.repository.js","sourceRoot":"","sources":["../../source/authentication/authentication-credentials.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAI9B,IAAe,mCAAmC,GAAlD,MAAe,mCAAmC;CAGxD,CAAA;AAHqB,mCAAmC;IADxD,IAAA,kBAAK,GAAE;GACc,mCAAmC,CAGxD;AAHqB,kFAAmC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NewEntity } from "../database";
|
|
2
2
|
import type { AuthenticationSession } from './models';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type AuthenticationSessionExtendData = {
|
|
4
|
+
end: number;
|
|
5
|
+
tokenId: string;
|
|
6
|
+
refreshTokenHashVersion: number;
|
|
7
|
+
refreshTokenSalt: Uint8Array;
|
|
8
|
+
refreshTokenHash: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
export declare abstract class AuthenticationSessionRepository {
|
|
11
|
+
abstract insert(authenticationSession: NewEntity<AuthenticationSession>): Promise<AuthenticationSession>;
|
|
12
|
+
abstract load(id: string): Promise<AuthenticationSession>;
|
|
13
|
+
abstract extend(id: string, data: AuthenticationSessionExtendData): Promise<void>;
|
|
14
|
+
abstract end(id: string, timestamp: number): Promise<void>;
|
|
6
15
|
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.AuthenticationSessionRepository = void 0;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let AuthenticationSessionRepository = class AuthenticationSessionRepository extends repository_1.Repository {
|
|
13
|
-
};
|
|
14
|
-
AuthenticationSessionRepository = __decorate([
|
|
15
|
-
(0, reflection_1.Class)()
|
|
16
|
-
], AuthenticationSessionRepository);
|
|
4
|
+
class AuthenticationSessionRepository {
|
|
5
|
+
}
|
|
17
6
|
exports.AuthenticationSessionRepository = AuthenticationSessionRepository;
|
|
18
7
|
//# sourceMappingURL=authentication-session.repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-session.repository.js","sourceRoot":"","sources":["../../source/authentication/authentication-session.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authentication-session.repository.js","sourceRoot":"","sources":["../../source/authentication/authentication-session.repository.ts"],"names":[],"mappings":";;;AAWA,MAAsB,+BAA+B;CAQpD;AARD,0EAQC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ObjectSchema, SchemaOutput } from "../schema/types/types";
|
|
2
|
+
import type { AbstractConstructor } from "../types";
|
|
3
|
+
import { TokenPayloadBase } from './models';
|
|
4
|
+
export declare class GetTokenParameters {
|
|
5
|
+
subject: string;
|
|
6
|
+
secret: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getAuthenticationApiEndpointsDefinition<AuthenticationDataSchema extends ObjectSchema<GetTokenParameters> | AbstractConstructor<GetTokenParameters>, TokenPayloadSchema extends ObjectSchema<TokenPayloadBase> | AbstractConstructor<TokenPayloadBase>>(options?: {
|
|
9
|
+
tokenPayloadSchema?: TokenPayloadSchema;
|
|
10
|
+
authenticationDataSchema?: AuthenticationDataSchema;
|
|
11
|
+
}): {
|
|
12
|
+
token: {
|
|
13
|
+
resource: string;
|
|
14
|
+
method: "POST";
|
|
15
|
+
parameters: ObjectSchema<SchemaOutput<AuthenticationDataSchema>> | AbstractConstructor<SchemaOutput<AuthenticationDataSchema>, any>;
|
|
16
|
+
result: ObjectSchema<SchemaOutput<TokenPayloadSchema>> | AbstractConstructor<SchemaOutput<TokenPayloadSchema>, any>;
|
|
17
|
+
};
|
|
18
|
+
refresh: {
|
|
19
|
+
resource: string;
|
|
20
|
+
method: "POST";
|
|
21
|
+
result: ObjectSchema<SchemaOutput<TokenPayloadSchema>> | AbstractConstructor<SchemaOutput<TokenPayloadSchema>, any>;
|
|
22
|
+
};
|
|
23
|
+
endSession: {
|
|
24
|
+
resource: string;
|
|
25
|
+
method: "POST";
|
|
26
|
+
result: import("../schema/types/types").ValueSchema<"ok">;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getAuthenticationApiEndpointsDefinition = exports.GetTokenParameters = void 0;
|
|
13
|
+
const property_1 = require("../schema/decorators/property");
|
|
14
|
+
const literal_1 = require("../schema/schemas/literal");
|
|
15
|
+
const models_1 = require("./models");
|
|
16
|
+
class GetTokenParameters {
|
|
17
|
+
subject;
|
|
18
|
+
secret;
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, property_1.Property)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], GetTokenParameters.prototype, "subject", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, property_1.Property)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], GetTokenParameters.prototype, "secret", void 0);
|
|
28
|
+
exports.GetTokenParameters = GetTokenParameters;
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
30
|
+
function getAuthenticationApiEndpointsDefinition(options = {}) {
|
|
31
|
+
const tokenParametersSchema = (options.authenticationDataSchema ?? GetTokenParameters);
|
|
32
|
+
const tokenResultSchema = (options.tokenPayloadSchema ?? models_1.TokenPayloadBase);
|
|
33
|
+
return {
|
|
34
|
+
token: {
|
|
35
|
+
resource: 'token',
|
|
36
|
+
method: 'POST',
|
|
37
|
+
parameters: tokenParametersSchema,
|
|
38
|
+
result: tokenResultSchema
|
|
39
|
+
},
|
|
40
|
+
refresh: {
|
|
41
|
+
resource: 'refresh',
|
|
42
|
+
method: 'POST',
|
|
43
|
+
result: tokenResultSchema
|
|
44
|
+
},
|
|
45
|
+
endSession: {
|
|
46
|
+
resource: 'end-session',
|
|
47
|
+
method: 'POST',
|
|
48
|
+
result: (0, literal_1.literal)('ok')
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.getAuthenticationApiEndpointsDefinition = getAuthenticationApiEndpointsDefinition;
|
|
53
|
+
//# sourceMappingURL=authentication.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.api.js","sourceRoot":"","sources":["../../source/authentication/authentication.api.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAAwD;AACxD,uDAAmD;AAGnD,qCAA4C;AAE5C,MAAa,kBAAkB;IAE7B,OAAO,CAAS;IAGhB,MAAM,CAAS;CAChB;AALC;IAAC,IAAA,mBAAQ,GAAE;;mDACK;AAEhB;IAAC,IAAA,mBAAQ,GAAE;;kDACI;AALjB,gDAMC;AAED,4EAA4E;AAC5E,SAAgB,uCAAuC,CAIrD,UAGI,EAAE;IAEN,MAAM,qBAAqB,GAAG,CAAC,OAAO,CAAC,wBAAwB,IAAI,kBAAkB,CAAuH,CAAA;IAC5M,MAAM,iBAAiB,GAAG,CAAC,OAAO,CAAC,kBAAkB,IAAI,yBAAgB,CAA2G,CAAC;IAErL,OAAO;QACL,KAAK,EAAE;YACL,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,qBAAqB;YACjC,MAAM,EAAE,iBAAiB;SAC1B;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,iBAAiB;SAC1B;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,IAAA,iBAAO,EAAC,IAAa,CAAC;SAC/B;KAC+B,CAAC;AACrC,CAAC;AA9BD,0FA8BC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { JwtToken, JwtTokenHeader } from "../utils/jwt";
|
|
2
|
-
import {
|
|
2
|
+
import { AuthenticationCredentialsRepository } from './authentication-credentials.repository';
|
|
3
3
|
import { AuthenticationSessionRepository } from './authentication-session.repository';
|
|
4
4
|
import { AuthenticationTokenPayloadProvider } from './authentication-token-payload.provider';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
iat: number;
|
|
8
|
-
exp: number;
|
|
9
|
-
}, JwtTokenHeader<TokenHeader>>;
|
|
5
|
+
import type { TokenPayloadBase } from './models';
|
|
6
|
+
export type Token<AdditionalTokenPayload> = JwtToken<AdditionalTokenPayload & TokenPayloadBase, JwtTokenHeader<TokenHeader>>;
|
|
10
7
|
export type TokenHeader = {
|
|
11
8
|
v: number;
|
|
12
9
|
};
|
|
@@ -24,18 +21,21 @@ export type AuthenticationResult = {
|
|
|
24
21
|
token: string;
|
|
25
22
|
refreshToken: string;
|
|
26
23
|
};
|
|
27
|
-
export declare class AuthenticationService<
|
|
28
|
-
private readonly
|
|
29
|
-
private readonly
|
|
24
|
+
export declare class AuthenticationService<AdditionalTokenPayload, AdditionalAuthenticationData> {
|
|
25
|
+
private readonly credentialsRepository;
|
|
26
|
+
private readonly sessionRepository;
|
|
30
27
|
private readonly tokenPayloadProviderService;
|
|
31
28
|
private readonly secret;
|
|
32
29
|
private readonly tokenVersion;
|
|
33
30
|
private readonly tokenTimeToLive;
|
|
34
31
|
private readonly sessionTimeToLive;
|
|
35
|
-
constructor(credentialsService:
|
|
36
|
-
|
|
37
|
-
authenticate(subject: string, secret: string
|
|
38
|
-
|
|
32
|
+
constructor(credentialsService: AuthenticationCredentialsRepository, sessionRepository: AuthenticationSessionRepository, tokenPayloadProviderService: AuthenticationTokenPayloadProvider<AdditionalTokenPayload, AdditionalAuthenticationData>, options: AuthenticationServiceOptions);
|
|
33
|
+
setCredentials(subject: string, secret: string): Promise<void>;
|
|
34
|
+
authenticate(subject: string, secret: string): Promise<boolean>;
|
|
35
|
+
getToken(subject: string, secret: string, additionalAuthenticationData: AdditionalAuthenticationData): Promise<AuthenticationResult>;
|
|
36
|
+
endSession(sessionId: string): Promise<void>;
|
|
37
|
+
refresh(sessionId: string, refreshToken: string, additionalAuthenticationData: AdditionalAuthenticationData): Promise<AuthenticationResult>;
|
|
38
|
+
validateToken(token: string): Promise<Token<AdditionalTokenPayload>>;
|
|
39
39
|
private createToken;
|
|
40
40
|
private createRefreshToken;
|
|
41
41
|
private getHash;
|
|
@@ -24,28 +24,28 @@ const jwt_1 = require("../utils/jwt");
|
|
|
24
24
|
const random_1 = require("../utils/random");
|
|
25
25
|
const type_guards_1 = require("../utils/type-guards");
|
|
26
26
|
const units_1 = require("../utils/units");
|
|
27
|
-
const
|
|
27
|
+
const authentication_credentials_repository_1 = require("./authentication-credentials.repository");
|
|
28
28
|
const authentication_session_repository_1 = require("./authentication-session.repository");
|
|
29
29
|
const authentication_token_payload_provider_1 = require("./authentication-token-payload.provider");
|
|
30
30
|
const tokens_1 = require("./tokens");
|
|
31
31
|
let AuthenticationService = class AuthenticationService {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
credentialsRepository;
|
|
33
|
+
sessionRepository;
|
|
34
34
|
tokenPayloadProviderService;
|
|
35
35
|
secret;
|
|
36
36
|
tokenVersion;
|
|
37
37
|
tokenTimeToLive;
|
|
38
38
|
sessionTimeToLive;
|
|
39
|
-
constructor(credentialsService,
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
39
|
+
constructor(credentialsService, sessionRepository, tokenPayloadProviderService, options) {
|
|
40
|
+
this.credentialsRepository = credentialsService;
|
|
41
|
+
this.sessionRepository = sessionRepository;
|
|
42
42
|
this.tokenPayloadProviderService = tokenPayloadProviderService;
|
|
43
43
|
this.secret = options.secret;
|
|
44
44
|
this.tokenVersion = options.version ?? 1;
|
|
45
45
|
this.tokenTimeToLive = options.tokenTimeToLive ?? (5 * units_1.millisecondsPerMinute);
|
|
46
46
|
this.sessionTimeToLive = options.sessionTimeToLive ?? (5 * units_1.millisecondsPerDay);
|
|
47
47
|
}
|
|
48
|
-
async
|
|
48
|
+
async setCredentials(subject, secret) {
|
|
49
49
|
const salt = (0, random_1.getRandomBytes)(32);
|
|
50
50
|
const hash = await this.getHash(secret, salt);
|
|
51
51
|
const credentials = {
|
|
@@ -54,45 +54,70 @@ let AuthenticationService = class AuthenticationService {
|
|
|
54
54
|
salt,
|
|
55
55
|
hash
|
|
56
56
|
};
|
|
57
|
-
await this.
|
|
57
|
+
await this.credentialsRepository.save(credentials);
|
|
58
58
|
}
|
|
59
|
-
async authenticate(subject, secret
|
|
60
|
-
const credentials = await this.
|
|
59
|
+
async authenticate(subject, secret) {
|
|
60
|
+
const credentials = await this.credentialsRepository.tryLoad(subject);
|
|
61
61
|
if ((0, type_guards_1.isUndefined)(credentials)) {
|
|
62
|
-
|
|
62
|
+
return false;
|
|
63
63
|
}
|
|
64
64
|
const hash = await this.getHash(secret, credentials.salt);
|
|
65
|
-
|
|
65
|
+
return (0, equals_1.binaryEquals)(hash, credentials.hash);
|
|
66
|
+
}
|
|
67
|
+
async getToken(subject, secret, additionalAuthenticationData) {
|
|
68
|
+
const isAuthenticated = await this.authenticate(subject, secret);
|
|
69
|
+
if (!isAuthenticated) {
|
|
66
70
|
throw new error_1.UnauthorizedError('Invalid credentials.');
|
|
67
71
|
}
|
|
68
72
|
const now = (0, date_time_1.currentTimestamp)();
|
|
69
73
|
const tokenPayload = await this.tokenPayloadProviderService.getTokenPayload(subject, additionalAuthenticationData);
|
|
70
74
|
const { token, payload } = await this.createToken(tokenPayload, now);
|
|
71
75
|
const refreshToken = await this.createRefreshToken();
|
|
72
|
-
await this.
|
|
76
|
+
await this.sessionRepository.insert({
|
|
73
77
|
subject,
|
|
74
78
|
begin: now,
|
|
75
79
|
end: now + this.sessionTimeToLive,
|
|
76
80
|
tokenId: payload.jti,
|
|
77
|
-
|
|
81
|
+
refreshTokenHashVersion: 1,
|
|
78
82
|
refreshTokenSalt: refreshToken.salt,
|
|
79
83
|
refreshTokenHash: refreshToken.hash
|
|
80
84
|
});
|
|
81
85
|
return { token, refreshToken: refreshToken.token };
|
|
82
86
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
async endSession(sessionId) {
|
|
88
|
+
const now = (0, date_time_1.currentTimestamp)();
|
|
89
|
+
await this.sessionRepository.end(sessionId, now);
|
|
90
|
+
}
|
|
91
|
+
async refresh(sessionId, refreshToken, additionalAuthenticationData) {
|
|
92
|
+
const session = await this.sessionRepository.load(sessionId);
|
|
93
|
+
const hash = await this.getHash(refreshToken, session.refreshTokenSalt);
|
|
94
|
+
if (session.end <= (0, date_time_1.currentTimestamp)()) {
|
|
95
|
+
throw new error_1.UnauthorizedError('Session is ended.');
|
|
96
|
+
}
|
|
97
|
+
if (!(0, equals_1.binaryEquals)(hash, session.refreshTokenHash)) {
|
|
98
|
+
throw new error_1.UnauthorizedError('Invalid refresh token.');
|
|
99
|
+
}
|
|
100
|
+
const now = (0, date_time_1.currentTimestamp)();
|
|
101
|
+
const tokenPayload = await this.tokenPayloadProviderService.getTokenPayload(session.subject, additionalAuthenticationData);
|
|
102
|
+
const { token, payload } = await this.createToken(tokenPayload, now);
|
|
103
|
+
const newRefreshToken = await this.createRefreshToken();
|
|
104
|
+
await this.sessionRepository.extend(sessionId, {
|
|
105
|
+
end: now + this.sessionTimeToLive,
|
|
106
|
+
tokenId: payload.jti,
|
|
107
|
+
refreshTokenHashVersion: 1,
|
|
108
|
+
refreshTokenSalt: newRefreshToken.salt,
|
|
109
|
+
refreshTokenHash: newRefreshToken.hash
|
|
110
|
+
});
|
|
111
|
+
return { token, refreshToken: newRefreshToken.token };
|
|
86
112
|
}
|
|
87
|
-
|
|
88
|
-
async validate(token) {
|
|
113
|
+
async validateToken(token) {
|
|
89
114
|
const validatedToken = await (0, jwt_1.parseAndValidateJwtTokenString)(token, 'HS256', this.secret);
|
|
90
115
|
if (validatedToken.header.v != this.tokenVersion) {
|
|
91
116
|
throw new invalid_token_error_1.InvalidTokenError('Invalid token version.');
|
|
92
117
|
}
|
|
93
118
|
return validatedToken;
|
|
94
119
|
}
|
|
95
|
-
async createToken(
|
|
120
|
+
async createToken(additionalTokenPayload, timestamp = (0, date_time_1.currentTimestamp)()) {
|
|
96
121
|
const header = {
|
|
97
122
|
v: this.tokenVersion,
|
|
98
123
|
alg: 'HS256',
|
|
@@ -102,7 +127,7 @@ let AuthenticationService = class AuthenticationService {
|
|
|
102
127
|
jti: (0, random_1.getRandomString)(24, alphabet_1.Alphabet.LowerUpperCaseNumbers),
|
|
103
128
|
iat: (0, date_time_1.timestampToTimestampSeconds)(timestamp),
|
|
104
129
|
exp: (0, date_time_1.timestampToTimestampSeconds)(timestamp + this.tokenTimeToLive),
|
|
105
|
-
...
|
|
130
|
+
...additionalTokenPayload
|
|
106
131
|
};
|
|
107
132
|
const token = await (0, jwt_1.createJwtTokenString)({
|
|
108
133
|
header,
|
|
@@ -116,16 +141,16 @@ let AuthenticationService = class AuthenticationService {
|
|
|
116
141
|
const hash = await this.getHash(token, salt);
|
|
117
142
|
return { token, salt, hash: new Uint8Array(hash) };
|
|
118
143
|
}
|
|
119
|
-
async getHash(
|
|
120
|
-
const key = await (0, cryptography_1.importPbkdf2Key)(
|
|
121
|
-
const hash = await globalThis.crypto.subtle.deriveBits({ name: 'PBKDF2', hash: 'SHA-512', iterations: 250000, salt }, key,
|
|
144
|
+
async getHash(secret, salt) {
|
|
145
|
+
const key = await (0, cryptography_1.importPbkdf2Key)(secret);
|
|
146
|
+
const hash = await globalThis.crypto.subtle.deriveBits({ name: 'PBKDF2', hash: 'SHA-512', iterations: 250000, salt }, key, 512);
|
|
122
147
|
return new Uint8Array(hash);
|
|
123
148
|
}
|
|
124
149
|
};
|
|
125
150
|
AuthenticationService = __decorate([
|
|
126
151
|
(0, container_1.singleton)(),
|
|
127
152
|
__param(3, (0, container_1.inject)(tokens_1.AUTHENTICATION_SERVICE_OPTIONS)),
|
|
128
|
-
__metadata("design:paramtypes", [
|
|
153
|
+
__metadata("design:paramtypes", [authentication_credentials_repository_1.AuthenticationCredentialsRepository,
|
|
129
154
|
authentication_session_repository_1.AuthenticationSessionRepository,
|
|
130
155
|
authentication_token_payload_provider_1.AuthenticationTokenPayloadProvider, Object])
|
|
131
156
|
], AuthenticationService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../source/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAgD;AAChD,oCAA4C;AAC5C,sEAAgE;AAChE,gDAA4C;AAC5C,wDAAuD;AACvD,kDAAkF;AAClF,4CAA8C;AAE9C,sCAAmF;AACnF,4CAAiE;AACjE,sDAAkD;AAClD,0CAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"authentication.service.js","sour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8Array;
|
|
6
6
|
hash: Uint8Array;
|
|
7
7
|
}
|
|
8
|
-
declare
|
|
9
|
-
|
|
8
|
+
export declare class NewAuthenticationCredentials {
|
|
9
|
+
subject: string;
|
|
10
|
+
hashVersion: number;
|
|
11
|
+
salt: Uint8Array;
|
|
12
|
+
hash: Uint8Array;
|
|
10
13
|
}
|
|
11
|
-
export {};
|
|
@@ -10,14 +10,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.NewAuthenticationCredentials = exports.AuthenticationCredentials = void 0;
|
|
13
|
-
const models_1 = require("../../orm/models");
|
|
14
13
|
const schema_1 = require("../../schema");
|
|
15
|
-
class AuthenticationCredentials
|
|
14
|
+
class AuthenticationCredentials {
|
|
15
|
+
id;
|
|
16
16
|
subject;
|
|
17
17
|
hashVersion;
|
|
18
18
|
salt;
|
|
19
19
|
hash;
|
|
20
20
|
}
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, schema_1.Property)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], AuthenticationCredentials.prototype, "id", void 0);
|
|
21
25
|
__decorate([
|
|
22
26
|
(0, schema_1.Property)(),
|
|
23
27
|
__metadata("design:type", String)
|
|
@@ -35,10 +39,27 @@ __decorate([
|
|
|
35
39
|
__metadata("design:type", Uint8Array)
|
|
36
40
|
], AuthenticationCredentials.prototype, "hash", void 0);
|
|
37
41
|
exports.AuthenticationCredentials = AuthenticationCredentials;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
class NewAuthenticationCredentials {
|
|
43
|
+
subject;
|
|
44
|
+
hashVersion;
|
|
45
|
+
salt;
|
|
46
|
+
hash;
|
|
47
|
+
}
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, schema_1.Property)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], NewAuthenticationCredentials.prototype, "subject", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, schema_1.Property)(),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], NewAuthenticationCredentials.prototype, "hashVersion", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, schema_1.Property)(),
|
|
58
|
+
__metadata("design:type", Uint8Array)
|
|
59
|
+
], NewAuthenticationCredentials.prototype, "salt", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, schema_1.Property)(),
|
|
62
|
+
__metadata("design:type", Uint8Array)
|
|
63
|
+
], NewAuthenticationCredentials.prototype, "hash", void 0);
|
|
43
64
|
exports.NewAuthenticationCredentials = NewAuthenticationCredentials;
|
|
44
65
|
//# sourceMappingURL=authentication-credentials.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-credentials.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-credentials.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authentication-credentials.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-credentials.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,MAAa,yBAAyB;IAEpC,EAAE,CAAS;IAGX,OAAO,CAAS;IAGhB,WAAW,CAAS;IAGpB,IAAI,CAAa;IAGjB,IAAI,CAAa;CAClB;AAdC;IAAC,IAAA,iBAAQ,GAAE;;qDACA;AAEX;IAAC,IAAA,iBAAQ,GAAE;;0DACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;8DACS;AAEpB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAEjB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAdnB,8DAeC;AAED,MAAa,4BAA4B;IAEvC,OAAO,CAAS;IAGhB,WAAW,CAAS;IAGpB,IAAI,CAAa;IAGjB,IAAI,CAAa;CAClB;AAXC;IAAC,IAAA,iBAAQ,GAAE;;6DACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;iEACS;AAEpB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;0DAAC;AAEjB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;0DAAC;AAXnB,oEAYC"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare class AuthenticationSession {
|
|
2
|
+
id: string;
|
|
3
3
|
subject: string;
|
|
4
|
+
/** timestamp */
|
|
4
5
|
begin: number;
|
|
6
|
+
/** timestamp */
|
|
5
7
|
end: number;
|
|
6
8
|
tokenId: string;
|
|
7
|
-
|
|
9
|
+
refreshTokenHashVersion: number;
|
|
8
10
|
refreshTokenSalt: Uint8Array;
|
|
9
11
|
refreshTokenHash: Uint8Array;
|
|
10
12
|
}
|
|
11
|
-
declare
|
|
12
|
-
|
|
13
|
+
export declare class NewAuthenticationSession {
|
|
14
|
+
subject: string;
|
|
15
|
+
begin: number;
|
|
16
|
+
end: number;
|
|
17
|
+
tokenId: string;
|
|
18
|
+
refreshTokenHashVersion: number;
|
|
19
|
+
refreshTokenSalt: Uint8Array;
|
|
20
|
+
refreshTokenHash: Uint8Array;
|
|
13
21
|
}
|
|
14
|
-
export {};
|
|
@@ -10,17 +10,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.NewAuthenticationSession = exports.AuthenticationSession = void 0;
|
|
13
|
-
const orm_1 = require("../../orm");
|
|
14
13
|
const schema_1 = require("../../schema");
|
|
15
|
-
class AuthenticationSession
|
|
14
|
+
class AuthenticationSession {
|
|
15
|
+
id;
|
|
16
16
|
subject;
|
|
17
|
+
/** timestamp */
|
|
17
18
|
begin;
|
|
19
|
+
/** timestamp */
|
|
18
20
|
end;
|
|
19
21
|
tokenId;
|
|
20
|
-
|
|
22
|
+
refreshTokenHashVersion;
|
|
21
23
|
refreshTokenSalt;
|
|
22
24
|
refreshTokenHash;
|
|
23
25
|
}
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, schema_1.Property)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], AuthenticationSession.prototype, "id", void 0);
|
|
24
30
|
__decorate([
|
|
25
31
|
(0, schema_1.Property)(),
|
|
26
32
|
__metadata("design:type", String)
|
|
@@ -40,7 +46,7 @@ __decorate([
|
|
|
40
46
|
__decorate([
|
|
41
47
|
(0, schema_1.Property)(),
|
|
42
48
|
__metadata("design:type", Number)
|
|
43
|
-
], AuthenticationSession.prototype, "
|
|
49
|
+
], AuthenticationSession.prototype, "refreshTokenHashVersion", void 0);
|
|
44
50
|
__decorate([
|
|
45
51
|
(0, schema_1.Property)(),
|
|
46
52
|
__metadata("design:type", Uint8Array)
|
|
@@ -50,10 +56,42 @@ __decorate([
|
|
|
50
56
|
__metadata("design:type", Uint8Array)
|
|
51
57
|
], AuthenticationSession.prototype, "refreshTokenHash", void 0);
|
|
52
58
|
exports.AuthenticationSession = AuthenticationSession;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
class NewAuthenticationSession {
|
|
60
|
+
subject;
|
|
61
|
+
begin;
|
|
62
|
+
end;
|
|
63
|
+
tokenId;
|
|
64
|
+
refreshTokenHashVersion;
|
|
65
|
+
refreshTokenSalt;
|
|
66
|
+
refreshTokenHash;
|
|
67
|
+
}
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, schema_1.Property)(),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], NewAuthenticationSession.prototype, "subject", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, schema_1.Property)(),
|
|
74
|
+
__metadata("design:type", Number)
|
|
75
|
+
], NewAuthenticationSession.prototype, "begin", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, schema_1.Property)(),
|
|
78
|
+
__metadata("design:type", Number)
|
|
79
|
+
], NewAuthenticationSession.prototype, "end", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, schema_1.Property)(),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], NewAuthenticationSession.prototype, "tokenId", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, schema_1.Property)(),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], NewAuthenticationSession.prototype, "refreshTokenHashVersion", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, schema_1.Property)(),
|
|
90
|
+
__metadata("design:type", Uint8Array)
|
|
91
|
+
], NewAuthenticationSession.prototype, "refreshTokenSalt", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, schema_1.Property)(),
|
|
94
|
+
__metadata("design:type", Uint8Array)
|
|
95
|
+
], NewAuthenticationSession.prototype, "refreshTokenHash", void 0);
|
|
58
96
|
exports.NewAuthenticationSession = NewAuthenticationSession;
|
|
59
97
|
//# sourceMappingURL=authentication-session.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-session.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-session.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authentication-session.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-session.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,MAAa,qBAAqB;IAEhC,EAAE,CAAS;IAGX,OAAO,CAAS;IAEhB,gBAAgB;IAEhB,KAAK,CAAS;IAEd,gBAAgB;IAEhB,GAAG,CAAS;IAGZ,OAAO,CAAS;IAGhB,uBAAuB,CAAS;IAGhC,gBAAgB,CAAa;IAG7B,gBAAgB,CAAa;CAC9B;AAzBC;IAAC,IAAA,iBAAQ,GAAE;;iDACA;AAEX;IAAC,IAAA,iBAAQ,GAAE;;sDACK;AAGhB;IAAC,IAAA,iBAAQ,GAAE;;oDACG;AAGd;IAAC,IAAA,iBAAQ,GAAE;;kDACC;AAEZ;IAAC,IAAA,iBAAQ,GAAE;;sDACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;sEACqB;AAEhC;IAAC,IAAA,iBAAQ,GAAE;8BACO,UAAU;+DAAC;AAE7B;IAAC,IAAA,iBAAQ,GAAE;8BACO,UAAU;+DAAC;AAzB/B,sDA0BC;AAED,MAAa,wBAAwB;IAEnC,OAAO,CAAS;IAGhB,KAAK,CAAS;IAGd,GAAG,CAAS;IAGZ,OAAO,CAAS;IAGhB,uBAAuB,CAAS;IAGhC,gBAAgB,CAAa;IAG7B,gBAAgB,CAAa;CAC9B;AApBC;IAAC,IAAA,iBAAQ,GAAE;;yDACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;uDACG;AAEd;IAAC,IAAA,iBAAQ,GAAE;;qDACC;AAEZ;IAAC,IAAA,iBAAQ,GAAE;;yDACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;yEACqB;AAEhC;IAAC,IAAA,iBAAQ,GAAE;8BACO,UAAU;kEAAC;AAE7B;IAAC,IAAA,iBAAQ,GAAE;8BACO,UAAU;kEAAC;AApB/B,4DAqBC"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authentication-credentials.model"), exports);
|
|
18
18
|
__exportStar(require("./authentication-session.model"), exports);
|
|
19
|
+
__exportStar(require("./token-payload-base.model"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|