Rename quack to quak
German for 'quack', matching the Ente (German for 'duck') naming. All references updated: package name, CLI binary, X-Client-Package header, test descriptions, temp dir prefixes, README, Makefile docker tag.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Tests for `ApiClient`.
|
||||
*
|
||||
* `ApiClient` is the HTTP layer that every other module in quack calls to
|
||||
* `ApiClient` is the HTTP layer that every other module in quak calls to
|
||||
* reach the Ente server. It handles:
|
||||
*
|
||||
* - Base URL resolution. Production uses `https://api.ente.io` for the
|
||||
@@ -14,7 +14,7 @@
|
||||
* dedicated CDN hosts.
|
||||
*
|
||||
* - Required headers. Every request carries `X-Client-Package`
|
||||
* (`berlin.sneak.quack`). Authenticated requests also carry
|
||||
* (`berlin.sneak.quak`). Authenticated requests also carry
|
||||
* `X-Auth-Token` with the token recovered by `unwrapAuth`.
|
||||
*
|
||||
* - JSON serialization. `getJSON` and `postJSON` handle Accept /
|
||||
@@ -121,7 +121,7 @@ describe("ApiClient defaults", () => {
|
||||
await client.getJSON("/ping");
|
||||
|
||||
const headers = new Headers(calls[0]!.init?.headers as HeadersInit);
|
||||
expect(headers.get("X-Client-Package")).toBe("berlin.sneak.quack");
|
||||
expect(headers.get("X-Client-Package")).toBe("berlin.sneak.quak");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* # Using the quack Client
|
||||
* # Using the quak Client
|
||||
*
|
||||
* This test file is a tutorial. It walks through every operation the
|
||||
* library supports, in the order you would use them in a real program.
|
||||
* Each `it()` block is a self-contained example with commentary
|
||||
* explaining what is happening and why. If you are reading the quack
|
||||
* explaining what is happening and why. If you are reading the quak
|
||||
* source for the first time, start here.
|
||||
*
|
||||
* The tests run against a mock Ente server built from the same SRP and
|
||||
@@ -30,7 +30,7 @@
|
||||
* All you need is the `Client` class:
|
||||
*
|
||||
* ```ts
|
||||
* import { Client } from "quack";
|
||||
* import { Client } from "quak";
|
||||
* ```
|
||||
*
|
||||
* The Client wraps every lower-level module (crypto, auth, api, model,
|
||||
@@ -332,7 +332,7 @@ beforeAll(async () => {
|
||||
await init();
|
||||
await sodium.ready;
|
||||
server = await buildServer();
|
||||
testDir = mkdtempSync(join(tmpdir(), "quack-usage-test-"));
|
||||
testDir = mkdtempSync(join(tmpdir(), "quak-usage-test-"));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -344,7 +344,7 @@ afterAll(() => {
|
||||
// The tutorial
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("quack Client usage guide", () => {
|
||||
describe("quak Client usage guide", () => {
|
||||
/**
|
||||
* ## 1. Logging in
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Tests for `crypto.decryptBox` and `crypto.decryptSealed`.
|
||||
*
|
||||
* These cover the two asymmetric-and-symmetric "box" primitives quack uses
|
||||
* These cover the two asymmetric-and-symmetric "box" primitives quak uses
|
||||
* to unwrap key material from Ente:
|
||||
*
|
||||
* - `decryptBox`: secretbox decryption. Used everywhere a small payload
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* authToken = decryptSealed(encryptedToken, publicKey, secretKey)
|
||||
*
|
||||
* Encryption is server-side; quack only ever decrypts.
|
||||
* Encryption is server-side; quak only ever decrypts.
|
||||
*/
|
||||
|
||||
import sodium from "libsodium-wrappers-sumo";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Ente delivers most binary fields as standard base64 strings (with `+`,
|
||||
* `/`, and `=` padding). A few fields, notably the auth token returned by
|
||||
* the login flow, are URL-safe base64 (with `-` and `_` instead of `+` and
|
||||
* `/`, and stripped padding). quack must accept both forms on input and
|
||||
* `/`, and stripped padding). quak must accept both forms on input and
|
||||
* produce the right form on output.
|
||||
*
|
||||
* These tests pin the contract:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* libsodium ships as WebAssembly. The bindings (`libsodium-wrappers-sumo`)
|
||||
* load asynchronously: the runtime must `await sodium.ready` once before any
|
||||
* crypto call is safe. quack hides that detail behind a single
|
||||
* crypto call is safe. quak hides that detail behind a single
|
||||
* `init()` function.
|
||||
*
|
||||
* Every other test in `test/crypto/**` calls `init()` in `beforeAll`. New
|
||||
|
||||
@@ -36,7 +36,7 @@ let testDir: string;
|
||||
beforeAll(async () => {
|
||||
await init();
|
||||
await sodium.ready;
|
||||
testDir = mkdtempSync(join(tmpdir(), "quack-test-"));
|
||||
testDir = mkdtempSync(join(tmpdir(), "quak-test-"));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -97,7 +97,7 @@ const mockFetchForBody = (body: Uint8Array) => {
|
||||
describe("downloadFile", () => {
|
||||
it("downloads, decrypts, and writes a single-chunk file", async () => {
|
||||
const plaintext = new TextEncoder().encode(
|
||||
"Hello from quack! This is a test photo payload.",
|
||||
"Hello from quak! This is a test photo payload.",
|
||||
);
|
||||
const key = sodium.crypto_secretstream_xchacha20poly1305_keygen();
|
||||
const { header, ciphertext } = encryptFileBody(plaintext, key);
|
||||
|
||||
@@ -87,7 +87,7 @@ const main = async () => {
|
||||
const { mkdtempSync, statSync } = await import("node:fs");
|
||||
const { join } = await import("node:path");
|
||||
const { tmpdir } = await import("node:os");
|
||||
const outDir = mkdtempSync(join(tmpdir(), "quack-live-test-"));
|
||||
const outDir = mkdtempSync(join(tmpdir(), "quak-live-test-"));
|
||||
const outPath = `${outDir}/${first.metadata.title}`;
|
||||
|
||||
console.log(`\n Downloading "${first.metadata.title}"...`);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* These two functions turn the raw encrypted JSON blobs the Ente server
|
||||
* returns into the decrypted Collection and EnteFile objects that the
|
||||
* rest of quack works with.
|
||||
* rest of quak works with.
|
||||
*
|
||||
* ## Collection decryption
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { VERSION } from "../src/index.js";
|
||||
|
||||
describe("quack", () => {
|
||||
describe("quak", () => {
|
||||
it("exports a version string", () => {
|
||||
expect(typeof VERSION).toBe("string");
|
||||
expect(VERSION.length).toBeGreaterThan(0);
|
||||
|
||||
Reference in New Issue
Block a user