@openora/core 0.4.1-canary.135 → 0.4.1-canary.138
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/.tsbuildinfo +1 -1
- package/dist/admin-console/plugin.d.ts +1 -1
- package/dist/analytics/plugin.d.ts +1 -1
- package/dist/audit/plugin.d.ts +1 -1
- package/dist/audit/plugin.d.ts.map +1 -1
- package/dist/audit/plugin.js +27 -0
- package/dist/audit/plugin.js.map +1 -1
- package/dist/casino/gaming/__tests__/gaming.service.int.test.js +55 -3
- package/dist/casino/gaming/__tests__/gaming.service.int.test.js.map +1 -1
- package/dist/casino/gaming/adapters/mock/mock-game-adapter.d.ts.map +1 -1
- package/dist/casino/gaming/adapters/mock/mock-game-adapter.js +3 -1
- package/dist/casino/gaming/adapters/mock/mock-game-adapter.js.map +1 -1
- package/dist/casino/gaming/contract/index.d.ts +2 -2
- package/dist/casino/gaming/contract/index.d.ts.map +1 -1
- package/dist/casino/gaming/contract/index.js +3 -1
- package/dist/casino/gaming/contract/index.js.map +1 -1
- package/dist/casino/gaming/plugin.d.ts +1 -1
- package/dist/casino/gaming/router/index.d.ts +1 -1
- package/dist/casino/gaming/service/gaming.service.d.ts +4 -1
- package/dist/casino/gaming/service/gaming.service.d.ts.map +1 -1
- package/dist/casino/gaming/service/gaming.service.js +40 -7
- package/dist/casino/gaming/service/gaming.service.js.map +1 -1
- package/dist/casino/lobby/plugin.d.ts +1 -1
- package/dist/cms/plugin.d.ts +1 -1
- package/dist/compliance/plugin.d.ts +1 -1
- package/dist/contracts/adapters/game.d.ts +9 -1
- package/dist/contracts/adapters/game.d.ts.map +1 -1
- package/dist/contracts/adapters/game.js.map +1 -1
- package/dist/contracts/adapters/index.d.ts +1 -1
- package/dist/contracts/adapters/index.d.ts.map +1 -1
- package/dist/contracts/adapters/rate-limit.d.ts +1 -0
- package/dist/contracts/adapters/rate-limit.d.ts.map +1 -1
- package/dist/contracts/adapters/rate-limit.js +1 -0
- package/dist/contracts/adapters/rate-limit.js.map +1 -1
- package/dist/contracts/schemas/events.d.ts +21 -0
- package/dist/contracts/schemas/events.d.ts.map +1 -1
- package/dist/contracts/schemas/events.js +20 -0
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/contracts/schemas/identity.d.ts +9 -0
- package/dist/contracts/schemas/identity.d.ts.map +1 -1
- package/dist/contracts/schemas/identity.js +15 -0
- package/dist/contracts/schemas/identity.js.map +1 -1
- package/dist/contracts/schemas/mail.d.ts +15 -1
- package/dist/contracts/schemas/mail.d.ts.map +1 -1
- package/dist/contracts/schemas/mail.js +3 -0
- package/dist/contracts/schemas/mail.js.map +1 -1
- package/dist/engagement/chat/plugin.d.ts +1 -1
- package/dist/engagement/chat-commands/plugin.d.ts +1 -1
- package/dist/engagement/notifications/__tests__/notification-event-map.test.js +14 -1
- package/dist/engagement/notifications/__tests__/notification-event-map.test.js.map +1 -1
- package/dist/engagement/notifications/plugin.d.ts +1 -1
- package/dist/engagement/notifications/plugin.d.ts.map +1 -1
- package/dist/engagement/notifications/plugin.js +11 -1
- package/dist/engagement/notifications/plugin.js.map +1 -1
- package/dist/engagement/social/plugin.d.ts +1 -1
- package/dist/fx/exchange-rate/plugin.d.ts +1 -1
- package/dist/iam/plugin.d.ts +1 -1
- package/dist/mail/adapters/default-email-template-renderer.d.ts.map +1 -1
- package/dist/mail/adapters/default-email-template-renderer.js +5 -0
- package/dist/mail/adapters/default-email-template-renderer.js.map +1 -1
- package/dist/mail/contract/index.d.ts +8 -0
- package/dist/mail/contract/index.d.ts.map +1 -1
- package/dist/mail/plugin.d.ts +1 -1
- package/dist/pam/identity/__tests__/withdrawal-pin.service.int.test.d.ts +2 -0
- package/dist/pam/identity/__tests__/withdrawal-pin.service.int.test.d.ts.map +1 -0
- package/dist/pam/identity/__tests__/withdrawal-pin.service.int.test.js +171 -0
- package/dist/pam/identity/__tests__/withdrawal-pin.service.int.test.js.map +1 -0
- package/dist/pam/identity/contract/index.d.ts +26 -0
- package/dist/pam/identity/contract/index.d.ts.map +1 -1
- package/dist/pam/identity/contract/index.js +10 -1
- package/dist/pam/identity/contract/index.js.map +1 -1
- package/dist/pam/identity/drizzle/migrations/0011_useful_the_executioner.sql +2 -0
- package/dist/pam/identity/drizzle/migrations/meta/0011_snapshot.json +1078 -0
- package/dist/pam/identity/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/pam/identity/plugin.d.ts +1 -1
- package/dist/pam/identity/plugin.d.ts.map +1 -1
- package/dist/pam/identity/plugin.js +15 -1
- package/dist/pam/identity/plugin.js.map +1 -1
- package/dist/pam/identity/react/account.d.ts +12 -1
- package/dist/pam/identity/react/account.d.ts.map +1 -1
- package/dist/pam/identity/react/account.js +16 -0
- package/dist/pam/identity/react/account.js.map +1 -1
- package/dist/pam/identity/router/index.d.ts +28 -1
- package/dist/pam/identity/router/index.d.ts.map +1 -1
- package/dist/pam/identity/router/index.js +3 -1
- package/dist/pam/identity/router/index.js.map +1 -1
- package/dist/pam/identity/schema/index.d.ts +34 -0
- package/dist/pam/identity/schema/index.d.ts.map +1 -1
- package/dist/pam/identity/schema/index.js +5 -0
- package/dist/pam/identity/schema/index.js.map +1 -1
- package/dist/pam/identity/service/fresh-reauthentication.service.d.ts +21 -0
- package/dist/pam/identity/service/fresh-reauthentication.service.d.ts.map +1 -0
- package/dist/pam/identity/service/fresh-reauthentication.service.js +50 -0
- package/dist/pam/identity/service/fresh-reauthentication.service.js.map +1 -0
- package/dist/pam/identity/service/phone-verification.service.d.ts +0 -1
- package/dist/pam/identity/service/phone-verification.service.d.ts.map +1 -1
- package/dist/pam/identity/service/phone-verification.service.js +7 -43
- package/dist/pam/identity/service/phone-verification.service.js.map +1 -1
- package/dist/pam/identity/service/security-controls.service.d.ts.map +1 -1
- package/dist/pam/identity/service/security-controls.service.js +4 -1
- package/dist/pam/identity/service/security-controls.service.js.map +1 -1
- package/dist/pam/identity/service/withdrawal-pin-hash.service.d.ts +3 -0
- package/dist/pam/identity/service/withdrawal-pin-hash.service.d.ts.map +1 -0
- package/dist/pam/identity/service/withdrawal-pin-hash.service.js +10 -0
- package/dist/pam/identity/service/withdrawal-pin-hash.service.js.map +1 -0
- package/dist/pam/identity/service/withdrawal-pin.service.d.ts +34 -0
- package/dist/pam/identity/service/withdrawal-pin.service.d.ts.map +1 -0
- package/dist/pam/identity/service/withdrawal-pin.service.js +130 -0
- package/dist/pam/identity/service/withdrawal-pin.service.js.map +1 -0
- package/dist/pam/player-management/plugin.d.ts +1 -1
- package/dist/pam/player-note/plugin.d.ts +1 -1
- package/dist/pam/profile/plugin.d.ts +1 -1
- package/dist/pam/react.d.ts +1 -1
- package/dist/pam/react.d.ts.map +1 -1
- package/dist/pam/react.js +1 -1
- package/dist/pam/react.js.map +1 -1
- package/dist/pam/tag/plugin.d.ts +1 -1
- package/dist/server/runtime/core-token-catalog.d.ts +1 -1
- package/dist/testing/seed-player.d.ts +4 -0
- package/dist/testing/seed-player.d.ts.map +1 -1
- package/dist/wallet/__tests__/swap.service.int.test.d.ts +2 -0
- package/dist/wallet/__tests__/swap.service.int.test.d.ts.map +1 -0
- package/dist/wallet/__tests__/swap.service.int.test.js +281 -0
- package/dist/wallet/__tests__/swap.service.int.test.js.map +1 -0
- package/dist/wallet/contract/index.d.ts +81 -2
- package/dist/wallet/contract/index.d.ts.map +1 -1
- package/dist/wallet/contract/index.js +54 -1
- package/dist/wallet/contract/index.js.map +1 -1
- package/dist/wallet/plugin.d.ts +1 -1
- package/dist/wallet/plugin.d.ts.map +1 -1
- package/dist/wallet/plugin.js +35 -1
- package/dist/wallet/plugin.js.map +1 -1
- package/dist/wallet/router/index.d.ts +54 -4
- package/dist/wallet/router/index.d.ts.map +1 -1
- package/dist/wallet/router/index.js +43 -1
- package/dist/wallet/router/index.js.map +1 -1
- package/dist/wallet/service/swap.service.d.ts +76 -0
- package/dist/wallet/service/swap.service.d.ts.map +1 -0
- package/dist/wallet/service/swap.service.js +283 -0
- package/dist/wallet/service/swap.service.js.map +1 -0
- package/dist/wallet/service/wallet.service.d.ts +1 -0
- package/dist/wallet/service/wallet.service.d.ts.map +1 -1
- package/dist/wallet/service/wallet.service.js +1 -1
- package/dist/wallet/service/wallet.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/server';
|
|
2
2
|
import { DatabaseError } from 'pg';
|
|
3
|
-
import { and, eq, gt,
|
|
3
|
+
import { and, eq, gt, sql } from 'drizzle-orm';
|
|
4
4
|
import { assertRateLimit, } from '@openora/core/server';
|
|
5
|
-
import {
|
|
5
|
+
import { phoneVerificationSession, user } from '../schema/index.js';
|
|
6
6
|
import { getSecurityControls } from './security-controls.service.js';
|
|
7
|
+
import { assertFreshReauthentication } from './fresh-reauthentication.service.js';
|
|
7
8
|
import { nodeHeadersToHeaders } from '../../shared/headers-mapper.js';
|
|
8
9
|
import { hashCode, generateCode } from '../../shared/otp.js';
|
|
9
10
|
const MINUTE_MS = 60 * 1000;
|
|
@@ -45,46 +46,6 @@ export class PhoneVerificationService {
|
|
|
45
46
|
this.identityReader = identityReader;
|
|
46
47
|
this.twoFactorLockout = twoFactorLockout;
|
|
47
48
|
}
|
|
48
|
-
async assertFreshReauthentication({ userId, headers, currentPassword, totpCode, twoFactorEnabled, meta, }) {
|
|
49
|
-
const [credential] = await this.drizzle.db
|
|
50
|
-
.select({ password: account.password })
|
|
51
|
-
.from(account)
|
|
52
|
-
.where(and(eq(account.userId, userId), isNotNull(account.password)))
|
|
53
|
-
.limit(1);
|
|
54
|
-
if (!credential?.password) {
|
|
55
|
-
throw new ORPCError('UNAUTHORIZED', { message: 'Current password is invalid.' });
|
|
56
|
-
}
|
|
57
|
-
const authContext = await this.auth.$context;
|
|
58
|
-
const passwordMatches = await authContext.password.verify({
|
|
59
|
-
password: currentPassword,
|
|
60
|
-
hash: credential.password,
|
|
61
|
-
});
|
|
62
|
-
if (!passwordMatches) {
|
|
63
|
-
throw new ORPCError('UNAUTHORIZED', { message: 'Current password is invalid.' });
|
|
64
|
-
}
|
|
65
|
-
if (!twoFactorEnabled) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (!totpCode) {
|
|
69
|
-
throw new ORPCError('UNPROCESSABLE_CONTENT', {
|
|
70
|
-
message: 'An authenticator code is required.',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
await this.twoFactorLockout?.assertNotLocked(userId);
|
|
74
|
-
// Library boundary: the base Auth API type omits endpoints contributed by the
|
|
75
|
-
// twoFactor plugin, but createAuth always installs that plugin for identity.
|
|
76
|
-
const api = this.auth.api;
|
|
77
|
-
const verification = await api.verifyTOTP({
|
|
78
|
-
body: { code: totpCode, trustDevice: false },
|
|
79
|
-
headers,
|
|
80
|
-
asResponse: true,
|
|
81
|
-
});
|
|
82
|
-
if (!verification.ok) {
|
|
83
|
-
await this.twoFactorLockout?.recordFailure(userId, meta);
|
|
84
|
-
throw new ORPCError('UNAUTHORIZED', { message: 'Invalid authenticator code.' });
|
|
85
|
-
}
|
|
86
|
-
await this.twoFactorLockout?.reset(userId);
|
|
87
|
-
}
|
|
88
49
|
async request({ userId, sessionId, input, reqHeaders, meta, }) {
|
|
89
50
|
await assertRateLimit(this.limiter, `phone-verification-request:${userId}`, REQUEST_RATE_LIMIT);
|
|
90
51
|
const [caller] = await this.drizzle.db
|
|
@@ -103,7 +64,10 @@ export class PhoneVerificationService {
|
|
|
103
64
|
message: 'Only players can verify a phone number.',
|
|
104
65
|
});
|
|
105
66
|
}
|
|
106
|
-
await
|
|
67
|
+
await assertFreshReauthentication({
|
|
68
|
+
drizzle: this.drizzle,
|
|
69
|
+
auth: this.auth,
|
|
70
|
+
twoFactorLockout: this.twoFactorLockout,
|
|
107
71
|
userId,
|
|
108
72
|
headers: nodeHeadersToHeaders(reqHeaders),
|
|
109
73
|
currentPassword: input.currentPassword,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-verification.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/phone-verification.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"phone-verification.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/phone-verification.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAKL,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,wBAAwB,EAAE,IAAI,EAAgB,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5B,MAAM,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC;AACjC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,aAAa,GAAG,CAAC,GAAG,SAAS,CAAC;AAEpC,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,MAAM,EAAW,CAAC;AAClG,MAAM,iBAAiB,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,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,"file":"security-controls.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/identity/service/security-controls.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAI5F,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"security-controls.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/identity/service/security-controls.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAI5F,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA0BlC"}
|
|
@@ -10,6 +10,7 @@ export async function getSecurityControls(drizzle, userId) {
|
|
|
10
10
|
phoneVerified: user.phoneVerified,
|
|
11
11
|
twoFactorEnabled: user.twoFactorEnabled,
|
|
12
12
|
loginWithdrawalAlertsEnabled: user.loginWithdrawalAlertsEnabled,
|
|
13
|
+
withdrawalPinHash: user.withdrawalPinHash,
|
|
13
14
|
})
|
|
14
15
|
.from(user)
|
|
15
16
|
.where(eq(user.id, userId))
|
|
@@ -18,11 +19,13 @@ export async function getSecurityControls(drizzle, userId) {
|
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
20
21
|
const phone = E164PhoneSchema.safeParse(row.phoneNumber);
|
|
22
|
+
const { withdrawalPinHash, ...rest } = row;
|
|
21
23
|
return {
|
|
22
|
-
...
|
|
24
|
+
...rest,
|
|
23
25
|
phoneNumber: phone.success ? phone.data : null,
|
|
24
26
|
phoneVerified: phone.success && row.phoneVerified,
|
|
25
27
|
twoFactorEnabled: row.twoFactorEnabled ?? false,
|
|
28
|
+
withdrawalPinSet: withdrawalPinHash !== null,
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=security-controls.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-controls.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/security-controls.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAoC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAuB,EACvB,MAAkB;IAElB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,EAAE;SAC3B,MAAM,CAAC;QACN,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;
|
|
1
|
+
{"version":3,"file":"security-controls.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/security-controls.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAoC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAuB,EACvB,MAAkB;IAElB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,EAAE;SAC3B,MAAM,CAAC;QACN,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;QAC/D,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC;SACD,IAAI,CAAC,IAAI,CAAC;SACV,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SAC1B,KAAK,CAAC,CAAC,CAAC,CAAC;IACZ,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IAC3C,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC9C,aAAa,EAAE,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,aAAa;QACjD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,IAAI,KAAK;QAC/C,gBAAgB,EAAE,iBAAiB,KAAK,IAAI;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal-pin-hash.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/identity/service/withdrawal-pin-hash.service.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
// A 4-digit PIN is long-lived and low-entropy (10,000 possibilities); the plain-sha256
|
|
3
|
+
// pattern in pam/shared/otp.ts is only safe there because those OTPs expire in minutes.
|
|
4
|
+
// HMAC-SHA256 with a dedicated, never-reused secret closes that gap without inventing a
|
|
5
|
+
// new primitive family (same shape as server/auth/sign-session-cookie.ts).
|
|
6
|
+
export const MIN_WITHDRAWAL_PIN_SECRET_LENGTH = 32;
|
|
7
|
+
export function hashWithdrawalPin(pin, secret) {
|
|
8
|
+
return createHmac('sha256', secret).update(pin).digest('hex');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=withdrawal-pin-hash.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal-pin-hash.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/withdrawal-pin-hash.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,uFAAuF;AACvF,wFAAwF;AACxF,wFAAwF;AACxF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAEnD,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,MAAc;IAC3D,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Auth, type EventBus, type DrizzleService, type NodeHeaders } from '@openora/core/server';
|
|
2
|
+
import { type ClientMeta, type IdentityReader, type RateLimiterAdapter, type SecurityControls, type SetWithdrawalPinInput, type User } from '@openora/core/contracts';
|
|
3
|
+
import type { TwoFactorLockoutService } from './two-factor-lockout.service.js';
|
|
4
|
+
export type WithdrawalPinServiceDeps = {
|
|
5
|
+
drizzle: DrizzleService;
|
|
6
|
+
events: EventBus;
|
|
7
|
+
limiter: RateLimiterAdapter;
|
|
8
|
+
auth: Auth;
|
|
9
|
+
identityReader: IdentityReader;
|
|
10
|
+
twoFactorLockout?: TwoFactorLockoutService;
|
|
11
|
+
hmacSecret: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Withdrawal PIN as a security control, independent of the login credential and of
|
|
15
|
+
* wallet withdrawal itself (verifying the PIN at withdrawal time is a separate,
|
|
16
|
+
* not-yet-built seam). Set and Change share the one upsert route below; Remove is
|
|
17
|
+
* immediate and un-gated by design (AC), so it deliberately skips fresh reauth.
|
|
18
|
+
*/
|
|
19
|
+
export declare class WithdrawalPinService {
|
|
20
|
+
private readonly drizzle;
|
|
21
|
+
private readonly events;
|
|
22
|
+
private readonly limiter;
|
|
23
|
+
private readonly auth;
|
|
24
|
+
private readonly identityReader;
|
|
25
|
+
private readonly twoFactorLockout?;
|
|
26
|
+
private readonly hmacSecret;
|
|
27
|
+
constructor({ drizzle, events, limiter, auth, identityReader, twoFactorLockout, hmacSecret, }: WithdrawalPinServiceDeps);
|
|
28
|
+
private securityControlsFor;
|
|
29
|
+
private loadCaller;
|
|
30
|
+
private assertPlayer;
|
|
31
|
+
set(userId: User['id'], input: SetWithdrawalPinInput, reqHeaders: NodeHeaders, meta: ClientMeta): Promise<SecurityControls>;
|
|
32
|
+
remove(userId: User['id'], meta: ClientMeta): Promise<SecurityControls>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=withdrawal-pin.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal-pin.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/identity/service/withdrawal-pin.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL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AAC,gBAAgB,CAAC;CAwB9E"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ORPCError } from '@orpc/server';
|
|
2
|
+
import { eq } from 'drizzle-orm';
|
|
3
|
+
import { assertRateLimit, } from '@openora/core/server';
|
|
4
|
+
import { RATE_LIMIT_KEYS, makeRateLimitKey, } from '@openora/core/contracts';
|
|
5
|
+
import { user } from '../schema/index.js';
|
|
6
|
+
import { getSecurityControls } from './security-controls.service.js';
|
|
7
|
+
import { assertFreshReauthentication } from './fresh-reauthentication.service.js';
|
|
8
|
+
import { hashWithdrawalPin } from './withdrawal-pin-hash.service.js';
|
|
9
|
+
import { nodeHeadersToHeaders } from '../../shared/headers-mapper.js';
|
|
10
|
+
const MINUTE_MS = 60 * 1000;
|
|
11
|
+
const WITHDRAWAL_PIN_RATE_LIMIT = {
|
|
12
|
+
limit: 5,
|
|
13
|
+
windowMs: 5 * MINUTE_MS,
|
|
14
|
+
onUnavailable: 'deny',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Withdrawal PIN as a security control, independent of the login credential and of
|
|
18
|
+
* wallet withdrawal itself (verifying the PIN at withdrawal time is a separate,
|
|
19
|
+
* not-yet-built seam). Set and Change share the one upsert route below; Remove is
|
|
20
|
+
* immediate and un-gated by design (AC), so it deliberately skips fresh reauth.
|
|
21
|
+
*/
|
|
22
|
+
export class WithdrawalPinService {
|
|
23
|
+
drizzle;
|
|
24
|
+
events;
|
|
25
|
+
limiter;
|
|
26
|
+
auth;
|
|
27
|
+
identityReader;
|
|
28
|
+
twoFactorLockout;
|
|
29
|
+
hmacSecret;
|
|
30
|
+
constructor({ drizzle, events, limiter, auth, identityReader, twoFactorLockout, hmacSecret, }) {
|
|
31
|
+
this.drizzle = drizzle;
|
|
32
|
+
this.events = events;
|
|
33
|
+
this.limiter = limiter;
|
|
34
|
+
this.auth = auth;
|
|
35
|
+
this.identityReader = identityReader;
|
|
36
|
+
this.twoFactorLockout = twoFactorLockout;
|
|
37
|
+
this.hmacSecret = hmacSecret;
|
|
38
|
+
}
|
|
39
|
+
async securityControlsFor(userId) {
|
|
40
|
+
const controls = await getSecurityControls(this.drizzle, userId);
|
|
41
|
+
if (!controls) {
|
|
42
|
+
throw new ORPCError('UNAUTHORIZED', { message: 'Not signed in.' });
|
|
43
|
+
}
|
|
44
|
+
return controls;
|
|
45
|
+
}
|
|
46
|
+
async loadCaller(userId) {
|
|
47
|
+
const [caller] = await this.drizzle.db
|
|
48
|
+
.select({
|
|
49
|
+
role: user.role,
|
|
50
|
+
twoFactorEnabled: user.twoFactorEnabled,
|
|
51
|
+
withdrawalPinHash: user.withdrawalPinHash,
|
|
52
|
+
})
|
|
53
|
+
.from(user)
|
|
54
|
+
.where(eq(user.id, userId))
|
|
55
|
+
.limit(1);
|
|
56
|
+
if (!caller) {
|
|
57
|
+
throw new ORPCError('UNAUTHORIZED', { message: 'Not signed in.' });
|
|
58
|
+
}
|
|
59
|
+
return caller;
|
|
60
|
+
}
|
|
61
|
+
async assertPlayer(userId, role, action, meta) {
|
|
62
|
+
if (role === 'player') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// A service-level denial still owes the audit log the same signal AdminGuard emits,
|
|
66
|
+
// since this check rejects before any shared guard runs (docs/standards/audit.md).
|
|
67
|
+
this.events.emit('identity.user.unauthorized_access', {
|
|
68
|
+
userId,
|
|
69
|
+
playerId: null,
|
|
70
|
+
resource: 'identity.security.withdrawal_pin',
|
|
71
|
+
action,
|
|
72
|
+
role,
|
|
73
|
+
ip: meta.ip,
|
|
74
|
+
userAgent: meta.userAgent,
|
|
75
|
+
});
|
|
76
|
+
throw new ORPCError('FORBIDDEN', { message: 'Only players can manage a withdrawal PIN.' });
|
|
77
|
+
}
|
|
78
|
+
async set(userId, input, reqHeaders, meta) {
|
|
79
|
+
await assertRateLimit(this.limiter, makeRateLimitKey(RATE_LIMIT_KEYS.WITHDRAWAL_PIN_MUTATION, userId), WITHDRAWAL_PIN_RATE_LIMIT);
|
|
80
|
+
const caller = await this.loadCaller(userId);
|
|
81
|
+
await this.assertPlayer(userId, caller.role, 'set', meta);
|
|
82
|
+
await assertFreshReauthentication({
|
|
83
|
+
drizzle: this.drizzle,
|
|
84
|
+
auth: this.auth,
|
|
85
|
+
twoFactorLockout: this.twoFactorLockout,
|
|
86
|
+
userId,
|
|
87
|
+
headers: nodeHeadersToHeaders(reqHeaders),
|
|
88
|
+
currentPassword: input.currentPassword,
|
|
89
|
+
totpCode: input.totpCode,
|
|
90
|
+
twoFactorEnabled: caller.twoFactorEnabled ?? false,
|
|
91
|
+
meta,
|
|
92
|
+
});
|
|
93
|
+
const wasAlreadySet = caller.withdrawalPinHash !== null;
|
|
94
|
+
await this.drizzle.db
|
|
95
|
+
.update(user)
|
|
96
|
+
.set({
|
|
97
|
+
withdrawalPinHash: hashWithdrawalPin(input.pin, this.hmacSecret),
|
|
98
|
+
withdrawalPinSetAt: new Date(),
|
|
99
|
+
})
|
|
100
|
+
.where(eq(user.id, userId));
|
|
101
|
+
this.events.emit('identity.security.withdrawal_pin.set', {
|
|
102
|
+
userId,
|
|
103
|
+
playerId: await this.identityReader.getPlayerIdByUserIdSafe(userId),
|
|
104
|
+
wasAlreadySet,
|
|
105
|
+
ip: meta.ip,
|
|
106
|
+
userAgent: meta.userAgent,
|
|
107
|
+
});
|
|
108
|
+
return this.securityControlsFor(userId);
|
|
109
|
+
}
|
|
110
|
+
async remove(userId, meta) {
|
|
111
|
+
await assertRateLimit(this.limiter, makeRateLimitKey(RATE_LIMIT_KEYS.WITHDRAWAL_PIN_MUTATION, userId), WITHDRAWAL_PIN_RATE_LIMIT);
|
|
112
|
+
const caller = await this.loadCaller(userId);
|
|
113
|
+
await this.assertPlayer(userId, caller.role, 'remove', meta);
|
|
114
|
+
if (caller.withdrawalPinHash === null) {
|
|
115
|
+
return this.securityControlsFor(userId);
|
|
116
|
+
}
|
|
117
|
+
await this.drizzle.db
|
|
118
|
+
.update(user)
|
|
119
|
+
.set({ withdrawalPinHash: null, withdrawalPinSetAt: null })
|
|
120
|
+
.where(eq(user.id, userId));
|
|
121
|
+
this.events.emit('identity.security.withdrawal_pin.removed', {
|
|
122
|
+
userId,
|
|
123
|
+
playerId: await this.identityReader.getPlayerIdByUserIdSafe(userId),
|
|
124
|
+
ip: meta.ip,
|
|
125
|
+
userAgent: meta.userAgent,
|
|
126
|
+
});
|
|
127
|
+
return this.securityControlsFor(userId);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=withdrawal-pin.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawal-pin.service.js","sourceRoot":"","sources":["../../../../src/pam/identity/service/withdrawal-pin.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAKL,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,gBAAgB,GAOjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5B,MAAM,yBAAyB,GAAG;IAChC,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC,GAAG,SAAS;IACvB,aAAa,EAAE,MAAM;CACb,CAAC;AAYX;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IACd,OAAO,CAAiB;IACxB,MAAM,CAAW;IACjB,OAAO,CAAqB;IAC5B,IAAI,CAAO;I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AAM,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE;aAClB,MAAM,CAAC,IAAI,CAAC;aACZ,GAAG,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;aAC1D,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;YAC3D,MAAM;YACN,QAAQ,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,MAAM,CAAC;YACnE,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -163,7 +163,7 @@ declare const _default: {
|
|
|
163
163
|
PLAYER_PROVISIONING: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerProvisioning>;
|
|
164
164
|
PLAYER_TAGS: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerTags>;
|
|
165
165
|
PLAY_ELIGIBILITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayEligibilityPort>;
|
|
166
|
-
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
166
|
+
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `withdrawal-pin-mutation:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
167
167
|
REALTIME_CLIENT_AUTHORIZER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeClientAuthorizer>;
|
|
168
168
|
REALTIME_TRANSPORT: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeTransport>;
|
|
169
169
|
RG_LIMITS: import("@openora/core/contracts").Token<import("@openora/core/contracts").RgLimitsPort>;
|
|
@@ -163,7 +163,7 @@ declare const _default: {
|
|
|
163
163
|
PLAYER_PROVISIONING: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerProvisioning>;
|
|
164
164
|
PLAYER_TAGS: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerTags>;
|
|
165
165
|
PLAY_ELIGIBILITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayEligibilityPort>;
|
|
166
|
-
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
166
|
+
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `withdrawal-pin-mutation:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
167
167
|
REALTIME_CLIENT_AUTHORIZER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeClientAuthorizer>;
|
|
168
168
|
REALTIME_TRANSPORT: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeTransport>;
|
|
169
169
|
RG_LIMITS: import("@openora/core/contracts").Token<import("@openora/core/contracts").RgLimitsPort>;
|
|
@@ -163,7 +163,7 @@ declare const _default: {
|
|
|
163
163
|
PLAYER_PROVISIONING: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerProvisioning>;
|
|
164
164
|
PLAYER_TAGS: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerTags>;
|
|
165
165
|
PLAY_ELIGIBILITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayEligibilityPort>;
|
|
166
|
-
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
166
|
+
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `withdrawal-pin-mutation:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
167
167
|
REALTIME_CLIENT_AUTHORIZER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeClientAuthorizer>;
|
|
168
168
|
REALTIME_TRANSPORT: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeTransport>;
|
|
169
169
|
RG_LIMITS: import("@openora/core/contracts").Token<import("@openora/core/contracts").RgLimitsPort>;
|
package/dist/pam/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { useCurrentUser, useLogin, useLogout, useRegister, useRequestPasswordReset, useResetPassword, } from './identity/react/auth.js';
|
|
2
|
-
export { useEnable2fa, useVerify2fa, useDisable2fa, useVerifyEmail, useUpdateProfile, useChangePassword, useSendEmailVerification, useMySecurityControls, useSetLoginWithdrawalAlerts, useRequestPhoneVerification, useConfirmPhoneVerification, useMySessions, useRevokeMySession, type Enable2faResult, type UseMySecurityControlsResult, type UseSetLoginWithdrawalAlertsResult, type UseRequestPhoneVerificationResult, type UseConfirmPhoneVerificationResult, } from './identity/react/account.js';
|
|
2
|
+
export { useEnable2fa, useVerify2fa, useDisable2fa, useVerifyEmail, useUpdateProfile, useChangePassword, useSendEmailVerification, useMySecurityControls, useSetLoginWithdrawalAlerts, useSetWithdrawalPin, useRemoveWithdrawalPin, useRequestPhoneVerification, useConfirmPhoneVerification, useMySessions, useRevokeMySession, type Enable2faResult, type UseMySecurityControlsResult, type UseSetLoginWithdrawalAlertsResult, type UseSetWithdrawalPinResult, type UseRequestPhoneVerificationResult, type UseConfirmPhoneVerificationResult, } from './identity/react/account.js';
|
|
3
3
|
export { usePlayerProfile, useUpdatePlayerProfile, useDisplayCurrency, useSetDisplayCurrency, type PlayerProfile, type DisplayCurrencyInfo, } from './profile/react/profile.js';
|
|
4
4
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/pam/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/pam/react.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,GACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/pam/react.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,iCAAiC,EACtC,KAAK,yBAAyB,EAC9B,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,GACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAC"}
|
package/dist/pam/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// `@openora/core/pam/react` - domain-owned hooks, keeping the base @openora/core/react SDK domain-agnostic.
|
|
2
2
|
export { useCurrentUser, useLogin, useLogout, useRegister, useRequestPasswordReset, useResetPassword, } from './identity/react/auth.js';
|
|
3
|
-
export { useEnable2fa, useVerify2fa, useDisable2fa, useVerifyEmail, useUpdateProfile, useChangePassword, useSendEmailVerification, useMySecurityControls, useSetLoginWithdrawalAlerts, useRequestPhoneVerification, useConfirmPhoneVerification, useMySessions, useRevokeMySession, } from './identity/react/account.js';
|
|
3
|
+
export { useEnable2fa, useVerify2fa, useDisable2fa, useVerifyEmail, useUpdateProfile, useChangePassword, useSendEmailVerification, useMySecurityControls, useSetLoginWithdrawalAlerts, useSetWithdrawalPin, useRemoveWithdrawalPin, useRequestPhoneVerification, useConfirmPhoneVerification, useMySessions, useRevokeMySession, } from './identity/react/account.js';
|
|
4
4
|
export { usePlayerProfile, useUpdatePlayerProfile, useDisplayCurrency, useSetDisplayCurrency, } from './profile/react/profile.js';
|
|
5
5
|
//# sourceMappingURL=react.js.map
|
package/dist/pam/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/pam/react.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,kBAAkB,
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/pam/react.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,kBAAkB,GAOnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,4BAA4B,CAAC"}
|
package/dist/pam/tag/plugin.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ declare const _default: {
|
|
|
163
163
|
PLAYER_PROVISIONING: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerProvisioning>;
|
|
164
164
|
PLAYER_TAGS: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerTags>;
|
|
165
165
|
PLAY_ELIGIBILITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayEligibilityPort>;
|
|
166
|
-
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
166
|
+
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `withdrawal-pin-mutation:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
167
167
|
REALTIME_CLIENT_AUTHORIZER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeClientAuthorizer>;
|
|
168
168
|
REALTIME_TRANSPORT: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeTransport>;
|
|
169
169
|
RG_LIMITS: import("@openora/core/contracts").Token<import("@openora/core/contracts").RgLimitsPort>;
|
|
@@ -160,7 +160,7 @@ declare const coreTokenCatalog: {
|
|
|
160
160
|
PLAYER_PROVISIONING: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerProvisioning>;
|
|
161
161
|
PLAYER_TAGS: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayerTags>;
|
|
162
162
|
PLAY_ELIGIBILITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").PlayEligibilityPort>;
|
|
163
|
-
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
163
|
+
RATE_LIMITER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RateLimiterAdapter<`register:${string}` | `login:${string}` | `enable2fa:${string}` | `verify2fa:${string}` | `disable2fa:${string}` | `pwreset-req:${string}` | `pwreset-verify:${string}` | `pwreset:${string}` | `change-password:${string}` | `withdrawal-pin-mutation:${string}` | `email-verify:${string}` | `verify-email:${string}` | `wallet-mutation:${string}` | `wallet-webhook:${string}` | `chat-room-join:${string}` | `chat-send:${string}` | `report-access-denied:${string}`>>;
|
|
164
164
|
REALTIME_CLIENT_AUTHORIZER: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeClientAuthorizer>;
|
|
165
165
|
REALTIME_TRANSPORT: import("@openora/core/contracts").Token<import("@openora/core/contracts").RealtimeTransport>;
|
|
166
166
|
RG_LIMITS: import("@openora/core/contracts").Token<import("@openora/core/contracts").RgLimitsPort>;
|
|
@@ -29,6 +29,8 @@ export declare function seedUser(db: TestDb, overrides?: Partial<typeof user.$in
|
|
|
29
29
|
banned: boolean | null;
|
|
30
30
|
banExpires: Date | null;
|
|
31
31
|
phoneVerifiedAt: Date | null;
|
|
32
|
+
withdrawalPinHash: string | null;
|
|
33
|
+
withdrawalPinSetAt: Date | null;
|
|
32
34
|
failedTwoFactorAttempts: number;
|
|
33
35
|
twoFactorLockoutUntil: Date | null;
|
|
34
36
|
twoFactorLockoutCount: number;
|
|
@@ -68,6 +70,8 @@ export declare function seedPlayerWithUser(db: TestDb, overrides?: SeedPlayerOve
|
|
|
68
70
|
banned: boolean | null;
|
|
69
71
|
banExpires: Date | null;
|
|
70
72
|
phoneVerifiedAt: Date | null;
|
|
73
|
+
withdrawalPinHash: string | null;
|
|
74
|
+
withdrawalPinSetAt: Date | null;
|
|
71
75
|
failedTwoFactorAttempts: number;
|
|
72
76
|
twoFactorLockoutUntil: Date | null;
|
|
73
77
|
twoFactorLockoutCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed-player.d.ts","sourceRoot":"","sources":["../../src/testing/seed-player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,MAAM,SAAW,GAAG,MAAM,CAExD;AAED,2EAA2E;AAC3E,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,CAAM
|
|
1
|
+
{"version":3,"file":"seed-player.d.ts","sourceRoot":"","sources":["../../src/testing/seed-player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,MAAM,SAAW,GAAG,MAAM,CAExD;AAED,2EAA2E;AAC3E,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe3F;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9F,uDAAuD;AACvD,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,mBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBvF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap.service.int.test.d.ts","sourceRoot":"","sources":["../../../src/wallet/__tests__/swap.service.int.test.ts"],"names":[],"mappings":""}
|