@@ -33,6 +33,7 @@ func GenerateShareReferenceWithLength(length int) (string, error) {
3333// The shared file stores only a pointer (storage ID + encrypted file key) instead of a copy
3434func ShareFile (vaultPath string , sharePassword string , session * Session ) (string , error ) {
3535 // 1. Find the file entry in the index
36+ PrintProgressStep (1 , 5 , "Locating file in vault..." )
3637 entry , err := session .Index .FindEntry (vaultPath )
3738 if err != nil {
3839 return "" , fmt .Errorf ("could not find file in vault: %w" , err )
@@ -42,14 +43,18 @@ func ShareFile(vaultPath string, sharePassword string, session *Session) (string
4243 if entry .Type == "folder" {
4344 return "" , fmt .Errorf ("'%s' is a directory, you can only share individual files" , vaultPath )
4445 }
46+ PrintCompletionLine ("File located" )
4547
4648 // 3. Generate a new reference with configurable length from settings
49+ PrintProgressStep (2 , 5 , "Generating share reference..." )
4750 ref , err := GenerateShareReferenceWithLength (session .Settings .ShareHashLength )
4851 if err != nil {
4952 return "" , fmt .Errorf ("failed to generate share reference: %w" , err )
5053 }
54+ PrintCompletionLine ("Share reference generated: " + ref )
5155
5256 // 4. Decrypt the file key with vault password to get raw 32-byte key
57+ PrintProgressStep (3 , 5 , "Preparing file key..." )
5358 fileKeyBytes , err := DecryptHexToBytes (entry .FileKey , session .Password )
5459 if err != nil {
5560 return "" , fmt .Errorf ("failed to decrypt file key: %w" , err )
@@ -66,12 +71,15 @@ func ShareFile(vaultPath string, sharePassword string, session *Session) (string
6671 }
6772
6873 // 6. Encrypt the pointer with the share password
74+ PrintProgressStep (4 , 5 , "Encrypting share pointer..." )
6975 pointerEncrypted , err := Encrypt (pointerJSON , sharePassword )
7076 if err != nil {
7177 return "" , fmt .Errorf ("failed to encrypt share pointer: %w" , err )
7278 }
79+ PrintCompletionLine ("Share pointer encrypted" )
7380
7481 // 7. Upload pointer to /shared/{ref}
82+ PrintProgressStep (5 , 5 , "Uploading to GitHub..." )
7583 sharedPath := fmt .Sprintf ("shared/%s" , ref )
7684 filesToPush := map [string ][]byte {
7785 sharedPath : pointerEncrypted ,
@@ -88,6 +96,7 @@ func ShareFile(vaultPath string, sharePassword string, session *Session) (string
8896 if err != nil {
8997 return "" , fmt .Errorf ("failed to upload share pointer: %w" , err )
9098 }
99+ PrintCompletionLine ("Share pointer uploaded to GitHub" )
91100
92101 // 8. Add entry to shared index
93102 if session .SharedIndex == nil {
0 commit comments