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

Function step2

apps/client/src/code/api-interface/users/change-email.ts:32–77  ·  view source on GitHub ↗
(
    input_: (typeof finishProcedureStep1)['_def']['_output_out'],
  )

Source from the content-addressed store, hash-verified

30 }
31
32 async function step2(
33 input_: (typeof finishProcedureStep1)['_def']['_output_out'],
34 ): Promise<(typeof finishProcedureStep2)['_def']['_input_in']> {
35 const newDerivedUserValues = await deriveUserValues({
36 email: input.newEmail,
37 password: input.password,
38 });
39
40 const newEncryptedPrivateKeyring = createPrivateKeyring(
41 input_.encryptedPrivateKeyring,
42 )
43 .unwrapSymmetric(input.oldDerivedUserValues.masterKey, {
44 associatedData: {
45 context: 'UserPrivateKeyring',
46 userId: authStore().userId,
47 },
48 })
49 .wrapSymmetric(newDerivedUserValues.masterKey, {
50 associatedData: {
51 context: 'UserPrivateKeyring',
52 userId: authStore().userId,
53 },
54 }).wrappedValue;
55 const newEncryptedSymmetricKeyring = createSymmetricKeyring(
56 input_.encryptedSymmetricKeyring,
57 )
58 .unwrapSymmetric(input.oldDerivedUserValues.masterKey, {
59 associatedData: {
60 context: 'UserSymmetricKeyring',
61 userId: authStore().userId,
62 },
63 })
64 .wrapSymmetric(newDerivedUserValues.masterKey, {
65 associatedData: {
66 context: 'UserSymmetricKeyring',
67 userId: authStore().userId,
68 },
69 }).wrappedValue;
70
71 return {
72 newLoginHash: newDerivedUserValues.loginHash,
73
74 newEncryptedSymmetricKeyring,
75 newEncryptedPrivateKeyring,
76 };
77 }
78
79 async function step3(
80 _input: (typeof finishProcedureStep2)['_def']['_output_out'],

Callers

nothing calls this directly

Calls 5

deriveUserValuesFunction · 0.90
createPrivateKeyringFunction · 0.90
createSymmetricKeyringFunction · 0.90
wrapSymmetricMethod · 0.65
unwrapSymmetricMethod · 0.65

Tested by

no test coverage detected