generated from mirzaev/pot
25 lines
748 B
JavaScript
25 lines
748 B
JavaScript
'use strict';
|
|
|
|
class password {
|
|
/**
|
|
* Сгенерировать
|
|
*
|
|
* @param {number} length Длина (количество слов в мнемоническом, либо символов в классическом)
|
|
*
|
|
* @return {object} {(string) password, (array) errors}
|
|
*/
|
|
static async generate(length = 12, type = "classic") {
|
|
return await fetch("https://account.mirzaev.sexy/api/generate/password", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
},
|
|
body: `length=${length}&type=${type}&return=password,errors`,
|
|
})
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
return data;
|
|
});
|
|
}
|
|
}
|