yc-types
Version:
TypeScript types and interfaces for YellowCard protobuf definitions
1,330 lines • 51.7 kB
JavaScript
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.8.3
// protoc v3.21.12
// source: issuer.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.RevokeIssuerKeyResponse = exports.RevokeIssuerKeyRequest = exports.ListIssuerKeysResponse = exports.ListIssuerKeysRequest = exports.GetIssuerKeyResponse = exports.GetIssuerKeyRequest = exports.GenerateIssuerKeyResponse = exports.GenerateIssuerKeyRequest = exports.IssuerKey = exports.ListIssuersResponse = exports.CreateIssuerRequest_AddressEntry = exports.CreateIssuerRequest = exports.Issuer_AddressEntry = exports.Issuer = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const auth_user_1 = require("./auth_user");
const common_1 = require("./common");
const timestamp_1 = require("./google/protobuf/timestamp");
exports.protobufPackage = "pb";
function createBaseIssuer() {
return {
id: "",
accreditedBy: undefined,
registrationNumber: undefined,
organizationName: undefined,
address: {},
contactEmail: undefined,
contactPhone: undefined,
needsLicence: undefined,
createdAt: undefined,
};
}
exports.Issuer = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.accreditedBy !== undefined) {
writer.uint32(18).string(message.accreditedBy);
}
if (message.registrationNumber !== undefined) {
writer.uint32(26).string(message.registrationNumber);
}
if (message.organizationName !== undefined) {
writer.uint32(34).string(message.organizationName);
}
Object.entries(message.address).forEach(([key, value]) => {
exports.Issuer_AddressEntry.encode({ key: key, value }, writer.uint32(42).fork()).join();
});
if (message.contactEmail !== undefined) {
writer.uint32(50).string(message.contactEmail);
}
if (message.contactPhone !== undefined) {
writer.uint32(58).string(message.contactPhone);
}
if (message.needsLicence !== undefined) {
writer.uint32(64).bool(message.needsLicence);
}
if (message.createdAt !== undefined) {
timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIssuer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.accreditedBy = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.registrationNumber = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.organizationName = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
const entry5 = exports.Issuer_AddressEntry.decode(reader, reader.uint32());
if (entry5.value !== undefined) {
message.address[entry5.key] = entry5.value;
}
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.contactEmail = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.contactPhone = reader.string();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.needsLicence = reader.bool();
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
accreditedBy: isSet(object.accreditedBy) ? globalThis.String(object.accreditedBy) : undefined,
registrationNumber: isSet(object.registrationNumber) ? globalThis.String(object.registrationNumber) : undefined,
organizationName: isSet(object.organizationName) ? globalThis.String(object.organizationName) : undefined,
address: isObject(object.address)
? Object.entries(object.address).reduce((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {})
: {},
contactEmail: isSet(object.contactEmail) ? globalThis.String(object.contactEmail) : undefined,
contactPhone: isSet(object.contactPhone) ? globalThis.String(object.contactPhone) : undefined,
needsLicence: isSet(object.needsLicence) ? globalThis.Boolean(object.needsLicence) : undefined,
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.accreditedBy !== undefined) {
obj.accreditedBy = message.accreditedBy;
}
if (message.registrationNumber !== undefined) {
obj.registrationNumber = message.registrationNumber;
}
if (message.organizationName !== undefined) {
obj.organizationName = message.organizationName;
}
if (message.address) {
const entries = Object.entries(message.address);
if (entries.length > 0) {
obj.address = {};
entries.forEach(([k, v]) => {
obj.address[k] = v;
});
}
}
if (message.contactEmail !== undefined) {
obj.contactEmail = message.contactEmail;
}
if (message.contactPhone !== undefined) {
obj.contactPhone = message.contactPhone;
}
if (message.needsLicence !== undefined) {
obj.needsLicence = message.needsLicence;
}
if (message.createdAt !== undefined) {
obj.createdAt = message.createdAt.toISOString();
}
return obj;
},
create(base) {
return exports.Issuer.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const message = createBaseIssuer();
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
message.accreditedBy = (_b = object.accreditedBy) !== null && _b !== void 0 ? _b : undefined;
message.registrationNumber = (_c = object.registrationNumber) !== null && _c !== void 0 ? _c : undefined;
message.organizationName = (_d = object.organizationName) !== null && _d !== void 0 ? _d : undefined;
message.address = Object.entries((_e = object.address) !== null && _e !== void 0 ? _e : {}).reduce((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
}
return acc;
}, {});
message.contactEmail = (_f = object.contactEmail) !== null && _f !== void 0 ? _f : undefined;
message.contactPhone = (_g = object.contactPhone) !== null && _g !== void 0 ? _g : undefined;
message.needsLicence = (_h = object.needsLicence) !== null && _h !== void 0 ? _h : undefined;
message.createdAt = (_j = object.createdAt) !== null && _j !== void 0 ? _j : undefined;
return message;
},
};
function createBaseIssuer_AddressEntry() {
return { key: "", value: "" };
}
exports.Issuer_AddressEntry = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.key !== "") {
writer.uint32(10).string(message.key);
}
if (message.value !== "") {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIssuer_AddressEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
key: isSet(object.key) ? globalThis.String(object.key) : "",
value: isSet(object.value) ? globalThis.String(object.value) : "",
};
},
toJSON(message) {
const obj = {};
if (message.key !== "") {
obj.key = message.key;
}
if (message.value !== "") {
obj.value = message.value;
}
return obj;
},
create(base) {
return exports.Issuer_AddressEntry.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseIssuer_AddressEntry();
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
return message;
},
};
function createBaseCreateIssuerRequest() {
return {
accreditedBy: "",
registrationNumber: "",
organizationName: "",
address: {},
contactEmail: "",
contactPhone: "",
user: undefined,
needsLicence: undefined,
};
}
exports.CreateIssuerRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.accreditedBy !== "") {
writer.uint32(10).string(message.accreditedBy);
}
if (message.registrationNumber !== "") {
writer.uint32(18).string(message.registrationNumber);
}
if (message.organizationName !== "") {
writer.uint32(26).string(message.organizationName);
}
Object.entries(message.address).forEach(([key, value]) => {
exports.CreateIssuerRequest_AddressEntry.encode({ key: key, value }, writer.uint32(34).fork()).join();
});
if (message.contactEmail !== "") {
writer.uint32(42).string(message.contactEmail);
}
if (message.contactPhone !== "") {
writer.uint32(50).string(message.contactPhone);
}
if (message.user !== undefined) {
auth_user_1.CreateUserRequest.encode(message.user, writer.uint32(58).fork()).join();
}
if (message.needsLicence !== undefined) {
writer.uint32(64).bool(message.needsLicence);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateIssuerRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.accreditedBy = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.registrationNumber = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.organizationName = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
const entry4 = exports.CreateIssuerRequest_AddressEntry.decode(reader, reader.uint32());
if (entry4.value !== undefined) {
message.address[entry4.key] = entry4.value;
}
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.contactEmail = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.contactPhone = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.user = auth_user_1.CreateUserRequest.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.needsLicence = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
accreditedBy: isSet(object.accreditedBy) ? globalThis.String(object.accreditedBy) : "",
registrationNumber: isSet(object.registrationNumber) ? globalThis.String(object.registrationNumber) : "",
organizationName: isSet(object.organizationName) ? globalThis.String(object.organizationName) : "",
address: isObject(object.address)
? Object.entries(object.address).reduce((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {})
: {},
contactEmail: isSet(object.contactEmail) ? globalThis.String(object.contactEmail) : "",
contactPhone: isSet(object.contactPhone) ? globalThis.String(object.contactPhone) : "",
user: isSet(object.user) ? auth_user_1.CreateUserRequest.fromJSON(object.user) : undefined,
needsLicence: isSet(object.needsLicence) ? globalThis.Boolean(object.needsLicence) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.accreditedBy !== "") {
obj.accreditedBy = message.accreditedBy;
}
if (message.registrationNumber !== "") {
obj.registrationNumber = message.registrationNumber;
}
if (message.organizationName !== "") {
obj.organizationName = message.organizationName;
}
if (message.address) {
const entries = Object.entries(message.address);
if (entries.length > 0) {
obj.address = {};
entries.forEach(([k, v]) => {
obj.address[k] = v;
});
}
}
if (message.contactEmail !== "") {
obj.contactEmail = message.contactEmail;
}
if (message.contactPhone !== "") {
obj.contactPhone = message.contactPhone;
}
if (message.user !== undefined) {
obj.user = auth_user_1.CreateUserRequest.toJSON(message.user);
}
if (message.needsLicence !== undefined) {
obj.needsLicence = message.needsLicence;
}
return obj;
},
create(base) {
return exports.CreateIssuerRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = createBaseCreateIssuerRequest();
message.accreditedBy = (_a = object.accreditedBy) !== null && _a !== void 0 ? _a : "";
message.registrationNumber = (_b = object.registrationNumber) !== null && _b !== void 0 ? _b : "";
message.organizationName = (_c = object.organizationName) !== null && _c !== void 0 ? _c : "";
message.address = Object.entries((_d = object.address) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
}
return acc;
}, {});
message.contactEmail = (_e = object.contactEmail) !== null && _e !== void 0 ? _e : "";
message.contactPhone = (_f = object.contactPhone) !== null && _f !== void 0 ? _f : "";
message.user = (object.user !== undefined && object.user !== null)
? auth_user_1.CreateUserRequest.fromPartial(object.user)
: undefined;
message.needsLicence = (_g = object.needsLicence) !== null && _g !== void 0 ? _g : undefined;
return message;
},
};
function createBaseCreateIssuerRequest_AddressEntry() {
return { key: "", value: "" };
}
exports.CreateIssuerRequest_AddressEntry = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.key !== "") {
writer.uint32(10).string(message.key);
}
if (message.value !== "") {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateIssuerRequest_AddressEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
key: isSet(object.key) ? globalThis.String(object.key) : "",
value: isSet(object.value) ? globalThis.String(object.value) : "",
};
},
toJSON(message) {
const obj = {};
if (message.key !== "") {
obj.key = message.key;
}
if (message.value !== "") {
obj.value = message.value;
}
return obj;
},
create(base) {
return exports.CreateIssuerRequest_AddressEntry.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseCreateIssuerRequest_AddressEntry();
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
return message;
},
};
function createBaseListIssuersResponse() {
return { status: 0, issuers: [], meta: undefined };
}
exports.ListIssuersResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
for (const v of message.issuers) {
exports.Issuer.encode(v, writer.uint32(18).fork()).join();
}
if (message.meta !== undefined) {
common_1.Metadata.encode(message.meta, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListIssuersResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.issuers.push(exports.Issuer.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.meta = common_1.Metadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
issuers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.issuers) ? object.issuers.map((e) => exports.Issuer.fromJSON(e)) : [],
meta: isSet(object.meta) ? common_1.Metadata.fromJSON(object.meta) : undefined,
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if ((_a = message.issuers) === null || _a === void 0 ? void 0 : _a.length) {
obj.issuers = message.issuers.map((e) => exports.Issuer.toJSON(e));
}
if (message.meta !== undefined) {
obj.meta = common_1.Metadata.toJSON(message.meta);
}
return obj;
},
create(base) {
return exports.ListIssuersResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseListIssuersResponse();
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
message.issuers = ((_b = object.issuers) === null || _b === void 0 ? void 0 : _b.map((e) => exports.Issuer.fromPartial(e))) || [];
message.meta = (object.meta !== undefined && object.meta !== null) ? common_1.Metadata.fromPartial(object.meta) : undefined;
return message;
},
};
function createBaseIssuerKey() {
return {
id: "",
issuerId: "",
publicKey: "",
keyFingerprint: "",
isActive: false,
createdAt: undefined,
expiresAt: undefined,
revokedAt: undefined,
revocationReason: "",
};
}
exports.IssuerKey = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.issuerId !== "") {
writer.uint32(18).string(message.issuerId);
}
if (message.publicKey !== "") {
writer.uint32(26).string(message.publicKey);
}
if (message.keyFingerprint !== "") {
writer.uint32(34).string(message.keyFingerprint);
}
if (message.isActive !== false) {
writer.uint32(40).bool(message.isActive);
}
if (message.createdAt !== undefined) {
timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join();
}
if (message.expiresAt !== undefined) {
timestamp_1.Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(58).fork()).join();
}
if (message.revokedAt !== undefined) {
timestamp_1.Timestamp.encode(toTimestamp(message.revokedAt), writer.uint32(66).fork()).join();
}
if (message.revocationReason !== "") {
writer.uint32(74).string(message.revocationReason);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIssuerKey();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.issuerId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.publicKey = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.keyFingerprint = reader.string();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.isActive = reader.bool();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.expiresAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.revokedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.revocationReason = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
issuerId: isSet(object.issuerId) ? globalThis.String(object.issuerId) : "",
publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "",
keyFingerprint: isSet(object.keyFingerprint) ? globalThis.String(object.keyFingerprint) : "",
isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : false,
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
expiresAt: isSet(object.expiresAt) ? fromJsonTimestamp(object.expiresAt) : undefined,
revokedAt: isSet(object.revokedAt) ? fromJsonTimestamp(object.revokedAt) : undefined,
revocationReason: isSet(object.revocationReason) ? globalThis.String(object.revocationReason) : "",
};
},
toJSON(message) {
const obj = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.issuerId !== "") {
obj.issuerId = message.issuerId;
}
if (message.publicKey !== "") {
obj.publicKey = message.publicKey;
}
if (message.keyFingerprint !== "") {
obj.keyFingerprint = message.keyFingerprint;
}
if (message.isActive !== false) {
obj.isActive = message.isActive;
}
if (message.createdAt !== undefined) {
obj.createdAt = message.createdAt.toISOString();
}
if (message.expiresAt !== undefined) {
obj.expiresAt = message.expiresAt.toISOString();
}
if (message.revokedAt !== undefined) {
obj.revokedAt = message.revokedAt.toISOString();
}
if (message.revocationReason !== "") {
obj.revocationReason = message.revocationReason;
}
return obj;
},
create(base) {
return exports.IssuerKey.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const message = createBaseIssuerKey();
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
message.issuerId = (_b = object.issuerId) !== null && _b !== void 0 ? _b : "";
message.publicKey = (_c = object.publicKey) !== null && _c !== void 0 ? _c : "";
message.keyFingerprint = (_d = object.keyFingerprint) !== null && _d !== void 0 ? _d : "";
message.isActive = (_e = object.isActive) !== null && _e !== void 0 ? _e : false;
message.createdAt = (_f = object.createdAt) !== null && _f !== void 0 ? _f : undefined;
message.expiresAt = (_g = object.expiresAt) !== null && _g !== void 0 ? _g : undefined;
message.revokedAt = (_h = object.revokedAt) !== null && _h !== void 0 ? _h : undefined;
message.revocationReason = (_j = object.revocationReason) !== null && _j !== void 0 ? _j : "";
return message;
},
};
function createBaseGenerateIssuerKeyRequest() {
return { issuerId: "" };
}
exports.GenerateIssuerKeyRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.issuerId !== "") {
writer.uint32(10).string(message.issuerId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenerateIssuerKeyRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.issuerId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { issuerId: isSet(object.issuerId) ? globalThis.String(object.issuerId) : "" };
},
toJSON(message) {
const obj = {};
if (message.issuerId !== "") {
obj.issuerId = message.issuerId;
}
return obj;
},
create(base) {
return exports.GenerateIssuerKeyRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseGenerateIssuerKeyRequest();
message.issuerId = (_a = object.issuerId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseGenerateIssuerKeyResponse() {
return { status: 0, message: "", key: undefined };
}
exports.GenerateIssuerKeyResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
if (message.key !== undefined) {
exports.IssuerKey.encode(message.key, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenerateIssuerKeyResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.key = exports.IssuerKey.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
key: isSet(object.key) ? exports.IssuerKey.fromJSON(object.key) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if (message.key !== undefined) {
obj.key = exports.IssuerKey.toJSON(message.key);
}
return obj;
},
create(base) {
return exports.GenerateIssuerKeyResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseGenerateIssuerKeyResponse();
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
message.message = (_b = object.message) !== null && _b !== void 0 ? _b : "";
message.key = (object.key !== undefined && object.key !== null) ? exports.IssuerKey.fromPartial(object.key) : undefined;
return message;
},
};
function createBaseGetIssuerKeyRequest() {
return { issuerId: "" };
}
exports.GetIssuerKeyRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.issuerId !== "") {
writer.uint32(10).string(message.issuerId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetIssuerKeyRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.issuerId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { issuerId: isSet(object.issuerId) ? globalThis.String(object.issuerId) : "" };
},
toJSON(message) {
const obj = {};
if (message.issuerId !== "") {
obj.issuerId = message.issuerId;
}
return obj;
},
create(base) {
return exports.GetIssuerKeyRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseGetIssuerKeyRequest();
message.issuerId = (_a = object.issuerId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseGetIssuerKeyResponse() {
return { status: 0, message: "", key: undefined };
}
exports.GetIssuerKeyResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
if (message.key !== undefined) {
exports.IssuerKey.encode(message.key, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetIssuerKeyResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.key = exports.IssuerKey.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
key: isSet(object.key) ? exports.IssuerKey.fromJSON(object.key) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if (message.key !== undefined) {
obj.key = exports.IssuerKey.toJSON(message.key);
}
return obj;
},
create(base) {
return exports.GetIssuerKeyResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseGetIssuerKeyResponse();
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
message.message = (_b = object.message) !== null && _b !== void 0 ? _b : "";
message.key = (object.key !== undefined && object.key !== null) ? exports.IssuerKey.fromPartial(object.key) : undefined;
return message;
},
};
function createBaseListIssuerKeysRequest() {
return { issuerId: "" };
}
exports.ListIssuerKeysRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.issuerId !== "") {
writer.uint32(10).string(message.issuerId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListIssuerKeysRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.issuerId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { issuerId: isSet(object.issuerId) ? globalThis.String(object.issuerId) : "" };
},
toJSON(message) {
const obj = {};
if (message.issuerId !== "") {
obj.issuerId = message.issuerId;
}
return obj;
},
create(base) {
return exports.ListIssuerKeysRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListIssuerKeysRequest();
message.issuerId = (_a = object.issuerId) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseListIssuerKeysResponse() {
return { status: 0, message: "", keys: [] };
}
exports.ListIssuerKeysResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
for (const v of message.keys) {
exports.IssuerKey.encode(v, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListIssuerKeysResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.keys.push(exports.IssuerKey.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
keys: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.keys) ? object.keys.map((e) => exports.IssuerKey.fromJSON(e)) : [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if ((_a = message.keys) === null || _a === void 0 ? void 0 : _a.length) {
obj.keys = message.keys.map((e) => exports.IssuerKey.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListIssuerKeysResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseListIssuerKeysResponse();
message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
message.message = (_b = object.message) !== null && _b !== void 0 ? _b : "";
message.keys = ((_c = object.keys) === null || _c === void 0 ? void 0 : _c.map((e) => exports.IssuerKey.fromPartial(e))) || [];
return message;
},
};
function createBaseRevokeIssuerKeyRequest() {
return { keyId: "", reason: "" };
}
exports.RevokeIssuerKeyRequest = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.keyId !== "") {
writer.uint32(10).string(message.keyId);
}
if (message.reason !== "") {
writer.uint32(18).string(message.reason);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRevokeIssuerKeyRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.keyId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.reason = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
keyId: isSet(object.keyId) ? globalThis.String(object.keyId) : "",
reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
};
},
toJSON(message) {
const obj = {};
if (message.keyId !== "") {
obj.keyId = message.keyId;
}
if (message.reason !== "") {
obj.reason = message.reason;
}
return obj;
},
create(base) {
return exports.RevokeIssuerKeyRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseRevokeIssuerKeyRequest();
message.keyId = (_a = object.keyId) !== null && _a !== void 0 ? _a : "";
message.reason = (_b = object.reason) !== null && _b !== void 0 ? _b : "";
return message;
},
};
function createBaseRevokeIssuerKeyResponse() {
return { status: 0, message: "" };
}
exports.RevokeIssuerKeyResponse = {
encode(message, writer = new wire_1.BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
return writer;
},
decode(input, length) {
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRevokeIssuerKeyResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7)