Skip to content

Commit 4ec8371

Browse files
committed
imp(kms/auth-api): add inspect API for kms/auth-api
1 parent 5d396ef commit 4ec8371

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

kms/auth-eth/src/ethereum.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ export class EthereumBackend {
5454
gatewayAppId,
5555
}
5656
}
57+
58+
async getGatewayAppId(): Promise<string> {
59+
return await this.kmsAuth.gatewayAppId();
60+
}
5761
}

kms/auth-eth/src/server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ export async function build(): Promise<FastifyInstance> {
4646
const provider = new ethers.JsonRpcProvider(rpcUrl);
4747
server.decorate('ethereum', new EthereumBackend(provider, kmsContractAddr));
4848

49+
server.get('/', async (request, reply) => {
50+
return {
51+
status: 'ok',
52+
kmsContractAddr: kmsContractAddr,
53+
gatewayAppId: await server.ethereum.getGatewayAppId(),
54+
};
55+
});
56+
4957
// Define routes
5058
server.post<{
5159
Body: BootInfo;
@@ -61,6 +69,7 @@ export async function build(): Promise<FastifyInstance> {
6169
try {
6270
return await server.ethereum.checkBoot(request.body, false);
6371
} catch (error) {
72+
console.error(error);
6473
reply.code(200).send({
6574
isAllowed: false,
6675
gatewayAppId: '',
@@ -83,6 +92,7 @@ export async function build(): Promise<FastifyInstance> {
8392
try {
8493
return await server.ethereum.checkBoot(request.body, true);
8594
} catch (error) {
95+
console.error(error);
8696
reply.code(200).send({
8797
isAllowed: false,
8898
gatewayAppId: '',

kms/dstack-app/compose-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ services:
2020
- ETH_RPC_URL=${ETH_RPC_URL}
2121
- KMS_CONTRACT_ADDR=${KMS_CONTRACT_ADDR}
2222
restart: unless-stopped
23+
ports:
24+
- 8001:8000
2325

2426
kms:
2527
build:

kms/dstack-app/deploy-to-vmm.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ else
2020
# The address of the KMS contract
2121
# KMS_CONTRACT_ADDR=0x59E4a36B01a87fD9D1A4C12377253FE9a7b018Ba
2222
23+
# The address of the auth-api service listening on Host machine
24+
# AUTH_API_RPC_ADDR=0.0.0.0:8001
25+
2326
# The address of the KMS service listening on Host machine
2427
# KMS_RPC_ADDR=0.0.0.0:9201
2528
@@ -42,6 +45,7 @@ fi
4245
required_env_vars=(
4346
"VMM_RPC"
4447
"KMS_RPC_ADDR"
48+
"AUTH_API_RPC_ADDR"
4549
"GUEST_AGENT_ADDR"
4650
"KMS_CONTRACT_ADDR"
4751
"ETH_RPC_URL"
@@ -104,6 +108,7 @@ $CLI deploy \
104108
--compose .app-compose.json \
105109
--image $OS_IMAGE \
106110
--port tcp:$KMS_RPC_ADDR:8000 \
111+
--port tcp:$AUTH_API_RPC_ADDR:8001 \
107112
--port tcp:$GUEST_AGENT_ADDR:8090 \
108113
--vcpu 8 \
109114
--memory 8G \

0 commit comments

Comments
 (0)