Additional information
Become a Webnative jedi 🧘
Check the Webnative version.
console.log(wn.VERSION)
Debug logging can be enabled through the configuration object.
{ ...configuration, debug: true }
When Webnative makes a change to the user's filesystem, it logs:
📓 Adding to the CID ledger
Next, Webnative links the change to make it available across the web.
🌊 Updating your DNSLink
When linking completes, the change is published and available to other browsers.
🪴 DNSLink updated:
When
debug
mode is enabled, the program
is added to the global context object (window
for example):const appInfo = { creator: "Nullsoft", name: "Winamp" }
await wn.program({
namespace: appInfo,
debug: true
})
// Program is exposed in debug mode
const program = globalThis.__webnative[ wn.namespace(appInfo) ] // namespace: "Nullsoft/Winamp"
A Webnative program provides shorthand utility functions for easy access:
export type ShortHands = {
accountDID: (username: string) => Promise<string>
agentDID: () => Promise<string>
sharingDID: () => Promise<string>
}
The shorthands include:
- accountDID. Retrieves the account DID associated with the user's account.
- agentDID. Retrieves the agent DID for the current device.
- sharingDID. Retrieves the sharing DID for the current device.
WNFS comes with three separate top-level file systems "roots": public, pretty, and private.
Not encrypted. Full metadata support. Starts with
/public
.Not encrypted. No metadata. Represented simply as
/p
to be nice and short when creating public URLs like /p/path/to/file.img
. It does not support versioning, use the Public or Private trees for that.Encrypted. Structured so that file metadata as well as contents are obscured. Starts with
/private
.
Can I use my file system in a web worker? Yes, but depending on which type of session you want you may need to adjust your setup. To be more specific, when working without capabilities you can just create a program in your web worker. But when working with capabilities, it'll depend on how your chosen capabilities flow works. In the case of the current Fission auth lobby, access to the window object is needed when requesting capabilties, so that'll need to happen on the UI/main thread.
Since the file system may evolve over time, a "version" is associated with each node in the file system (tracked with semver).
Last modified 7mo ago