@ardrive/turbo-sdk 1.0.0-alpha.20 → 1.0.0-alpha.22
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/README.md +134 -23
- package/bundles/web.bundle.min.js +37 -14
- package/lib/cjs/common/factory.js +6 -2
- package/lib/cjs/common/http.js +16 -29
- package/lib/cjs/common/payment.js +29 -52
- package/lib/cjs/common/turbo.js +24 -46
- package/lib/cjs/common/upload.js +27 -34
- package/lib/cjs/node/factory.js +8 -2
- package/lib/cjs/node/signer.js +42 -22
- package/lib/cjs/utils/axiosClient.js +4 -1
- package/lib/cjs/utils/readableStream.js +13 -22
- package/lib/cjs/web/factory.js +8 -2
- package/lib/cjs/web/signer.js +24 -33
- package/lib/esm/common/factory.js +6 -2
- package/lib/esm/common/http.js +16 -29
- package/lib/esm/common/payment.js +29 -52
- package/lib/esm/common/turbo.js +24 -46
- package/lib/esm/common/upload.js +27 -34
- package/lib/esm/node/factory.js +8 -2
- package/lib/esm/node/signer.js +42 -22
- package/lib/esm/utils/axiosClient.js +4 -1
- package/lib/esm/utils/readableStream.js +13 -22
- package/lib/esm/web/factory.js +8 -2
- package/lib/esm/web/signer.js +24 -33
- package/lib/types/common/payment.d.ts +0 -1
- package/lib/types/common/payment.d.ts.map +1 -1
- package/lib/types/common/turbo.d.ts +6 -6
- package/lib/types/common/turbo.d.ts.map +1 -1
- package/lib/types/common/upload.d.ts +2 -3
- package/lib/types/common/upload.d.ts.map +1 -1
- package/lib/types/node/signer.d.ts +8 -3
- package/lib/types/node/signer.d.ts.map +1 -1
- package/lib/types/types.d.ts +5 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils/readableStream.d.ts +2 -1
- package/lib/types/utils/readableStream.d.ts.map +1 -1
- package/lib/types/web/signer.d.ts +7 -3
- package/lib/types/web/signer.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/esm/common/upload.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
import { TurboHTTPService } from './http.js';
|
11
2
|
export class TurboUnauthenticatedUploadService {
|
12
3
|
constructor({ url = 'https://upload.ardrive.dev', retryConfig, }) {
|
@@ -15,17 +6,17 @@ export class TurboUnauthenticatedUploadService {
|
|
15
6
|
retryConfig,
|
16
7
|
});
|
17
8
|
}
|
18
|
-
uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
}
|
9
|
+
async uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
|
10
|
+
const fileSize = dataItemSizeFactory();
|
11
|
+
// TODO: add p-limit constraint or replace with separate upload class
|
12
|
+
return this.httpService.post({
|
13
|
+
endpoint: `/tx`,
|
14
|
+
signal,
|
15
|
+
data: dataItemStreamFactory(),
|
16
|
+
headers: {
|
17
|
+
'content-type': 'application/octet-stream',
|
18
|
+
'content-length': `${fileSize}`,
|
19
|
+
},
|
29
20
|
});
|
30
21
|
}
|
31
22
|
}
|
@@ -35,20 +26,22 @@ export class TurboAuthenticatedUploadService extends TurboUnauthenticatedUploadS
|
|
35
26
|
super({ url, retryConfig });
|
36
27
|
this.signer = signer;
|
37
28
|
}
|
38
|
-
uploadFile({ fileStreamFactory, signal, }) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
29
|
+
async uploadFile({ fileStreamFactory, fileSizeFactory, signal, }) {
|
30
|
+
const { dataItemStreamFactory, dataItemSizeFactory } = await this.signer.signDataItem({
|
31
|
+
fileStreamFactory,
|
32
|
+
fileSizeFactory,
|
33
|
+
});
|
34
|
+
const signedDataItem = dataItemStreamFactory();
|
35
|
+
const fileSize = dataItemSizeFactory();
|
36
|
+
// TODO: add p-limit constraint or replace with separate upload class
|
37
|
+
return this.httpService.post({
|
38
|
+
endpoint: `/tx`,
|
39
|
+
signal,
|
40
|
+
data: signedDataItem,
|
41
|
+
headers: {
|
42
|
+
'content-type': 'application/octet-stream',
|
43
|
+
'content-length': `${fileSize}`,
|
44
|
+
},
|
52
45
|
});
|
53
46
|
}
|
54
47
|
}
|
package/lib/esm/node/factory.js
CHANGED
@@ -20,8 +20,14 @@ import { TurboNodeArweaveSigner } from './signer.js';
|
|
20
20
|
export class TurboFactory extends TurboBaseFactory {
|
21
21
|
static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
|
22
22
|
const signer = new TurboNodeArweaveSigner({ privateKey });
|
23
|
-
const paymentService = new TurboAuthenticatedPaymentService(
|
24
|
-
|
23
|
+
const paymentService = new TurboAuthenticatedPaymentService({
|
24
|
+
...paymentServiceConfig,
|
25
|
+
signer,
|
26
|
+
});
|
27
|
+
const uploadService = new TurboAuthenticatedUploadService({
|
28
|
+
...uploadServiceConfig,
|
29
|
+
signer,
|
30
|
+
});
|
25
31
|
return new TurboAuthenticatedClient({
|
26
32
|
uploadService,
|
27
33
|
paymentService,
|
package/lib/esm/node/signer.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
/**
|
11
2
|
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
12
3
|
*
|
@@ -33,22 +24,51 @@ export class TurboNodeArweaveSigner {
|
|
33
24
|
this.privateKey = privateKey;
|
34
25
|
this.signer = new ArweaveSigner(this.privateKey);
|
35
26
|
}
|
36
|
-
signDataItem({ fileStreamFactory, }) {
|
27
|
+
async signDataItem({ fileStreamFactory, fileSizeFactory, }) {
|
37
28
|
// TODO: replace with our own signer implementation
|
38
29
|
const [stream1, stream2] = [fileStreamFactory(), fileStreamFactory()];
|
39
|
-
|
30
|
+
const signedDataItem = await streamSigner(stream1, stream2, this.signer);
|
31
|
+
// TODO: support target, anchor, and tags
|
32
|
+
const signedDataItemSize = this.calculateSignedDataHeadersSize({
|
33
|
+
dataSize: fileSizeFactory(),
|
34
|
+
});
|
35
|
+
return {
|
36
|
+
dataItemStreamFactory: () => signedDataItem,
|
37
|
+
dataItemSizeFactory: () => signedDataItemSize,
|
38
|
+
};
|
40
39
|
}
|
41
40
|
// NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
|
42
|
-
generateSignedRequestHeaders() {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
41
|
+
async generateSignedRequestHeaders() {
|
42
|
+
const nonce = randomBytes(16).toString('hex');
|
43
|
+
const buffer = Buffer.from(nonce);
|
44
|
+
const signature = await Arweave.crypto.sign(this.privateKey, buffer);
|
45
|
+
return {
|
46
|
+
'x-public-key': this.privateKey.n,
|
47
|
+
'x-nonce': nonce,
|
48
|
+
'x-signature': toB64Url(Buffer.from(signature)),
|
49
|
+
};
|
50
|
+
}
|
51
|
+
// TODO: make dynamic that accepts anchor and target and tags to return the size of the headers + data
|
52
|
+
// reference https://github.com/ArweaveTeam/arweave-standards/blob/master/ans/ANS-104.md#13-dataitem-format
|
53
|
+
calculateSignedDataHeadersSize({ dataSize }) {
|
54
|
+
const anchor = 1; // + whatever they provide (max of 33)
|
55
|
+
const target = 1; // + whatever they provide (max of 33)
|
56
|
+
const tags = 0;
|
57
|
+
const signatureLength = 512;
|
58
|
+
const ownerLength = 512;
|
59
|
+
const signatureTypeLength = 2;
|
60
|
+
const numOfTagsLength = 8; // https://github.com/Bundlr-Network/arbundles/blob/master/src/tags.ts#L191-L198
|
61
|
+
const numOfTagsBytesLength = 8;
|
62
|
+
return [
|
63
|
+
anchor,
|
64
|
+
target,
|
65
|
+
tags,
|
66
|
+
signatureLength,
|
67
|
+
ownerLength,
|
68
|
+
signatureTypeLength,
|
69
|
+
numOfTagsLength,
|
70
|
+
numOfTagsBytesLength,
|
71
|
+
dataSize,
|
72
|
+
].reduce((totalSize, currentSize) => (totalSize += currentSize));
|
53
73
|
}
|
54
74
|
}
|
@@ -27,7 +27,10 @@ export const createAxiosInstance = ({ axiosConfig = {}, retryConfig = {
|
|
27
27
|
console.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
|
28
28
|
},
|
29
29
|
}, }) => {
|
30
|
-
const axiosInstance = axios.create(
|
30
|
+
const axiosInstance = axios.create({
|
31
|
+
...axiosConfig,
|
32
|
+
validateStatus: () => true, // don't throw on non-200 status codes
|
33
|
+
});
|
31
34
|
// eslint-disable-next-line
|
32
35
|
if (retryConfig.retries && retryConfig.retries > 0) {
|
33
36
|
axiosRetry(axiosInstance, retryConfig);
|
@@ -1,24 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const reader = stream.getReader();
|
13
|
-
const chunks = [];
|
14
|
-
let done = false;
|
15
|
-
while (!done) {
|
16
|
-
const { done: streamDone, value } = yield reader.read();
|
17
|
-
done = streamDone;
|
18
|
-
if (!done) {
|
19
|
-
chunks.push(value);
|
20
|
-
}
|
1
|
+
export async function readableStreamToBuffer({ stream, size, }) {
|
2
|
+
const reader = stream.getReader();
|
3
|
+
const buffer = Buffer.alloc(size);
|
4
|
+
let offset = 0;
|
5
|
+
let done = false;
|
6
|
+
while (!done) {
|
7
|
+
const { done: streamDone, value } = await reader.read();
|
8
|
+
done = streamDone;
|
9
|
+
if (!done) {
|
10
|
+
buffer.set(value, offset);
|
11
|
+
offset += value.byteLength;
|
21
12
|
}
|
22
|
-
|
23
|
-
|
13
|
+
}
|
14
|
+
return buffer;
|
24
15
|
}
|
package/lib/esm/web/factory.js
CHANGED
@@ -20,8 +20,14 @@ import { TurboWebArweaveSigner } from './signer.js';
|
|
20
20
|
export class TurboFactory extends TurboBaseFactory {
|
21
21
|
static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
|
22
22
|
const signer = new TurboWebArweaveSigner({ privateKey });
|
23
|
-
const paymentService = new TurboAuthenticatedPaymentService(
|
24
|
-
|
23
|
+
const paymentService = new TurboAuthenticatedPaymentService({
|
24
|
+
...paymentServiceConfig,
|
25
|
+
signer,
|
26
|
+
});
|
27
|
+
const uploadService = new TurboAuthenticatedUploadService({
|
28
|
+
...uploadServiceConfig,
|
29
|
+
signer,
|
30
|
+
});
|
25
31
|
return new TurboAuthenticatedClient({
|
26
32
|
uploadService,
|
27
33
|
paymentService,
|
package/lib/esm/web/signer.js
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
/**
|
11
2
|
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
12
3
|
*
|
@@ -33,32 +24,32 @@ export class TurboWebArweaveSigner {
|
|
33
24
|
this.privateKey = privateKey;
|
34
25
|
this.signer = new ArweaveSigner(this.privateKey);
|
35
26
|
}
|
36
|
-
signDataItem({ fileStreamFactory, }) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
// TODO: add payload size to get performance improvements
|
42
|
-
});
|
43
|
-
const signedDataItem = createData(buffer, this.signer);
|
44
|
-
yield signedDataItem.sign(this.signer);
|
45
|
-
return signedDataItem.getRaw();
|
27
|
+
async signDataItem({ fileStreamFactory, fileSizeFactory, }) {
|
28
|
+
// TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
|
29
|
+
const buffer = await readableStreamToBuffer({
|
30
|
+
stream: fileStreamFactory(),
|
31
|
+
size: fileSizeFactory(),
|
46
32
|
});
|
33
|
+
// TODO: support target, anchor and tags for upload
|
34
|
+
const signedDataItem = createData(buffer, this.signer, {});
|
35
|
+
await signedDataItem.sign(this.signer);
|
36
|
+
return {
|
37
|
+
// while this returns a Buffer - it needs to match our return type for uploading
|
38
|
+
dataItemStreamFactory: () => signedDataItem.getRaw(),
|
39
|
+
dataItemSizeFactory: () => signedDataItem.getRaw().length,
|
40
|
+
};
|
47
41
|
}
|
48
42
|
// NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
|
49
|
-
generateSignedRequestHeaders() {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
'x-signature': toB64Url(Buffer.from(signature)),
|
61
|
-
};
|
62
|
-
});
|
43
|
+
async generateSignedRequestHeaders() {
|
44
|
+
// a bit hacky - but arweave exports cause issues in tests vs. browser
|
45
|
+
const arweave = Arweave.default ?? Arweave;
|
46
|
+
const nonce = randomBytes(16).toString('hex');
|
47
|
+
const buffer = Buffer.from(nonce);
|
48
|
+
const signature = await arweave.crypto.sign(this.privateKey, buffer, {});
|
49
|
+
return {
|
50
|
+
'x-public-key': this.privateKey.n,
|
51
|
+
'x-nonce': nonce,
|
52
|
+
'x-signature': toB64Url(Buffer.from(signature)),
|
53
|
+
};
|
63
54
|
}
|
64
55
|
}
|
@@ -34,7 +34,6 @@ export declare class TurboUnauthenticatedPaymentService implements TurboUnauthen
|
|
34
34
|
}): Promise<TurboPriceResponse>;
|
35
35
|
}
|
36
36
|
export declare class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentService implements TurboAuthenticatedPaymentServiceInterface {
|
37
|
-
protected readonly httpService: TurboHTTPService;
|
38
37
|
protected readonly signer: TurboWalletSigner;
|
39
38
|
constructor({ url, retryConfig, signer, }: TurboAuthenticatedPaymentServiceInterfaceConfiguration);
|
40
39
|
getBalance(): Promise<TurboBalanceResponse>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,yCAAyC,EACzC,sDAAsD,EACtD,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,2CAA2C,EAC3C,wDAAwD,EACxD,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,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,EAAE,wDAAwD;IAOrD,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAM3C,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAM5B,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAMxD,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAM1D,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAW3B,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;;;KAAA,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAKxE;AAGD,qBAAa,gCACX,SAAQ,kCACR,YAAW,yCAAyC;IAEpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEjC,EACV,GAAmC,EACnC,WAAW,EACX,MAAM,GACP,EAAE,sDAAsD;IAKnD,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAWlD"}
|
@@ -16,8 +16,8 @@
|
|
16
16
|
*/
|
17
17
|
import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse } from '../types.js';
|
18
18
|
export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedClientInterface {
|
19
|
-
protected
|
20
|
-
protected
|
19
|
+
protected paymentService: TurboUnauthenticatedPaymentServiceInterface;
|
20
|
+
protected uploadService: TurboUnauthenticatedUploadServiceInterface;
|
21
21
|
constructor({ uploadService, paymentService, }: TurboPublicClientConfiguration);
|
22
22
|
/**
|
23
23
|
* Returns the supported fiat currency conversion rate for 1AR based on current market prices.
|
@@ -56,11 +56,11 @@ export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedC
|
|
56
56
|
/**
|
57
57
|
* Uploads a signed data item to the Turbo Upload Service.
|
58
58
|
*/
|
59
|
-
uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
59
|
+
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
60
60
|
}
|
61
61
|
export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient implements TurboAuthenticatedClientInterface {
|
62
|
-
protected
|
63
|
-
protected
|
62
|
+
protected paymentService: TurboAuthenticatedPaymentServiceInterface;
|
63
|
+
protected uploadService: TurboAuthenticatedUploadServiceInterface;
|
64
64
|
constructor({ paymentService, uploadService, }: TurboPrivateClientConfiguration);
|
65
65
|
/**
|
66
66
|
* Returns the current balance of the user's wallet in 'winc'.
|
@@ -69,6 +69,6 @@ export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient
|
|
69
69
|
/**
|
70
70
|
* Signs and uploads raw data to the Turbo Upload Service.
|
71
71
|
*/
|
72
|
-
uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
72
|
+
uploadFile({ fileStreamFactory, fileSizeFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
73
73
|
}
|
74
74
|
//# sourceMappingURL=turbo.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"turbo.d.ts","sourceRoot":"","sources":["../../../src/common/turbo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIhE;;OAEG;IACG,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAIjC;;OAEG;IACG,cAAc,CAAC,EACnB,MAAM,EACN,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;IAIpD;;OAEG;IACG,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAO1D;AAED,qBAAa,wBACX,SAAQ,0BACR,YAAW,iCAAiC;IAG5C,SAAS,CAAC,cAAc,EAAE,yCAAyC,CAAC;IACpE,SAAS,CAAC,aAAa,EAAE,wCAAwC,CAAC;gBAEtD,EACV,cAAc,EACd,aAAa,GACd,EAAE,+BAA+B;IAIlC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIjD;;OAEG;IACG,UAAU,CAAC,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAO1D"}
|
@@ -19,12 +19,11 @@ import { TurboHTTPService } from './http.js';
|
|
19
19
|
export declare class TurboUnauthenticatedUploadService implements TurboUnauthenticatedUploadServiceInterface {
|
20
20
|
protected httpService: TurboHTTPService;
|
21
21
|
constructor({ url, retryConfig, }: TurboUnauthenticatedUploadServiceInterfaceConfiguration);
|
22
|
-
uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
22
|
+
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
23
23
|
}
|
24
24
|
export declare class TurboAuthenticatedUploadService extends TurboUnauthenticatedUploadService implements TurboAuthenticatedUploadServiceInterface {
|
25
|
-
protected httpService: TurboHTTPService;
|
26
25
|
protected signer: TurboWalletSigner;
|
27
26
|
constructor({ url, retryConfig, signer, }: TurboAuthenticatedUploadServiceConfiguration);
|
28
|
-
uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
27
|
+
uploadFile({ fileStreamFactory, fileSizeFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
29
28
|
}
|
30
29
|
//# sourceMappingURL=upload.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/common/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,EACxC,gBAAgB,EAChB,0BAA0B,EAC1B,0CAA0C,EAC1C,uDAAuD,EACvD,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,iCACX,YAAW,0CAA0C;IAErD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAE5B,EACV,GAAkC,EAClC,WAAW,GACZ,EAAE,uDAAuD;IAOpD,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/common/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,EACxC,gBAAgB,EAChB,0BAA0B,EAC1B,0CAA0C,EAC1C,uDAAuD,EACvD,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,iCACX,YAAW,0CAA0C;IAErD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAE5B,EACV,GAAkC,EAClC,WAAW,GACZ,EAAE,uDAAuD;IAOpD,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAa1D;AAGD,qBAAa,+BACX,SAAQ,iCACR,YAAW,wCAAwC;IAEnD,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAExB,EACV,GAAkC,EAClC,WAAW,EACX,MAAM,GACP,EAAE,4CAA4C;IAKzC,UAAU,CAAC,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAmB1D"}
|
@@ -18,20 +18,25 @@
|
|
18
18
|
import { ArweaveSigner } from 'arbundles';
|
19
19
|
import { Readable } from 'node:stream';
|
20
20
|
import { JWKInterface } from '../common/jwk.js';
|
21
|
-
import { TurboWalletSigner } from '../types.js';
|
21
|
+
import { StreamSizeFactory, TurboWalletSigner } from '../types.js';
|
22
22
|
export declare class TurboNodeArweaveSigner implements TurboWalletSigner {
|
23
23
|
protected privateKey: JWKInterface;
|
24
24
|
protected signer: ArweaveSigner;
|
25
25
|
constructor({ privateKey }: {
|
26
26
|
privateKey: JWKInterface;
|
27
27
|
});
|
28
|
-
signDataItem({ fileStreamFactory, }: {
|
28
|
+
signDataItem({ fileStreamFactory, fileSizeFactory, }: {
|
29
29
|
fileStreamFactory: () => Readable;
|
30
|
-
|
30
|
+
fileSizeFactory: StreamSizeFactory;
|
31
|
+
}): Promise<{
|
32
|
+
dataItemStreamFactory: () => Readable;
|
33
|
+
dataItemSizeFactory: StreamSizeFactory;
|
34
|
+
}>;
|
31
35
|
generateSignedRequestHeaders(): Promise<{
|
32
36
|
'x-public-key': string;
|
33
37
|
'x-nonce': string;
|
34
38
|
'x-signature': string;
|
35
39
|
}>;
|
40
|
+
private calculateSignedDataHeadersSize;
|
36
41
|
}
|
37
42
|
//# sourceMappingURL=signer.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/node/signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAgB,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/node/signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAgB,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGnE,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;gBAGpB,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,YAAY,CAAA;KAAE;IAKlD,YAAY,CAAC,EACjB,iBAAiB,EACjB,eAAe,GAChB,EAAE;QACD,iBAAiB,EAAE,MAAM,QAAQ,CAAC;QAClC,eAAe,EAAE,iBAAiB,CAAC;KACpC,GAAG,OAAO,CAAC;QACV,qBAAqB,EAAE,MAAM,QAAQ,CAAC;QACtC,mBAAmB,EAAE,iBAAiB,CAAC;KACxC,CAAC;IAeI,4BAA4B;;;;;IAclC,OAAO,CAAC,8BAA8B;CAqBvC"}
|
package/lib/types/types.d.ts
CHANGED
@@ -90,11 +90,14 @@ export type TurboPrivateClientConfiguration = {
|
|
90
90
|
};
|
91
91
|
export type FileStreamFactory = (() => Readable) | (() => ReadableStream) | (() => Buffer);
|
92
92
|
export type SignedDataStreamFactory = FileStreamFactory;
|
93
|
+
export type StreamSizeFactory = () => number;
|
93
94
|
export type TurboFileFactory = {
|
94
95
|
fileStreamFactory: FileStreamFactory;
|
96
|
+
fileSizeFactory: StreamSizeFactory;
|
95
97
|
};
|
96
98
|
export type TurboSignedDataItemFactory = {
|
97
99
|
dataItemStreamFactory: SignedDataStreamFactory;
|
100
|
+
dataItemSizeFactory: StreamSizeFactory;
|
98
101
|
};
|
99
102
|
export type TurboAbortSignal = {
|
100
103
|
signal?: AbortSignal;
|
@@ -115,7 +118,7 @@ export interface TurboHTTPServiceInterface {
|
|
115
118
|
}): Promise<T>;
|
116
119
|
}
|
117
120
|
export interface TurboWalletSigner {
|
118
|
-
signDataItem({ fileStreamFactory, }: TurboFileFactory): Promise<
|
121
|
+
signDataItem({ fileStreamFactory, fileSizeFactory, }: TurboFileFactory): Promise<TurboSignedDataItemFactory>;
|
119
122
|
generateSignedRequestHeaders(): Promise<TurboSignedRequestHeaders>;
|
120
123
|
}
|
121
124
|
export interface TurboUnauthenticatedPaymentServiceInterface {
|
@@ -140,7 +143,7 @@ export interface TurboUnauthenticatedUploadServiceInterface {
|
|
140
143
|
uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
141
144
|
}
|
142
145
|
export interface TurboAuthenticatedUploadServiceInterface extends TurboUnauthenticatedUploadServiceInterface {
|
143
|
-
uploadFile({ fileStreamFactory, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
146
|
+
uploadFile({ fileStreamFactory, fileSizeFactory, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
144
147
|
}
|
145
148
|
export interface TurboUnauthenticatedClientInterface extends TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface {
|
146
149
|
}
|
package/lib/types/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AACzC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,oBAAoB,CAAC;AACxD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAC7E,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,mBAA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AAC,2BAA2B,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,mCACf,SAAQ,2CAA2C,EACjD,0CAA0C;CAAG;AACjD,MAAM,WAAW,iCACf,SAAQ,yCAAyC,EAC/C,wCAAwC;CAAG"}
|
@@ -17,7 +17,8 @@
|
|
17
17
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
*/
|
19
19
|
import { ReadableStream } from 'node:stream/web';
|
20
|
-
export declare function readableStreamToBuffer({ stream, }: {
|
20
|
+
export declare function readableStreamToBuffer({ stream, size, }: {
|
21
21
|
stream: ReadableStream;
|
22
|
+
size: number;
|
22
23
|
}): Promise<Buffer>;
|
23
24
|
//# sourceMappingURL=readableStream.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"readableStream.d.ts","sourceRoot":"","sources":["../../../src/utils/readableStream.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,sBAAsB,CAAC,EAC3C,MAAM,
|
1
|
+
{"version":3,"file":"readableStream.d.ts","sourceRoot":"","sources":["../../../src/utils/readableStream.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,sBAAsB,CAAC,EAC3C,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAelB"}
|
@@ -19,16 +19,20 @@
|
|
19
19
|
import { ArweaveSigner } from 'arbundles';
|
20
20
|
import { ReadableStream } from 'node:stream/web';
|
21
21
|
import { JWKInterface } from '../common/jwk.js';
|
22
|
-
import { TurboWalletSigner } from '../types.js';
|
22
|
+
import { StreamSizeFactory, TurboWalletSigner } from '../types.js';
|
23
23
|
export declare class TurboWebArweaveSigner implements TurboWalletSigner {
|
24
24
|
protected privateKey: JWKInterface;
|
25
25
|
protected signer: ArweaveSigner;
|
26
26
|
constructor({ privateKey }: {
|
27
27
|
privateKey: JWKInterface;
|
28
28
|
});
|
29
|
-
signDataItem({ fileStreamFactory, }: {
|
29
|
+
signDataItem({ fileStreamFactory, fileSizeFactory, }: {
|
30
30
|
fileStreamFactory: () => ReadableStream;
|
31
|
-
|
31
|
+
fileSizeFactory: StreamSizeFactory;
|
32
|
+
}): Promise<{
|
33
|
+
dataItemStreamFactory: () => Buffer;
|
34
|
+
dataItemSizeFactory: StreamSizeFactory;
|
35
|
+
}>;
|
32
36
|
generateSignedRequestHeaders(): Promise<{
|
33
37
|
'x-public-key': string;
|
34
38
|
'x-nonce': string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/web/signer.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAc,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/web/signer.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAc,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAInE,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;gBAEpB,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,YAAY,CAAA;KAAE;IAKlD,YAAY,CAAC,EACjB,iBAAiB,EACjB,eAAe,GAChB,EAAE;QACD,iBAAiB,EAAE,MAAM,cAAc,CAAC;QACxC,eAAe,EAAE,iBAAiB,CAAC;KACpC,GAAG,OAAO,CAAC;QAEV,qBAAqB,EAAE,MAAM,MAAM,CAAC;QACpC,mBAAmB,EAAE,iBAAiB,CAAC;KACxC,CAAC;IAiBI,4BAA4B;;;;;CAanC"}
|