MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / unlockGroupContentKeyring

Function unlockGroupContentKeyring

apps/client/src/code/crypto.ts:210–245  ·  view source on GitHub ↗
(
  groupId: string,
  password: string,
)

Source from the content-addressed store, hash-verified

208}
209
210export async function unlockGroupContentKeyring(
211 groupId: string,
212 password: string,
213) {
214 const groupPasswordValues = await computeGroupPasswordValues(
215 groupId,
216 password,
217 );
218
219 let groupContentKeyring = await groupContentKeyrings()(groupId).getAsync();
220
221 if (groupContentKeyring == null) {
222 throw new Error('Group content keyring was not found.');
223 }
224
225 if (groupContentKeyring.topLayer === DataLayer.Symmetric) {
226 try {
227 groupContentKeyring = groupContentKeyring.unwrapSymmetric(
228 groupPasswordValues.passwordKey,
229 {
230 associatedData: {
231 context: 'GroupContentKeyringPasswordProtection',
232 groupId,
233 },
234 },
235 );
236 } catch (error) {
237 throw new Error('Password is incorrect.');
238 }
239 }
240
241 pagesStore().dict[`${GROUP_CONTENT_KEYRING}:${groupId}`] =
242 groupContentKeyring;
243
244 return groupContentKeyring;
245}

Callers 2

createPageFunction · 0.90
step1Function · 0.90

Calls 2

unwrapSymmetricMethod · 0.65

Tested by

no test coverage detected