From ca738f147009cd7eba327ac46acb63579aaa8aab Mon Sep 17 00:00:00 2001 From: "Samuel EF. Tinnerholm" Date: Sun, 24 May 2026 20:24:31 +0300 Subject: [PATCH] fix: smarkets auth credential guards Fixes #220 --- core/src/exchanges/smarkets/auth.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/exchanges/smarkets/auth.ts b/core/src/exchanges/smarkets/auth.ts index 52ccef25..61dfddf4 100644 --- a/core/src/exchanges/smarkets/auth.ts +++ b/core/src/exchanges/smarkets/auth.ts @@ -46,14 +46,20 @@ export class SmarketsAuth { * Returns the username (email) used for session creation. */ getUsername(): string { - return this.credentials.apiKey!; + if (!this.credentials.apiKey) { + throw new Error('[smarkets] apiKey (username) is required'); + } + return this.credentials.apiKey; } /** * Returns the password used for session creation. */ getPassword(): string { - return this.credentials.privateKey!; + if (!this.credentials.privateKey) { + throw new Error('[smarkets] privateKey (password) is required'); + } + return this.credentials.privateKey; } /**