@nervosnetwork/ckb-sdk-utils
Version:
Utils module of @nervosnetwork/ckb-sdk-core
96 lines • 3.83 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.PersonalLenException = exports.PersonalTypeException = exports.KeyTypeException = exports.InputTypeException = exports.SaltLenException = exports.SaltTypeException = exports.OutTypeException = exports.KeyLenTooLargeException = exports.KeyLenTooSmallException = exports.OutLenTooLargeException = exports.OutLenTooSmallException = void 0;
const tslib_1 = require("tslib");
const ErrorCode_js_1 = (0, tslib_1.__importDefault)(require("./ErrorCode.js"));
class OutLenTooSmallException extends Error {
constructor(outlen, minLen) {
super(`Expect outlen to be at least ${minLen}, but ${outlen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.OutLenTooSmallException = OutLenTooSmallException;
class OutLenTooLargeException extends Error {
constructor(outlen, maxLen) {
super(`Expect outlen to be at most ${maxLen}, but ${outlen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.OutLenTooLargeException = OutLenTooLargeException;
class KeyLenTooSmallException extends Error {
constructor(keyLen, minLen) {
super(`Expect key length to be at least ${minLen}, but ${keyLen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.KeyLenTooSmallException = KeyLenTooSmallException;
class KeyLenTooLargeException extends Error {
constructor(keyLen, maxLen) {
super(`Expect key length to be at most ${maxLen}, but ${keyLen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.KeyLenTooLargeException = KeyLenTooLargeException;
class OutTypeException extends TypeError {
constructor() {
super(`Expect out to be "binary", "hex", Uint8Array, or Buffer`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.OutTypeException = OutTypeException;
class SaltTypeException extends TypeError {
constructor() {
super(`Expect salt to be Uint8Array or Buffer`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.SaltTypeException = SaltTypeException;
class SaltLenException extends Error {
constructor(saltLen, requiredLen) {
super(`Expect salt length to be ${requiredLen}, but ${saltLen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.SaltLenException = SaltLenException;
class InputTypeException extends TypeError {
constructor() {
super(`Expect input to be Uint8Array or Buffer`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.InputTypeException = InputTypeException;
class KeyTypeException extends TypeError {
constructor() {
super(`Expect key to be Uint8Array or Buffer`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.KeyTypeException = KeyTypeException;
class PersonalTypeException extends TypeError {
constructor() {
super(`Expect PERSONAL to be Uint8Array or Buffer`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.PersonalTypeException = PersonalTypeException;
class PersonalLenException extends Error {
constructor(personalLen, requiredLen) {
super(`Expect PERSONAL length to be ${requiredLen}, but ${personalLen} received`);
this.code = ErrorCode_js_1.default.ParameterInvalid;
}
}
exports.PersonalLenException = PersonalLenException;
exports.default = {
OutLenTooSmallException,
OutLenTooLargeException,
KeyLenTooSmallException,
KeyLenTooLargeException,
OutTypeException,
SaltTypeException,
SaltLenException,
InputTypeException,
KeyTypeException,
PersonalTypeException,
PersonalLenException,
};
//# sourceMappingURL=blake2b.js.map
;