Skip to content

Commit 45d3e2d

Browse files
committed
Merge remote-tracking branch 'origin/main' into ph/acceptCert
2 parents 1772f5a + 742e590 commit 45d3e2d

File tree

87 files changed

+743
-581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+743
-581
lines changed

src/db/configuration/getConfiguration.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ const toParsedConfig = async (config: Configuration): Promise<ParsedConfig> => {
166166
gcp: gcpWalletConfiguration,
167167
legacyWalletType_removeInNextBreakingChange,
168168
},
169+
mtlsCertificate: config.mtlsCertificateEncrypted
170+
? decrypt(config.mtlsCertificateEncrypted)
171+
: null,
172+
mtlsPrivateKey: config.mtlsPrivateKeyEncrypted
173+
? decrypt(config.mtlsPrivateKeyEncrypted)
174+
: null,
169175
};
170176
};
171177

src/db/configuration/updateConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { encrypt } from "../../utils/crypto";
33
import { prisma } from "../client";
44

55
export const updateConfiguration = async (
6-
data: Prisma.ConfigurationUpdateArgs["data"],
6+
data: Prisma.ConfigurationUpdateInput,
77
) => {
88
return prisma.configuration.update({
99
where: {

src/prisma/migrations/20241024194728_add_mtls_webhooks/migration.sql

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "configuration" ADD COLUMN "mtlsCertificateEncrypted" TEXT,
3+
ADD COLUMN "mtlsPrivateKeyEncrypted" TEXT;

src/prisma/schema.prisma

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ model Configuration {
5050
accessControlAllowOrigin String @default("https://thirdweb.com,https://embed.ipfscdn.io") @map("accessControlAllowOrigin")
5151
ipAllowlist String[] @default([]) @map("ipAllowlist")
5252
clearCacheCronSchedule String @default("*/30 * * * * *") @map("clearCacheCronSchedule")
53+
// mTLS support
54+
mtlsCertificateEncrypted String?
55+
mtlsPrivateKeyEncrypted String?
5356
5457
@@map("configuration")
5558
}
@@ -178,10 +181,6 @@ model Webhooks {
178181
secret String @map("secret")
179182
eventType String @map("evenType")
180183
181-
mtlsClientCert String?
182-
mtlsClientKey String?
183-
mtlsCaCert String?
184-
185184
createdAt DateTime @default(now()) @map("createdAt")
186185
updatedAt DateTime @updatedAt @map("updatedAt")
187186
revokedAt DateTime? @map("revokedAt")

src/schema/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export interface ParsedConfig
3333
| "gcpApplicationCredentialEmail"
3434
| "gcpApplicationCredentialPrivateKey"
3535
| "contractSubscriptionsRetryDelaySeconds"
36+
| "mtlsCertificateEncrypted"
37+
| "mtlsPrivateKeyEncrypted"
3638
> {
3739
walletConfiguration: {
3840
aws: AwsWalletConfiguration | null;
@@ -41,4 +43,6 @@ export interface ParsedConfig
4143
};
4244
contractSubscriptionsRequeryDelaySeconds: string;
4345
chainOverridesParsed: Chain[];
46+
mtlsCertificate: string | null;
47+
mtlsPrivateKey: string | null;
4448
}

src/schema/webhooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export enum WebhooksEventTypes {
1010
CONTRACT_SUBSCRIPTION = "contract_subscription",
1111
}
1212

13-
export interface WalletBalanceWebhookSchema {
13+
export type BackendWalletBalanceWebhookParams = {
1414
walletAddress: string;
1515
minimumBalance: string;
1616
currentBalance: string;
1717
chainId: number;
1818
message: string;
19-
}
19+
};

src/server/routes/admin/nonces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const responseBodySchema = Type.Object({
2727
...AddressSchema,
2828
description: "Backend wallet address",
2929
},
30-
chainId: Type.Number({
30+
chainId: Type.Integer({
3131
description: "Chain ID",
3232
examples: [80002],
3333
}),

src/server/routes/backend-wallet/getAll.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Static, Type } from "@sinclair/typebox";
2-
import { FastifyInstance } from "fastify";
1+
import { Type, type Static } from "@sinclair/typebox";
2+
import type { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { getAllWallets } from "../../../db/wallets/getAllWallets";
55
import {
@@ -8,15 +8,17 @@ import {
88
} from "../../schemas/sharedApiSchemas";
99

1010
const QuerySchema = Type.Object({
11-
page: Type.Number({
11+
page: Type.Integer({
1212
description: "The page of wallets to get.",
1313
examples: ["1"],
1414
default: "1",
15+
minimum: 1,
1516
}),
16-
limit: Type.Number({
17+
limit: Type.Integer({
1718
description: "The number of wallets to get per page.",
1819
examples: ["10"],
1920
default: "10",
21+
minimum: 1,
2022
}),
2123
});
2224

src/server/routes/backend-wallet/getNonce.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Static, Type } from "@sinclair/typebox";
2-
import { FastifyInstance } from "fastify";
1+
import { Type, type Static } from "@sinclair/typebox";
2+
import type { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
4-
import { Address } from "thirdweb";
4+
import type { Address } from "thirdweb";
55
import { inspectNonce } from "../../../db/wallets/walletNonce";
66
import { standardResponseSchema } from "../../schemas/sharedApiSchemas";
77
import { walletWithAddressParamSchema } from "../../schemas/wallet";
@@ -11,7 +11,7 @@ const requestSchema = walletWithAddressParamSchema;
1111

1212
const responseSchema = Type.Object({
1313
result: Type.Object({
14-
nonce: Type.Number(),
14+
nonce: Type.Integer(),
1515
}),
1616
});
1717

0 commit comments

Comments
 (0)