@ray-js/lock-sdk 1.1.3-beta.7 → 1.1.3-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/temporary.js +66 -66
- package/package.json +1 -1
package/lib/temporary.js
CHANGED
|
@@ -49,71 +49,71 @@ export const createTempCustom = parallelOnly(async (params) => {
|
|
|
49
49
|
password: aesPwd,
|
|
50
50
|
schedule,
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const targetDpCode = config.supportBigData
|
|
84
|
-
? dpCodes.tempPwdCreateW
|
|
85
|
-
: dpCodes.tempPwdCreate;
|
|
86
|
-
const result = await publishDps({
|
|
87
|
-
[targetDpCode]: dpUtils.format(dpData, (config.supportBigData
|
|
88
|
-
? addTempPwdBigDpMap
|
|
89
|
-
: addTempPwdDpMap)),
|
|
90
|
-
}, {
|
|
91
|
-
checkReport: (dpData) => {
|
|
92
|
-
const reportData = dpData[targetDpCode];
|
|
93
|
-
if (reportData) {
|
|
94
|
-
const data = dpUtils.parse(dpData[targetDpCode], (config.supportBigData
|
|
95
|
-
? reportAddTempPwdDBigpMap
|
|
96
|
-
: reportAddTempPwdDpMap));
|
|
97
|
-
if (data.cloudNo === tyNum) {
|
|
98
|
-
return data;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
if (result.status === 0) {
|
|
105
|
-
return {
|
|
106
|
-
type: "custom",
|
|
107
|
-
name: name,
|
|
108
|
-
password: password,
|
|
109
|
-
unlockBindingId: result.unlockBindingId,
|
|
110
|
-
effectiveConfig: effective,
|
|
52
|
+
try {
|
|
53
|
+
if (useNear) {
|
|
54
|
+
await isValidPassword(baseData);
|
|
55
|
+
const { tyNum, name } = await createTemporaryPassword({
|
|
56
|
+
...baseData,
|
|
57
|
+
sn: 0,
|
|
58
|
+
availTime: 0,
|
|
59
|
+
symbolic: false,
|
|
60
|
+
dpTunnel: 2,
|
|
61
|
+
});
|
|
62
|
+
if (!tyNum) {
|
|
63
|
+
throw getError(1043);
|
|
64
|
+
}
|
|
65
|
+
const dpData = {
|
|
66
|
+
cloudNo: tyNum,
|
|
67
|
+
valid: true,
|
|
68
|
+
validConfig: {
|
|
69
|
+
startTime: effective.effectiveDate,
|
|
70
|
+
endTime: effective.expiredDate,
|
|
71
|
+
loop: loopType,
|
|
72
|
+
loopConfig: 0,
|
|
73
|
+
weeks: effective.weeks ? effective.weeks : [0, 0, 0, 0, 0, 0, 0],
|
|
74
|
+
days: [],
|
|
75
|
+
startHour: Math.floor(effectiveTime / 60),
|
|
76
|
+
startMinute: effectiveTime % 60,
|
|
77
|
+
endHour: Math.floor(expiredTime / 60),
|
|
78
|
+
endMinute: expiredTime % 60,
|
|
79
|
+
},
|
|
80
|
+
validNum: 0,
|
|
81
|
+
pwdLength: params.password.length,
|
|
82
|
+
pwd: params.password.split("").map(Number),
|
|
111
83
|
};
|
|
84
|
+
const targetDpCode = config.supportBigData
|
|
85
|
+
? dpCodes.tempPwdCreateW
|
|
86
|
+
: dpCodes.tempPwdCreate;
|
|
87
|
+
const result = await publishDps({
|
|
88
|
+
[targetDpCode]: dpUtils.format(dpData, (config.supportBigData
|
|
89
|
+
? addTempPwdBigDpMap
|
|
90
|
+
: addTempPwdDpMap)),
|
|
91
|
+
}, {
|
|
92
|
+
checkReport: (dpData) => {
|
|
93
|
+
const reportData = dpData[targetDpCode];
|
|
94
|
+
if (reportData) {
|
|
95
|
+
const data = dpUtils.parse(dpData[targetDpCode], (config.supportBigData
|
|
96
|
+
? reportAddTempPwdDBigpMap
|
|
97
|
+
: reportAddTempPwdDpMap));
|
|
98
|
+
if (data.cloudNo === tyNum) {
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
if (result.status === 0) {
|
|
106
|
+
return {
|
|
107
|
+
type: "custom",
|
|
108
|
+
name: name,
|
|
109
|
+
password: password,
|
|
110
|
+
unlockBindingId: result.unlockBindingId,
|
|
111
|
+
effectiveConfig: effective,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
throw getError(result.status === 2 ? 1041 : 1042);
|
|
112
115
|
}
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
try {
|
|
116
|
+
else {
|
|
117
117
|
const res = await createTemporaryPassword({
|
|
118
118
|
...baseData,
|
|
119
119
|
sn: 0,
|
|
@@ -129,9 +129,9 @@ export const createTempCustom = parallelOnly(async (params) => {
|
|
|
129
129
|
effectiveConfig: effective,
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
throw handleCloudError(error);
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
export const removeTempCustom = async (params) => {
|