Comparing version 0.4.0 to 0.5.0
@@ -1,4 +0,4 @@ | ||
import { Signer } from '../build/signing'; | ||
import FileBundle from './FileBundle'; | ||
import FileDataItem from './FileDataItem'; | ||
import { Signer } from "../src/signing"; | ||
import FileBundle from "./FileBundle"; | ||
import FileDataItem from "./FileDataItem"; | ||
export declare function bundleAndSignData(dataItems: FileDataItem[], signer: Signer, dir?: string): Promise<FileBundle>; |
@@ -28,3 +28,3 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const utils_1 = require("../build/utils"); | ||
const utils_1 = require("../src/utils"); | ||
const FileBundle_1 = __importDefault(require("./FileBundle")); | ||
@@ -50,2 +50,2 @@ async function bundleAndSignData(dataItems, signer, dir) { | ||
exports.bundleAndSignData = bundleAndSignData; | ||
//# sourceMappingURL=bundleData.js.map | ||
//# sourceMappingURL=bundleData.js.map |
/// <reference types="node" /> | ||
import FileDataItem from "./FileDataItem"; | ||
import { DataItemCreateOptions } from "../build/ar-data-base"; | ||
import { Signer } from '../build/signing'; | ||
import { DataItemCreateOptions } from "../src"; | ||
import { Signer } from "../src/signing"; | ||
export declare function createData(data: string | Uint8Array | NodeJS.ReadableStream, signer: Signer, opts?: DataItemCreateOptions): Promise<FileDataItem>; |
@@ -31,6 +31,7 @@ "use strict"; | ||
const assert_1 = __importDefault(require("assert")); | ||
const utils_1 = require("../build/utils"); | ||
const parser_1 = require("../build/parser"); | ||
const utils_1 = require("../src/utils"); | ||
const parser_1 = require("../src/parser"); | ||
const promises_1 = require("stream/promises"); | ||
async function createData(data, signer, opts) { | ||
var _a, _b, _c, _d, _e; | ||
const filename = await tmp_promise_1.tmpName(); | ||
@@ -41,5 +42,5 @@ const stream = fs.createWriteStream(filename); | ||
const _owner = signer.publicKey; | ||
const _target = opts?.target ? base64url_1.default.toBuffer(opts.target) : null; | ||
const _anchor = opts?.anchor ? Buffer.from(opts.anchor) : null; | ||
const _tags = (opts?.tags?.length ?? 0) > 0 ? await parser_1.serializeTags(opts.tags) : null; | ||
const _target = (opts === null || opts === void 0 ? void 0 : opts.target) ? base64url_1.default.toBuffer(opts.target) : null; | ||
const _anchor = (opts === null || opts === void 0 ? void 0 : opts.anchor) ? Buffer.from(opts.anchor) : null; | ||
const _tags = ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.tags) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0 ? await parser_1.serializeTags(opts.tags) : null; | ||
stream.write(utils_1.shortTo2ByteArray(signer.signatureType)); | ||
@@ -62,4 +63,4 @@ // Signature | ||
// TODO: Finish this | ||
stream.write(utils_1.longTo8ByteArray(opts?.tags?.length ?? 0)); | ||
const bytesCount = utils_1.longTo8ByteArray(_tags?.byteLength ?? 0); | ||
stream.write(utils_1.longTo8ByteArray((_d = (_c = opts === null || opts === void 0 ? void 0 : opts.tags) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0)); | ||
const bytesCount = utils_1.longTo8ByteArray((_e = _tags === null || _tags === void 0 ? void 0 : _tags.byteLength) !== null && _e !== void 0 ? _e : 0); | ||
stream.write(bytesCount); | ||
@@ -85,2 +86,2 @@ if (_tags) { | ||
} | ||
//# sourceMappingURL=createData.js.map | ||
//# sourceMappingURL=createData.js.map |
@@ -28,4 +28,4 @@ "use strict"; | ||
const util_1 = require("util"); | ||
const utils_1 = require("../build/utils"); | ||
const parser_1 = require("../build/parser"); | ||
const utils_1 = require("../src/utils"); | ||
const parser_1 = require("../src/parser"); | ||
const base64url_1 = __importDefault(require("base64url")); | ||
@@ -91,4 +91,5 @@ const read = util_1.promisify(fs.read); | ||
async function getId(file, options) { | ||
var _a; | ||
const fd = await fileToFd(file); | ||
const offset = options.offset ?? 0; | ||
const offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0; | ||
const buffer = await read(fd.fd, Buffer.allocUnsafe(512), offset, 512, null).then((r) => r.buffer); | ||
@@ -100,4 +101,5 @@ await fd.close(); | ||
async function getSignature(file, options) { | ||
var _a; | ||
const fd = await fileToFd(file); | ||
const offset = options.offset ?? 0; | ||
const offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0; | ||
const buffer = await read(fd.fd, Buffer.allocUnsafe(512), offset, 512, null).then((r) => r.buffer); | ||
@@ -109,4 +111,5 @@ await fd.close(); | ||
async function getOwner(file, options) { | ||
var _a; | ||
const fd = await fileToFd(file); | ||
const offset = options.offset ?? 0; | ||
const offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0; | ||
const buffer = await read(fd.fd, Buffer.allocUnsafe(512), offset + 512, 512, null).then((r) => r.buffer); | ||
@@ -118,4 +121,5 @@ await fd.close(); | ||
async function getTarget(file, options) { | ||
var _a; | ||
const fd = await fileToFd(file); | ||
const offset = options.offset ?? 0; | ||
const offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0; | ||
const targetStart = offset + 1024; | ||
@@ -132,4 +136,5 @@ const targetPresent = await read(fd.fd, Buffer.allocUnsafe(1), targetStart, 1, null).then((value) => value.buffer[0] == 1); | ||
async function getAnchor(file, options) { | ||
var _a; | ||
const fd = await fileToFd(file); | ||
const offset = options.offset ?? 0; | ||
const offset = (_a = options.offset) !== null && _a !== void 0 ? _a : 0; | ||
const targetPresent = await read(fd.fd, Buffer.allocUnsafe(1), 1024, 1, null).then((value) => value.buffer[0] == 1); | ||
@@ -150,5 +155,6 @@ let anchorStart = offset + 1025; | ||
async function getTags(file, options) { | ||
var _a, _b; | ||
const fd = await fileToFd(file); | ||
const offset = options?.offset ?? 0; | ||
let tagsStart = 512 + 512 + 2 + (options?.offset ?? 0); | ||
const offset = (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : 0; | ||
let tagsStart = 512 + 512 + 2 + ((_b = options === null || options === void 0 ? void 0 : options.offset) !== null && _b !== void 0 ? _b : 0); | ||
const targetPresent = await read(fd.fd, Buffer.allocUnsafe(1), 0, 1, offset + 1024).then((value) => value.buffer[0] == 1); | ||
@@ -170,2 +176,2 @@ tagsStart += targetPresent ? 32 : 0; | ||
exports.getTags = getTags; | ||
//# sourceMappingURL=file.js.map | ||
//# sourceMappingURL=file.js.map |
/// <reference types="node" /> | ||
import { BundleInterface } from "../build/BundleInterface"; | ||
import { BundleInterface } from "../src/BundleInterface"; | ||
import FileDataItem from "./FileDataItem"; | ||
@@ -7,3 +7,3 @@ import { PathLike } from "fs"; | ||
import Transaction from "arweave/node/lib/transaction"; | ||
import { JWKInterface } from "../build/interface-jwk"; | ||
import { JWKInterface } from "../src/interface-jwk"; | ||
export default class FileBundle implements BundleInterface { | ||
@@ -10,0 +10,0 @@ readonly headerFile: PathLike; |
@@ -27,3 +27,3 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const utils_1 = require("../build/utils"); | ||
const utils_1 = require("../src/utils"); | ||
const multistream_1 = __importDefault(require("multistream")); | ||
@@ -155,2 +155,2 @@ const util_1 = require("util"); | ||
exports.default = FileBundle; | ||
//# sourceMappingURL=FileBundle.js.map | ||
//# sourceMappingURL=FileBundle.js.map |
/// <reference types="node" /> | ||
import { PathLike } from "fs"; | ||
import { BundleItem } from "../build/BundleItem"; | ||
import { Signer } from "../build/signing"; | ||
import { BundleItem } from "../src/BundleItem"; | ||
import { Signer } from "../src/signing"; | ||
import { AxiosResponse } from "axios"; | ||
@@ -6,0 +6,0 @@ export default class FileDataItem implements BundleItem { |
@@ -27,11 +27,11 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const utils_1 = require("../build/utils"); | ||
const parser_1 = require("../build/parser"); | ||
const index_1 = require("../build"); | ||
const utils_1 = require("../src/utils"); | ||
const parser_1 = require("../src/parser"); | ||
const src_1 = require("../src"); | ||
const utils_2 = require("arweave/web/lib/utils"); | ||
const arweave_1 = __importDefault(require("arweave")); | ||
const util_1 = require("util"); | ||
const signing_1 = require("../build/signing"); | ||
const signing_1 = require("../src/signing"); | ||
const axios_1 = __importDefault(require("axios")); | ||
const constants_1 = require("../build/constants"); | ||
const constants_1 = require("../src/constants"); | ||
const write = util_1.promisify(fs.write); | ||
@@ -45,3 +45,4 @@ const read = util_1.promisify(fs.read); | ||
async signatureLength() { | ||
const length = constants_1.SIG_CONFIG[await this.signatureType()]?.sigLength; | ||
var _a; | ||
const length = (_a = constants_1.SIG_CONFIG[await this.signatureType()]) === null || _a === void 0 ? void 0 : _a.sigLength; | ||
if (!length) | ||
@@ -52,3 +53,4 @@ throw new Error("Signature type not supported"); | ||
async ownerLength() { | ||
const length = constants_1.SIG_CONFIG[await this.signatureType()]?.pubLength; | ||
var _a; | ||
const length = (_a = constants_1.SIG_CONFIG[await this.signatureType()]) === null || _a === void 0 ? void 0 : _a.pubLength; | ||
if (!length) | ||
@@ -96,3 +98,3 @@ throw new Error("Signature type not supported"); | ||
const owner = await item.rawOwner(); | ||
const signatureData = await index_1.deepHash([ | ||
const signatureData = await src_1.deepHash([ | ||
utils_2.stringToBuffer("dataitem"), | ||
@@ -226,3 +228,3 @@ utils_2.stringToBuffer("1"), | ||
const dataStart = await this.dataStart(); | ||
const signatureData = await index_1.deepHash([ | ||
const signatureData = await src_1.deepHash([ | ||
utils_2.stringToBuffer("dataitem"), | ||
@@ -291,2 +293,2 @@ utils_2.stringToBuffer("1"), | ||
exports.default = FileDataItem; | ||
//# sourceMappingURL=FileDataItem.js.map | ||
//# sourceMappingURL=FileDataItem.js.map |
{ | ||
"name": "arbundles", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Arweave bundling library", | ||
"author": "Josh Benaron <joshbenaron@gmail.com>", | ||
"license": "Apache-2.0", | ||
"main": "build/index.js", | ||
"types": "build/index.d.ts", | ||
"main": "src/index.js", | ||
"types": "src/index.d.ts", | ||
"files": [ | ||
"build/**/*.js", | ||
"/build/**/*.ts", | ||
"file/**/*" | ||
"build/**/*.ts", | ||
"file/**/*.ts", | ||
"file/**/*.js", | ||
"stream/**/*.ts", | ||
"stream/**/*.js", | ||
"src/**/*.ts", | ||
"src/**/*.js" | ||
], | ||
"scripts": { | ||
"build": "rm -rf file lib build && tsc", | ||
"build": "tsc", | ||
"lint": "eslint ./src -c ./.eslintrc.json --ext .ts,.tsx", | ||
@@ -48,2 +53,3 @@ "test": "jest --coverage", | ||
"@akiroz/size-chunker-stream": "^0.0.1", | ||
"@noble/ed25519": "^1.3.0", | ||
"@toruslabs/eccrypto": "^1.1.7", | ||
@@ -67,3 +73,2 @@ "@types/axios": "^0.14.0", | ||
"multistream": "^4.1.0", | ||
"noble-ed25519": "^1.2.6", | ||
"secp256k1": "^4.0.2", | ||
@@ -70,0 +75,0 @@ "starkbank-ecdsa": "^1.1.2", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
218874
5728
108
1
+ Added@noble/ed25519@^1.3.0
+ Added@noble/ed25519@1.7.3(transitive)
- Removednoble-ed25519@^1.2.6
- Removednoble-ed25519@1.2.6(transitive)