libkernel
Advanced tools
Comparing version 0.0.67 to 0.0.68
@@ -8,3 +8,3 @@ export { blake2b } from "./blake2b.js"; | ||
export { addLeafBytesToBlake2bProofStack, blake2bMerkleRoot, blake2bProofStackRoot } from "./merkle.js"; | ||
export { testMessage, callModule, upload, padAndEncrypt } from "./messages.js"; | ||
export { testMessage, callModule, upload } from "./messages.js"; | ||
export { taggedRegistryEntryKeys, deriveRegistryEntryID, resolverLink } from "./registry.js"; | ||
@@ -11,0 +11,0 @@ export { generateSeedPhraseDeterministic, validSeedPhrase } from "./seed.js"; |
@@ -8,3 +8,3 @@ export { blake2b } from "./blake2b.js"; | ||
export { addLeafBytesToBlake2bProofStack, blake2bMerkleRoot, blake2bProofStackRoot } from "./merkle.js"; | ||
export { testMessage, callModule, upload, padAndEncrypt } from "./messages.js"; | ||
export { testMessage, callModule, upload } from "./messages.js"; | ||
export { taggedRegistryEntryKeys, deriveRegistryEntryID, resolverLink } from "./registry.js"; | ||
@@ -11,0 +11,0 @@ export { generateSeedPhraseDeterministic, validSeedPhrase } from "./seed.js"; |
export declare function testMessage(): Promise<string>; | ||
export declare function callModule(module: string, method: string, data: any): Promise<any>; | ||
export declare function upload(filename: string, fileData: Uint8Array): Promise<string>; | ||
export declare function padAndEncrypt(filepath: string, fileData: Uint8Array): Promise<string>; |
@@ -115,3 +115,3 @@ import { composeErr } from "./err.js"; | ||
data: { | ||
module: "AQBPTRusvKdVkFKz7mVaP8nCFxKEMBI3u59gd-Y9CiBarg", | ||
module: "AQAT_a0MzOInZoJzt1CwBM2U8oQ3GIfP5yKKJu8Un-SfNg", | ||
method: "secureUpload", | ||
@@ -137,34 +137,1 @@ data: { | ||
} | ||
// padAndEncrypt will take a filename and file data as input and return a | ||
// padded, encrypted version of the data that can be privately stored on | ||
// Skynet. | ||
// | ||
// TODO: Need to figure out how to handle the pubkey and the tweak as well. | ||
// 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) => { | ||
init() | ||
.then(() => { | ||
let [, query] = newKernelQuery({ | ||
kernelMethod: "moduleCall", | ||
module: "AQAs00kS6OKUd-FIWj9qdJLArCiEDMVgYBSkaetuTF-MsQ", | ||
moduleMethod: "padAndEncrypt", | ||
moduleInput: { | ||
filepath, | ||
fileData, | ||
}, | ||
}, null); | ||
query | ||
.then((response) => { | ||
resolve(response.output); | ||
}) | ||
.catch((response) => { | ||
reject(response.err); | ||
}); | ||
}) | ||
.catch((x) => { | ||
reject(x); | ||
}); | ||
}); | ||
} |
{ | ||
"name": "libkernel", | ||
"version": "0.0.67", | ||
"version": "0.0.68", | ||
"description": "helper library to interact with skynet and the skynet kernel", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
## libkernel | ||
Work in progress | ||
libkernel is a node module for web developers that would like to use the Skynet | ||
kernel in their applications, or would like to build modules for the Skynet | ||
kernel. It contains a bunch of helper functions and syntax sugar for | ||
interacting with the kernel itself, and it also contains a bunch of functions | ||
for dealing with Skynet objects such as skylinks. | ||
libkernel for the time being should be considered highly unstable - there is | ||
ongoing discussion about whether the scope of libkernel is too broad and | ||
whether some of the Skynet related functions should be split out into their own | ||
libraries. Methods you depend on today may be gone or have altered APIs | ||
tomorrow, we hope to have libkernel in a stable place within the next 2-3 | ||
weeks. | ||
A particular quirk of libkernel is that errors are always of the type `string | null` rather than being of type `Error`. This is because libkernel is | ||
frequently used in webworkers and other settings where errors need to be | ||
serialized and send over postMessage, and the `Error` type is generally not | ||
suitable for this. We therefore use strings everywhere as errors, to ensure | ||
that libkernel can be used in all relevant places. |
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
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
21
108576
3708