@subreader/netflix-msl
Advanced tools
Comparing version 1.0.4 to 1.0.5
/// <reference types="node" /> | ||
import { RequestInfo, RequestInit, Response } from "node-fetch"; | ||
import { Message } from "./Message"; | ||
@@ -14,8 +15,10 @@ import { EncryptionEnvelope } from "./EncryptionEnvelope"; | ||
esn: string; | ||
fetchOptions?: RequestInit; | ||
static generateMessageID(): number; | ||
static generateESN(): string; | ||
constructor({ esn, keyPair, store, }: { | ||
constructor({ esn, keyPair, store, fetchOptions, }: { | ||
esn: string; | ||
keyPair: KeyPair; | ||
store: IMSLClientStore; | ||
fetchOptions?: RequestInit; | ||
}); | ||
@@ -50,2 +53,3 @@ createHandshakeRequestMessage(): Message; | ||
sendMessage(message: Message): Promise<Message>; | ||
fetch(info: RequestInfo, init: RequestInit): Promise<Response>; | ||
encrypt: (buffer: string) => Promise<EncryptionEnvelope>; | ||
@@ -52,0 +56,0 @@ decrypt: (encryptionEnvelope: EncryptionEnvelope) => Promise<string>; |
"use strict"; | ||
/* globals fetch */ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -16,3 +15,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
class MSLClient { | ||
constructor({ esn = MSLClient.generateESN(), keyPair, store, }) { | ||
constructor({ esn = MSLClient.generateESN(), keyPair, store, fetchOptions, }) { | ||
this.encrypt = async (buffer) => { | ||
@@ -48,2 +47,3 @@ const masterToken = await this.store.getMasterToken(); | ||
this.store = store; | ||
this.fetchOptions = fetchOptions; | ||
} | ||
@@ -241,8 +241,8 @@ static generateMessageID() { | ||
async sendHandshake(handshakeRequestMessage) { | ||
const res = await isomorphic_fetch_1.default(MSLClient.ENDPOINT, { | ||
const res = await this.fetch(MSLClient.ENDPOINT, { | ||
method: "POST", | ||
body: handshakeRequestMessage.serialize(), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: handshakeRequestMessage.serialize(), | ||
}); | ||
@@ -371,3 +371,3 @@ const text = await res.text(); | ||
const data = await message.encrypt(this.encrypt, this.sign); | ||
const res = await isomorphic_fetch_1.default(MSLClient.ENDPOINT, { | ||
const res = await this.fetch(MSLClient.ENDPOINT, { | ||
method: "POST", | ||
@@ -387,2 +387,6 @@ headers: { | ||
} | ||
fetch(info, init) { | ||
// @ts-ignore | ||
return isomorphic_fetch_1.default(info, Object.assign(Object.assign({}, this.fetchOptions), init)); | ||
} | ||
} | ||
@@ -389,0 +393,0 @@ exports.MSLClient = MSLClient; |
@@ -5,3 +5,3 @@ { | ||
"description": "Netflix MSL Client", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"license": "ISC", | ||
@@ -24,3 +24,3 @@ "main": "lib/MSLClient.js", | ||
"@types/node": "^12.12.29", | ||
"@types/node-fetch": "^2.5.4", | ||
"@types/node-fetch": "^2.5.7", | ||
"@typescript-eslint/eslint-plugin": "^2.17.0", | ||
@@ -27,0 +27,0 @@ "@typescript-eslint/parser": "^2.17.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91461
1513