Skip to content

Commit

Permalink
chore: cleanup comments, fix lib package outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Sep 6, 2023
1 parent 96208ea commit b56216e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import Ardrive from '@ardrive/turbo-sdk/web';

The provided typings (`./lib/types/index.d.ts`) will be automatically recognized, offering type checking and autocompletion benefits.

# APIs
# APIs (WIP)

## TurboFactory

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
"./node": {
"import": "./lib/node/index.js",
"require": "./lib/node/index.js",
"types": "./lib/index.d.ts"
"types": "./lib/types/index.d.ts"
},
"./web": {
"browser": "./bundles/web.bundle.min.js",
"types": "./lib/types/index.d.ts"
"import": "./lib/web/index.js",
"require": "./lib/web/index.js",
"types": "./lib/types/index.d.ts",
"browser": "./bundles/web.bundle.min.js"
}
},
"engines": {
Expand All @@ -42,7 +44,7 @@
"license": "AGPL-3.0-or-later",
"scripts": {
"build:web": "node bundle.cjs",
"build:esm": "yarn tsc -p tsconfig.node.json && cp package.json README.md LICENSE.md ./lib",
"build:esm": "yarn tsc -p tsconfig.node.json && yarn tsc -p tsconfig.web.json && cp package.json README.md LICENSE.md ./lib",
"build": "yarn clean && yarn build:web && yarn build:esm",
"clean": "rimraf [ lib coverage bundles ]",
"postinstall": "husky install",
Expand Down
2 changes: 1 addition & 1 deletion src/web/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class TurboWebArweaveSigner implements TurboWalletSigner {
// TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
const buffer = await readableStreamToBuffer({
stream: fileStreamFactory(),
// TODO: add payload size to get performance improvements
});
const signedDataItem = createData(buffer, this.signer);
await signedDataItem.sign(this.signer);
Expand All @@ -49,7 +50,6 @@ export class TurboWebArweaveSigner implements TurboWalletSigner {

// 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
async generateSignedRequestHeaders() {
// due to exports of SubtleCrypto - we need to import the module dynamically
const nonce = randomBytes(16).toString('hex');
const buffer = Buffer.from(nonce);
const signature = await Arweave.default.crypto.sign(
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.web.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": true
},
"include": ["src/web", "src/common", "src/utils"]
}

0 comments on commit b56216e

Please sign in to comment.