mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Renamed folders: ./apps/desktop/src/models/nativeMessaging ./apps/desktop/src/models/nativeMessaging/encryptedMessagePayloads ./apps/desktop/src/models/nativeMessaging/encryptedMessageResponses Renamed all files Cleaned up entries in whitelist-capital-letters.txt
This commit is contained in:
committed by
GitHub
parent
175eef5376
commit
db2d8aaa7e
@@ -0,0 +1,6 @@
|
||||
import { EncryptedCommand } from "./encrypted-command";
|
||||
|
||||
export type DecryptedCommandData = {
|
||||
command: EncryptedCommand;
|
||||
payload?: any;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export type EncryptedCommand =
|
||||
| "bw-status"
|
||||
| "bw-credential-retrieval"
|
||||
| "bw-credential-create"
|
||||
| "bw-credential-update"
|
||||
| "bw-generate-password";
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CredentialCreatePayload = {
|
||||
userId: string;
|
||||
userName: string;
|
||||
password: string;
|
||||
name: string;
|
||||
uri: string;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export type CredentialRetrievePayload = {
|
||||
userId: string;
|
||||
uri: string;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export type CredentialUpdatePayload = {
|
||||
userId: string;
|
||||
userName: string;
|
||||
password: string;
|
||||
name: string;
|
||||
uri: string;
|
||||
credentialId: string;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type PasswordGeneratePayload = {
|
||||
userId: string;
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
|
||||
import { MessageCommon } from "./message-common";
|
||||
|
||||
export type EncryptedMessageResponse = MessageCommon & {
|
||||
encryptedPayload: EncString;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export type AccountStatusResponse = {
|
||||
id: string;
|
||||
email: string;
|
||||
status: "locked" | "unlocked";
|
||||
active: boolean;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type CannotDecryptErrorResponse = {
|
||||
error: "cannot-decrypt";
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CipherResponse = {
|
||||
userId: string;
|
||||
credentialId: string;
|
||||
userName: string;
|
||||
password: string;
|
||||
name: string;
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { AccountStatusResponse } from "./account-status-response";
|
||||
import { CannotDecryptErrorResponse } from "./cannot-decrypt-error-response";
|
||||
import { CipherResponse } from "./cipher-response";
|
||||
import { FailureStatusResponse } from "./failure-status-response";
|
||||
import { GenerateResponse } from "./generate-response";
|
||||
import { SuccessStatusResponse } from "./success-status-response";
|
||||
import { UserStatusErrorResponse } from "./user-status-error-response";
|
||||
|
||||
export type EncyptedMessageResponse =
|
||||
| AccountStatusResponse[]
|
||||
| CannotDecryptErrorResponse
|
||||
| CipherResponse[]
|
||||
| FailureStatusResponse
|
||||
| GenerateResponse
|
||||
| SuccessStatusResponse
|
||||
| UserStatusErrorResponse;
|
||||
@@ -0,0 +1,3 @@
|
||||
export type FailureStatusResponse = {
|
||||
status: "failure";
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type GenerateResponse = {
|
||||
password: string;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type SuccessStatusResponse = {
|
||||
status: "success";
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type UserStatusErrorResponse = {
|
||||
error: "locked" | "not-active-user";
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
|
||||
import { MessageCommon } from "./message-common";
|
||||
|
||||
export type EncryptedMessage = MessageCommon & {
|
||||
// Will decrypt to a DecryptedCommandData object
|
||||
encryptedCommand: EncString;
|
||||
};
|
||||
25
apps/desktop/src/models/native-messaging/index.ts
Normal file
25
apps/desktop/src/models/native-messaging/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export * from "./encrypted-message-payloads/credential-create-payload";
|
||||
export * from "./encrypted-message-payloads/credential-retrieve-payload";
|
||||
export * from "./encrypted-message-payloads/credential-update-payload";
|
||||
export * from "./encrypted-message-payloads/password-generate-payload";
|
||||
|
||||
export * from "./encrypted-message-responses/account-status-response";
|
||||
export * from "./encrypted-message-responses/cannot-decrypt-error-response";
|
||||
export * from "./encrypted-message-responses/cipher-response";
|
||||
export * from "./encrypted-message-responses/encrypted-message-response";
|
||||
export * from "./encrypted-message-responses/failure-status-response";
|
||||
export * from "./encrypted-message-responses/generate-response";
|
||||
export * from "./encrypted-message-responses/success-status-response";
|
||||
export * from "./encrypted-message-responses/user-status-error-response";
|
||||
|
||||
export * from "./decrypted-command-data";
|
||||
export * from "./encrypted-command";
|
||||
export * from "./encrypted-message";
|
||||
export * from "./encrypted-message-response";
|
||||
export * from "./legacy-message";
|
||||
export * from "./legacy-message-wrapper";
|
||||
export * from "./message";
|
||||
export * from "./message-common";
|
||||
export * from "./unencrypted-command";
|
||||
export * from "./unencrypted-message";
|
||||
export * from "./unencrypted-message-response";
|
||||
@@ -0,0 +1,8 @@
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
|
||||
import { LegacyMessage } from "./legacy-message";
|
||||
|
||||
export type LegacyMessageWrapper = {
|
||||
message: LegacyMessage | EncString;
|
||||
appId: string;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export type LegacyMessage = {
|
||||
command: string;
|
||||
|
||||
userId?: string;
|
||||
timestamp?: number;
|
||||
|
||||
publicKey?: string;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface MessageCommon {
|
||||
version: number;
|
||||
messageId: string;
|
||||
}
|
||||
4
apps/desktop/src/models/native-messaging/message.ts
Normal file
4
apps/desktop/src/models/native-messaging/message.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { EncryptedMessage } from "./encrypted-message";
|
||||
import { UnencryptedMessage } from "./unencrypted-message";
|
||||
|
||||
export type Message = UnencryptedMessage | EncryptedMessage;
|
||||
@@ -0,0 +1 @@
|
||||
export type UnencryptedCommand = "bw-handshake";
|
||||
@@ -0,0 +1,16 @@
|
||||
import { MessageCommon } from "./message-common";
|
||||
|
||||
export type UnencryptedMessageResponse = MessageCommon &
|
||||
(
|
||||
| {
|
||||
payload: {
|
||||
status: "success";
|
||||
sharedKey: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
payload: {
|
||||
error: "canceled" | "locked" | "cannot-decrypt" | "version-discrepancy";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
import { MessageCommon } from "./message-common";
|
||||
import { UnencryptedCommand } from "./unencrypted-command";
|
||||
|
||||
export type UnencryptedMessage = MessageCommon & {
|
||||
command: UnencryptedCommand;
|
||||
payload: {
|
||||
publicKey: string;
|
||||
applicationName: string;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user