@cronstamp/clientlib
Version:
Client library for cronstamp, a blockchain-based document timestamping and verification service.
30 lines • 941 B
TypeScript
export type HashAlgorithm = 'SHA-256' | 'SHA-384' | 'SHA-512';
export declare const defaultAlgo: HashAlgorithm;
export declare const VersionToHashAlgorithm: {
1: string;
};
/**
* Hash text string and return base64 hash
* @param message
* @param algo
*/
export declare function hashString(message: string, algo?: HashAlgorithm): Promise<string>;
/**
* Hash a file and return the base64 encoded hash
* @param file
* @param algo
*/
export declare function hashFile(file: File, algo?: HashAlgorithm): Promise<string>;
/**
* Check the length of a base64 encoded hash
* @param hash
* @param algo
*/
export declare function isValidHash(hash: string, algo?: HashAlgorithm): boolean;
/**
* Hash two hashes on the same level in the merkle tree, to result in the parent hash
* @param hashA
* @param hashB
*/
export declare function hashSiblingHashes(hashA: string, hashB: string): Promise<string>;
//# sourceMappingURL=hash.d.ts.map