amazon-qldb-kvs-nodejs
Version:
A helper module, simplifying basic interactions with Amazon Quantum Ledger Database for Node.js through a simple key-value store interface.
31 lines (30 loc) • 1.6 kB
TypeScript
import { ValueHolder } from "@aws-sdk/client-qldb";
import { Base64EncodedString } from "./Util";
/**
* Flip a single random bit in the given hash value.
* This method is intended to be used for purpose of demonstrating the QLDB verification features only.
* @param original The hash value to alter.
* @returns The altered hash with a single random bit changed.
*/
export declare function flipRandomBit(original: any): Uint8Array;
/**
* Take two hash values, sort them, concatenate them, and generate a new hash value from the concatenated values.
* @param h1 Byte array containing one of the hashes to compare.
* @param h2 Byte array containing one of the hashes to compare.
* @returns The concatenated array of hashes.
*/
export declare function joinHashesPairwise(h1: Uint8Array, h2: Uint8Array): Uint8Array;
/**
* Parse the Block object returned by QLDB and retrieve block hash.
* @param valueHolder A structure containing an Ion string value.
* @returns The block hash.
*/
export declare function parseBlock(valueHolder: ValueHolder): Uint8Array;
/**
* Verify document revision metadata against the provided digest.
* @param documentHash The SHA-256 value representing the document revision to be verified.
* @param digest A Base64 encoded SHA-256 hash value representing the ledger digest.
* @param proof The Proof object retrieved from GetRevision.getRevision.
* @returns If the document revision verifies against the ledger digest.
*/
export declare function verifyDocumentMetadata(documentHash: Uint8Array, digest: Base64EncodedString, proof: ValueHolder): boolean;