Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: use more steps for invites #484

Merged
merged 28 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e915c13
refactor!: use more steps for invites
EvanHahn Feb 19, 2024
c8e108c
Merge branch 'main' into update-invites
EvanHahn Feb 21, 2024
f71351d
Remove event listener if accepting fails
EvanHahn Feb 21, 2024
8ad29aa
Add HashMap class for a Map-like interface that can use Buffers for keys
EvanHahn Feb 21, 2024
e1ebe54
Make invitorName required
EvanHahn Feb 21, 2024
d07b4a5
Handle errors in #handleInvite
EvanHahn Feb 21, 2024
d35b515
Minor: shorten definition of PendingInvites
EvanHahn Feb 21, 2024
cc5f132
Fix broken test
EvanHahn Feb 21, 2024
539916f
Remove premature optimization for pending invites
EvanHahn Feb 21, 2024
4382619
Merge branch 'main' into update-invites
EvanHahn Feb 22, 2024
89d7aee
Merge branch 'main' into update-invites
EvanHahn Feb 25, 2024
3446583
Re-number message types
EvanHahn Feb 25, 2024
1e9a381
Merge branch 'main' into update-invites
EvanHahn Mar 6, 2024
a337d51
Update comment for isBlank
EvanHahn Mar 8, 2024
6dc3c2a
Merge branch 'main' into update-invites
EvanHahn Mar 8, 2024
f7e6864
Remove project name from join details
EvanHahn Mar 8, 2024
941ca2c
Reorder event listener and assert
EvanHahn Mar 8, 2024
0a62501
Add onceSatisfied helper to clean up event listening
EvanHahn Mar 9, 2024
210ab8b
Lower default timeout, move to separate variable
EvanHahn Mar 9, 2024
1c1e3c1
Include projectPublicId on external invite object
EvanHahn Mar 11, 2024
572d09c
Improve handling of bad invite messages
EvanHahn Mar 11, 2024
ac78617
Improve error handling when sending invite responses
EvanHahn Mar 11, 2024
a183f18
Tweak a comment
EvanHahn Mar 11, 2024
6ff40d2
Remove extra name save in project create
EvanHahn Mar 11, 2024
25d3c07
Merge branch 'main' into update-invites
EvanHahn Mar 11, 2024
d785f92
Merge branch 'main' into update-invites
EvanHahn Mar 12, 2024
759e5c5
Make onceSatisfied throw
EvanHahn Mar 12, 2024
dbfb6a9
Cancel invite listener on timeout
EvanHahn Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions proto/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@ syntax = "proto3";
import "keys.proto";

message Invite {
// Project info that is displayed to the user receiving the invite
message ProjectInfo {
optional string name = 1;
}
bytes projectKey = 1;
EncryptionKeys encryptionKeys = 2;
optional ProjectInfo projectInfo = 3;
string roleName = 4;
bytes inviteId = 1;
string projectPublicId = 2;
string projectName = 3;
optional string roleName = 4;
optional string roleDescription = 5;
string invitorName = 6;
}

message InviteResponse {
enum Decision {
REJECT = 0;
ACCEPT = 1;
ALREADY = 2;
}
bytes projectKey = 1;
bytes inviteId = 1;
Decision decision = 2;
}

message ProjectJoinDetails {
bytes inviteId = 1;
bytes projectKey = 2;
EncryptionKeys encryptionKeys = 3;
}

