How to start with the Javascript SDK - ziti-sdk-js?

Hi,
I'm trying to use the example of the ziti-sdk-nodejs for getting started with the browser version (ziti-sdk-js), but I got the error "zitiConfig is not defined".

Here is the snippet:

import ziti from '@openziti/ziti-sdk-js';

async function getServerStatus(serverUrl: string) {
	// Somehow provide path to identity file, e.g. via env var
	const zitiIdentityFile = process.env.ZITI_IDENTITIES;

	// Authenticate ourselves onto the Ziti network
	await ziti.init(zitiIdentityFile).catch((err) => { /* probably exit */ });
}

I set the environment var ZITI_IDENTITIES to the path of my identity json and tested it with the Python SDK. So this connection basically works. Could you please give me a hint?

Best regards,
Sky

Hi @chrda81, and welcome to OpenZiti.

As you can see by the commit history, the ziti-sdk-js has been dormant for a couple years. This particular SDK should not be considered viable at this time.

It will most likely be reborn as ziti-sdk-browser (yes, spelled with an s not a z). This would be the SDK to manually embed within your web app, if you elected not to use our automatic web-app-Zitification enabled by the broader browZer stack.

Here is a link to the article that introduces the browZer concept: Introducing OpenZiti BrowZer

See also GitHub - openziti/ziti-sdk-nodejs: An SDK for embedding zero trust into Node.JS applications and web servers to improve security. (this may have been what you used rather than sdk-js? this repo is up-to-date). But, if you are looking for in-browser, follow the links Curt supplied

Hi @curt,

thanks for the quick response. I'm trying to create a plugin for Obsidian (GitHub - obsidianmd/obsidian-sample-plugin) which is based on TypeScript and makes API calls to a zitified service. It seems that Obsidian is using an internal browser view to render its content, this is why I can't use the ziti-skd-nodejs package. If I understand you correctly the mentioned package ziti-sdk-browser isn't released yet? What else could I try to reach my zitified API service?

(caveat: I am not familiar with Obsidian)

If Obsidian uses an embedded V8/JavaScript engine (i.e. not Node, but just V8) to execute plugins, then for the scenario you described, you would need the future ziti-sdk-js or ziti-sdk-browser to facilitate doing requests to a remote/protected Ziti Service.

I like where you're headed here, btw. Sounds like a cool plugin.

Forgot to ask: do you know if Obsidian involves Electron to accomplish the:

internal browser view to render its content

I think Obsidian should be based on Electron. A quick research mentioned CodeMirror and Electron as combination.

OK, I did some Electron-based Ziti prototypes a while back (like the ziti-sdk-js, those items are a bit dusty right now). When I get a chance to examine Obsidian more closely, I'll come at it from the Electron angle.

1 Like