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

libkernel

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libkernel - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

3

dist/messages.d.ts
export declare function testMessage(): Promise<string>;
export declare function padAndEncrypt(): Promise<string>;
export declare function upload(filename: string, fileData: Uint8Array): Promise<string>;
export declare function padAndEncrypt(filepath: string, fileData: Uint8Array): Promise<string>;

@@ -28,2 +28,27 @@ import { init, postKernelMessage } from './init';

}
// upload will take a filename and some file data and perform a secure upload
// to Skynet. Secure in this case means that all data is verified before being
// uploaded - the portal cannot lie about the skylink that it returns after
// uploading the data.
//
// TODO: The secure upload caps at about 4 MB of data right now.
export function upload(filename, fileData) {
return new Promise((resolve, reject) => {
init()
.then(x => {
postKernelMessage(resolve, reject, {
kernelMethod: "moduleCall",
module: "AQCS3RHbDlk00IdICFEI1rKZp-VNsnsKWC0n7K-taoAuog",
moduleMethod: "secureUpload",
moduleInput: {
filename,
fileData,
},
});
})
.catch(x => {
reject(x);
});
});
}
// padAndEncrypt will take a filename and file data as input and return a

@@ -34,14 +59,8 @@ // padded, encrypted version of the data that can be privately stored on

// TODO: Need to figure out how to handle the pubkey and the tweak as well.
export function padAndEncrypt() {
// Retrun a promise that will resolve when a response is received from
// the kernel.
// Should padAndEncrypt be telling telling the caller what pubkey and tweak to
// use? Should it outright handle everything? Not sure.
export function padAndEncrypt(filepath, fileData) {
return new Promise((resolve, reject) => {
// Every message should start with init. If initialization has
// already happened, this will be a no-op that instantly
// resolves.
init()
.then(x => {
// Send a 'requestTest' message to the kernel. The
// request test message uniquely doesn't have any other
// parameters.
postKernelMessage(resolve, reject, {

@@ -52,4 +71,4 @@ kernelMethod: "moduleCall",

moduleInput: {
filepath: "test.txt",
fileData: "whatevs",
filepath,
fileData,
},

@@ -59,5 +78,2 @@ });

.catch(x => {
// For some reason, the bridge is not available.
// Likely, this means that the user has not installed
// the browser extension.
reject(x);

@@ -64,0 +80,0 @@ });

{
"name": "libkernel",
"version": "0.0.23",
"version": "0.0.24",
"description": "helper library to interact with the skynet kernel",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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