@things-factory/auth-base 10.1.205 → 10.1.208

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 (43) hide show
  1. package/dist-server/controllers/passkey.d.ts +35 -0
  2. package/dist-server/controllers/passkey.js +182 -0
  3. package/dist-server/controllers/passkey.js.map +1 -0
  4. package/dist-server/controllers/signin.d.ts +24 -0
  5. package/dist-server/controllers/signin.js +63 -39
  6. package/dist-server/controllers/signin.js.map +1 -1
  7. package/dist-server/middlewares/index.d.ts +0 -1
  8. package/dist-server/middlewares/index.js +0 -1
  9. package/dist-server/middlewares/index.js.map +1 -1
  10. package/dist-server/router/auth-signin-router.js +2 -1
  11. package/dist-server/router/auth-signin-router.js.map +1 -1
  12. package/dist-server/router/webauthn-router.js +55 -93
  13. package/dist-server/router/webauthn-router.js.map +1 -1
  14. package/dist-server/service/access-request/index.d.ts +1 -1
  15. package/dist-server/service/audit/audit-kinds.js +3 -1
  16. package/dist-server/service/audit/audit-kinds.js.map +1 -1
  17. package/dist-server/service/audit/index.d.ts +1 -1
  18. package/dist-server/service/domain-link/index.d.ts +1 -1
  19. package/dist-server/service/domain-owner/index.d.ts +1 -1
  20. package/dist-server/service/index.d.ts +1 -1
  21. package/dist-server/service/index.js +2 -1
  22. package/dist-server/service/index.js.map +1 -1
  23. package/dist-server/service/open-fields.js +4 -1
  24. package/dist-server/service/open-fields.js.map +1 -1
  25. package/dist-server/service/role-template/index.d.ts +1 -1
  26. package/dist-server/service/web-auth-credential/index.d.ts +3 -0
  27. package/dist-server/service/web-auth-credential/index.js +4 -1
  28. package/dist-server/service/web-auth-credential/index.js.map +1 -1
  29. package/dist-server/service/web-auth-credential/web-auth-credential-mutation.d.ts +7 -0
  30. package/dist-server/service/web-auth-credential/web-auth-credential-mutation.js +67 -0
  31. package/dist-server/service/web-auth-credential/web-auth-credential-mutation.js.map +1 -0
  32. package/dist-server/service/web-auth-credential/web-auth-credential-query.d.ts +5 -0
  33. package/dist-server/service/web-auth-credential/web-auth-credential-query.js +29 -0
  34. package/dist-server/service/web-auth-credential/web-auth-credential-query.js.map +1 -0
  35. package/dist-server/service/web-auth-credential/web-auth-credential.d.ts +4 -0
  36. package/dist-server/service/web-auth-credential/web-auth-credential.js +24 -2
  37. package/dist-server/service/web-auth-credential/web-auth-credential.js.map +1 -1
  38. package/dist-server/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +5 -5
  40. package/tests/audit-db.test.ts +4 -4
  41. package/tests/passkey-authenticator.ts +104 -0
  42. package/tests/passkey-db.test.ts +286 -0
  43. package/translations/ko.json +2 -2
