You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
524 B
18 lines
524 B
const request = require('superagent')
|
|
|
|
module.exports.decryption = async (ctx, next) => {
|
|
try {
|
|
const { xunruan } = ctx.config
|
|
const { file } = ctx.request
|
|
let url = `${xunruan.host}/uploadSecret`;
|
|
let res_ = await request.post(url).set('Content-Type', 'application/octet-stream')
|
|
.send(file.buffer)
|
|
.responseType('binary')
|
|
|
|
ctx.status = 200;
|
|
ctx.body = res_.body
|
|
} catch (error) {
|
|
ctx.status = 400;
|
|
ctx.body = { message: 'decryption error.' };
|
|
}
|
|
}
|
|
|