UNPKG

@phnq/message

Version:

Asynchronous, incremental messaging client and server

25 lines (24 loc) 951 B
/** * Although it may be tempting to no-op this and let `JSON.stringify` serialize * dates to ISO 8601 strings, this is not a good idea. The reason is that a * string that happens to be an ISO 8601 date string when serialized will be * deserialized as a Date object. This could have implications during message * signing and verification. * * { * str: "2025-03-22T11:53:26.424" * } * * will have the `str` deserialized as a Date object. But when verifying the message, * which involves using `JSON.stringify`, it will be serialized as: * { * str: "2025-03-22T11:53:26.424Z" * } * * The additional `Z` at the end of the string will cause the hash to be different * and the verification to fail. */ export declare const annotate: (val: unknown) => unknown; export declare const deannotate: (val: unknown) => unknown; export declare const serialize: (val: unknown) => string; export declare const deserialize: <T>(str: string) => T;