1
1
import winston from 'winston' ;
2
2
import { Command } from 'commander' ;
3
- import { listAllTeamDevices } from '../../command-handlers' ;
3
+ import { createTeamDevice , listAllTeamDevices } from '../../command-handlers' ;
4
4
import { connectAndPrepare } from '../../modules/database' ;
5
- import { deactivateTeamDevice , registerTeamDevice } from '../../endpoints' ;
5
+ import { deactivateTeamDevice } from '../../endpoints' ;
6
6
7
7
export const teamCredentialsCommands = ( params : { teamGroup : Command } ) => {
8
8
const { teamGroup } = params ;
@@ -14,23 +14,19 @@ export const teamCredentialsCommands = (params: { teamGroup: Command }) => {
14
14
. option ( '--json' , 'Output in JSON format' )
15
15
. description ( 'Generate new team credentials' )
16
16
. action ( async ( options : { json : boolean } ) => {
17
- const { db, localConfiguration } = await connectAndPrepare ( { autoSync : false } ) ;
18
- const credentials = await registerTeamDevice ( { localConfiguration, deviceName : 'Dashlane CLI' } ) ;
19
- db . close ( ) ;
17
+ const teamDeviceKeys = await createTeamDevice ( ) ;
20
18
21
19
if ( options . json ) {
22
20
console . log (
23
21
JSON . stringify ( {
24
- DASHLANE_TEAM_UUID : credentials . teamUuid ,
25
- DASHLANE_TEAM_ACCESS_KEY : credentials . deviceAccessKey ,
26
- DASHLANE_TEAM_SECRET_KEY : credentials . deviceSecretKey ,
22
+ DASHLANE_TEAM_DEVICE_KEYS : teamDeviceKeys ,
27
23
} )
28
24
) ;
29
25
} else {
30
- winston . info ( 'The credentials have been generated, run the following commands to export them:' ) ;
31
- console . log ( `export DASHLANE_TEAM_UUID= ${ credentials . teamUuid } ` ) ;
32
- console . log ( `export DASHLANE_TEAM_ACCESS_KEY= ${ credentials . deviceAccessKey } ` ) ;
33
- console . log ( `export DASHLANE_TEAM_SECRET_KEY =${ credentials . deviceSecretKey } ` ) ;
26
+ winston . info (
27
+ 'The credentials have been generated, run the following command to export them in your env:'
28
+ ) ;
29
+ console . log ( `export DASHLANE_TEAM_DEVICE_KEYS =${ teamDeviceKeys } ` ) ;
34
30
}
35
31
} ) ;
36
32
0 commit comments