122 lines
2.3 KiB
TypeScript
122 lines
2.3 KiB
TypeScript
|
import type { ValidationSchema } from '../../config/validator.js';
|
||
|
|
||
|
/**
|
||
|
* SMS service configuration schema
|
||
|
*/
|
||
|
export const smsConfigSchema: ValidationSchema = {
|
||
|
apiGatewayApiToken: {
|
||
|
type: 'string',
|
||
|
required: true
|
||
|
},
|
||
|
defaultSender: {
|
||
|
type: 'string',
|
||
|
required: false
|
||
|
},
|
||
|
rateLimit: {
|
||
|
type: 'object',
|
||
|
required: false,
|
||
|
schema: {
|
||
|
enabled: {
|
||
|
type: 'boolean',
|
||
|
required: false,
|
||
|
default: true
|
||
|
},
|
||
|
maxPerPeriod: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 100,
|
||
|
min: 1
|
||
|
},
|
||
|
periodMs: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 60000, // 1 minute
|
||
|
min: 1000
|
||
|
},
|
||
|
perKey: {
|
||
|
type: 'boolean',
|
||
|
required: false,
|
||
|
default: true
|
||
|
},
|
||
|
burstTokens: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 5,
|
||
|
min: 0
|
||
|
},
|
||
|
maxPerRecipientPerDay: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 10,
|
||
|
min: 1
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
provider: {
|
||
|
type: 'object',
|
||
|
required: false,
|
||
|
schema: {
|
||
|
type: {
|
||
|
type: 'string',
|
||
|
required: false,
|
||
|
enum: ['gateway', 'twilio', 'other'],
|
||
|
default: 'gateway'
|
||
|
},
|
||
|
config: {
|
||
|
type: 'object',
|
||
|
required: false
|
||
|
},
|
||
|
fallback: {
|
||
|
type: 'object',
|
||
|
required: false,
|
||
|
schema: {
|
||
|
enabled: {
|
||
|
type: 'boolean',
|
||
|
required: false,
|
||
|
default: false
|
||
|
},
|
||
|
type: {
|
||
|
type: 'string',
|
||
|
required: false,
|
||
|
enum: ['gateway', 'twilio', 'other']
|
||
|
},
|
||
|
config: {
|
||
|
type: 'object',
|
||
|
required: false
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
verification: {
|
||
|
type: 'object',
|
||
|
required: false,
|
||
|
schema: {
|
||
|
codeLength: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 6,
|
||
|
min: 4,
|
||
|
max: 10
|
||
|
},
|
||
|
expirationSeconds: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 300, // 5 minutes
|
||
|
min: 60
|
||
|
},
|
||
|
maxAttempts: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 3,
|
||
|
min: 1
|
||
|
},
|
||
|
cooldownSeconds: {
|
||
|
type: 'number',
|
||
|
required: false,
|
||
|
default: 60, // 1 minute
|
||
|
min: 0
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|