init commit

master
flyl 2 years ago
parent 8bb87c88d1
commit 65dbd33869
  1. 22
      README.md
  2. 9
      ali.js
  3. 1
      package.json

@ -1,3 +1,23 @@
# ali_ecc_js
阿里云盘 签名 js版
#阿里云盘 签名 js版
###install the packages
`
npm install
`
### set the user data and file_id
. deviceId
. userId
. drive_id
. authorization
. file_id
### run
`
npm start
`

@ -10,7 +10,7 @@ const userData = {
publicKey: "",
signatureData: "",
drive_id:"6xxxx93", // DevTools -> Application -> Local Storage -> cna
authorization: "Bearer xxxxxxxxxx" // Request Headers -> authorization
authorization: "" // Request Headers -> authorization Bearer xxxxxxxxxx
}
const headers = {
@ -59,7 +59,7 @@ const DownloadFile = (file_id) => {
headers: {...headers},
});
}
const InitAliKey = async () => {
const InitAliKey = () => {
const {appId, deviceId, userId, nonce} = userData;
const max = 32;
const privKey = randomString(max);
@ -82,7 +82,10 @@ const InitAliKey = async () => {
const main = async () => {
InitAliKey();
if(!userData.publicKey || !headers['x-signature'] || !userData.authorization) return;
if(!userData.publicKey || !headers['x-signature'] || !userData.authorization) {
console.log('need set the userdata');
return
}
const session = await CreateSession();
console.log(session.data) // { result: true, success: true, code: null, message: null }
// file_id

@ -4,6 +4,7 @@
"description": "",
"main": "ali.js",
"scripts": {
"start": "node ali.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "fly1397@sina.com",

Loading…
Cancel
Save