Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@maildrop/api

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maildrop/api - npm Package Compare versions

Comparing version 1.0.21 to 1.0.23

62

main.js

@@ -1,3 +0,2 @@

const axios = require("axios");
const bigInteger = require("big-integer");
const fetch = require("cross-fetch");
const url = require("url");

@@ -27,10 +26,13 @@

const alias = email.replace(/@maildrop.cc$/, "");
const options = { headers: { "x-api-key": await this.getApiKey() } };
const options = {
headers: { "x-api-key": await this.getApiKey() },
method: "DELETE",
};
const { data } = await axios.delete(
url.resolve(this.apiHost, `${this.apiRelativePath}/${alias}/${id}`),
options
);
return data;
return await (
await fetch(
url.resolve(this.apiHost, `${this.apiRelativePath}/${alias}/${id}`),
options
)
).json();
},

@@ -51,15 +53,19 @@

const { data: inbox } = await axios.get(
url.resolve(this.apiHost, `${this.apiRelativePath}/${alias}`),
options
);
const inbox = await (
await fetch(
url.resolve(this.apiHost, `${this.apiRelativePath}/${alias}`),
options
)
).json();
for (const message of inbox.messages) {
const { data } = await axios.get(
url.resolve(
this.apiHost,
`${this.apiRelativePath}/${alias}/${message.id}`
),
options
);
const data = await (
await fetch(
url.resolve(
this.apiHost,
`${this.apiRelativePath}/${alias}/${message.id}`
),
options
)
).json();

@@ -82,9 +88,17 @@ // contains raw body & html

if (force || !this.apiKey || this.apiKeyExpiry < new Date().getTime()) {
const { data: html } = await axios.get(this.webHost);
const { data: js } = await axios.get(
url.resolve(this.webHost, html.match(/([^"]+static\/js\/main[^"]+)/)[1])
);
const html = await (await fetch(this.webHost)).text();
const js = await (
await fetch(
url.resolve(
this.webHost,
html.match(/([^"]+static\/js\/main[^"]+)/)[1]
)
)
).text();
this.apiKey = js.match(/x-api-key":"([^"]+)/)[1];
this.apiKeyExpiry = new Date().getTime() + 6 * 60 * 60 * 1000; // 6 hour expiration
}
return this.apiKey;

@@ -91,0 +105,0 @@ },

{
"dependencies": {
"axios": "^0.19.2",
"cross-fetch": "^3.0.4",
"url": "^0.11.0"

@@ -21,3 +21,3 @@ },

},
"version": "1.0.21"
"version": "1.0.23"
}

@@ -5,3 +5,3 @@ const maildrop = require("./main.js");

const email = "linto@maildrop.cc";
console.log(email);
console.log({ email, xApiKey: await maildrop.getApiKey() });

@@ -8,0 +8,0 @@ // test fetchMails

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc