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

Function step2

apps/client/src/code/api-interface/users/change-password.ts:43–90  ·  view source on GitHub ↗
(
    input_: (typeof changePasswordProcedureStep1)['_def']['_output_out'],
  )

Source from the content-addressed store, hash-verified

41 }
42
43 async function step2(
44 input_: (typeof changePasswordProcedureStep1)['_def']['_output_out'],
45 ): Promise<(typeof changePasswordProcedureStep2)['_def']['_input_in']> {
46 const newDerivedUserValues = await deriveUserValues({
47 email,
48 password: input.newPassword,
49 });
50
51 // Reencrypt values
52
53 const newEncryptedPrivateKeyring = createPrivateKeyring(
54 input_.encryptedPrivateKeyring,
55 )
56 .unwrapSymmetric(oldDerivedUserValues.masterKey, {
57 associatedData: {
58 context: 'UserPrivateKeyring',
59 userId: authStore().userId,
60 },
61 })
62 .wrapSymmetric(newDerivedUserValues.masterKey, {
63 associatedData: {
64 context: 'UserPrivateKeyring',
65 userId: authStore().userId,
66 },
67 }).wrappedValue;
68 const newEncryptedSymmetricKeyring = createSymmetricKeyring(
69 input_.encryptedSymmetricKeyring,
70 )
71 .unwrapSymmetric(oldDerivedUserValues.masterKey, {
72 associatedData: {
73 context: 'UserSymmetricKeyring',
74 userId: authStore().userId,
75 },
76 })
77 .wrapSymmetric(newDerivedUserValues.masterKey, {
78 associatedData: {
79 context: 'UserSymmetricKeyring',
80 userId: authStore().userId,
81 },
82 }).wrappedValue;
83
84 return {
85 newLoginHash: newDerivedUserValues.loginHash,
86
87 newEncryptedPrivateKeyring,
88 newEncryptedSymmetricKeyring,
89 };
90 }
91
92 async function step3(
93 _input: (typeof changePasswordProcedureStep2)['_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