Redefined encryption on posting
This commit is contained in:
parent
fd4a1df6b3
commit
541c66b4bd
1 changed files with 6 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { ofetch } from 'ofetch'
|
||||
import encryptAes from './encryptAes'
|
||||
import dayjs from 'dayjs'
|
||||
import encryptRsa from './encryptRsa'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
|
||||
|
|
@ -8,9 +8,9 @@ export default async (api: string, body: Object) => {
|
|||
const today = new Date()
|
||||
const todayUnix = dayjs(today).unix()
|
||||
const expiration = todayUnix + 9
|
||||
const aes = await encryptAes(`${todayUnix.toString()}-${expiration.toString()}`)
|
||||
const aes = await encryptRsa(`${api.toString()}-${todayUnix.toString()}-${expiration.toString()}`)
|
||||
|
||||
const hash = `ocbo-${aes}-token`
|
||||
const hash = `ocbo=${aes}token`
|
||||
try {
|
||||
await ofetch(API + api, {
|
||||
headers: {
|
||||
|
|
@ -18,6 +18,9 @@ export default async (api: string, body: Object) => {
|
|||
'Cache-Control': 'no-cache',
|
||||
'OCBO-Token': hash,
|
||||
},
|
||||
retry: 3,
|
||||
retryDelay: 500,
|
||||
retryStatusCodes: [400, 404, 405, 500, 502],
|
||||
method: 'POST',
|
||||
body: body,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue