@vonage/verify
Version:
Verify API provides a choice of routes for sending a code to a user. You can use this to confirm a user's contact information, as a second factor when authenticating users, or for step-up authentication.
171 lines (167 loc) • 4.28 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);
// lib/classes/index.ts
var classes_exports = {};
__export(classes_exports, {
PSD2: () => PSD2,
Verification: () => Verification
});
module.exports = __toCommonJS(classes_exports);
// lib/classes/PSD2.ts
var PSD2 = class {
/**
* The phone number to be verified.
*/
number;
/**
* The payee's name or identifier for the payment confirmation.
*/
payee;
/**
* The decimal amount of the payment to be confirmed, in Euros.
*/
amount;
/**
* The country code associated with the phone number (optional).
*/
country;
/**
* The desired length of the verification code (optional).
*/
codeLength;
/**
* @deprecated This property is deprecated. Use `lg` instead.
*/
language;
/**
* The language for sending verification messages (optional).
*/
lg;
/**
* The duration in seconds for which the verification code will be valid.
*/
pinExpiry;
/**
* The duration in seconds to wait before sending the next verification event.
*/
nextEventWait;
/**
* The workflow ID for customizing the verification process (optional).
*/
workflowId;
constructor(phoneNumber, payee, amount, country, codeLength, language, lg, pinExpiry, nextEventWait, workflowId) {
this.number = phoneNumber;
this.amount = amount;
this.payee = payee;
if (country) {
this.country = country;
}
if (codeLength) {
this.codeLength = codeLength;
}
if (language) {
this.lg = language;
this.language = language;
}
if (pinExpiry) {
this.pinExpiry = pinExpiry;
}
if (nextEventWait) {
this.nextEventWait = nextEventWait;
}
if (workflowId) {
this.workflowId = workflowId;
}
}
};
// lib/classes/Verification.ts
var Verification = class {
/**
* The phone number to be verified.
*/
number;
/**
* The brand or application name associated with the verification request.
*/
brand;
/**
* The country code associated with the phone number (optional).
*/
country;
/**
* The sender ID or phone number that will be used to send verification
* messages (optional).
*/
senderId;
/**
* The desired length of the verification code (optional).
*/
codeLength;
/**
* @deprecated This property is deprecated. Use `lg` instead.
*/
language;
/**
* The language for sending verification messages (optional).
*/
lg;
/**
* The duration in seconds for which the verification code will be valid.
*/
pinExpiry;
/**
* The duration in seconds to wait before sending the next verification event.
*/
nextEventWait;
/**
* The workflow ID for customizing the verification process (optional).
*/
workflowId;
constructor(phoneNumber, brand, country, senderId, codeLength, language, lg, pinExpiry, nextEventWait, workflowId) {
this.number = phoneNumber;
this.brand = brand;
if (country) {
this.country = country;
}
if (senderId) {
this.senderId = senderId;
}
if (codeLength) {
this.codeLength = codeLength;
}
if (language) {
this.lg = language;
this.language = language;
}
if (pinExpiry) {
this.pinExpiry = pinExpiry;
}
if (nextEventWait) {
this.nextEventWait = nextEventWait;
}
if (workflowId) {
this.workflowId = workflowId;
}
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PSD2,
Verification
});