MIT licensed LWS drafts as of 2026-11-09 10 languages · 1 API design v0.1.0

Linked Web Storage clients for ten languages

Read and write data in any W3C Linked Web Storage (LWS) server from Java, JavaScript/TypeScript, C++, Rust, Go, Python, C#, Swift, PHP or Kotlin. Each client is idiomatic to its language, and all ten share the same concepts, wire behaviour and conformance tests. The Rust client also comes as a WebAssembly component, for any language that can host one.

At a glance

  • Complete client side of LWS 1.0: discovery, CRUD, containers, linksets, notifications, access requests and grants, type index and search.
  • Authorization handled for you. On a 401 the client finds the authorization server through the protected resource metadata (RFC 9728), makes the checks the spec requires, and performs an OAuth 2.0 token exchange. It then caches the token per storage.
  • Every authentication suite: OpenID Connect, SAML 2.0, and self-signed identities (controlled identifier documents and did:key) with ES256 and EdDSA.
  • Verified webhooks: RFC 9421 HTTP Message Signatures and RFC 9530 Content-Digest, checked against the storage's published keys.
  • One contract, ten idioms: the same concept names everywhere, expressed with each language's async model, iteration and error style.

A taste

var credentials = SelfSignedCredentials.didKey(KeyPairs.generateP256());
LwsClient client = LwsClient.builder().authenticator(TokenExchangeAuthenticator.of(credentials)).build();

StorageDescription storage = client.discoverStorage(URI.create("https://storage.example/root/"));
URI todo = client.createJson(storage.storageRoot(), Map.of("task", "write docs", "done", false),
        CreateOptions.DEFAULT).location();
client.patch(todo, JsonPatch.builder().replace("/done", true).build());

client.listContainer(storage.storageRoot())
        .forEach(item -> System.out.println(item.id() + " " + item.format().orElse("container")));
const credentials = SelfSignedCredentials.didKey(await generateKeyPair());
const client = new LwsClient({ authenticator: new TokenExchangeAuthenticator(credentials) });

const storage = await client.discoverStorage("https://storage.example/root/");
const todo = await client.createJson(storage.storageRoot(), { task: "write docs", done: false });
await client.patch(todo.location, new JsonPatch().replace("/done", true));

for await (const item of client.listContainer(storage.storageRoot())) {
  console.log(item.id, item.format);
}
lws::ClientOptions options;
options.authenticator = std::make_shared<lws::TokenExchangeAuthenticator>(
    lws::SelfSignedCredentials::did_key(lws::PrivateKey::generate(lws::KeyAlgorithm::ES256)));
lws::Client client(options);

auto storage = client.discover_storage("https://storage.example/root/");
auto todo = client.create_json(storage.storage_root(), {{"task", "write docs"}, {"done", false}});
client.patch(todo.location, lws::JsonPatch{}.replace("/done", true));

for (const auto& item : client.list_container(storage.storage_root())) {
    std::cout << item.id << ' ' << item.format.value_or("container") << '\n';
}
let credentials = SelfSignedCredentials::did_key(SigningKey::generate_p256()?);
let client = Client::builder()
    .authenticator(TokenExchangeAuthenticator::new(credentials))
    .build()?;

let storage = client.discover_storage("https://storage.example/root/").await?;
let root = storage.storage_root()?.clone();
let todo = client
    .create_json(&root, &serde_json::json!({"task": "write docs", "done": false}))
    .await?
    .location;
client.patch(&todo, &JsonPatch::new().replace("/done", true)).await?;

let mut items = client.list_container(&root);
while let Some(item) = items.try_next().await? {
    println!("{} {:?}", item.id, item.format);
}
key, _ := lws.GenerateP256Key()
credentials, _ := lws.NewDIDKeyCredentials(key, nil)
client := lws.NewClient(lws.WithAuthenticator(lws.NewTokenExchangeAuthenticator(credentials, nil)))

storage, err := client.DiscoverStorage(ctx, "https://storage.example/root/")
if err != nil {
	return err
}
root, _ := storage.StorageRoot()
todo, err := client.CreateJSON(ctx, root, map[string]any{"task": "write docs", "done": false})
if err != nil {
	return err
}
if _, err := client.Patch(ctx, todo.Location, lws.JSONPatch{}.Replace("/done", true)); err != nil {
	return err
}

