UNPKG

gamemoney-commonjs

Version:
18 lines (17 loc) 734 B
/// <reference types="node" /> import crypto from 'node:crypto'; export type RsaKey = Parameters<crypto.Sign['sign']>[0]; export type HmacKey = Parameters<typeof crypto.createHmac>[1]; type JsonPrimitive = number | number[] | string | string[] | undefined | null; type Json = { [key: string]: Json | JsonPrimitive; }; type Body = { signature: string; } & Json; export declare function parametersToString(body: Json): string; export declare function verifyRsaSignature(body: Body): boolean; export declare function generateRsaSignature(body: Json, key: RsaKey): string; export declare function generateHmacSignature(body: Json, key: HmacKey): string; export declare function getRandomString(length: number): string; export {};