MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / loadUserData

Method loadUserData

apps/client/src/code/pages/pages.ts:108–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106 }
107
108 async loadUserData() {
109 if (!authStore().loggedIn) {
110 return;
111 }
112
113 const promises: PromiseLike<any>[] = [];
114
115 promises.push(
116 (async () => {
117 pagesStore().notifications =
118 await trpcClient.users.pages.notifications.load.query();
119 })(),
120 );
121
122 promises.push(
123 (async () => {
124 const [encryptedDefaultNote, encryptedDefaultArrow, isNewUser] =
125 await internals.realtime.hmget('user', authStore().userId, [
126 'encrypted-default-note',
127 'encrypted-default-arrow',
128 'new',
129 ]);
130
131 this.defaultNote = unpack(
132 internals.symmetricKeyring.decrypt(encryptedDefaultNote, {
133 padding: true,
134 associatedData: {
135 context: 'UserDefaultNote',
136 userId: authStore().userId,
137 },
138 }),
139 );
140 this.defaultArrow = unpack(
141 internals.symmetricKeyring.decrypt(encryptedDefaultArrow, {
142 padding: true,
143 associatedData: {
144 context: 'UserDefaultArrow',
145 userId: authStore().userId,
146 },
147 }),
148 );
149
150 this.react.isNewUser = !!isNewUser;
151
152 if (isNewUser) {
153 internals.realtime.hset('user', authStore().userId, 'new', false);
154 }
155 })(),
156 );
157
158 await Promise.all(promises);
159 }
160
161 async setupPage(pageId: string) {
162 this.react.page?.deactivate();

Callers

nothing calls this directly

Calls 3

hsetMethod · 0.80
hmgetMethod · 0.45
decryptMethod · 0.45

Tested by

no test coverage detected