react-native-mosquito-transport 0.0.43 → 0.0.45
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.
|
@@ -43,7 +43,7 @@ public class FileUploader {
|
|
|
43
43
|
connection.setRequestProperty("hash-upload", config.getString("createHash"));
|
|
44
44
|
connection.setRequestProperty("Mosquito-Destination", config.getString("destination"));
|
|
45
45
|
if (config.hasKey("authToken")) {
|
|
46
|
-
connection.setRequestProperty("
|
|
46
|
+
connection.setRequestProperty("mtoken", config.getString("authToken"));
|
|
47
47
|
}
|
|
48
48
|
connection.setFixedLengthStreamingMode((int) totalBytes);
|
|
49
49
|
|
package/ios/Mosquitodb.swift
CHANGED
|
@@ -101,7 +101,7 @@ class MosquitodbUploadTask: NSObject, URLSessionDataDelegate {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
if options["authToken"] != nil {
|
|
104
|
-
request.setValue(options["authToken"] as? String, forHTTPHeaderField: "
|
|
104
|
+
request.setValue(options["authToken"] as? String, forHTTPHeaderField: "mtoken")
|
|
105
105
|
}
|
|
106
106
|
request.setValue(options["createHash"] as? String, forHTTPHeaderField: "hash-upload");
|
|
107
107
|
request.setValue("buffer/upload", forHTTPHeaderField: "Content-Type")
|
|
@@ -197,7 +197,7 @@ class MosquitodbDownloadTask: NSObject, URLSessionDownloadDelegate {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
if options["authToken"] != nil {
|
|
200
|
-
request.setValue(options["authToken"] as? String, forHTTPHeaderField: "
|
|
200
|
+
request.setValue(options["authToken"] as? String, forHTTPHeaderField: "mtoken")
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
let session = URLSession(configuration: URLSessionConfiguration.default, delegate: self, delegateQueue: nil)
|
package/package.json
CHANGED
package/src/helpers/utils.js
CHANGED
|
@@ -190,7 +190,7 @@ export const buildFetchInterface = async ({ body, authToken, method, uglify, ser
|
|
|
190
190
|
headers: {
|
|
191
191
|
...extraHeaders,
|
|
192
192
|
'Content-type': uglify ? 'request/buffer' : 'application/json',
|
|
193
|
-
...(authToken && !uglify) ? { '
|
|
193
|
+
...(authToken && !uglify) ? { 'mtoken': authToken } : {}
|
|
194
194
|
},
|
|
195
195
|
method: method || 'POST',
|
|
196
196
|
credentials: 'omit'
|
|
@@ -26,7 +26,7 @@ export default class MTAuth {
|
|
|
26
26
|
|
|
27
27
|
customSignup = (email, password, name, metadata) => doCustomSignup(this.builder, email, password, name, metadata);
|
|
28
28
|
|
|
29
|
-
googleSignin = (token) => doGoogleSignin(this.builder, token);
|
|
29
|
+
googleSignin = (token, metadata) => doGoogleSignin(this.builder, token, metadata);
|
|
30
30
|
|
|
31
31
|
appleSignin() {
|
|
32
32
|
throw 'unsupported method call';
|
|
@@ -308,7 +308,7 @@ export const purgePendingToken = async (nodeId) => {
|
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
-
const doGoogleSignin = (builder, token) => new Promise(async (resolve, reject) => {
|
|
311
|
+
const doGoogleSignin = (builder, token, metadata) => new Promise(async (resolve, reject) => {
|
|
312
312
|
const { projectUrl, serverE2E_PublicKey, uglify, extraHeaders } = builder;
|
|
313
313
|
|
|
314
314
|
try {
|
|
@@ -316,7 +316,7 @@ const doGoogleSignin = (builder, token) => new Promise(async (resolve, reject) =
|
|
|
316
316
|
const thisAuthStore = basicClone(CacheStore.AuthStore[projectUrl]);
|
|
317
317
|
|
|
318
318
|
const [reqBuilder, [privateKey]] = await buildFetchInterface({
|
|
319
|
-
body: { token },
|
|
319
|
+
body: { token, metadata },
|
|
320
320
|
uglify,
|
|
321
321
|
serverE2E_PublicKey,
|
|
322
322
|
extraHeaders
|
|
@@ -143,7 +143,7 @@ export const mfetch = async (input = '', init, config) => {
|
|
|
143
143
|
const [reqBuilder, [privateKey]] = uglified ? await serializeE2E(body, mtoken, serverE2E_PublicKey) : [null, []];
|
|
144
144
|
|
|
145
145
|
const f = await fetch(isLink ? input : `${projectUrl}/${normalizeRoute(input)}`, {
|
|
146
|
-
...
|
|
146
|
+
...(encodeBody || uglified) ? { method: 'POST' } : {},
|
|
147
147
|
credentials: 'omit',
|
|
148
148
|
...init,
|
|
149
149
|
...uglified ? { body: reqBuilder } : encodeBody ? { body: serialize(body) } : {},
|