@@ -10,6 +10,7 @@ import * as path from 'path';
1010import {
1111 CHANNELS ,
1212 CreateKeyRequest ,
13+ CreatePrincipalRequest ,
1314 FieldPurpose ,
1415 ItemKind ,
1516 SignInRequest ,
@@ -242,6 +243,11 @@ export const registerIpc = (service: VaultService): void => {
242243 expiresIn : days === undefined ? undefined : { days : assertInt ( days , 1 , 3650 ) } ,
243244 accessLevel :
244245 request ?. accessLevel === undefined ? undefined : assertString ( request . accessLevel ) ,
246+ principalId :
247+ request ?. principalId === undefined ? undefined : assertString ( request . principalId ) ,
248+ orgId : request ?. orgId === undefined ? undefined : assertString ( request . orgId ) ,
249+ databaseId :
250+ request ?. databaseId === undefined ? undefined : assertString ( request . databaseId ) ,
245251 } ,
246252 proof ( stepUp )
247253 ) ;
@@ -256,6 +262,40 @@ export const registerIpc = (service: VaultService): void => {
256262 await accounts ( ) . revokeApiKey ( assertString ( itemId ) , proof ( stepUp ) ) ;
257263 service . scheduleSave ( ) ;
258264 } ) ;
265+ handle (
266+ CHANNELS . accountsAssignKeyDatabase ,
267+ async ( itemId : string , databaseId : string ) => {
268+ await accounts ( ) . assignKeyToDatabase ( assertString ( itemId ) , assertString ( databaseId ) ) ;
269+ service . scheduleSave ( ) ;
270+ }
271+ ) ;
272+ handle ( CHANNELS . accountsPrincipals , ( accountItemId : string ) =>
273+ accounts ( ) . listPrincipals ( assertString ( accountItemId ) )
274+ ) ;
275+ handle (
276+ CHANNELS . accountsCreatePrincipal ,
277+ ( accountItemId : string , request : CreatePrincipalRequest , stepUp ?: StepUpProof ) =>
278+ accounts ( ) . createPrincipal (
279+ assertString ( accountItemId ) ,
280+ {
281+ name : assertString ( request ?. name ) ,
282+ orgId : assertString ( request ?. orgId ) ,
283+ isReadOnly : Boolean ( request ?. isReadOnly ) ,
284+ bypassStepUp : Boolean ( request ?. bypassStepUp ) ,
285+ } ,
286+ proof ( stepUp )
287+ )
288+ ) ;
289+ handle (
290+ CHANNELS . accountsDeletePrincipal ,
291+ async ( accountItemId : string , principalId : string , stepUp ?: StepUpProof ) => {
292+ await accounts ( ) . deletePrincipal (
293+ assertString ( accountItemId ) ,
294+ assertString ( principalId ) ,
295+ proof ( stepUp )
296+ ) ;
297+ }
298+ ) ;
259299 handle ( CHANNELS . accountsLinkTotp , async ( accountItemId : string , totpItemId : string ) => {
260300 await accounts ( ) . linkTotp ( assertString ( accountItemId ) , assertString ( totpItemId ) ) ;
261301 service . scheduleSave ( ) ;
0 commit comments