Skip to content

Commit

Permalink
fix: credentials on multiple requests (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulclindo authored Oct 4, 2023
1 parent 75e7889 commit 42c0a14
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 6 deletions.
8 changes: 4 additions & 4 deletions shinkai-mini-apps/shinkai-tray/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shinkai-mini-apps/shinkai-tray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.6",
"@shinkai_network/shinkai-message-ts": "^0.0.5",
"@shinkai_network/shinkai-message-ts": "^0.0.6",
"@tanstack/react-query": "^4.35.3",
"@tauri-apps/api": "^1.4.0",
"@tiptap/extension-placeholder": "^2.1.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import type {
ShinkaiMessage,
} from "@shinkai_network/shinkai-message-ts/models";

export type CreateChatInput = CredentialsPayload & {
export type CreateChatInput = Pick<
CredentialsPayload,
"my_device_encryption_sk" | "my_device_identity_sk" | "node_encryption_pk"
> & {
sender: string;
senderSubidentity: string;
receiver: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ export const sendMessageToInbox = async ({
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
}: SendMessageToInboxInput) => {
return await sendTextMessageWithInbox(sender, "", receiver, message, inboxId, {
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ export const getAgents = async ({
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
}: GetAgentsInput) => {
const profile_sender = sender + "/" + senderSubidentity;
const result = await getProfileAgents(profile_sender, "", shinkaiIdentity, {
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
});
return result;
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const getInboxes = async ({
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
}: GetInboxesInput) => {
const inboxes = await getAllInboxesForProfile(
shinkaiIdentity,
Expand All @@ -20,6 +22,8 @@ export const getInboxes = async ({
my_device_encryption_sk,
my_device_identity_sk,
node_encryption_pk,
profile_encryption_sk,
profile_identity_sk,
}
);
return inboxes.map((inbox) => encodeURIComponent(inbox));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ const ChatConversation = () => {
my_device_encryption_sk: setupData.profile_encryption_sk,
my_device_identity_sk: setupData.profile_identity_sk,
node_encryption_pk: setupData.node_encryption_pk,
profile_encryption_sk: setupData.profile_encryption_sk,
profile_identity_sk: setupData.profile_identity_sk,
});
}
chatForm.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const EmptyMessage = () => {
my_device_encryption_sk: setupData?.my_device_encryption_sk ?? "",
my_device_identity_sk: setupData?.my_device_identity_sk ?? "",
node_encryption_pk: setupData?.node_encryption_pk ?? "",
profile_encryption_sk: setupData?.profile_encryption_sk ?? "",
profile_identity_sk: setupData?.profile_identity_sk ?? "",
});
return (
<div className="flex w-full items-center justify-center p-6">
Expand Down
2 changes: 2 additions & 0 deletions shinkai-mini-apps/shinkai-tray/src/pages/chat/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const ChatLayout = () => {
// Assuming receiver and target_shinkai_name_profile are the same as sender
receiver: setupData?.shinkai_identity ?? "",
targetShinkaiNameProfile: `${setupData?.shinkai_identity}/${setupData?.profile}`,
profile_encryption_sk: setupData?.profile_encryption_sk ?? "",
profile_identity_sk: setupData?.profile_identity_sk ?? "",
});

return (
Expand Down
2 changes: 2 additions & 0 deletions shinkai-mini-apps/shinkai-tray/src/pages/create-job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const CreateJobPage = () => {
my_device_encryption_sk: setupData?.profile_encryption_sk ?? "",
my_device_identity_sk: setupData?.profile_identity_sk ?? "",
node_encryption_pk: setupData?.node_encryption_pk ?? "",
profile_encryption_sk: setupData?.profile_encryption_sk ?? "",
profile_identity_sk: setupData?.profile_identity_sk ?? "",
});

const { isLoading, mutateAsync: createJob } = useCreateJob({
Expand Down

0 comments on commit 42c0a14

Please sign in to comment.