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

wnfs

Package Overview
Dependencies
Maintainers
8
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wnfs - npm Package Compare versions

Comparing version 0.1.21 to 0.1.22

2

package.json

@@ -8,3 +8,3 @@ {

"description": "WebNative Filesystem API (WebAssembly)",
"version": "0.1.21",
"version": "0.1.22",
"license": "Apache-2.0",

@@ -11,0 +11,0 @@ "repository": {

@@ -46,6 +46,7 @@ ## Wasm WNFS

WNFS does not have an opinion on where you want to persist your content or the file tree. Instead, the API expects any object that implements the async [`BlockStore`][blockstore-trait] interface. This implementation also defers system-level operations to the user; requiring that operations like time and random number generation be passed in from the interface. This makes for a clean wasm interface that works everywhere.
Let's see an example of working with a public directory. Here we are going to use a custom-written memory-based blockstore.
WNFS does not have an opinion on where you want to persist your content or the file tree. Instead, the API takes any object that implements the asynchronous [`BlockStore`][blockstore-trait] trait. The library also avoids including system function calls that could possibly tie it to a set of platforms. Operations like time and random number generation have to be passed in via the API. This allows the library to be used in a wide variety of environments. It particularly makes virtualisation easier.
Let's see an example of working with a public filesystem. We will use a user-provided in-memory block store.
```js

@@ -174,3 +175,3 @@ import { MemoryBlockStore } from "<custom>";

[blockstore-trait]: https://github.com/wnfs-wg/rs-wnfs/blob/main/wnfs/src/common/blockstore.rs
[blockstore-trait]: https://github.com/wnfs-wg/rs-wnfs/blob/main/wnfs-common/src/blockstore.rs
[hamt-wiki]: https://en.wikipedia.org/wiki/Hash_array_mapped_trie

@@ -177,0 +178,0 @@ [ipld-spec]: https://ipld.io/

/* tslint:disable */
/* eslint-disable */
/**
* @param {SharePayload} share_payload
* @param {AccessKey} access_key
* @param {number} share_count
* @param {string} sharer_root_did
* @param {PrivateForest} sharer_forest
* @param {BlockStore} sharer_store
* @param {Uint8Array} recipient_exchange_root
* @param {BlockStore} recipient_store
* @param {BlockStore} store
* @returns {Promise<any>}
*/
export function share(share_payload: SharePayload, share_count: number, sharer_root_did: string, sharer_forest: PrivateForest, sharer_store: BlockStore, recipient_exchange_root: Uint8Array, recipient_store: BlockStore): Promise<any>;
export function share(access_key: AccessKey, share_count: number, sharer_root_did: string, sharer_forest: PrivateForest, recipient_exchange_root: Uint8Array, store: BlockStore): Promise<any>;
/**

@@ -27,6 +26,6 @@ * @param {number} share_count

* @param {PrivateForest} sharer_forest
* @param {BlockStore} sharer_store
* @param {BlockStore} store
* @returns {Promise<any>}
*/
export function findLatestShareCounter(share_count: number, limit: number, recipient_exchange_key: Uint8Array, sharer_root_did: string, sharer_forest: PrivateForest, sharer_store: BlockStore): Promise<any>;
export function findLatestShareCounter(share_count: number, limit: number, recipient_exchange_key: Uint8Array, sharer_root_did: string, sharer_forest: PrivateForest, store: BlockStore): Promise<any>;
/**

@@ -36,6 +35,6 @@ * @param {Namefilter} share_label

* @param {PrivateForest} sharer_forest
* @param {BlockStore} sharer_store
* @param {BlockStore} store
* @returns {Promise<any>}
*/
export function receiveShare(share_label: Namefilter, recipient_key: PrivateKey, sharer_forest: PrivateForest, sharer_store: BlockStore): Promise<any>;
export function receiveShare(share_label: Namefilter, recipient_key: PrivateKey, sharer_forest: PrivateForest, store: BlockStore): Promise<any>;
/**

@@ -48,16 +47,2 @@ * Panic hook lets us get better error messages if our Rust code ever panics.

export function setPanicHook(): void;
/**
* Represents the format the content a CID points to.
*
* The variants are based on the ipld and multiformats specification.
*
* - https://ipld.io/docs/codecs/#known-codecs
* - https://github.com/multiformats/multicodec/blob/master/table.csv
*/
export enum Code {
DagProtobuf = 112,
DagCbor = 113,
DagJson = 297,
Raw = 85,
}

@@ -71,2 +56,19 @@ export interface BlockStore {

/**
*/
export class AccessKey {
free(): void;
/**
* @returns {Uint8Array}
*/
getLabel(): Uint8Array;
/**
* @returns {Uint8Array}
*/
getTemporalKey(): Uint8Array;
/**
* @returns {Uint8Array}
*/
getContentCid(): Uint8Array;
}
/**
* A block store provided by the host (JavaScript) for custom implementation like connection to the IPFS network.

@@ -386,4 +388,4 @@ */

/**
* Loads a node from the PrivateForest using the PrivateRef.
* @param {PrivateRef} private_ref
* Loads a node from the PrivateForest using the AccessKey.
* @param {AccessKey} access_key
* @param {PrivateForest} forest

@@ -393,3 +395,3 @@ * @param {BlockStore} store

*/
static load(private_ref: PrivateRef, forest: PrivateForest, store: BlockStore): Promise<any>;
static load(access_key: AccessKey, forest: PrivateForest, store: BlockStore): Promise<any>;
/**

@@ -417,25 +419,2 @@ * @returns {PrivateDirectory}

/**
*/
export class PrivateRef {
free(): void;
/**
* @param {Uint8Array} label
* @param {Uint8Array} temporal_key
* @param {Uint8Array} content_cid
*/
constructor(label: Uint8Array, temporal_key: Uint8Array, content_cid: Uint8Array);
/**
* @returns {Uint8Array}
*/
getLabel(): Uint8Array;
/**
* @returns {Uint8Array}
*/
getTemporalKey(): Uint8Array;
/**
* @returns {Uint8Array}
*/
getContentCid(): Uint8Array;
}
/**
* A directory in a WNFS public file system.

@@ -631,20 +610,2 @@ */

}
/**
*/
export class SharePayload {
free(): void;
/**
* @param {PrivateNode} node
* @param {boolean} temporal
* @param {PrivateForest} forest
* @param {BlockStore} store
* @param {Rng} rng
* @returns {Promise<any>}
*/
static fromNode(node: PrivateNode, temporal: boolean, forest: PrivateForest, store: BlockStore, rng: Rng): Promise<any>;
/**
* @returns {Uint8Array}
*/
getLabel(): Uint8Array;
}

@@ -656,2 +617,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

readonly __wbg_foreignblockstore_free: (a: number) => void;
readonly __wbg_accesskey_free: (a: number) => void;
readonly accesskey_getLabel: (a: number, b: number) => void;
readonly accesskey_getTemporalKey: (a: number, b: number) => void;
readonly accesskey_getContentCid: (a: number, b: number) => void;
readonly __wbg_privatedirectory_free: (a: number) => void;

@@ -704,11 +669,3 @@ readonly privatedirectory_new: (a: number, b: number, c: number, d: number) => void;

readonly forestchange_getValue2: (a: number, b: number) => void;
readonly __wbg_privateref_free: (a: number) => void;
readonly privateref_new: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
readonly privateref_getLabel: (a: number, b: number) => void;
readonly privateref_getTemporalKey: (a: number, b: number) => void;
readonly privateref_getContentCid: (a: number, b: number) => void;
readonly __wbg_sharepayload_free: (a: number) => void;
readonly sharepayload_fromNode: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
readonly sharepayload_getLabel: (a: number, b: number) => void;
readonly share: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
readonly share: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
readonly createShareLabel: (a: number, b: number, c: number, d: number, e: number) => number;

@@ -754,7 +711,7 @@ readonly findLatestShareCounter: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;

readonly __wbindgen_export_2: WebAssembly.Table;
readonly wasm_bindgen__convert__closures__invoke1_mut__h1235ffecc0644e71: (a: number, b: number, c: number) => void;
readonly wasm_bindgen__convert__closures__invoke1_mut__h73d25faefd4cda1f: (a: number, b: number, c: number) => void;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_exn_store: (a: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h207542f0da2d5b16: (a: number, b: number, c: number, d: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h0e8ff37cca297720: (a: number, b: number, c: number, d: number) => void;
}

@@ -761,0 +718,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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