app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

private-session.test.ts (1312B)


      1 import { expect, it } from 'vitest';
      2 import { createIdentitySession } from '../../src/lib/runtime/identity-session.ts';
      3 import {
      4   createPrivateSession,
      5   privateSessionSnapshot,
      6   privateSessionOwnership,
      7   closePrivateSession,
      8   type PrivateSession
      9 } from '../../src/lib/runtime/private-session.ts';
     10 import { getPrivatePool } from '../../src/lib/nostr/private-pool.ts';
     11 it('SSR private import and explicit admission acquire no browser transport', async () => {
     12   const identity = createIdentitySession();
     13   expect(
     14     await createPrivateSession(identity, 'reviewed_private_session')
     15   ).toBeUndefined();
     16   expect(getPrivatePool({} as PrivateSession, {} as never, [])).toBeUndefined();
     17 });
     18 it('guest observation and unreviewed admission do not create private authority', async () => {
     19   const identity = createIdentitySession();
     20   expect(await createPrivateSession(identity, 'unreviewed')).toBeUndefined();
     21   expect(
     22     await createPrivateSession({} as never, 'reviewed_private_session')
     23   ).toBeUndefined();
     24 });
     25 it('forged private session cannot expose an owner or generation', () => {
     26   expect(privateSessionSnapshot({} as PrivateSession)).toBeUndefined();
     27   expect(privateSessionOwnership({} as PrivateSession)).toBeUndefined();
     28   expect(() => closePrivateSession({} as PrivateSession)).not.toThrow();
     29 });