@scolastico-dev/walu
    Preparing search index...

    Class WaluConfig

    Configuration class for WALU. Manages API URLs, storage functions, and cryptographic verification settings. Provides a centralized configuration interface for all WALU operations.

    Index

    Constructors

    • Creates a new WaluConfig instance with the specified configuration options.

      Parameters

      • config: {
            apiUrls: string | IApiUrls;
            downloadStatusFunction?: (msg: string, progress: number) => Promise<void>;
            publicKey: string;
            storageReadFunction?: () => Promise<ICacheData>;
            storageWriteFunction?: (data: ICacheData) => Promise<void>;
            workerPath: string;
        }

        Configuration object containing all necessary settings

        • apiUrls: string | IApiUrls

          API URLs object or base URL string for version and update endpoints

        • OptionaldownloadStatusFunction?: (msg: string, progress: number) => Promise<void>

          Optional callback for download progress updates

        • publicKey: string

          RSA public key in PEM format for signature verification

        • OptionalstorageReadFunction?: () => Promise<ICacheData>

          Optional custom function to read storage data

        • OptionalstorageWriteFunction?: (data: ICacheData) => Promise<void>

          Optional custom function to write storage data

        • workerPath: string

          Path to the service worker script

      Returns WaluConfig

    Properties

    apiUrls: IApiUrls
    config: {
        apiUrls: string | IApiUrls;
        downloadStatusFunction?: (msg: string, progress: number) => Promise<void>;
        publicKey: string;
        storageReadFunction?: () => Promise<ICacheData>;
        storageWriteFunction?: (data: ICacheData) => Promise<void>;
        workerPath: string;
    }

    Configuration object containing all necessary settings

    downloadStatusFunction: (msg: string, progress: number) => Promise<void> = ...
    publicKey: string
    storageReadFunction: () => Promise<ICacheData>
    storageWriteFunction: (data: ICacheData) => Promise<void>
    workerPath: string

    Methods

    • Reports download status using the configured status function.

      Parameters

      • msg: string

        Status message to display

      • progress: number

        Progress value between 0 and 1

      Returns Promise<void>

    • Gets the API URLs configuration.

      Returns IApiUrls

      The API URLs object containing version and update endpoints

    • Gets the RSA public key used for signature verification.

      Returns string

      The public key in PEM format

    • Gets the path to the service worker script.

      Returns string

      The worker path as a string

    • Reads storage data using the configured storage read function.

      Returns Promise<ICacheData>

      Promise resolving to the stored data or null if no data exists

    • Writes storage data using the configured storage write function.

      Parameters

      Returns Promise<void>

      Promise that resolves when the data is written