@iotize/tap
Version:
IoTize Device client for Javascript
44 lines (43 loc) • 1.3 kB
TypeScript
import { Tap } from '@iotize/tap';
import { EncryptionKeys, EncryptionOptions } from './scram-interceptor';
export interface EncryptionSessionState {
enabled?: boolean;
keys?: EncryptionKeys;
frameCounter?: number;
}
export declare class TapEncryption {
private tap;
private scramInterceptor;
get isStarted(): boolean;
constructor(tap: Tap);
setEncryptionKeys(keys: EncryptionKeys): void;
setEncryptedFrameCounter(frameCounter: number): void;
getEncryptionOptions(): EncryptionOptions;
refreshEncryptionInitializationVector(): Promise<void>;
setInitializationVectorRefreshPeriod(period: number): void;
/**
* Enable encryption
*/
start(): Promise<Uint8Array>;
/**
* Disable encryption
*/
stop(): void;
/**
* Pause encryption
*/
pause(): void;
/**
* Pause encryption
*/
resume(): void;
/**
* Setter for the session key
* @param key if null, it will stop encryption and remove session key. If true it will update session key used for encryption
*/
set sessionKey(key: Uint8Array | undefined);
/**
* Get current session key for encrypted communicatioin
*/
get sessionKey(): Uint8Array | undefined;
}