@ardrive/turbo-sdk 1.0.0-alpha.1 → 1.0.0-alpha.11
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 +13 -13
- package/bundles/web.bundle.min.js +6 -5
- package/lib/cjs/common/factory.js +17 -0
- package/lib/cjs/common/http.js +49 -0
- package/lib/cjs/common/index.js +35 -0
- package/lib/cjs/common/jwk.js +2 -0
- package/lib/cjs/common/payment.js +86 -0
- package/lib/cjs/common/turbo.js +105 -0
- package/lib/cjs/common/upload.js +59 -0
- package/lib/cjs/node/factory.js +34 -0
- package/lib/cjs/node/index.js +36 -0
- package/lib/cjs/node/signer.js +61 -0
- package/lib/cjs/types.js +2 -0
- package/lib/cjs/utils/axiosClient.js +60 -0
- package/lib/cjs/utils/base64.js +47 -0
- package/lib/cjs/utils/errors.js +33 -0
- package/lib/cjs/utils/readableStream.js +28 -0
- package/lib/cjs/web/factory.js +34 -0
- package/lib/cjs/web/index.js +36 -0
- package/lib/cjs/web/signer.js +71 -0
- package/lib/{web → esm/node}/index.js +1 -0
- package/lib/{node → esm/web}/index.js +1 -0
- package/lib/{web → esm/web}/signer.js +6 -3
- package/lib/{common → types/common}/factory.d.ts +2 -1
- package/lib/types/common/factory.d.ts.map +1 -0
- package/lib/{common → types/common}/http.d.ts +2 -1
- package/lib/types/common/http.d.ts.map +1 -0
- package/lib/{common → types/common}/index.d.ts +1 -0
- package/lib/types/common/index.d.ts.map +1 -0
- package/lib/types/{arweave.d.ts → common/jwk.d.ts} +1 -0
- package/lib/types/common/jwk.d.ts.map +1 -0
- package/lib/{common → types/common}/payment.d.ts +2 -1
- package/lib/types/common/payment.d.ts.map +1 -0
- package/lib/{common → types/common}/turbo.d.ts +2 -1
- package/lib/types/common/turbo.d.ts.map +1 -0
- package/lib/{common → types/common}/upload.d.ts +2 -1
- package/lib/types/common/upload.d.ts.map +1 -0
- package/lib/{node → types/node}/factory.d.ts +2 -1
- package/lib/types/node/factory.d.ts.map +1 -0
- package/lib/{web → types/node}/index.d.ts +2 -0
- package/lib/types/node/index.d.ts.map +1 -0
- package/lib/{node → types/node}/signer.d.ts +3 -2
- package/lib/types/node/signer.d.ts.map +1 -0
- package/lib/types/{turbo.d.ts → types.d.ts} +2 -1
- package/lib/types/types.d.ts.map +1 -0
- package/lib/{utils → types/utils}/axiosClient.d.ts +1 -0
- package/lib/types/utils/axiosClient.d.ts.map +1 -0
- package/lib/{utils → types/utils}/base64.d.ts +3 -2
- package/lib/types/utils/base64.d.ts.map +1 -0
- package/lib/{utils → types/utils}/errors.d.ts +1 -0
- package/lib/types/utils/errors.d.ts.map +1 -0
- package/lib/{utils → types/utils}/readableStream.d.ts +1 -0
- package/lib/types/utils/readableStream.d.ts.map +1 -0
- package/lib/{web → types/web}/factory.d.ts +2 -1
- package/lib/types/web/factory.d.ts.map +1 -0
- package/lib/{node → types/web}/index.d.ts +2 -0
- package/lib/types/web/index.d.ts.map +1 -0
- package/lib/{web → types/web}/signer.d.ts +4 -3
- package/lib/types/web/signer.d.ts.map +1 -0
- package/package.json +16 -14
- package/lib/LICENSE.md +0 -661
- package/lib/README.md +0 -114
- package/lib/package.json +0 -106
- package/lib/types/index.d.ts +0 -18
- package/lib/types/index.js +0 -18
- /package/lib/{common → esm/common}/factory.js +0 -0
- /package/lib/{common → esm/common}/http.js +0 -0
- /package/lib/{common → esm/common}/index.js +0 -0
- /package/lib/{types/arweave.js → esm/common/jwk.js} +0 -0
- /package/lib/{common → esm/common}/payment.js +0 -0
- /package/lib/{common → esm/common}/turbo.js +0 -0
- /package/lib/{common → esm/common}/upload.js +0 -0
- /package/lib/{node → esm/node}/factory.js +0 -0
- /package/lib/{node → esm/node}/signer.js +0 -0
- /package/lib/{types/turbo.js → esm/types.js} +0 -0
- /package/lib/{utils → esm/utils}/axiosClient.js +0 -0
- /package/lib/{utils → esm/utils}/base64.js +0 -0
- /package/lib/{utils → esm/utils}/errors.js +0 -0
- /package/lib/{utils → esm/utils}/readableStream.js +0 -0
- /package/lib/{web → esm/web}/factory.js +0 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.createAxiosInstance = void 0;
|
30
|
+
/**
|
31
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
32
|
+
*
|
33
|
+
* This program is free software: you can redistribute it and/or modify
|
34
|
+
* it under the terms of the GNU Affero General Public License as published by
|
35
|
+
* the Free Software Foundation, either version 3 of the License, or
|
36
|
+
* (at your option) any later version.
|
37
|
+
*
|
38
|
+
* This program is distributed in the hope that it will be useful,
|
39
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
40
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
41
|
+
* GNU Affero General Public License for more details.
|
42
|
+
*
|
43
|
+
* You should have received a copy of the GNU Affero General Public License
|
44
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
45
|
+
*/
|
46
|
+
const axios_1 = __importDefault(require("axios"));
|
47
|
+
const rax = __importStar(require("retry-axios"));
|
48
|
+
const createAxiosInstance = ({ axiosConfig = {}, retryConfig = {
|
49
|
+
backoffType: 'exponential',
|
50
|
+
retry: 3,
|
51
|
+
onRetryAttempt: (err) => {
|
52
|
+
const cfg = rax.getConfig(err);
|
53
|
+
console.debug(`Retry attempt #${cfg === null || cfg === void 0 ? void 0 : cfg.currentRetryAttempt}`);
|
54
|
+
},
|
55
|
+
}, }) => {
|
56
|
+
const axiosInstance = axios_1.default.create(Object.assign(Object.assign({}, axiosConfig), { validateStatus: () => true }));
|
57
|
+
axiosInstance.defaults.raxConfig = Object.assign({ instance: axiosInstance }, retryConfig);
|
58
|
+
return axiosInstance;
|
59
|
+
};
|
60
|
+
exports.createAxiosInstance = createAxiosInstance;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.sha256B64Url = exports.toB64Url = exports.fromB64Url = exports.ownerToAddress = exports.jwkToPublicArweaveAddress = exports.base64URLRegex = void 0;
|
4
|
+
/**
|
5
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
6
|
+
*
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Affero General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Affero General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
const utils_js_1 = require("arweave/node/lib/utils.js");
|
21
|
+
const crypto_1 = require("crypto");
|
22
|
+
exports.base64URLRegex = /^[a-zA-Z0-9_-]{43}$/;
|
23
|
+
function jwkToPublicArweaveAddress(jwk) {
|
24
|
+
return ownerToAddress(jwk.n);
|
25
|
+
}
|
26
|
+
exports.jwkToPublicArweaveAddress = jwkToPublicArweaveAddress;
|
27
|
+
function ownerToAddress(owner) {
|
28
|
+
return sha256B64Url(fromB64Url(owner));
|
29
|
+
}
|
30
|
+
exports.ownerToAddress = ownerToAddress;
|
31
|
+
function fromB64Url(input) {
|
32
|
+
const paddingLength = input.length % 4 === 0 ? 0 : 4 - (input.length % 4);
|
33
|
+
const base64 = input
|
34
|
+
.replace(/-/g, '+')
|
35
|
+
.replace(/_/g, '/')
|
36
|
+
.concat('='.repeat(paddingLength));
|
37
|
+
return Buffer.from(base64, 'base64');
|
38
|
+
}
|
39
|
+
exports.fromB64Url = fromB64Url;
|
40
|
+
function toB64Url(buffer) {
|
41
|
+
return (0, utils_js_1.bufferTob64Url)(buffer);
|
42
|
+
}
|
43
|
+
exports.toB64Url = toB64Url;
|
44
|
+
function sha256B64Url(input) {
|
45
|
+
return toB64Url((0, crypto_1.createHash)('sha256').update(input).digest());
|
46
|
+
}
|
47
|
+
exports.sha256B64Url = sha256B64Url;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FailedRequestError = exports.UnauthenticatedRequestError = void 0;
|
4
|
+
/**
|
5
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
6
|
+
*
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Affero General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Affero General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
class UnauthenticatedRequestError extends Error {
|
21
|
+
constructor() {
|
22
|
+
super('Failed authentication. JWK is required.');
|
23
|
+
this.name = 'UnauthenticatedRequestError';
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.UnauthenticatedRequestError = UnauthenticatedRequestError;
|
27
|
+
class FailedRequestError extends Error {
|
28
|
+
constructor(status, message) {
|
29
|
+
super(`Failed request: ${status}: ${message}`);
|
30
|
+
this.name = 'FailedRequestError';
|
31
|
+
}
|
32
|
+
}
|
33
|
+
exports.FailedRequestError = FailedRequestError;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.readableStreamToBuffer = void 0;
|
13
|
+
function readableStreamToBuffer({ stream, }) {
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
15
|
+
const reader = stream.getReader();
|
16
|
+
const chunks = [];
|
17
|
+
let done = false;
|
18
|
+
while (!done) {
|
19
|
+
const { done: streamDone, value } = yield reader.read();
|
20
|
+
done = streamDone;
|
21
|
+
if (!done) {
|
22
|
+
chunks.push(value);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
return Buffer.concat(chunks);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
exports.readableStreamToBuffer = readableStreamToBuffer;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TurboFactory = void 0;
|
4
|
+
/**
|
5
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
6
|
+
*
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Affero General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Affero General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
*/
|
20
|
+
const factory_js_1 = require("../common/factory.js");
|
21
|
+
const index_js_1 = require("../common/index.js");
|
22
|
+
const signer_js_1 = require("./signer.js");
|
23
|
+
class TurboFactory extends factory_js_1.TurboBaseFactory {
|
24
|
+
static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
|
25
|
+
const signer = new signer_js_1.TurboWebArweaveSigner({ privateKey });
|
26
|
+
const paymentService = new index_js_1.TurboAuthenticatedPaymentService(Object.assign(Object.assign({}, paymentServiceConfig), { signer }));
|
27
|
+
const uploadService = new index_js_1.TurboAuthenticatedUploadService(Object.assign(Object.assign({}, uploadServiceConfig), { signer }));
|
28
|
+
return new index_js_1.TurboAuthenticatedClient({
|
29
|
+
uploadService,
|
30
|
+
paymentService,
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
exports.TurboFactory = TurboFactory;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
/**
|
18
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
19
|
+
*
|
20
|
+
* This program is free software: you can redistribute it and/or modify
|
21
|
+
* it under the terms of the GNU Affero General Public License as published by
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
23
|
+
* (at your option) any later version.
|
24
|
+
*
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28
|
+
* GNU Affero General Public License for more details.
|
29
|
+
*
|
30
|
+
* You should have received a copy of the GNU Affero General Public License
|
31
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
32
|
+
*/
|
33
|
+
__exportStar(require("./factory.js"), exports);
|
34
|
+
__exportStar(require("./signer.js"), exports);
|
35
|
+
__exportStar(require("../common/index.js"), exports);
|
36
|
+
__exportStar(require("../types.js"), exports);
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.TurboWebArweaveSigner = void 0;
|
16
|
+
/**
|
17
|
+
* Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
|
18
|
+
*
|
19
|
+
* This program is free software: you can redistribute it and/or modify
|
20
|
+
* it under the terms of the GNU Affero General Public License as published by
|
21
|
+
* the Free Software Foundation, either version 3 of the License, or
|
22
|
+
* (at your option) any later version.
|
23
|
+
*
|
24
|
+
* This program is distributed in the hope that it will be useful,
|
25
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27
|
+
* GNU Affero General Public License for more details.
|
28
|
+
*
|
29
|
+
* You should have received a copy of the GNU Affero General Public License
|
30
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
31
|
+
*/
|
32
|
+
const arbundles_1 = require("arbundles");
|
33
|
+
const arweave_1 = __importDefault(require("arweave"));
|
34
|
+
const node_crypto_1 = require("node:crypto");
|
35
|
+
const base64_js_1 = require("../utils/base64.js");
|
36
|
+
const readableStream_js_1 = require("../utils/readableStream.js");
|
37
|
+
class TurboWebArweaveSigner {
|
38
|
+
constructor({ privateKey }) {
|
39
|
+
this.privateKey = privateKey;
|
40
|
+
this.signer = new arbundles_1.ArweaveSigner(this.privateKey);
|
41
|
+
}
|
42
|
+
signDataItem({ fileStreamFactory, }) {
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
44
|
+
// TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
|
45
|
+
const buffer = yield (0, readableStream_js_1.readableStreamToBuffer)({
|
46
|
+
stream: fileStreamFactory(),
|
47
|
+
// TODO: add payload size to get performance improvements
|
48
|
+
});
|
49
|
+
const signedDataItem = (0, arbundles_1.createData)(buffer, this.signer);
|
50
|
+
yield signedDataItem.sign(this.signer);
|
51
|
+
return signedDataItem.getRaw();
|
52
|
+
});
|
53
|
+
}
|
54
|
+
// 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
|
55
|
+
generateSignedRequestHeaders() {
|
56
|
+
var _a;
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
58
|
+
// a bit hacky - but arweave exports cause issues in tests vs. browser
|
59
|
+
const arweave = (_a = arweave_1.default.default) !== null && _a !== void 0 ? _a : arweave_1.default;
|
60
|
+
const nonce = (0, node_crypto_1.randomBytes)(16).toString('hex');
|
61
|
+
const buffer = Buffer.from(nonce);
|
62
|
+
const signature = yield arweave.crypto.sign(this.privateKey, buffer, {});
|
63
|
+
return {
|
64
|
+
'x-public-key': this.privateKey.n,
|
65
|
+
'x-nonce': nonce,
|
66
|
+
'x-signature': (0, base64_js_1.toB64Url)(Buffer.from(signature)),
|
67
|
+
};
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}
|
71
|
+
exports.TurboWebArweaveSigner = TurboWebArweaveSigner;
|
@@ -23,8 +23,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
23
23
|
* You should have received a copy of the GNU Affero General Public License
|
24
24
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25
25
|
*/
|
26
|
-
import { ArweaveSigner, createData } from 'arbundles
|
27
|
-
import Arweave from 'arweave
|
26
|
+
import { ArweaveSigner, createData } from 'arbundles';
|
27
|
+
import Arweave from 'arweave';
|
28
28
|
import { randomBytes } from 'node:crypto';
|
29
29
|
import { toB64Url } from '../utils/base64.js';
|
30
30
|
import { readableStreamToBuffer } from '../utils/readableStream.js';
|
@@ -47,10 +47,13 @@ export class TurboWebArweaveSigner {
|
|
47
47
|
}
|
48
48
|
// 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
49
|
generateSignedRequestHeaders() {
|
50
|
+
var _a;
|
50
51
|
return __awaiter(this, void 0, void 0, function* () {
|
52
|
+
// a bit hacky - but arweave exports cause issues in tests vs. browser
|
53
|
+
const arweave = (_a = Arweave.default) !== null && _a !== void 0 ? _a : Arweave;
|
51
54
|
const nonce = randomBytes(16).toString('hex');
|
52
55
|
const buffer = Buffer.from(nonce);
|
53
|
-
const signature = yield
|
56
|
+
const signature = yield arweave.crypto.sign(this.privateKey, buffer, {});
|
54
57
|
return {
|
55
58
|
'x-public-key': this.privateKey.n,
|
56
59
|
'x-nonce': nonce,
|
@@ -14,8 +14,9 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { TurboPublicConfiguration } from '../types
|
17
|
+
import { TurboPublicConfiguration } from '../types.js';
|
18
18
|
import { TurboUnauthenticatedClient } from './turbo.js';
|
19
19
|
export declare class TurboBaseFactory {
|
20
20
|
static unauthenticated({ paymentServiceConfig, uploadServiceConfig, }?: TurboPublicConfiguration): TurboUnauthenticatedClient;
|
21
21
|
}
|
22
|
+
//# sourceMappingURL=factory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/common/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAGxD,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,eAAe,CAAC,EACrB,oBAAyB,EACzB,mBAAwB,GACzB,GAAE,wBAA6B;CAYjC"}
|
@@ -21,7 +21,7 @@ import { AxiosInstance } from 'axios';
|
|
21
21
|
import { RetryConfig } from 'retry-axios';
|
22
22
|
import { Readable } from 'stream';
|
23
23
|
import { ReadableStream } from 'stream/web';
|
24
|
-
import { TurboHTTPServiceInterface, TurboSignedRequestHeaders } from '../types
|
24
|
+
import { TurboHTTPServiceInterface, TurboSignedRequestHeaders } from '../types.js';
|
25
25
|
export declare class TurboHTTPService implements TurboHTTPServiceInterface {
|
26
26
|
protected axios: AxiosInstance;
|
27
27
|
constructor({ url, retryConfig, }: {
|
@@ -42,3 +42,4 @@ export declare class TurboHTTPService implements TurboHTTPServiceInterface {
|
|
42
42
|
data: Readable | Buffer | ReadableStream;
|
43
43
|
}): Promise<T>;
|
44
44
|
}
|
45
|
+
//# sourceMappingURL=http.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/http.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,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aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../../src/common/jwk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AACD,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { Currency, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedPaymentServiceInterfaceConfiguration, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboPriceResponse, TurboRatesResponse, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedPaymentServiceInterfaceConfiguration, TurboWalletSigner } from '../types
|
17
|
+
import { Currency, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedPaymentServiceInterfaceConfiguration, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboPriceResponse, TurboRatesResponse, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedPaymentServiceInterfaceConfiguration, TurboWalletSigner } from '../types.js';
|
18
18
|
import { TurboHTTPService } from './http.js';
|
19
19
|
export declare class TurboUnauthenticatedPaymentService implements TurboUnauthenticatedPaymentServiceInterface {
|
20
20
|
protected readonly httpService: TurboHTTPService;
|
@@ -39,3 +39,4 @@ export declare class TurboAuthenticatedPaymentService extends TurboUnauthenticat
|
|
39
39
|
constructor({ url, retryConfig, signer, }: TurboAuthenticatedPaymentServiceInterfaceConfiguration);
|
40
40
|
getBalance(): Promise<TurboBalanceResponse>;
|
41
41
|
}
|
42
|
+
//# sourceMappingURL=payment.d.ts.map
|
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,kCACX,YAAW,2CAA2C;IAEtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAErC,EACV,GAAmC,EACnC,WAAW,GACZ,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,WAAW,EAAE,gBAAgB,CAAC;IACjD,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"}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse } from '../types
|
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
19
|
protected readonly paymentService: TurboUnauthenticatedPaymentServiceInterface;
|
20
20
|
protected readonly uploadService: TurboUnauthenticatedUploadServiceInterface;
|
@@ -71,3 +71,4 @@ export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient
|
|
71
71
|
*/
|
72
72
|
uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
73
73
|
}
|
74
|
+
//# sourceMappingURL=turbo.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"turbo.d.ts","sourceRoot":"","sources":["../../../src/common/turbo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,iCAAiC,EACjC,yCAAyC,EACzC,wCAAwC,EACxC,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,2CAA2C,EAC3C,0CAA0C,EAC1C,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAIrB,qBAAa,0BACX,YAAW,mCAAmC;IAE9C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,2CAA2C,CAAC;IAC/E,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,0CAA0C,CAAC;gBAEjE,EACV,aAAyD,EACzD,cAA2D,GAC5D,EAAE,8BAA8B;IAKjC;;OAEG;IACG,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIlC;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIjD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAI9D;;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,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAM1D;AAED,qBAAa,wBACX,SAAQ,0BACR,YAAW,iCAAiC;IAE5C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,yCAAyC,CAAC;IAC7E,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,wCAAwC,CAAC;gBAE/D,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,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAG1D"}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { TurboAbortSignal, TurboAuthenticatedUploadServiceConfiguration, TurboAuthenticatedUploadServiceInterface, TurboFileFactory, TurboSignedDataItemFactory, TurboUnauthenticatedUploadServiceInterface, TurboUnauthenticatedUploadServiceInterfaceConfiguration, TurboUploadDataItemResponse, TurboWalletSigner } from '../types
|
17
|
+
import { TurboAbortSignal, TurboAuthenticatedUploadServiceConfiguration, TurboAuthenticatedUploadServiceInterface, TurboFileFactory, TurboSignedDataItemFactory, TurboUnauthenticatedUploadServiceInterface, TurboUnauthenticatedUploadServiceInterfaceConfiguration, TurboUploadDataItemResponse, TurboWalletSigner } from '../types.js';
|
18
18
|
import { TurboHTTPService } from './http.js';
|
19
19
|
export declare class TurboUnauthenticatedUploadService implements TurboUnauthenticatedUploadServiceInterface {
|
20
20
|
protected httpService: TurboHTTPService;
|
@@ -27,3 +27,4 @@ export declare class TurboAuthenticatedUploadService extends TurboUnauthenticate
|
|
27
27
|
constructor({ url, retryConfig, signer, }: TurboAuthenticatedUploadServiceConfiguration);
|
28
28
|
uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
29
29
|
}
|
30
|
+
//# sourceMappingURL=upload.d.ts.map
|
@@ -0,0 +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;CAW1D;AAGD,qBAAa,+BACX,SAAQ,iCACR,YAAW,wCAAwC;IAEnD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAExB,EACV,GAAkC,EAClC,WAAW,EACX,MAAM,GACP,EAAE,4CAA4C;IAKzC,UAAU,CAAC,EACf,iBAAiB,EACjB,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAc1D"}
|
@@ -16,7 +16,8 @@
|
|
16
16
|
*/
|
17
17
|
import { TurboBaseFactory } from '../common/factory.js';
|
18
18
|
import { TurboAuthenticatedClient } from '../common/index.js';
|
19
|
-
import { TurboPrivateConfiguration } from '../types
|
19
|
+
import { TurboPrivateConfiguration } from '../types.js';
|
20
20
|
export declare class TurboFactory extends TurboBaseFactory {
|
21
21
|
static authenticated({ privateKey, paymentServiceConfig, uploadServiceConfig, }: TurboPrivateConfiguration): TurboAuthenticatedClient;
|
22
22
|
}
|
23
|
+
//# sourceMappingURL=factory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/node/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,wBAAwB,EAGzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,MAAM,CAAC,aAAa,CAAC,EACnB,UAAU,EACV,oBAAyB,EACzB,mBAAwB,GACzB,EAAE,yBAAyB;CAe7B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
@@ -17,8 +17,8 @@
|
|
17
17
|
*/
|
18
18
|
import { ArweaveSigner } from 'arbundles';
|
19
19
|
import { Readable } from 'node:stream';
|
20
|
-
import { JWKInterface } from '../
|
21
|
-
import { TurboWalletSigner } from '../types
|
20
|
+
import { JWKInterface } from '../common/jwk.js';
|
21
|
+
import { TurboWalletSigner } from '../types.js';
|
22
22
|
export declare class TurboNodeArweaveSigner implements TurboWalletSigner {
|
23
23
|
protected privateKey: JWKInterface;
|
24
24
|
protected signer: ArweaveSigner;
|
@@ -34,3 +34,4 @@ export declare class TurboNodeArweaveSigner implements TurboWalletSigner {
|
|
34
34
|
'x-signature': string;
|
35
35
|
}>;
|
36
36
|
}
|
37
|
+
//# sourceMappingURL=signer.d.ts.map
|
@@ -0,0 +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;AAGhD,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;IAKxD,YAAY,CAAC,EACX,iBAAiB,GAClB,EAAE;QACD,iBAAiB,EAAE,MAAM,QAAQ,CAAC;KACnC,GAAG,OAAO,CAAC,QAAQ,CAAC;IAOf,4BAA4B;;;;;CAWnC"}
|
@@ -21,7 +21,7 @@ import { Readable } from 'node:stream';
|
|
21
21
|
import { ReadableStream } from 'node:stream/web';
|
22
22
|
import { RetryConfig } from 'retry-axios';
|
23
23
|
import winston from 'winston';
|
24
|
-
import { JWKInterface } from './
|
24
|
+
import { JWKInterface } from './common/jwk.js';
|
25
25
|
export type Base64String = string;
|
26
26
|
export type PublicArweaveAddress = Base64String;
|
27
27
|
export type TransactionId = Base64String;
|
@@ -147,3 +147,4 @@ export interface TurboUnauthenticatedClientInterface extends TurboUnauthenticate
|
|
147
147
|
export interface TurboAuthenticatedClientInterface extends TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface {
|
148
148
|
}
|
149
149
|
export {};
|
150
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,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,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CA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C,kBAAkB,EAAE,aAAa,CAAC,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,yCACf,SAAQ,2CAA2C;IACnD,UAAU,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,0CAA0C;IACzD,oBAAoB,CAAC,EACnB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC3D;AAED,MAAM,WAAW,wCACf,SAAQ,0CAA0C;IAClD,UAAU,CAAC,EACT,iBAAiB,GAClB,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,mCACf,SAAQ,2CAA2C,EACjD,0CAA0C;CAAG;AACjD,MAAM,WAAW,iCACf,SAAQ,yCAAyC,EAC/C,wCAAwC;CAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/utils/axiosClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,kCAU7B,uBAAuB,KAAG,aAU5B,CAAC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
|
-
import { JWKInterface } from '../
|
3
|
-
import { Base64String, PublicArweaveAddress } from '../types
|
2
|
+
import { JWKInterface } from '../common/jwk.js';
|
3
|
+
import { Base64String, PublicArweaveAddress } from '../types.js';
|
4
4
|
export declare const base64URLRegex: RegExp;
|
5
5
|
export declare function jwkToPublicArweaveAddress(jwk: JWKInterface): PublicArweaveAddress;
|
6
6
|
export declare function ownerToAddress(owner: Base64String): PublicArweaveAddress;
|
7
7
|
export declare function fromB64Url(input: Base64String): Buffer;
|
8
8
|
export declare function toB64Url(buffer: Buffer): Base64String;
|
9
9
|
export declare function sha256B64Url(input: Buffer): Base64String;
|
10
|
+
//# sourceMappingURL=base64.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/utils/base64.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAwB,CAAC;AAEpD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,YAAY,GAChB,oBAAoB,CAEtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,CAExE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAStD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAErD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAExD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;;CAKrD;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C"}
|
@@ -0,0 +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,GACP,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,CAAC,CAalB"}
|
@@ -16,7 +16,8 @@
|
|
16
16
|
*/
|
17
17
|
import { TurboBaseFactory } from '../common/factory.js';
|
18
18
|
import { TurboAuthenticatedClient } from '../common/index.js';
|
19
|
-
import { TurboPrivateConfiguration } from '../types
|
19
|
+
import { TurboPrivateConfiguration } from '../types.js';
|
20
20
|
export declare class TurboFactory extends TurboBaseFactory {
|
21
21
|
static authenticated({ privateKey, paymentServiceConfig, uploadServiceConfig, }: TurboPrivateConfiguration): TurboAuthenticatedClient;
|
22
22
|
}
|
23
|
+
//# sourceMappingURL=factory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/web/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,wBAAwB,EAGzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,MAAM,CAAC,aAAa,CAAC,EACnB,UAAU,EACV,oBAAyB,EACzB,mBAAwB,GACzB,EAAE,yBAAyB;CAe7B"}
|