"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeSign = exports.serializeSign = exports.cSignVersion = void 0;
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
exports.cSignVersion = 1;
function serializeSign(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cSign);
    }
    stream.writeUInt8(exports.cSignVersion);
    stream.writeString(obj.owner);
    stream.writeString(obj.sig);
}
exports.serializeSign = serializeSign;
function deserializeSign(stream) {
    const version = stream.readUInt8();
    if (version > exports.cSignVersion) {
        throw new Error('Sign version mismatch');
    }
    const owner = stream.readString();
    const sig = stream.readString();
    return {
        owner,
        sig,
    };
}
exports.deserializeSign = deserializeSign;
//# sourceMappingURL=Sign.js.map