Skip to content

Commit 32b2a2a

Browse files
Merge pull request #7 from dv-net/DV-3332
DV-3332: Mask CEX API keys in response from merchant
2 parents a446c2b + 55e8a9f commit 32b2a2a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Updated email change request to accept string for verification code [DV-3194]
2626
- Added locale migration for wallets [DV-3210]
2727
- Sort wallet addresses by blockchain and native token in email notification [DV-3174]
28+
- Mask response with CEX API keys [DV-3332]
2829

2930
## [0.6.1] - 2025-08-11
3031
- Internal/External API withdrawal route now takes a random store ID related to the user for internal requests, and uses the store ID from the XApiKey header for external requests. [DV-2704]

internal/tools/converters/exchange.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,18 @@ func NewExchangeKeysResponseFromDto(keys []exchange.KeysExchangeDTO) []exchange_
5656
}
5757

5858
func NewExchangeKeyResponseByDto(dto exchange.KeysExchangeDTO) exchange_response.ExchangeKey {
59+
var maskedValue *string
60+
if dto.Value != nil && len(*dto.Value) > 4 {
61+
maskedLength := len(*dto.Value) - 4
62+
mask := strings.Repeat("*", maskedLength)
63+
suffix := (*dto.Value)[len(*dto.Value)-4:]
64+
maskedValue = lo.ToPtr(mask + suffix)
65+
} else {
66+
maskedValue = dto.Value
67+
}
5968
return exchange_response.ExchangeKey{
6069
Name: dto.Name,
61-
Value: dto.Value,
70+
Value: maskedValue,
6271
}
6372
}
6473

0 commit comments

Comments
 (0)