Skip to content

Commit ba5a5aa

Browse files
Update sync
1 parent f53fd54 commit ba5a5aa

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/commands/token/sync.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { TwilioClientCommand } = require('@twilio/cli-core').baseCommands;
33
const Twilio = require('twilio');
44
const createToken = require('../../helpers/accessToken.js');
55
const globalFlags = require('../../helpers/globalFlags.js');
6+
const validateSid = require('../../helpers/validatin-helpers.js');
67

78
class SyncTokenGenerator extends TwilioClientCommand {
89
constructor(argv, config) {
@@ -11,20 +12,13 @@ class SyncTokenGenerator extends TwilioClientCommand {
1112
this.showHeaders = true;
1213
}
1314

14-
validateSyncServiceSid(sid) {
15-
return (
16-
sid.startsWith('IS') &&
17-
sid.length === 34
18-
);
19-
}
20-
2115
async run() {
2216
await super.run();
2317

2418
const syncServiceSid = await this.flags['sync-service-sid'];
2519
const accessToken = createToken.call(this);
2620

27-
if (!this.validateSyncServiceSid(syncServiceSid)) {
21+
if (!validateSid('IS', syncServiceSid)) {
2822
this.logger.error(
2923
'Invalid Sync Service SID, must look like ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
3024
);

0 commit comments

Comments
 (0)