@@ -10,11 +10,7 @@ import {
1010 RotationProfile ,
1111 ScheduleData ,
1212} from './rotationTypes'
13- import {
14- getVaultRecord ,
15- recordExistsInVault ,
16- getVaultRecordTitleType ,
17- } from './rotationHelpers'
13+ import { getVaultRecord , recordExistsInVault , getVaultRecordTitleType } from './rotationHelpers'
1814import { RECORD_ROTATION_KIND } from './rotationConstants'
1915
2016const DEFAULT_PAM_SPECIAL_CHAR = '!@#$%^&*()_+-=[]{}|;:,.<>?'
@@ -54,15 +50,12 @@ export async function editRotation(
5450 const skippedRecords : EditRotationResult [ 'skippedRecords' ] = [ ]
5551
5652 try {
57- const currentRotation = storage . getByUid < DRecordRotation > (
58- RECORD_ROTATION_KIND ,
59- recordUid
60- )
53+ const currentRotation = storage . getByUid < DRecordRotation > ( RECORD_ROTATION_KIND , recordUid )
6154
6255 if ( ! currentRotation && ! input . configUid && ! input . iamAadConfigUid && ! input . saasConfigUid ) {
6356 throw new KeeperSdkError (
6457 `Record "${ recordUid } " does not have rotation configured yet. ` +
65- `You must provide a PAM Configuration UID (--config) to configure rotation for this record.` ,
58+ `You must provide a PAM Configuration UID (--config) to configure rotation for this record.` ,
6659 ResultCodes . PAM_ROTATION_RECORD_REQUIRED
6760 )
6861 }
@@ -75,7 +68,7 @@ export async function editRotation(
7568 if ( ! configUid && ! currentRotation ) {
7669 throw new KeeperSdkError (
7770 `PAM Configuration UID is required when setting up rotation for the first time. ` +
78- `Provide it with --config, --iam-aad-config, or --saas-config.` ,
71+ `Provide it with --config, --iam-aad-config, or --saas-config.` ,
7972 ResultCodes . PAM_ROTATION_RECORD_REQUIRED
8073 )
8174 }
@@ -93,9 +86,10 @@ export async function editRotation(
9386 let scheduleData = validateAndBuildScheduleData ( input )
9487 if ( ! scheduleData && currentRotation ?. schedule ) {
9588 try {
96- scheduleData = typeof currentRotation . schedule === 'string'
97- ? JSON . parse ( currentRotation . schedule )
98- : currentRotation . schedule
89+ scheduleData =
90+ typeof currentRotation . schedule === 'string'
91+ ? JSON . parse ( currentRotation . schedule )
92+ : currentRotation . schedule
9993 } catch ( e ) {
10094 scheduleData = null
10195 }
@@ -109,9 +103,10 @@ export async function editRotation(
109103 if ( currentRotation ) {
110104 if ( currentRotation . schedule ) {
111105 try {
112- currentSchedule = typeof currentRotation . schedule === 'string'
113- ? currentRotation . schedule
114- : JSON . stringify ( currentRotation . schedule )
106+ currentSchedule =
107+ typeof currentRotation . schedule === 'string'
108+ ? currentRotation . schedule
109+ : JSON . stringify ( currentRotation . schedule )
115110 } catch ( e ) {
116111 currentSchedule = ''
117112 }
@@ -151,11 +146,7 @@ export async function editRotation(
151146
152147 let passwordComplexityEncrypted = currentComplexity
153148 if ( input . passwordComplexity ) {
154- const encrypted = await encryptPasswordComplexity (
155- storage ,
156- recordUid ,
157- input . passwordComplexity
158- )
149+ const encrypted = await encryptPasswordComplexity ( storage , recordUid , input . passwordComplexity )
159150 if ( encrypted ) {
160151 passwordComplexityEncrypted = platform . base64ToBytes ( encrypted )
161152 }
@@ -164,9 +155,7 @@ export async function editRotation(
164155 let finalScheduleData = scheduleData
165156 if ( ! finalScheduleData && currentSchedule ) {
166157 try {
167- finalScheduleData = typeof currentSchedule === 'string'
168- ? JSON . parse ( currentSchedule )
169- : currentSchedule
158+ finalScheduleData = typeof currentSchedule === 'string' ? JSON . parse ( currentSchedule ) : currentSchedule
170159 } catch ( e ) {
171160 finalScheduleData = null
172161 }
@@ -295,10 +284,7 @@ async function encryptPasswordComplexity(
295284 }
296285
297286 const plainText = JSON . stringify ( complexityData )
298- const encrypted = await platform . aesGcmEncrypt (
299- platform . stringToBytes ( plainText ) ,
300- recordKey
301- )
287+ const encrypted = await platform . aesGcmEncrypt ( platform . stringToBytes ( plainText ) , recordKey )
302288 return platform . bytesToBase64 ( encrypted )
303289 } catch ( err ) {
304290 throw new KeeperSdkError (
0 commit comments