New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@web3-storage/data-segment

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-storage/data-segment - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

2

dist/src/api.d.ts

@@ -73,3 +73,3 @@ import type { Link, ToString } from 'multiformats';

*
* Returns the offset + number of bytes written.
* Returns the number of bytes that were written.
*/

@@ -76,0 +76,0 @@ digestInto(output: Uint8Array, offset?: number, asMultihash?: boolean): number;

@@ -18,2 +18,6 @@ /**

export const ROOT_SIZE: 32;
/**
* Size of the multihash digest in bytes.
*/
export const MAX_DIGEST_SIZE: number;
export const TAG_SIZE: number;

@@ -20,0 +24,0 @@ /**

{
"name": "@web3-storage/data-segment",
"description": "Implementation of [FRC-0058](https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0058.md) verifiable aggregation scheme",
"version": "4.0.0",
"version": "5.0.0",
"keywords": [

@@ -6,0 +6,0 @@ "FRC-0058",

@@ -98,3 +98,3 @@ import type { Link, ToString } from 'multiformats'

*
* Returns the offset + number of bytes written.
* Returns the number of bytes that were written.
*/

@@ -101,0 +101,0 @@ digestInto(output: Uint8Array, offset?: number, asMultihash?: boolean): number

@@ -40,6 +40,7 @@ import { varint } from 'multiformats'

export const ROOT_SIZE = SHA256.size
/**
* Size of the multihash digest in bytes.
*/
const MAX_DIGEST_SIZE = MAX_PADDING_SIZE + HEIGHT_SIZE + SHA256.size
export const MAX_DIGEST_SIZE = MAX_PADDING_SIZE + HEIGHT_SIZE + SHA256.size

@@ -46,0 +47,0 @@ export const TAG_SIZE = varint.encodingLength(code)

@@ -169,25 +169,27 @@ import * as API from './api.js'

let endOffset = byteOffset
// Write the multihash prefix if requested
if (asMultihash) {
varint.encodeTo(code, output, byteOffset)
byteOffset += Digest.TAG_SIZE
varint.encodeTo(code, output, endOffset)
endOffset += Digest.TAG_SIZE
const size = paddingLength + Digest.HEIGHT_SIZE + Digest.ROOT_SIZE
const sizeLength = varint.encodingLength(size)
varint.encodeTo(size, output, byteOffset)
byteOffset += sizeLength
varint.encodeTo(size, output, endOffset)
endOffset += sizeLength
}
varint.encodeTo(padding, output, byteOffset)
byteOffset += paddingLength
varint.encodeTo(padding, output, endOffset)
endOffset += paddingLength
// Write the tree height as the first byte of the digest
output[byteOffset] = height
byteOffset += 1
output[endOffset] = height
endOffset += 1
// Write the root as the remaining 32 bytes of the digest
output.set(root, byteOffset)
byteOffset += root.length
output.set(root, endOffset)
endOffset += root.length
return byteOffset
// Return number of bytes written
return endOffset - byteOffset
}

@@ -194,0 +196,0 @@ /**

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc