UNPKG

@smartdcc/gbcs-parser

Version:
68 lines 2.1 kB
import { KeyObject } from 'crypto'; import { Slice } from './util'; export interface CipherInfo { origCounter: Uint8Array; origSysTitle: Uint8Array; recipSysTitle: Uint8Array; supplimentryRemotePartyId?: Uint8Array; supplimentryOriginatorCounter?: Uint8Array; cra: 'command' | 'response' | 'alert'; } export interface ParsedItem { type: 'ITEM'; depth: number; hex: string; notes?: string; children?: { [key: string]: ParsedItem; }; } export interface ParsedBlock { type: 'SEPARATOR'; depth: number; children: { [key: string]: ParsedItem; }; } export interface ParsedMessage { [key: string]: ParsedBlock; } export type KeyStore = (eui: string | Uint8Array, type: 'KA' | 'DS', options: { privateKey?: boolean; prePayment?: boolean; }) => Promise<KeyObject>; export type DecryptCB = (cipherInfo: CipherInfo, aesKey: KeyObject) => void; export interface Context { lookupKey: KeyStore; acbEui?: string | Uint8Array; output: ParsedMessage; current: (ParsedBlock | ParsedItem)[]; decryptionList: DecryptCB[]; } export declare function putSeparator(ctx: Context, title: string): void; export declare function putBytes(ctx: Context, name: string, bytes: Slice, notes?: string): void; export declare function putUnparsedBytes(bytes: Slice): void; export interface MinimizedParsedItem { hex: string; notes?: string; children?: { [key: string]: MinimizedParsedItem; }; } export interface MinimizedParsedBlock { [key: string]: MinimizedParsedItem; } export interface MinimizedParsedMessage { [key: string]: MinimizedParsedBlock; } export declare function minimizeItem({ hex, notes, children, }: ParsedItem): MinimizedParsedItem; export declare function minimizeBlock({ children }: ParsedBlock): MinimizedParsedBlock; /** * Removes files from ParsedMessage structure that are only relevant for * internal use. * * @param message * @returns */ export declare function minimizeMessage(message: ParsedMessage): MinimizedParsedMessage; //# sourceMappingURL=context.d.ts.map