UNPKG

wiegand-encoder

Version:

Encode and decode 26, 34, or 38 bit Wiegand protocol credentials

31 lines (30 loc) 857 B
/** * Calculate left and right parity for a given credential * @param {string} contents - Wiegand credential * @throws * @returns {{left: number, right: number}} */ declare function calculate(contents: string): { left: number; right: number; }; /** * Confirm left and right parity bits. Throws an exception if they are not valid. * @param {string} message - a Wiegand credential message * @throws * @returns {boolean} */ declare function validate(message: string): boolean; /** * Wrap a Wiegand credential in parity bits * @param {string} credential - Wiegand credential * @throws * @returns {string} - The credential wrapped in parity bits */ declare function wrap(contents: string): string; declare const _default: { calculate: typeof calculate; validate: typeof validate; wrap: typeof wrap; }; export default _default;