Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ FLOW NOTE Sync needs a Flow ID account with a NOTE notepad, and Obsidian 1.11.5
## Linking

1. Open **Settings → FLOW NOTE Sync** and select **Link**, or run **FLOW NOTE Sync: Link this vault** from the command palette.
2. The plugin shows a code and a 12-digit device code, and opens `note.flow.talk/link` in your browser.
3. On that page, sign in if asked, check the code, type the device code and approve with your passkey. The device code never leaves this device any other way: Flow ID only ever sees a slow hash of it, so it can't swap in keys or a notepad of its own.
2. The plugin shows a Flow ID code and an 8-character device code (`XXXX XXXX`), and opens `note.flow.talk/link` in your default browser.
3. Approve from the browser where you use NOTE. If that's another browser or profile, select **Copy link** and open the link there, such as the browser that set up or recovered your notepad. A browser that has never opened your notepad can't approve, and neither can one that NOTE says can't change who has access to your notepad. On that page, sign in if asked, enter the Flow ID code if the page asks for one, type the device code and approve with your passkey. The device code never leaves this device any other way: Flow ID only ever sees a slow hash of it, so it can't swap in keys or a notepad of its own.
4. Back in Obsidian, the plugin shows the account it was linked to: its DID, and its handle when the handle checks out both ways, with the domain that vouched for it set apart so a lookalike such as `alice-flow.talk.example` reads as `talk.example`. **Nothing syncs until you confirm it is yours.** A code someone else guessed and approved would otherwise bind your vault to their notepad.

A link has to be approved within ten minutes. A vault that is still linked can't be linked again: if syncing stopped, settings offer **Retry** and **Unlink**, and you link again only after unlinking.
Expand Down
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "flow-note",
"name": "FLOW NOTE Sync",
"version": "0.1.0",
"version": "0.1.1",
"minAppVersion": "1.11.5",
"description": "Sync your vault both ways with your end-to-end encrypted NOTE notepad, linked once through your browser.",
"author": "Flow Industries",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flow-note-sync",
"private": true,
"version": "0.1.0",
"version": "0.1.1",
"description": "FLOW NOTE Sync for Obsidian",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -30,6 +30,6 @@
"typescript-eslint": "8.72.1"
},
"dependencies": {
"@flow-industries/seal": "^0.1.0"
"@flow-industries/seal": "^0.2.0"
}
}
52 changes: 44 additions & 8 deletions src/obsidian/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export class LinkModal extends Modal {
private label: string;
private error: string | null = null;
private opened = false;
private copyFailed = false;
private linkField: HTMLInputElement | null = null;

constructor(
app: App,
Expand All @@ -85,6 +87,7 @@ export class LinkModal extends Modal {
const { contentEl } = this;
const { phase } = this.controller;
contentEl.empty();
this.linkField = null;
if (this.error)
contentEl.createEl("p", { cls: "mod-warning", text: this.error });
if (phase.kind === "linking") return this.renderPrompt(phase.prompt);
Expand Down Expand Up @@ -131,10 +134,10 @@ export class LinkModal extends Modal {
}
contentEl.createEl("p", {
text: page
? "Your browser opened NOTE's link page. Sign in there if asked, check the code matches, and type the device code below."
: `Open ${NOTE_ORIGIN}/link in your browser, enter the code below, and type the device code.`,
? "NOTE's link page opened in your default browser. Approve from the browser where you use NOTE: if that's another browser or profile, copy the link and open it there. Sign in if asked, enter the Flow ID code if the page asks for it, then type the device code below."
: `Open ${NOTE_ORIGIN}/link in the browser where you use NOTE, enter the Flow ID code below, and type the device code.`,
});
new Setting(contentEl).setName("Code").setDesc(prompt.userCode);
new Setting(contentEl).setName("Flow ID code").setDesc(prompt.userCode);
const secret = new Setting(contentEl)
.setName("Device code")
.setDesc(
Expand All @@ -146,14 +149,47 @@ export class LinkModal extends Modal {
});
const row = new Setting(contentEl);
if (page)
row.addButton((button) =>
button
.setButtonText("Open link page again")
.onClick(() => window.open(page)),
);
row
.addButton((button) =>
button
.setButtonText("Copy link")
.onClick(() => void this.copyLink(page)),
)
.addButton((button) =>
button
.setButtonText("Open link page again")
.onClick(() => window.open(page)),
);
row.addButton((button) =>
button.setButtonText("Cancel").onClick(() => this.close()),
);
if (page && this.copyFailed)
new Setting(contentEl)
.setName("Link")
.setDesc(
"Copying failed. Copy the link from here and open it in the browser where you use NOTE.",
)
.addText((text) => {
text.setValue(page);
text.inputEl.readOnly = true;
this.linkField = text.inputEl;
});
}

private async copyLink(page: string) {
try {
await navigator.clipboard.writeText(page);
new Notice("Link copied. Open it in the browser where you use NOTE.");
} catch {
new Notice(
`Couldn't copy the link. Open ${page} in the browser where you use NOTE.`,
0,
);
this.copyFailed = true;
this.render();
this.linkField?.focus();
this.linkField?.select();
}
}

private renderConfirm(account: LinkedAccount) {
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ async function link(admin: AdminBrowser, vault: Obsidian) {
await new Promise((resolve) => setTimeout(resolve, 10));
const [prompt] = vault.prompts;
if (!prompt) throw new Error("No prompt");
expect(prompt.pairingCode).toMatch(/^\d{4} \d{4} \d{4}$/);
expect(prompt.pairingCode).toMatch(
/^[0-9A-HJKMNP-TV-Z]{4} [0-9A-HJKMNP-TV-Z]{4}$/,
);
await approveLink(admin, prompt);
return linking;
}
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"0.1.0": "1.11.5"
"0.1.0": "1.11.5",
"0.1.1": "1.11.5"
}
Loading