@dudousxd/adonis-authkit-server 0.1.1 → 0.2.0

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 (34) hide show
  1. package/build/index.d.ts +3 -2
  2. package/build/index.js +2 -1
  3. package/build/src/accounts/account_store.d.ts +74 -17
  4. package/build/src/accounts/account_store.js +12 -1
  5. package/build/src/accounts/lucid_account_store.d.ts +12 -27
  6. package/build/src/accounts/lucid_account_store.js +38 -365
  7. package/build/src/accounts/lucid_store/core.d.ts +8 -0
  8. package/build/src/accounts/lucid_store/core.js +108 -0
  9. package/build/src/accounts/lucid_store/mfa.d.ts +8 -0
  10. package/build/src/accounts/lucid_store/mfa.js +77 -0
  11. package/build/src/accounts/lucid_store/provider_identity.d.ts +8 -0
  12. package/build/src/accounts/lucid_store/provider_identity.js +41 -0
  13. package/build/src/accounts/lucid_store/shared.d.ts +48 -0
  14. package/build/src/accounts/lucid_store/shared.js +15 -0
  15. package/build/src/accounts/lucid_store/webauthn.d.ts +8 -0
  16. package/build/src/accounts/lucid_store/webauthn.js +135 -0
  17. package/build/src/define_config.d.ts +6 -0
  18. package/build/src/define_config.js +20 -5
  19. package/build/src/host/controllers/account_mfa_controller.js +2 -1
  20. package/build/src/host/controllers/account_session_controller.js +10 -18
  21. package/build/src/host/controllers/interaction_controller.js +13 -32
  22. package/build/src/host/controllers/social_controller.js +7 -0
  23. package/build/src/host/login_attempt.d.ts +39 -0
  24. package/build/src/host/login_attempt.js +37 -0
  25. package/build/src/host/register_auth_host.d.ts +13 -0
  26. package/build/src/host/register_auth_host.js +9 -2
  27. package/build/src/mixins/json_column.d.ts +38 -0
  28. package/build/src/mixins/json_column.js +31 -0
  29. package/build/src/mixins/with_audit_log.js +2 -4
  30. package/build/src/mixins/with_auth_user.js +2 -4
  31. package/build/src/mixins/with_mfa.js +2 -6
  32. package/build/src/mixins/with_personal_access_token.js +2 -4
  33. package/build/src/mixins/with_webauthn_credential.js +6 -8
  34. package/package.json +1 -1
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { column, beforeSave } from '@adonisjs/lucid/orm';
8
8
  import { Scrypt } from '@adonisjs/core/hash/drivers/scrypt';
9
+ import { jsonColumn } from './json_column.js';
9
10
  const hasher = new Scrypt({});
10
11
  export function withAuthUser() {
11
12
  return (superclass) => {
@@ -26,10 +27,7 @@ export function withAuthUser() {
26
27
  column({ serializeAs: null })
27
28
  ], AuthUserMixin.prototype, "password", void 0);
28
29
  __decorate([
29
- column({
30
- prepare: (value) => JSON.stringify(value ?? []),
31
- consume: (value) => (value ? JSON.parse(value) : []),
32
- })
30
+ column(jsonColumn({ fallback: [], emptyOnWrite: 'serialize' }))
33
31
  ], AuthUserMixin.prototype, "globalRoles", void 0);
34
32
  __decorate([
35
33
  beforeSave()
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { column } from '@adonisjs/lucid/orm';
8
+ import { jsonColumn } from './json_column.js';
8
9
  /**
9
10
  * Mixin de MFA/TOTP. Adiciona as colunas `totp_secret`, `mfa_enabled_at` e
10
11
  * `recovery_codes` ao model de credenciais. Mantido separado de
@@ -26,12 +27,7 @@ export function withMfa() {
26
27
  __decorate([
27
28
  column({
28
29
  serializeAs: null,
29
- prepare: (value) => (value ? JSON.stringify(value) : null),
30
- consume: (value) => {
31
- if (value === null || value === undefined)
32
- return null;
33
- return Array.isArray(value) ? value : JSON.parse(value);
34
- },
30
+ ...jsonColumn({ fallback: null, passthroughParsed: true }),
35
31
  })
36
32
  ], MfaMixin.prototype, "recoveryCodes", void 0);
37
33
  return MfaMixin;
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { column } from '@adonisjs/lucid/orm';
8
+ import { jsonColumn } from './json_column.js';
8
9
  export function withPersonalAccessToken() {
9
10
  return (superclass) => {
10
11
  class PatMixin extends superclass {
@@ -19,10 +20,7 @@ export function withPersonalAccessToken() {
19
20
  column({ serializeAs: null })
20
21
  ], PatMixin.prototype, "tokenHash", void 0);
21
22
  __decorate([
22
- column({
23
- prepare: (value) => (value ? JSON.stringify(value) : null),
24
- consume: (value) => (value ? JSON.parse(value) : []),
25
- })
23
+ column(jsonColumn({ fallback: [] }))
26
24
  ], PatMixin.prototype, "scopes", void 0);
27
25
  __decorate([
28
26
  column()
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { column } from '@adonisjs/lucid/orm';
8
+ import { jsonColumn } from './json_column.js';
8
9
  /**
9
10
  * Mixin de credenciais WebAuthn / passkey. Adiciona as colunas
10
11
  * `account_id`, `public_key`, `counter`, `transports`, `label` + timestamps ao
@@ -26,14 +27,11 @@ export function withWebauthnCredential() {
26
27
  column()
27
28
  ], WebauthnCredentialMixin.prototype, "counter", void 0);
28
29
  __decorate([
29
- column({
30
- prepare: (value) => (value && value.length ? JSON.stringify(value) : null),
31
- consume: (value) => {
32
- if (value === null || value === undefined)
33
- return null;
34
- return Array.isArray(value) ? value : JSON.parse(value);
35
- },
36
- })
30
+ column(jsonColumn({
31
+ fallback: null,
32
+ treatEmptyArrayAsEmpty: true,
33
+ passthroughParsed: true,
34
+ }))
37
35
  ], WebauthnCredentialMixin.prototype, "transports", void 0);
38
36
  __decorate([
39
37
  column()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/adonis-authkit-server",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "AdonisJS OIDC/OAuth2 provider (Identity Provider) toolkit: ejectable auth server with sessions, rate-limiting, MFA/TOTP, audit log, federated logout and OpenTelemetry metrics.",
5
5
  "license": "MIT",
6
6
  "author": "dudousxd",