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.3 to 0.0.4

2

dist/index.d.ts
export { sayHello, sayGoodbye } from './hello-world';
export { kernelBridgeInit, kernelBridgeRequestTest } from './messages';
export { init, testMessage } from './messages';
export { sayHello, sayGoodbye } from './hello-world';
export { kernelBridgeInit, kernelBridgeRequestTest } from './messages';
export { init, testMessage } from './messages';

@@ -1,2 +0,2 @@

export declare function kernelBridgeInit(): void;
export declare function kernelBridgeRequestTest(): void;
export declare function init(): void;
export declare function testMessage(): Promise<unknown>;

@@ -1,7 +0,9 @@

// kernelBridgeInit will add an event listener for messages from the kernel
// bridge.
// TODO: Need to write the nonce framework.
var nextNonce = 0;
var queries = new Object();
// init will add an event listener for messages from the kernel bridge.
//
// TODO: Init should check whether the bridge exists and throw an error if it
// does not.
export function kernelBridgeInit() {
// does not. Ideally init can tell if there's a browser extension.
export function init() {
window.addEventListener("message", function (event) {

@@ -14,17 +16,24 @@ if (!("data" in event) || !("method" in event.data)) {

}
console.log("got message from bridge");
console.log("got message from bridge\n", event, "\n", event.data);
});
}
// kernelBridgeRequestTest will send a message to the bridge asking for a
// kernel test.
// kernelRequestTest will send a message to the bridge asking for a kernel
// test.
//
// TODO: Function should know if the bridge exists and if the init worked.
export function kernelBridgeRequestTest() {
window.postMessage({
method: "kernelMessage",
nonce: 1,
kernelMessage: {
kernelMethod: "requestTest",
},
}, window.location.origin);
//
// TODO: Need to block until kenrel is loaded.
export function testMessage() {
return new Promise(resolve => {
let nonce = nextNonce;
nextNonce++;
queries[nonce] = resolve;
window.postMessage({
method: "kernelMessage",
nonce,
kernelMessage: {
kernelMethod: "requestTest",
},
}, window.location.origin);
});
}
{
"name": "libkernel",
"version": "0.0.3",
"version": "0.0.4",
"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