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
8 changes: 4 additions & 4 deletions docs/specs/SPEC-session-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ Reserved for mVote, as additive methods only: `ParticipantSession.publishShared(

## Session key file

The file is Markdown so it can be read in Obsidian or Teams. The JSON block after the marker comment is the only source of truth; the human-readable parts are regenerated from it on every save. `parseSessionFile` rejects any file whose JSON is missing, invalid, of an unknown `format`, or has malformed fields.
The file is Markdown so it can be read in any text editor or Markdown viewer. The JSON block after the marker comment is the only source of truth; the human-readable parts are regenerated from it on every save. `parseSessionFile` rejects any file whose JSON is missing, invalid, of an unknown `format`, or has malformed fields.

````markdown
# MalverdeSoftware session key: Youth CAB text message sort

> **Keep this file private.** Anyone who has it can read every response in this session.
> Keep it only on your computer and in your study team's Teams channel files. Do not put it
> in a git repository, email it, or paste it into a chat or AI tool. If it is lost, the
> responses cannot be recovered by anyone.
> Keep it only on your computer and in a secure place your study has approved for its files.
> Do not put it in a git repository, email it, or paste it into a chat or AI tool. If it is
> lost, the responses cannot be recovered by anyone.

| | |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion packages/session-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@malverdesoftware/session-client",
"version": "0.1.3",
"version": "0.1.4",
"license": "Apache-2.0",
"description": "Session lifecycle for MalverdeSoftware apps: session key files, personal links with passcodes, sealed drafts and submissions.",
"type": "module",
Expand Down
10 changes: 5 additions & 5 deletions packages/session-client/src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export async function readDefinition(file: SessionFile): Promise<unknown> {
return (payload as { appDefinition: unknown }).appDefinition;
}

const longDate = (iso: string) =>
new Intl.DateTimeFormat("en-US", { dateStyle: "long", timeZone: "America/New_York" }).format(new Date(iso));
// In the time zone of the computer that saves the file, which is where the researcher reads it.
const longDate = (iso: string) => new Intl.DateTimeFormat("en-US", { dateStyle: "long" }).format(new Date(iso));

export function renderSessionFile(file: SessionFile): string {
const active = file.participants.filter((p) => !p.revokedAt);
Expand All @@ -156,9 +156,9 @@ export function renderSessionFile(file: SessionFile): string {
`# MalverdeSoftware session key: ${file.title}`,
"",
"> **Keep this file private.** Anyone who has it can read every response in this session.",
"> Keep it only on your computer and in your study team's Teams channel files. Do not put it",
"> in a git repository, email it, or paste it into a chat or AI tool. If it is lost, the",
"> responses cannot be recovered by anyone.",
"> Keep it only on your computer and in a secure place your study has approved for its files.",
"> Do not put it in a git repository, email it, or paste it into a chat or AI tool. If it is",
"> lost, the responses cannot be recovered by anyone.",
"",
"| | |",
"|---|---|",
Expand Down
1 change: 1 addition & 0 deletions packages/session-client/test/file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ test("the session file renders to Markdown and parses back losslessly", async ()
assert.deepEqual(parseSessionFile(markdown), file);
assert.match(markdown, /Keep this file private/);
assert.match(markdown, /cannot be recovered by anyone/);
assert.match(markdown, /a secure place your study has approved/);
assert.ok(markdown.includes(`| Y01 | ${file.participants[0]!.link} | ${file.participants[0]!.passcode} |`));
assert.ok(!markdown.includes(`| Y02 |`), "revoked participants are left out of the link table");
assert.ok(markdown.includes(`| Y03 | ${file.participants[2]!.link} | ${file.participants[2]!.passcode} |`));
Expand Down
Loading