Skip to content

[UI] Some WASM generated Typescript functions might lead to silent errors during dev stage #698

@HatemMn

Description

@HatemMn

Required setup

A compiled wasm and an ui that runs in dev mode ( pnpm dev should return no error )

Issue

Take this function as example :
export function import_ttlv_request(unique_identifier: string | null | undefined, key_bytes: Uint8Array, key_format: string, public_key_id: string | null | undefined, private_key_id: string | null | undefined, certificate_id: string | null | undefined, unwrap: boolean, replace_existing: boolean, tags: string[], key_usage?: string[] | null, wrapping_key_id?: string | null): any;

Declaration is on the file : ui/src/wasm/pkg/cosmian_kms_client_wasm.d.ts

Devs should be meticulous about some args such as kekFormat - For example PKCS8 would provoque a silent error while pkcs8-pub would be a correct value. Because this is typescript, not Rust

A solution

Strong typing - Ts Side, and absolute abolition of the any type and mere string passing. The dream would be to auto-generate the adequate TS interfaces from the rust code. I didn't look if that's possible, but that's the best acheivable solution IMO

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions