@ragnaraven/zitadel-node-dual
Version:
Library for API access to ZITADEL with modern ES import syntax. Works everywhere - NestJS, Node.js, any TypeScript environment. No more require()!
425 lines • 13.4 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var password_exports = {};
__export(password_exports, {
HashedPassword: () => HashedPassword,
NotificationType: () => NotificationType,
Password: () => Password,
ReturnPasswordResetCode: () => ReturnPasswordResetCode,
SendPasswordResetLink: () => SendPasswordResetLink,
SetPassword: () => SetPassword,
notificationTypeFromJSON: () => notificationTypeFromJSON,
notificationTypeToJSON: () => notificationTypeToJSON,
protobufPackage: () => protobufPackage
});
module.exports = __toCommonJS(password_exports);
var import_wire = require("@bufbuild/protobuf/wire");
const protobufPackage = "zitadel.user.v2beta";
var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
NotificationType2[NotificationType2["NOTIFICATION_TYPE_Unspecified"] = 0] = "NOTIFICATION_TYPE_Unspecified";
NotificationType2[NotificationType2["NOTIFICATION_TYPE_Email"] = 1] = "NOTIFICATION_TYPE_Email";
NotificationType2[NotificationType2["NOTIFICATION_TYPE_SMS"] = 2] = "NOTIFICATION_TYPE_SMS";
NotificationType2[NotificationType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
return NotificationType2;
})(NotificationType || {});
function notificationTypeFromJSON(object) {
switch (object) {
case 0:
case "NOTIFICATION_TYPE_Unspecified":
return 0 /* NOTIFICATION_TYPE_Unspecified */;
case 1:
case "NOTIFICATION_TYPE_Email":
return 1 /* NOTIFICATION_TYPE_Email */;
case 2:
case "NOTIFICATION_TYPE_SMS":
return 2 /* NOTIFICATION_TYPE_SMS */;
case -1:
case "UNRECOGNIZED":
default:
return -1 /* UNRECOGNIZED */;
}
}
function notificationTypeToJSON(object) {
switch (object) {
case 0 /* NOTIFICATION_TYPE_Unspecified */:
return "NOTIFICATION_TYPE_Unspecified";
case 1 /* NOTIFICATION_TYPE_Email */:
return "NOTIFICATION_TYPE_Email";
case 2 /* NOTIFICATION_TYPE_SMS */:
return "NOTIFICATION_TYPE_SMS";
case -1 /* UNRECOGNIZED */:
default:
return "UNRECOGNIZED";
}
}
function createBasePassword() {
return { password: "", changeRequired: false };
}
const Password = {
encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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 };
}
const HashedPassword = {
encode(message, writer = new import_wire.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 import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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: void 0 };
}
const SendPasswordResetLink = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.notificationType !== 0) {
writer.uint32(8).int32(message.notificationType);
}
if (message.urlTemplate !== void 0) {
writer.uint32(18).string(message.urlTemplate);
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.notificationType !== 0) {
obj.notificationType = notificationTypeToJSON(message.notificationType);
}
if (message.urlTemplate !== void 0) {
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 ?? void 0;
return message;
}
};
function createBaseReturnPasswordResetCode() {
return {};
}
const ReturnPasswordResetCode = {
encode(_, writer = new import_wire.BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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: void 0, hashedPassword: void 0, currentPassword: void 0, verificationCode: void 0 };
}
const SetPassword = {
encode(message, writer = new import_wire.BinaryWriter()) {
if (message.password !== void 0) {
Password.encode(message.password, writer.uint32(10).fork()).join();
}
if (message.hashedPassword !== void 0) {
HashedPassword.encode(message.hashedPassword, writer.uint32(18).fork()).join();
}
if (message.currentPassword !== void 0) {
writer.uint32(26).string(message.currentPassword);
}
if (message.verificationCode !== void 0) {
writer.uint32(34).string(message.verificationCode);
}
return writer;
},
decode(input, length) {
const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
const end = length === void 0 ? 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) : void 0,
hashedPassword: isSet(object.hashedPassword) ? HashedPassword.fromJSON(object.hashedPassword) : void 0,
currentPassword: isSet(object.currentPassword) ? globalThis.String(object.currentPassword) : void 0,
verificationCode: isSet(object.verificationCode) ? globalThis.String(object.verificationCode) : void 0
};
},
toJSON(message) {
const obj = {};
if (message.password !== void 0) {
obj.password = Password.toJSON(message.password);
}
if (message.hashedPassword !== void 0) {
obj.hashedPassword = HashedPassword.toJSON(message.hashedPassword);
}
if (message.currentPassword !== void 0) {
obj.currentPassword = message.currentPassword;
}
if (message.verificationCode !== void 0) {
obj.verificationCode = message.verificationCode;
}
return obj;
},
create(base) {
return SetPassword.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSetPassword();
message.password = object.password !== void 0 && object.password !== null ? Password.fromPartial(object.password) : void 0;
message.hashedPassword = object.hashedPassword !== void 0 && object.hashedPassword !== null ? HashedPassword.fromPartial(object.hashedPassword) : void 0;
message.currentPassword = object.currentPassword ?? void 0;
message.verificationCode = object.verificationCode ?? void 0;
return message;
}
};
function isSet(value) {
return value !== null && value !== void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HashedPassword,
NotificationType,
Password,
ReturnPasswordResetCode,
SendPasswordResetLink,
SetPassword,
notificationTypeFromJSON,
notificationTypeToJSON,
protobufPackage
});
//# sourceMappingURL=password.js.map