Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libskynet

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libskynet - npm Package Compare versions

Comparing version 0.0.58 to 0.0.59

21

dist/inode.js

@@ -0,1 +1,3 @@

import { bufToB64 } from "./encoding.js";
import { sha512 } from "./sha512.js";
// namespaceInode is a function for namespacing inodes based on the type of

@@ -7,5 +9,7 @@ // file that is being used, this way a file that is created using

// files on Skynet.
//
// No cryptography is needed here, the inodes don't get exposed publicly.
function namespaceInode(filetype, inode) {
// We pad out the filetype to 32 characters to ensure that two different
// filetypes can never have a filetype+inode combination that will collide.
// If the filetype is different, the final result will definitely also be
// different.
if (filetype.length > 32) {

@@ -15,6 +19,15 @@ return ["", "filetype can be at most 32 characters"];

while (filetype.length < 32) {
filetype += "__";
filetype += "_";
}
return [filetype + inode, null];
// Add the inode to the extended filetype.
filetype += inode;
// We hash the result to make it smaller. Because we use this as an
// encryption key and not for authentication, our security model only
// requires 16 bits of entropy. We therefore only take the first 16 bytes
// of the hash and return the base64 encoded string.
const fullHash = sha512(new TextEncoder().encode(filetype + inode));
const quarterHash = fullHash.slice(0, 16);
const b64 = bufToB64(quarterHash);
return [b64, null];
}
export { namespaceInode };

2

package.json
{
"name": "libskynet",
"version": "0.0.58",
"version": "0.0.59",
"author": "Skynet Labs",

@@ -5,0 +5,0 @@ "description": "helper library to interact with skynet's low level primitives",

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