message DeviceInfo {
enum DeviceType {
mobile = 0;
Expand Down
141 changes: 69 additions & 72 deletions src/generated/rpc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
import _m0 from "protobufjs/minimal.js";
import { EncryptionKeys } from "./keys.js";
export interface Invite {
projectKey: Buffer;
encryptionKeys: EncryptionKeys | undefined;
projectInfo?: Invite_ProjectInfo | undefined;
roleName: string;
inviteId: Buffer;
projectPublicId: string;
projectName: string;
roleName?: string | undefined;
roleDescription?: string | undefined;
invitorName: string;
}
/** Project info that is displayed to the user receiving the invite */
export interface Invite_ProjectInfo {
name?: string | undefined;
}
export interface InviteResponse {
projectKey: Buffer;
inviteId: Buffer;
decision: InviteResponse_Decision;
}
export declare const InviteResponse_Decision: {
Expand All @@ -26,6 +22,11 @@ export declare const InviteResponse_Decision: {
export type InviteResponse_Decision = typeof InviteResponse_Decision[keyof typeof InviteResponse_Decision];
export declare function inviteResponse_DecisionFromJSON(object: any): InviteResponse_Decision;
export declare function inviteResponse_DecisionToNumber(object: InviteResponse_Decision): number;
export interface ProjectJoinDetails {
inviteId: Buffer;
projectKey: Buffer;
encryptionKeys: EncryptionKeys | undefined;
}
export interface DeviceInfo {
name: string;
deviceType?: DeviceInfo_DeviceType | undefined;
Expand All @@ -43,6 +44,59 @@ export declare const Invite: {
encode(message: Invite, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): Invite;
create<I extends {
inviteId?: Buffer;
projectPublicId?: string;
projectName?: string;
roleName?: string | undefined;
roleDescription?: string | undefined;
invitorName?: string;
} & {
inviteId?: Buffer;
projectPublicId?: string;
projectName?: string;
roleName?: string | undefined;
roleDescription?: string | undefined;
invitorName?: string;
} & { [K in Exclude<keyof I, keyof Invite>]: never; }>(base?: I): Invite;
fromPartial<I_1 extends {
inviteId?: Buffer;
projectPublicId?: string;
projectName?: string;
roleName?: string | undefined;
roleDescription?: string | undefined;
invitorName?: string;
} & {
inviteId?: Buffer;
projectPublicId?: string;
projectName?: string;
roleName?: string | undefined;
roleDescription?: string | undefined;
invitorName?: string;
} & { [K_1 in Exclude<keyof I_1, keyof Invite>]: never; }>(object: I_1): Invite;
};
export declare const InviteResponse: {
encode(message: InviteResponse, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): InviteResponse;
create<I extends {
inviteId?: Buffer;
decision?: InviteResponse_Decision;
} & {
inviteId?: Buffer;
decision?: InviteResponse_Decision;
} & { [K in Exclude<keyof I, keyof InviteResponse>]: never; }>(base?: I): InviteResponse;
fromPartial<I_1 extends {
inviteId?: Buffer;
decision?: InviteResponse_Decision;
} & {
inviteId?: Buffer;
decision?: InviteResponse_Decision;
} & { [K_1 in Exclude<keyof I_1, keyof InviteResponse>]: never; }>(object: I_1): InviteResponse;
};
export declare const ProjectJoinDetails: {
encode(message: ProjectJoinDetails, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): ProjectJoinDetails;
create<I extends {
inviteId?: Buffer;
projectKey?: Buffer;
encryptionKeys?: {
auth?: Buffer;
Expand All @@ -51,13 +105,8 @@ export declare const Invite: {
blobIndex?: Buffer;
blob?: Buffer;
};
projectInfo?: {
name?: string | undefined;
};
roleName?: string;
roleDescription?: string | undefined;
invitorName?: string;
} & {
inviteId?: Buffer;
projectKey?: Buffer;
encryptionKeys?: {
auth?: Buffer;
Expand All @@ -72,16 +121,9 @@ export declare const Invite: {
blobIndex?: Buffer;
blob?: Buffer;
} & { [K in Exclude<keyof I["encryptionKeys"], keyof EncryptionKeys>]: never; };
projectInfo?: {
name?: string | undefined;
} & {
name?: string | undefined;
} & { [K_1 in Exclude<keyof I["projectInfo"], "name">]: never; };
roleName?: string;
roleDescription?: string | undefined;
invitorName?: string;
} & { [K_2 in Exclude<keyof I, keyof Invite>]: never; }>(base?: I): Invite;
} & { [K_1 in Exclude<keyof I, keyof ProjectJoinDetails>]: never; }>(base?: I): ProjectJoinDetails;
fromPartial<I_1 extends {
inviteId?: Buffer;
projectKey?: Buffer;
encryptionKeys?: {
auth?: Buffer;
Expand All @@ -90,13 +132,8 @@ export declare const Invite: {
blobIndex?: Buffer;
blob?: Buffer;
};
projectInfo?: {
name?: string | undefined;
};
roleName?: string;
roleDescription?: string | undefined;
invitorName?: string;
} & {
inviteId?: Buffer;
projectKey?: Buffer;
encryptionKeys?: {
auth?: Buffer;
Expand All @@ -110,48 +147,8 @@ export declare const Invite: {
config?: Buffer;
blobIndex?: Buffer;
blob?: Buffer;
} & { [K_3 in Exclude<keyof I_1["encryptionKeys"], keyof EncryptionKeys>]: never; };
projectInfo?: {
name?: string | undefined;
} & {
name?: string | undefined;
} & { [K_4 in Exclude<keyof I_1["projectInfo"], "name">]: never; };
roleName?: string;
roleDescription?: string | undefined;
invitorName?: string;
} & { [K_5 in Exclude<keyof I_1, keyof Invite>]: never; }>(object: I_1): Invite;
};
export declare const Invite_ProjectInfo: {
encode(message: Invite_ProjectInfo, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): Invite_ProjectInfo;
create<I extends {
name?: string | undefined;
} & {
name?: string | undefined;
} & { [K in Exclude<keyof I, "name">]: never; }>(base?: I): Invite_ProjectInfo;
fromPartial<I_1 extends {
name?: string | undefined;
} & {
name?: string | undefined;
} & { [K_1 in Exclude<keyof I_1, "name">]: never; }>(object: I_1): Invite_ProjectInfo;
};
export declare const InviteResponse: {
encode(message: InviteResponse, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): InviteResponse;
create<I extends {
projectKey?: Buffer;
decision?: InviteResponse_Decision;
} & {
projectKey?: Buffer;
decision?: InviteResponse_Decision;
} & { [K in Exclude<keyof I, keyof InviteResponse>]: never; }>(base?: I): InviteResponse;
fromPartial<I_1 extends {
projectKey?: Buffer;
decision?: InviteResponse_Decision;
} & {
projectKey?: Buffer;
decision?: InviteResponse_Decision;
} & { [K_1 in Exclude<keyof I_1, keyof InviteResponse>]: never; }>(object: I_1): InviteResponse;
} & { [K_2 in Exclude<keyof I_1["encryptionKeys"], keyof EncryptionKeys>]: never; };
} & { [K_3 in Exclude<keyof I_1, keyof ProjectJoinDetails>]: never; }>(object: I_1): ProjectJoinDetails;
};
export declare const DeviceInfo: {
encode(message: DeviceInfo, writer?: _m0.Writer): _m0.Writer;
Expand Down
Loading
Loading