import type { Authentication } from '../sender/security.ts' import type { Envelope } from './envelope.ts' import type { Reason } from './reason.ts' export type Session = Envelope & { state: 'new' | 'negotiating' | 'authenticating' | 'established' | 'finishing' | 'finished' | 'failed' encryptionOptions?: Array compressionOptions?: Array schemeOptions?: Array encryption?: string compression?: string scheme?: string authentication?: Omit reason?: Reason } export const isSession = (value: Envelope): value is Session => { return 'state' in value }