for item, err := range client.ListContainer(ctx, root) {
	if err != nil {
		return err
	}
	fmt.Println(item.ID, item.Format)
}
credentials = SelfSignedCredentials.did_key(SigningKey.generate())
with LwsClient(authenticator=TokenExchangeAuthenticator(credentials)) as client:
    storage = client.discover_storage("https://storage.example/root/")
    todo = client.create_json(storage.storage_root(), {"task": "write docs", "done": False})
    client.patch(todo.location, JsonPatch().replace("/done", True))

    for item in client.list_container(storage.storage_root()):
        print(item.id, item.format)
var credentials = SelfSignedCredentials.DidKey(SigningKey.GenerateP256());
using var authenticator = new TokenExchangeAuthenticator(credentials);
using var client = new LwsClient(new LwsClientOptions { Authenticator = authenticator });

StorageDescription storage = await client.DiscoverStorageAsync(new Uri("https://storage.example/root/"));
CreateResult todo = await client.CreateJsonAsync(storage.GetStorageRoot(), new { task = "write docs", done = false });
await client.PatchAsync(todo.Location, new JsonPatch().Replace("/done", true));

await foreach (ContainedResource item in client.ListContainerAsync(storage.GetStorageRoot()))
    Console.WriteLine($"{item.Id} {item.Format ?? "container"}");
let credentials = try SelfSignedCredentials.didKey(.generateP256())
let client = LWSClient(authenticator: TokenExchangeAuthenticator(credentials: credentials))

let storage = try await client.discoverStorage(URL(string: "https://storage.example/root/")!)
let todo = try await client.createJSON(in: try storage.storageRoot(), json: ["task": "write docs", "done": false])
_ = try await client.patch(todo.location, patch: JSONPatch().replace("/done", true))

for try await item in client.listContainer(try storage.storageRoot()) {
    print(item.id, item.format ?? "container")
}
$credentials = SelfSignedCredentials::didKey(SigningKey::generateP256());
$client = new LwsClient(authenticator: new TokenExchangeAuthenticator($credentials));

$storage = $client->discoverStorage('https://storage.example/root/');
$todo = $client->createJson($storage->storageRoot(), ['task' => 'write docs', 'done' => false]);
$client->patch($todo->location, (new JsonPatch())->replace('/done', true));

foreach ($client->listContainer($storage->storageRoot()) as $item) {
    echo $item->id, ' ', $item->format ?? 'container', "\n";
}
val credentials = SelfSignedCredentials.didKey(SigningKey.generateP256())
val client = LwsClient(authenticator = TokenExchangeAuthenticator(credentials))

val storage = client.discoverStorage(URI("https://storage.example/root/"))
val todo = client.createJson(storage.storageRoot(), buildJsonObject { put("task", "write docs"); put("done", false) })
client.patch(todo.location, jsonPatch { replace("/done", true) })

client.listContainer(storage.storageRoot()).collect { item ->
    println("${item.id} ${item.format ?: "container"}")
}

What's covered

Pick your language

How it works

  1. Discover. Every LWS response links to its storage (rel="https://www.w3.org/ns/lws#storage"). The storage description lists the root container and optional services such as notifications, access requests and type search.
  2. Authenticate. Choose a credential provider: an OpenID Connect ID token, a SAML assertion, or a self-signed key. The client exchanges it for short-lived access tokens when it is challenged.
  3. Read and write. Containers list their members as application/lws+json; data resources are plain HTTP resources with ETags; metadata lives in linksets and changes through JSON Patch.
  4. React. Subscribe a webhook inbox to a container and verify each signed notification before trusting it.

Built to agree with each other

The clients share language-neutral conformance fixtures, including 13 RFC 9421 webhook vectors and the did:key specification vector. They also all pass the same end-to-end interop scenario against a bundled mock LWS server. Every code sample on this site is type-checked or compiled against the real libraries before it is published. The getting-started program is also run against the mock server in all ten languages.

The baseline is the W3C LWS Working Group's documents as of 2026-11-09, including the switch of the baseline PATCH format to JSON Patch. See spec coverage for details and interpretation decisions.