@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
392 lines (391 loc) • 13.8 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc unknown
// source: zitadel/user/v2beta/password.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "zitadel.user.v2beta";
export var NotificationType;
(function (NotificationType) {
NotificationType[NotificationType["NOTIFICATION_TYPE_Unspecified"] = 0] = "NOTIFICATION_TYPE_Unspecified";
NotificationType[NotificationType["NOTIFICATION_TYPE_Email"] = 1] = "NOTIFICATION_TYPE_Email";
NotificationType[NotificationType["NOTIFICATION_TYPE_SMS"] = 2] = "NOTIFICATION_TYPE_SMS";
NotificationType[NotificationType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(NotificationType || (NotificationType = {}));
export function notificationTypeFromJSON(object) {
switch (object) {
case 0:
case "NOTIFICATION_TYPE_Unspecified":
return NotificationType.NOTIFICATION_TYPE_Unspecified;
case 1:
case "NOTIFICATION_TYPE_Email":
return NotificationType.NOTIFICATION_TYPE_Email;
case 2:
case "NOTIFICATION_TYPE_SMS":
return NotificationType.NOTIFICATION_TYPE_SMS;
case -1:
case "UNRECOGNIZED":
default:
return NotificationType.UNRECOGNIZED;
}
}
export function notificationTypeToJSON(object) {
switch (object) {
case NotificationType.NOTIFICATION_TYPE_Unspecified:
return "NOTIFICATION_TYPE_Unspecified";
case NotificationType.NOTIFICATION_TYPE_Email:
return "NOTIFICATION_TYPE_Email";
case NotificationType.NOTIFICATION_TYPE_SMS:
return "NOTIFICATION_TYPE_SMS";
case NotificationType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBasePassword() {
return { password: "", changeRequired: false };
}
export const Password = {
encode(message, writer = new BinaryWriter()) {
if (message.password !== "") {
writer.uint32(10).string(message.password);
}
if (message.changeRequired !== false) {
writer.uint32(16).bool(message.changeRequired);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePassword();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.password = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.changeRequired = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
password: isSet(object.password) ? globalThis.String(object.password) : "",
changeRequired: isSet(object.changeRequired) ? globalThis.Boolean(object.changeRequired) : false,
};
},
toJSON(message) {
const obj = {};
if (message.password !== "") {
obj.password = message.password;
}
if (message.changeRequired !== false) {
obj.changeRequired = message.changeRequired;
}
return obj;
},
create(base) {
return Password.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBasePassword();
message.password = object.password ?? "";
message.changeRequired = object.changeRequired ?? false;
return message;
},
};
function createBaseHashedPassword() {
return { hash: "", changeRequired: false };
}
export const HashedPassword = {
encode(message, writer = new BinaryWriter()) {
if (message.hash !== "") {
writer.uint32(10).string(message.hash);
}
if (message.changeRequired !== false) {
writer.uint32(16).bool(message.changeRequired);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHashedPassword();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.hash = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.changeRequired = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
hash: isSet(object.hash) ? globalThis.String(object.hash) : "",
changeRequired: isSet(object.changeRequired) ? globalThis.Boolean(object.changeRequired) : false,
};
},
toJSON(message) {
const obj = {};
if (message.hash !== "") {
obj.hash = message.hash;
}
if (message.changeRequired !== false) {
obj.changeRequired = message.changeRequired;
}
return obj;
},
create(base) {
return HashedPassword.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseHashedPassword();
message.hash = object.hash ?? "";
message.changeRequired = object.changeRequired ?? false;
return message;
},
};
function createBaseSendPasswordResetLink() {
return { notificationType: 0, urlTemplate: undefined };
}
export const SendPasswordResetLink = {
encode(message, writer = new BinaryWriter()) {
if (message.notificationType !== 0) {
writer.uint32(8).int32(message.notificationType);
}
if (message.urlTemplate !== undefined) {
writer.uint32(18).string(message.urlTemplate);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSendPasswordResetLink();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.notificationType = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.urlTemplate = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
notificationType: isSet(object.notificationType) ? notificationTypeFromJSON(object.notificationType) : 0,
urlTemplate: isSet(object.urlTemplate) ? globalThis.String(object.urlTemplate) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.notificationType !== 0) {
obj.notificationType = notificationTypeToJSON(message.notificationType);
}
if (message.urlTemplate !== undefined) {
obj.urlTemplate = message.urlTemplate;
}
return obj;
},
create(base) {
return SendPasswordResetLink.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSendPasswordResetLink();
message.notificationType = object.notificationType ?? 0;
message.urlTemplate = object.urlTemplate ?? undefined;
return message;
},
};
function createBaseReturnPasswordResetCode() {
return {};
}
export const ReturnPasswordResetCode = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReturnPasswordResetCode();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return ReturnPasswordResetCode.fromPartial(base ?? {});
},
fromPartial(_) {
const message = createBaseReturnPasswordResetCode();
return message;
},
};
function createBaseSetPassword() {
return { password: undefined, hashedPassword: undefined, currentPassword: undefined, verificationCode: undefined };
}
export const SetPassword = {
encode(message, writer = new BinaryWriter()) {
if (message.password !== undefined) {
Password.encode(message.password, writer.uint32(10).fork()).join();
}
if (message.hashedPassword !== undefined) {
HashedPassword.encode(message.hashedPassword, writer.uint32(18).fork()).join();
}
if (message.currentPassword !== undefined) {
writer.uint32(26).string(message.currentPassword);
}
if (message.verificationCode !== undefined) {
writer.uint32(34).string(message.verificationCode);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSetPassword();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.password = Password.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.hashedPassword = HashedPassword.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.currentPassword = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.verificationCode = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
password: isSet(object.password) ? Password.fromJSON(object.password) : undefined,
hashedPassword: isSet(object.hashedPassword) ? HashedPassword.fromJSON(object.hashedPassword) : undefined,
currentPassword: isSet(object.currentPassword) ? globalThis.String(object.currentPassword) : undefined,
verificationCode: isSet(object.verificationCode) ? globalThis.String(object.verificationCode) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.password !== undefined) {
obj.password = Password.toJSON(message.password);
}
if (message.hashedPassword !== undefined) {
obj.hashedPassword = HashedPassword.toJSON(message.hashedPassword);
}
if (message.currentPassword !== undefined) {
obj.currentPassword = message.currentPassword;
}
if (message.verificationCode !== undefined) {
obj.verificationCode = message.verificationCode;
}
return obj;
},
create(base) {
return SetPassword.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetPassword();
message.password = (object.password !== undefined && object.password !== null)
? Password.fromPartial(object.password)
: undefined;
message.hashedPassword = (object.hashedPassword !== undefined && object.hashedPassword !== null)
? HashedPassword.fromPartial(object.hashedPassword)
: undefined;
message.currentPassword = object.currentPassword ?? undefined;
message.verificationCode = object.verificationCode ?? undefined;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}