fix: remove fallback key
This commit is contained in:
parent
22a7547e6c
commit
c63604ac55
@ -181,9 +181,11 @@ export const sendCompletion = async (
|
|||||||
return encryptedKey
|
return encryptedKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!secretKey) {
|
||||||
|
throw new Error('Encryption key unavailable: cannot encrypt API key.')
|
||||||
|
}
|
||||||
const apiKey = provider.api_key
|
const apiKey = provider.api_key
|
||||||
? decryptApiKey(provider.api_key, secretKey || 'fallback-key')
|
? decryptApiKey(provider.api_key, secretKey)
|
||||||
: (secretKey ?? '')
|
: (secretKey ?? '')
|
||||||
|
|
||||||
const tokenJS = new TokenJS({
|
const tokenJS = new TokenJS({
|
||||||
|
|||||||
@ -536,9 +536,10 @@ function ProviderDetail() {
|
|||||||
const secretKey = await getServiceHub()
|
const secretKey = await getServiceHub()
|
||||||
.core()
|
.core()
|
||||||
.getAppToken()
|
.getAppToken()
|
||||||
|
if (secretKey)
|
||||||
updateObj.api_key = CryptoJS.AES.encrypt(
|
updateObj.api_key = CryptoJS.AES.encrypt(
|
||||||
newValue,
|
newValue,
|
||||||
secretKey || 'fallback-key'
|
secretKey
|
||||||
).toString()
|
).toString()
|
||||||
} else if (
|
} else if (
|
||||||
settingKey === 'base-url' &&
|
settingKey === 'base-url' &&
|
||||||
@ -555,7 +556,7 @@ function ProviderDetail() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (deviceSettingIndex !== -1) {
|
if (deviceSettingIndex !== -1) {
|
||||||
(
|
;(
|
||||||
newSettings[deviceSettingIndex]
|
newSettings[deviceSettingIndex]
|
||||||
.controller_props as {
|
.controller_props as {
|
||||||
value: string
|
value: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user