UNPKG

tweetnacl-ts

Version:

Port of TweetNaCl cryptographic library to TypeScript (and ES6)

15 lines 496 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function validateBase64(s) { if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)) { throw new TypeError('invalid base64 string'); } } exports.validateBase64 = validateBase64; function validateHex(s) { if (!/^(?:[A-Fa-f0-9]{2})+$/.test(s)) { throw new TypeError('invalid hex string'); } } exports.validateHex = validateHex; //# sourceMappingURL=validate.js.map