UNPKG

@etherspot/remote-signer

Version:

Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler

48 lines (46 loc) 1.24 kB
import { isHex } from "./chunk-VPBLFL5G.mjs"; // src/sdk/dto/validators/is-bytes-like.validator.ts import { registerDecorator } from "class-validator"; function IsBytesLike(options = {}) { return (object, propertyName) => { registerDecorator({ propertyName, options: { message: `${propertyName} must be bytes like`, ...options }, name: "IsBytesLike", target: object ? object.constructor : void 0, constraints: [], validator: { validate(value) { let result = false; try { if (value) { switch (typeof value) { case "string": if (options.acceptText) { result = true; } else { result = isHex(value) && value.length % 2 === 0; } break; case "object": result = Array.isArray(value) && value.every((value2) => typeof value2 === "number"); break; } } } catch (err) { } return result; } } }); }; } export { IsBytesLike }; //# sourceMappingURL=chunk-BO54Y6IN.mjs.map