feat(git): add token authentication and credential discovery
Add support for token-based git authentication in identity profiles. Enable discovery and import of credentials from ~/.git-credentials file. Introduce remote URL-based filtering for token identities in git view.
This commit is contained in:
@@ -21,7 +21,8 @@ import type {
|
||||
GitLogResponse,
|
||||
GitCommitFilesResponse,
|
||||
GitIdentitySummary,
|
||||
GitIdentityProfile
|
||||
GitIdentityProfile,
|
||||
DiscoveredGitCredential
|
||||
} from '@openchamber/ui/lib/api/types';
|
||||
|
||||
async function safeGitInvoke<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||
@@ -237,4 +238,24 @@ export const createDesktopGitAPI = (): GitAPI => ({
|
||||
async deleteGitIdentity(id: string): Promise<void> {
|
||||
return safeGitInvoke<void>('delete_git_identity', { id });
|
||||
},
|
||||
|
||||
async discoverGitCredentials(): Promise<DiscoveredGitCredential[]> {
|
||||
return safeGitInvoke<DiscoveredGitCredential[]>('discover_git_credentials');
|
||||
},
|
||||
|
||||
async getGlobalGitIdentity(): Promise<GitIdentitySummary | null> {
|
||||
try {
|
||||
return await safeGitInvoke<GitIdentitySummary>('get_global_git_identity');
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
async getRemoteUrl(directory: string, remote?: string): Promise<string | null> {
|
||||
try {
|
||||
return await safeGitInvoke<string | null>('get_remote_url', { directory, remote });
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user