diff --git a/api/customer-server.api.yml b/api/customer-server.api.yml index 18e99ac..472a0e5 100644 --- a/api/customer-server.api.yml +++ b/api/customer-server.api.yml @@ -138,7 +138,7 @@ components: - version - fbKeyId - requestId - - externalKeyId + - signingDeviceKeyId - algorithm - data properties: @@ -160,7 +160,7 @@ components: type: string format: uuid example: b015f35e-5d44-4d68-a0df-a1c625255abc - externalKeyId: + signingDeviceKeyId: type: string example: 70721651-a7f3-42f6-a984-6e058269495f algorithm: diff --git a/api/customer-server.d.ts b/api/customer-server.d.ts index f6a815b..d7db0ae 100644 --- a/api/customer-server.d.ts +++ b/api/customer-server.d.ts @@ -112,7 +112,7 @@ export interface components { */ requestId: string; /** @example 70721651-a7f3-42f6-a984-6e058269495f */ - externalKeyId: string; + signingDeviceKeyId: string; algorithm: components["schemas"]["Algorithm"]; /** * @description The string to sign diff --git a/examples/server/package.json b/examples/server/package.json index adc6f25..855c447 100644 --- a/examples/server/package.json +++ b/examples/server/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build:api": "openapi-typescript ../../api/customer-server.api.yml -o ./src/customer-server.d.ts", - "build": "tsc", + "build": "npm run build:api && tsc", "start": "NODE_ENV=dev node ./dist/server.js", "dev": "NODE_ENV=dev ts-node ./src/server.ts", "build:docker": "npm run build:api && docker build -t softhsm2:2.6.1 .", diff --git a/examples/server/src/customer-server.d.ts b/examples/server/src/customer-server.d.ts index f6a815b..d7db0ae 100644 --- a/examples/server/src/customer-server.d.ts +++ b/examples/server/src/customer-server.d.ts @@ -112,7 +112,7 @@ export interface components { */ requestId: string; /** @example 70721651-a7f3-42f6-a984-6e058269495f */ - externalKeyId: string; + signingDeviceKeyId: string; algorithm: components["schemas"]["Algorithm"]; /** * @description The string to sign diff --git a/examples/server/src/services/hsm-sign-service.ts b/examples/server/src/services/hsm-sign-service.ts index ce266ec..890ad4e 100644 --- a/examples/server/src/services/hsm-sign-service.ts +++ b/examples/server/src/services/hsm-sign-service.ts @@ -14,9 +14,9 @@ export async function randomlySignOrFailMessagesAsync(msgIds: number[]) { msg.errorMessage = `Simulate error while signing this message ${msg.msgId}`; } const algorithm = msg.message.algorithm === 'EDDSA_ED25519' ? 'EDDSA' : 'ECDSA'; - const { externalKeyId, data } = msg.message; + const { signingDeviceKeyId, data } = msg.message; if (msg.status === 'SIGNED') { - msg.signedPayload = await hsmFacade.sign(externalKeyId, data, algorithm); + msg.signedPayload = await hsmFacade.sign(signingDeviceKeyId, data, algorithm); } await messagesDao.updateMessageStatus(msg); console.log(`Set ${msg.msgId} from status ${previousStatus} to ${msg.status}`); @@ -29,8 +29,8 @@ export async function signMessages(msgIds: number[]) { const messages = await getMessages(msgIds); messages.forEach(async (msg) => { const algorithm = msg.message.algorithm === 'EDDSA_ED25519' ? 'EDDSA' : 'ECDSA'; - const { externalKeyId, data } = msg.message; - msg.signedPayload = await hsmFacade.sign(externalKeyId, data, algorithm); + const { signingDeviceKeyId, data } = msg.message; + msg.signedPayload = await hsmFacade.sign(signingDeviceKeyId, data, algorithm); msg.status = 'SIGNED'; logger.info(`signed message ${msg.msgId}. signature: ${msg.signedPayload}`); await messagesDao.updateMessageStatus(msg); diff --git a/src/services/server.api.test.ts b/src/services/server.api.test.ts index 308d2b7..fd9408c 100644 --- a/src/services/server.api.test.ts +++ b/src/services/server.api.test.ts @@ -199,7 +199,7 @@ export const messageBuilder = { version: 1, fbKeyId: c.guid(), requestId: c.guid(), - externalKeyId: c.guid(), + signingDeviceKeyId: c.guid(), algorithm: 'ECDSA_SECP256K1', data: c.string(), ...message,