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

Function step1

apps/client/src/code/api-interface/pages/move.ts:53–185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 let destGroupContentKeyring: SymmetricKeyring | undefined;
52
53 async function step1(): Promise<
54 (typeof moveProcedureStep1)['_def']['_input_in']
55 > {
56 let destGroupId: string;
57
58 let groupCreation: (typeof moveProcedureStep1)['_def']['_input_in']['groupCreation'];
59
60 if (input.groupCreation != null) {
61 if (input.groupCreation.groupName === '') {
62 throw new Error('Please enter a group name.');
63 }
64
65 if (input.groupCreation.groupMemberName === '') {
66 throw new Error('Please enter an user alias.');
67 }
68
69 if (
70 input.groupCreation.groupPassword != null &&
71 zxcvbn(input.groupCreation.groupPassword).score <= 2
72 ) {
73 await asyncDialog({
74 title: 'Weak password',
75 html: true,
76 message:
77 'Your password is relatively weak.<br/>Are you sure you want to continue?',
78 style: { width: 'max-content', padding: '4px 8px' },
79
80 focus: 'cancel',
81
82 cancel: { label: 'No', flat: true, color: 'primary' },
83 ok: { label: 'Yes', flat: true, color: 'negative' },
84 });
85 }
86
87 const groupValues = await generateGroupValues({
88 userKeyPair: internals.keyPair,
89 isPublic: input.groupCreation.groupIsPublic,
90 password:
91 input.groupCreation.groupPassword != null
92 ? input.groupCreation.groupPassword
93 : undefined,
94 });
95
96 destGroupId = groupValues.groupId;
97
98 destGroupContentKeyring = groupValues.contentKeyring;
99
100 const groupEncryptedName = groupValues.accessKeyring.encrypt(
101 textToBytes(input.groupCreation.groupName),
102 {
103 padding: true,
104 associatedData: {
105 context: 'GroupName',
106 groupId: groupValues.groupId,
107 },
108 },
109 );
110

Callers

nothing calls this directly

Calls 5

asyncDialogFunction · 0.90
generateGroupValuesFunction · 0.90
textToBytesFunction · 0.90
encryptMethod · 0.45

Tested by

no test coverage detected