@@ -37,12 +37,17 @@ const exchangeAuthCodeToTokenMutation = `mutation ExchangeAuthCodeToToken($reque
3737}`
3838
3939// vaultPermissionForMethod returns the API permission name for the given vault operation.
40+ // Names match the VaultPermission enum in platform GraphQL (createVaultAuthorizationUrl).
4041func vaultPermissionForMethod (method string ) (string , error ) {
4142 switch method {
4243 case vaulttypes .MethodSecretsCreate :
4344 return "VAULT_PERMISSION_CREATE_SECRETS" , nil
4445 case vaulttypes .MethodSecretsUpdate :
4546 return "VAULT_PERMISSION_UPDATE_SECRETS" , nil
47+ case vaulttypes .MethodSecretsDelete :
48+ return "VAULT_PERMISSION_DELETE_SECRETS" , nil
49+ case vaulttypes .MethodSecretsList :
50+ return "VAULT_PERMISSION_LIST_SECRETS" , nil
4651 default :
4752 return "" , fmt .Errorf ("unsupported method: %s" , method )
4853 }
@@ -110,6 +115,16 @@ func (h *Handler) executeBrowserUpsert(ctx context.Context, inputs UpsertSecrets
110115 return fmt .Errorf ("unsupported method %q (expected %q or %q)" , method , vaulttypes .MethodSecretsCreate , vaulttypes .MethodSecretsUpdate )
111116 }
112117
118+ return h .ExecuteBrowserVaultAuthorization (ctx , method , digest )
119+ }
120+
121+ // ExecuteBrowserVaultAuthorization completes platform OAuth for a vault JSON-RPC digest (create/update/delete/list).
122+ // It does not POST to the gateway; the short-lived vault JWT is for future DON submission.
123+ func (h * Handler ) ExecuteBrowserVaultAuthorization (ctx context.Context , method string , digest [32 ]byte ) error {
124+ if h .Credentials .AuthType == credentials .AuthTypeApiKey {
125+ return fmt .Errorf ("this sign-in flow requires an interactive login; API keys are not supported" )
126+ }
127+
113128 perm , err := vaultPermissionForMethod (method )
114129 if err != nil {
115130 return err
0 commit comments