Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
328 changes: 328 additions & 0 deletions masterBitgoExpress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
{
"openapi": "3.0.3",
"info": {
"title": "@bitgo/master-bitgo-express",
"version": "1.0.0",
"description": "BitGo Enclaved Express - Secure enclave for BitGo signing operations with mTLS"
},
"paths": {
"/api/{coin}/wallet/{walletId}/sendMany": {
"post": {
"parameters": [
{
"name": "walletId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "coin",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"pubkey": {
"type": "string"
},
"source": {
"type": "string",
"enum": [
"user",
"backup"
]
},
"recipients": {
"type": "array",
"items": {}
},
"numBlocks": {
"type": "number"
},
"feeRate": {
"type": "number"
},
"feeMultiplier": {
"type": "number"
},
"maxFeeRate": {
"type": "number"
},
"minConfirms": {
"type": "number"
},
"enforceMinConfirmsForChange": {
"type": "boolean"
},
"targetWalletUnspents": {
"type": "number"
},
"message": {
"type": "string"
},
"minValue": {
"oneOf": [
{
"type": "number"
},
{
"type": "string"
}
]
},
"maxValue": {
"oneOf": [
{
"type": "number"
},
{
"type": "string"
}
]
},
"sequenceId": {
"type": "string"
},
"lastLedgerSequence": {
"type": "number"
},
"ledgerSequenceDelta": {
"type": "number"
},
"gasPrice": {
"type": "number"
},
"noSplitChange": {
"type": "boolean"
},
"unspents": {
"type": "array",
"items": {
"type": "string"
}
},
"comment": {
"type": "string"
},
"otp": {
"type": "string"
},
"changeAddress": {
"type": "string"
},
"allowExternalChangeAddress": {
"type": "boolean"
},
"instant": {
"type": "boolean"
},
"memo": {
"type": "string"
},
"transferId": {
"type": "number"
},
"eip1559": {},
"gasLimit": {
"type": "number"
},
"custodianTransactionId": {
"type": "string"
}
},
"required": [
"pubkey",
"source",
"recipients"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"details": {
"type": "string"
}
},
"required": [
"error",
"details"
]
}
}
}
}
}
}
},
"/api/{coin}/wallet/generate": {
"post": {
"parameters": [
{
"name": "coin",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"multisigType": {
"type": "string",
"enum": [
"onchain",
"tss"
]
},
"enterprise": {
"type": "string"
},
"disableTransactionNotifications": {
"type": "boolean"
},
"isDistributedCustody": {
"type": "boolean"
}
},
"required": [
"label",
"enterprise"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"details": {
"type": "string"
}
},
"required": [
"error",
"details"
]
}
}
}
}
}
}
},
"/ping": {
"post": {
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"timestamp": {
"type": "string"
}
},
"required": [
"status",
"timestamp"
]
}
}
}
}
}
}
},
"/version": {
"get": {
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"version": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"version",
"name"
]
}
}
}
}
}
}
}
},
"components": {
"schemas": {}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"test:watch": "mocha --require ts-node/register --watch 'src/**/__tests__/**/*.test.ts'",
"test:coverage": "nyc mocha --require ts-node/register 'src/**/__tests__/**/*.test.ts'",
"lint": "eslint --quiet .",
"generate-test-ssl": "openssl req -x509 -newkey rsa:2048 -keyout test-ssl-key.pem -out test-ssl-cert.pem -days 365 -nodes -subj '/CN=localhost'"
"generate-test-ssl": "openssl req -x509 -newkey rsa:2048 -keyout test-ssl-key.pem -out test-ssl-cert.pem -days 365 -nodes -subj '/CN=localhost'",
"generate:openapi:masterExpress": "npx @api-ts/openapi-generator --name @bitgo/master-bitgo-express ./src/masterBitgoExpress/routers/index.ts > masterBitgoExpress.json"
},
"dependencies": {
"@api-ts/io-ts-http": "^3.2.1",
Expand Down
38 changes: 38 additions & 0 deletions src/masterBitgoExpress/routers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { apiSpec } from '@api-ts/io-ts-http';
import { HealthCheckApiSpec } from './healthCheck';
import { MasterApiSpec } from './masterApiSpec';

// Combine all API specifications
const combinedSpec = apiSpec({
...HealthCheckApiSpec,
...MasterApiSpec,
});

// Export the OpenAPI specification
export default {
openapi: '3.1.0',
info: {
title: '@bitgo/master-bitgo-express',
version: '0.0.1',
description: 'BitGo Master Express - Gateway for on Prem BitGo services',
},
...combinedSpec,
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
description: 'Enter your Bearer token in the format "Bearer {token}"',
},
},
},
security: [
{
bearerAuth: [],
},
],
};

// Also export the combined API spec for internal use
export const FullApiSpec = combinedSpec;
4 changes: 2 additions & 2 deletions src/masterBitgoExpress/routers/masterApiSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const MasterApiSpec = apiSpec({
'v1.wallet.generate': {
post: httpRoute({
method: 'POST' as const,
path: '/{coin}/wallet/generate',
path: '/api/{coin}/wallet/generate',
request: httpRequest({
params: {
coin: t.string,
Expand All @@ -104,7 +104,7 @@ export const MasterApiSpec = apiSpec({
'v1.wallet.sendMany': {
post: httpRoute({
method: 'POST',
path: '/{coin}/wallet/{walletId}/sendMany',
path: '/api/{coin}/wallet/{walletId}/sendMany',
request: httpRequest({
params: {
walletId: t.string,
Expand Down
Loading