@@ -6,8 +6,12 @@ export declare class WebAuthCredential {
6
6
  credentialId: string;
7
7
  publicKey: string;
8
8
  counter: number;
9
+ name?: string;
10
+ transports?: string[];
11
+ lastUsedAt?: Date;
9
12
  createdAt?: Date;
10
13
  updatedAt?: Date;
14
+ deletedAt?: Date;
11
15
  creator?: User;
12
16
  creatorId?: string;
13
17
  updater?: User;
@@ -37,6 +37,21 @@ tslib_1.__decorate([
37
37
  (0, type_graphql_1.Field)({ nullable: true, description: 'The signature counter, used to prevent replay attacks.' }),
38
38
  tslib_1.__metadata("design:type", Number)
39
39
  ], WebAuthCredential.prototype, "counter", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)({ nullable: true }),
42
+ (0, type_graphql_1.Field)({ nullable: true, description: "The owner's label for this passkey, such as the device it was made on." }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], WebAuthCredential.prototype, "name", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.Column)('simple-array', { nullable: true }),
47
+ (0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'How the authenticator can be reached: usb, nfc, ble, hybrid, internal.' }),
48
+ tslib_1.__metadata("design:type", Array)
49
+ ], WebAuthCredential.prototype, "transports", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.Column)({ nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When this passkey was last used to sign in.' }),
53
+ tslib_1.__metadata("design:type", Date)
54
+ ], WebAuthCredential.prototype, "lastUsedAt", void 0);
40
55
  tslib_1.__decorate([
41
56
  (0, typeorm_1.CreateDateColumn)(),
42
57
  (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the credential was created.' }),
@@ -45,8 +60,15 @@ tslib_1.__decorate([
45
60
  tslib_1.__decorate([
46
61
  (0, typeorm_1.UpdateDateColumn)(),
47
62
  (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the credential was last updated.' }),
48
- tslib_1.__metadata("design:type", Date)
63
+ tslib_1.__metadata("design:type", Date
64
+ /* A removed passkey signs nobody in - every find skips it. */
65
+ )
49
66
  ], WebAuthCredential.prototype, "updatedAt", void 0);
67
+ tslib_1.__decorate([
68
+ (0, typeorm_1.DeleteDateColumn)(),
69
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the credential was removed.' }),
70
+ tslib_1.__metadata("design:type", Date)
71
+ ], WebAuthCredential.prototype, "deletedAt", void 0);
50
72
  tslib_1.__decorate([
51
73
  (0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
52
74
  (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true, description: 'The user who created the credential.' }),
@@ -67,7 +89,7 @@ tslib_1.__decorate([
67
89
  ], WebAuthCredential.prototype, "updaterId", void 0);
68
90
  exports.WebAuthCredential = WebAuthCredential = tslib_1.__decorate([
69
91
  (0, typeorm_1.Entity)(),
70
- (0, typeorm_1.Index)('ix_web_auth_credential_0', (webAuthCredential) => [webAuthCredential.user, webAuthCredential.credentialId], { unique: true }),
92
+ (0, typeorm_1.Index)('ix_web_auth_credential_0', (webAuthCredential) => [webAuthCredential.user, webAuthCredential.credentialId], { unique: true, where: '"deleted_at" IS NULL' }),
71
93
  (0, type_graphql_1.ObjectType)({ description: 'Represents a WebAuthn credential for passwordless authentication.' })
72
94
  ], WebAuthCredential);
73
95
  //# sourceMappingURL=web-auth-credential.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-auth-credential.js","sourceRoot":"","sources":["../../../server/service/web-auth-credential/web-auth-credential.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,6CAAsC;AAS/B,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CA6C7B,CAAA;AA7CY,8CAAiB;AAGnB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;6CACzD;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;sCAC3F,cAAI;+CAAA;AAGX;IADC,IAAA,oBAAU,EAAC,CAAC,iBAAoC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;;iDAC9D;AAIf;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;;uDACxF;AAIpB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;oDAC3D;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;;kDAClF;AAIf;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gDAAgD,EA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n,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\n\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index(\n 'ix_web_auth_credential_0',\n (webAuthCredential: WebAuthCredential) => [webAuthCredential.user, webAuthCredential.credentialId],\n { unique: true }\n)\n@ObjectType({ description: 'Represents a WebAuthn credential for passwordless authentication.' })\nexport class WebAuthCredential {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the credential.' })\n readonly id: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user associated with this credential.' })\n user?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.user)\n userId?: string\n\n @Column()\n @Field({ nullable: true, description: 'The unique ID for this credential, provided by the authenticator.' })\n credentialId: string\n\n @Column()\n @Field({ nullable: true, description: 'The public key of the credential.' })\n publicKey: string\n\n @Column()\n @Field({ nullable: true, description: 'The signature counter, used to prevent replay attacks.' })\n counter: number\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the credential was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the credential was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the credential.' })\n creator?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the credential.' })\n updater?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"web-auth-credential.js","sourceRoot":"","sources":["../../../server/service/web-auth-credential/web-auth-credential.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAUgB;AAEhB,6CAAsC;AAS/B,IAAM,iBAAiB,GAAvB,MA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CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;sCACxF,cAAI;kDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,iBAAoC,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC;;oDAC9D;4BA/DP,iBAAiB;IAP7B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,iBAAoC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,YAAY,CAAC,EAClG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAChD;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;GACpF,iBAAiB,CAgE7B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\n\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index(\n 'ix_web_auth_credential_0',\n (webAuthCredential: WebAuthCredential) => [webAuthCredential.user, webAuthCredential.credentialId],\n { unique: true, where: '\"deleted_at\" IS NULL' }\n)\n@ObjectType({ description: 'Represents a WebAuthn credential for passwordless authentication.' })\nexport class WebAuthCredential {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the credential.' })\n readonly id: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user associated with this credential.' })\n user?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.user)\n userId?: string\n\n @Column()\n @Field({ nullable: true, description: 'The unique ID for this credential, provided by the authenticator.' })\n credentialId: string\n\n @Column()\n @Field({ nullable: true, description: 'The public key of the credential.' })\n publicKey: string\n\n @Column()\n @Field({ nullable: true, description: 'The signature counter, used to prevent replay attacks.' })\n counter: number\n\n /* The person's own label for it. The screen proposes one from the device and browser (ADR-0156 decision 6). */\n @Column({ nullable: true })\n @Field({ nullable: true, description: \"The owner's label for this passkey, such as the device it was made on.\" })\n name?: string\n\n /* What the authenticator said it can be reached by - usb, nfc, ble, hybrid, internal. Handed back to the browser as a hint. */\n @Column('simple-array', { nullable: true })\n @Field(type => [String], { nullable: true, description: 'How the authenticator can be reached: usb, nfc, ble, hybrid, internal.' })\n transports?: string[]\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When this passkey was last used to sign in.' })\n lastUsedAt?: Date\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the credential was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the credential was last updated.' })\n updatedAt?: Date\n\n /* A removed passkey signs nobody in - every find skips it. */\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When the credential was removed.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who created the credential.' })\n creator?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The user who last updated the credential.' })\n updater?: User\n\n @RelationId((webAuthCredential: WebAuthCredential) => webAuthCredential.updater)\n updaterId?: string\n}\n"]}