File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ export interface Routes {
88 */
99 addDevice : ( kwargs : { id : string } ) => Promise < void > ;
1010
11+ /**
12+ * Returns the credentials file (.ovpn) for device `id`
13+ * @param id "new-device"
14+ */
15+ getCredFile ( { id } : { id : string } ) : Promise < string > ;
16+
1117 /**
1218 * Creates a new OpenVPN credentials file, encrypted.
1319 * The filename is the (16 chars short) result of hashing the generated salt in the db,
@@ -57,6 +63,7 @@ export interface Routes {
5763
5864export const routesData : { [ P in keyof Routes ] : { } } = {
5965 addDevice : { } ,
66+ getCredFile : { } ,
6067 getDeviceCredentials : { } ,
6168 getMasterAdminCred : { } ,
6269 getStatus : { } ,
Original file line number Diff line number Diff line change 1+ import { getClient } from "../openvpn" ;
2+
3+ /**
4+ * Returns the credentials file (.ovpn) for device `id`
5+ * @param id "new-device"
6+ */
7+ export async function getCredFile ( { id } : { id : string } ) : Promise < string > {
8+ return await getClient ( id ) ;
9+ }
Original file line number Diff line number Diff line change 11export * from "./addDevice" ;
2+ export * from "./getCredFile" ;
23export * from "./getDeviceCredentials" ;
34export * from "./getMasterAdminCred" ;
45export * from "./getStatus" ;
Original file line number Diff line number Diff line change 6363 console . log ( chalk . green ( `Credentials generated for ${ id } :\n${ url } ` ) ) ;
6464 }
6565 } )
66+ . command ( {
67+ command : "print <id>" ,
68+ describe : "Print config file to stdout." ,
69+ builder : idArg ,
70+ handler : async ( { id } ) => {
71+ const credFile = await api . getCredFile ( { id } ) ;
72+ console . log ( credFile ) ;
73+ }
74+ } )
6675 . command ( {
6776 command : "add <id>" ,
6877 describe : "Add device." ,
You can’t perform that action at this time.
0 commit comments