@@ -186,10 +186,19 @@ func PerformProvisioning(incomingCtx context.Context, deviceStore store.DeviceSt
186186
187187 // Store identity keys?
188188 address , err := libsignalgo .NewUUIDAddress (device .ACI , uint (device .DeviceID ))
189+ if err != nil {
190+ c <- ProvisioningResponse {
191+ State : StateProvisioningError ,
192+ Err : fmt .Errorf ("error creating new address: %w" , err ),
193+ }
194+ return
195+ }
189196 _ , err = device .IdentityStore .SaveIdentityKey (ctx , address , device .ACIIdentityKeyPair .GetIdentityKey ())
190197 if err != nil {
191- zlog .Err (err ).Msg ("error saving identity key" )
192- c <- ProvisioningResponse {State : StateProvisioningError , Err : err }
198+ c <- ProvisioningResponse {
199+ State : StateProvisioningError ,
200+ Err : fmt .Errorf ("error saving identity key: %w" , err ),
201+ }
193202 return
194203 }
195204
@@ -202,8 +211,10 @@ func PerformProvisioning(incomingCtx context.Context, deviceStore store.DeviceSt
202211 // Store our profile key
203212 err = device .ProfileKeyStore .StoreProfileKey (ctx , data .ACI , profileKey )
204213 if err != nil {
205- zlog .Err (err ).Msg ("error storing profile key" )
206- c <- ProvisioningResponse {State : StateProvisioningError , Err : err }
214+ c <- ProvisioningResponse {
215+ State : StateProvisioningError ,
216+ Err : fmt .Errorf ("error storing profile key: %w" , err ),
217+ }
207218 return
208219 }
209220
@@ -214,11 +225,20 @@ func PerformProvisioning(incomingCtx context.Context, deviceStore store.DeviceSt
214225 // TODO hacky client construction
215226 cli := & Client {Store : device }
216227 err = cli .GenerateAndRegisterPreKeys (ctx , types .UUIDKindACI )
228+ if err != nil {
229+ c <- ProvisioningResponse {
230+ State : StateProvisioningError ,
231+ Err : fmt .Errorf ("error generating and registering ACI prekeys: %w" , err ),
232+ }
233+ return
234+ }
217235 err = cli .GenerateAndRegisterPreKeys (ctx , types .UUIDKindPNI )
218236
219237 if err != nil {
220- zlog .Err (err ).Msg ("error generating and registering prekeys" )
221- c <- ProvisioningResponse {State : StateProvisioningError , Err : err }
238+ c <- ProvisioningResponse {
239+ State : StateProvisioningError ,
240+ Err : fmt .Errorf ("error generating and registering PNI prekeys: %w" , err ),
241+ }
222242 return
223243 }
224244
@@ -248,6 +268,9 @@ func startProvisioning(ctx context.Context, ws *websocket.Conn, provisioningCiph
248268 // Decode provisioning UUID
249269 provisioningUuid := & signalpb.ProvisioningUuid {}
250270 err = proto .Unmarshal (msg .Request .Body , provisioningUuid )
271+ if err != nil {
272+ return "" , fmt .Errorf ("failed to unmarshal provisioning UUID: %w" , err )
273+ }
251274
252275 // Create provisioning URL
253276 bytesKey , _ := pubKey .Serialize ()
0 commit comments