Merge pull request #912 from SuanmoSuanyangTechnology/feature/api_zy
feat(web): Keep the last 4 characters of the API key as original
This commit is contained in:
@@ -43,7 +43,8 @@ export const maskApiKeys = (text: string): string => {
|
|||||||
result = result.replace(API_KEY_PATTERNS[key as keyof typeof API_KEY_PREFIX], (match) => {
|
result = result.replace(API_KEY_PATTERNS[key as keyof typeof API_KEY_PREFIX], (match) => {
|
||||||
const prefixLength = API_KEY_PREFIX[key].length
|
const prefixLength = API_KEY_PREFIX[key].length
|
||||||
const prefix = match.substring(0, prefixLength)
|
const prefix = match.substring(0, prefixLength)
|
||||||
return prefix + '*'.repeat(match.length - prefixLength)
|
const suffix = match.slice(-4)
|
||||||
|
return prefix + '*'.repeat(match.length - prefixLength - 4) + suffix
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user