Skip to content

Commit d05ad74

Browse files
committed
Fixes to Go backend (RELEASEPATCH)
1 parent dc3cea1 commit d05ad74

File tree

9 files changed

+17
-19
lines changed

9 files changed

+17
-19
lines changed

frontend/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "voiceit2-web-sdk",
3-
"version": "1.5.10",
3+
"version": "1.5.11",
44
"scripts": {
55
"start": "node src/index.js",
66
"build": "./node_modules/webpack/bin/webpack.js"

node-server-example/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node-server-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-server-example",
3-
"version": "1.5.10",
3+
"version": "1.5.11",
44
"description": "Node Web SDK Example",
55
"main": "server.js",
66
"scripts": {

voiceit-go-websdk/liveness_server_client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ type GenerateLCORequestReturn struct {
2323
func (livenessServerClient LivenessServerClient) GenerateLCORequest(userId, contentLanguage string) ([]byte, error) {
2424

2525
req, err := http.NewRequest("GET", livenessServerClient.BaseUrl+"/v1/verification/"+userId+"/"+contentLanguage, nil)
26+
if err != nil {
27+
return []byte{}, errors.New(`http.NewRequest("GET", "` + livenessServerClient.BaseUrl + "/v1/verification/" + userId + "/" + contentLanguage + `", nil) Exception: ` + err.Error())
28+
}
2629

2730
req.SetBasicAuth(livenessServerClient.APIKey, livenessServerClient.APIToken)
2831

voiceit-go-websdk/websdk.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
const (
19-
platformVersion = "1.5.10"
19+
platformVersion = "1.5.11"
2020
platformId = "53"
2121
)
2222

@@ -133,13 +133,13 @@ func (websdk WebSDK) validateToken(tokenString string) (valid bool, userId strin
133133

134134
}
135135

136-
func (websdk WebSDK) MakeCall(w http.ResponseWriter, r *http.Request) (map[string]interface{}, error) {
136+
func (websdk WebSDK) MakeCall(r *http.Request) (map[string]interface{}, error) {
137137

138138
res := make(map[string]interface{})
139139

140140
if err := r.ParseMultipartForm(32 << 20); err != nil {
141141
log.Println("r.ParseMultipartForm(32 << 20) Exception: " + err.Error())
142-
w.WriteHeader(http.StatusBadRequest)
142+
// w.WriteHeader(http.StatusBadRequest)
143143
// w.Write([]byte("r.ParseMultipartForm(32 << 20) Exception: " + err.Error()))
144144
return res, errors.New("r.ParseMultipartForm(32 << 20) Exception: " + err.Error())
145145
}
@@ -148,7 +148,7 @@ func (websdk WebSDK) MakeCall(w http.ResponseWriter, r *http.Request) (map[strin
148148

149149
if viRequestType == "" {
150150
log.Println(`viRequestType == ""`)
151-
w.WriteHeader(http.StatusBadRequest)
151+
// w.WriteHeader(http.StatusBadRequest)
152152
// w.Write([]byte("viRequestType not passed"))
153153
return res, errors.New("viRequestType not passed")
154154
}
@@ -193,11 +193,9 @@ func (websdk WebSDK) MakeCall(w http.ResponseWriter, r *http.Request) (map[strin
193193
case "createVoiceEnrollment", "voiceVerification":
194194
key = "viVoiceData"
195195
extension = ".wav"
196-
break
197196
case "createFaceEnrollment", "createVideoEnrollment", "faceVerification", "faceVerificationWithLiveness", "videoVerificationWithLiveness", "videoVerification":
198197
key = "viVideoData"
199198
extension = ".mp4"
200-
break
201199
}
202200

203201
file, header, err := r.FormFile(key)
@@ -228,7 +226,7 @@ func (websdk WebSDK) MakeCall(w http.ResponseWriter, r *http.Request) (map[strin
228226

229227
// Make client request to API 2/Liveness Server
230228
} else if viRequestType == "enoughVoiceEnrollments" || viRequestType == "enoughFaceEnrollments" || viRequestType == "enoughVideoEnrollments" {
231-
return websdk.enoughEnrollments(w, viRequestType, userId)
229+
return websdk.enoughEnrollments(res, viRequestType, userId)
232230
// return
233231
}
234232

@@ -280,8 +278,7 @@ func (websdk WebSDK) MakeCall(w http.ResponseWriter, r *http.Request) (map[strin
280278

281279
}
282280

283-
func (websdk WebSDK) enoughEnrollments(w http.ResponseWriter, viRequestType, userId string) (map[string]interface{}, error) {
284-
res := make(map[string]interface{})
281+
func (websdk WebSDK) enoughEnrollments(res map[string]interface{}, viRequestType, userId string) (map[string]interface{}, error) {
285282
switch viRequestType {
286283
case "enoughVoiceEnrollments":
287284
var voiceEnrollmentsResponse structs.GetAllVoiceEnrollmentsReturn
@@ -299,8 +296,6 @@ func (websdk WebSDK) enoughEnrollments(w http.ResponseWriter, viRequestType, use
299296
log.Println(`json.Unmarshal([]byte("` + string(ret) + `"), &voiceEnrollmentsResponse) Exception: ` + err.Error())
300297
res["responseCode"] = "BERR"
301298
res["message"] = err.Error()
302-
marshaled, _ := json.Marshal(res)
303-
w.Write(marshaled)
304299
return res, nil
305300
}
306301
ret, err = websdk.vi.GetAllVideoEnrollments(userId)

voiceit-node-websdk/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

voiceit-node-websdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "voiceit-node-websdk",
3-
"version": "1.5.10",
3+
"version": "1.5.11",
44
"description": "NodeJS Backend for VoiceIt Web SDK",
55
"main": "index.js",
66
"author": "VoiceIt Technologies, LLC (C) 2020",

voiceit-php-websdk/VoiceIt2WebBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function returnJson($jsonResponse){
3232
class VoiceIt2WebBackend {
3333
public $BASE_URL = 'https://api.voiceit.io';
3434
public $LIVENESS_URL = 'https://liveness.voiceit.io/v1';
35-
const VERSION = '1.5.10';
35+
const VERSION = '1.5.11';
3636
public $api_key;
3737
public $platformId = '48';
3838
public $notification_url = '';

0 commit comments

Comments
 (0)