-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK-2259:added retrieve qr code #290
Merged
mehmet-yoti
merged 57 commits into
SDK-2254-go-create-qr-code
from
SDK-2259-go-retrieve-qr-code
Dec 14, 2023
Merged
Changes from 5 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
6691dec
SDK-2259:added retrieve qr code
mehmet-yoti be2b96b
SDK-2235 added retrieve receipt
mehmet-yoti 6f50c88
SDK-2235 Added Retrieve Receipt
mehmet-yoti fb79e33
SDK-2235 Added Retrieve Receipt
mehmet-yoti 1586dea
SDK-2235 Added Retrieve Receipt
mehmet-yoti c2d3b6c
SDK-2235 Added Retrieve Receipt
mehmet-yoti 22d0896
SDK-2254 Resolved pr comments
mehmet-yoti 359a293
SDK-2259:updated needed pr reviews
mehmet-yoti cb5f083
SDK-2259:updated needed pr reviews
mehmet-yoti ce57837
SDK-2259:updated needed pr reviews
mehmet-yoti f61e496
SDK-2254 Resolved pr comments
mehmet-yoti 708fe86
SDK-2254:updated pr changes
mehmet-yoti 2a0f087
SDK-2254 removed unused builder
mehmet-yoti 5912800
SDK-2259:added retrieve qr code
mehmet-yoti e4a1fc8
SDK-2254 Removed unused examples and updated function namings
mehmet-yoti 06d91c3
SDK-2259:updated needed pr reviews
mehmet-yoti f410402
SDK-2259:removed unused example files
mehmet-yoti fd1f342
Merge remote-tracking branch 'origin/SDK-2259-go-retrieve-qr-code' in…
86d40a4
SDK-2259:added retrieve qr code structs
mehmet-yoti 60e2f4d
SDK-2254 Removed unused examples and updated function namings
mehmet-yoti 7a955f4
SDK-2259:removed unused example files
mehmet-yoti 33131cc
Merge remote-tracking branch 'origin/SDK-2259-go-retrieve-qr-code' in…
ae46a53
SDK-2254 Resolved pr comments
mehmet-yoti 22bbe7d
SDK-2259:updated needed pr reviews
mehmet-yoti 9a619e8
SDK-2259:updated needed pr reviews
mehmet-yoti bc20038
SDK-2259:updated needed pr reviews
mehmet-yoti 00ef7b0
SDK-2254 Resolved pr comments
mehmet-yoti 4cf2791
SDK-2254:updated pr changes
mehmet-yoti ad1f3f9
SDK-2254 removed unused builder
mehmet-yoti 87d61de
SDK-2259:added retrieve qr code structs
mehmet-yoti 6c2d312
SDK-2254 Removed unused examples and updated function namings
mehmet-yoti d40c218
SDK-2259:removed unused example files
mehmet-yoti f8657c2
SDK-2254 Removed unused examples and updated function namings
mehmet-yoti 4c019b3
SDK-2259:removed unused example files
mehmet-yoti a841a3e
SDK-2235:error handling, updated comments
mehmet-yoti 87f5098
SDK-2235:updated method descriptions and addedd error handlers with d…
mehmet-yoti 2492915
SDK-2235:added some error handling, updated comments, added error han…
mehmet-yoti 5bf052f
Update digitalidentity/service.go
mehmet-yoti 9661755
Update digitalidentity/service.go
mehmet-yoti 75502ef
Update digitalidentity/service.go
mehmet-yoti b7d7b23
Update digitalidentity/service.go
mehmet-yoti 8e20b5e
Update digitalidentity/service.go
mehmet-yoti b893957
Update digitalidentity/service.go
mehmet-yoti 4993e35
Update digitalidentity/service.go
mehmet-yoti e52a26c
Update cryptoutil/crypto_utils.go
mehmet-yoti b9d8fed
Update digitalidentity/service.go
mehmet-yoti c09c2c2
Update cryptoutil/crypto_utils.go
mehmet-yoti 8dd3c7c
SDK-2235: added error details, cleaned unneccessary func and merged i…
mehmet-yoti f705d44
Merge branch 'SDK-2259-go-retrieve-qr-code' into SDK-2235-share-v-2-r…
mehmet-yoti a4775d2
Update cryptoutil/crypto_utils.go
mehmet-yoti 3da5372
SDK-2235:reduced complexity
mehmet-yoti 9d403b8
SDK-2235 removed unused method, added panic controls, added error con…
mehmet-yoti af99524
SDK-2235 added error contexts
mehmet-yoti a3d8314
Update digitalidentity/service.go
mehmet-yoti 5f1ec57
Update digitalidentity/service.go
mehmet-yoti 3fb2de7
SDK-2235 updated error context text
mehmet-yoti ac64677
Merge pull request #289 from getyoti/SDK-2235-share-v-2-retrieve-receipt
mehmet-yoti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ report.json | |
|
||
# Generated binaries | ||
/_examples/docscan/docscan | ||
|
||
/_examples/idv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |||||
const identitySessionCreationEndpoint = "/v2/sessions" | ||||||
const identitySessionRetrieval = "/v2/sessions/%s" | ||||||
const identitySessionQrCodeCreation = "/v2/sessions/%s/qr-codes" | ||||||
const identitySessionQrCodeRetrieval = "/v2/qr-codes/%s" | ||||||
|
||||||
// CreateShareSession creates session using the supplied session specification | ||||||
func CreateShareSession(httpClient requests.HttpClient, shareSessionRequest *ShareSessionRequest, clientSdkId, apiUrl string, key *rsa.PrivateKey) (*ShareSession, error) { | ||||||
|
@@ -82,7 +83,7 @@ func GetShareSession(httpClient requests.HttpClient, sessionID string, clientSdk | |||||
return shareSession, err | ||||||
} | ||||||
|
||||||
// CreateQrCode using the supplied sessionID parameter | ||||||
// CreateShareQrCode generates a sharing qr code using the supplied sessionID parameter | ||||||
func CreateShareQrCode(httpClient requests.HttpClient, sessionID string, clientSdkId, apiUrl string, key *rsa.PrivateKey) (*QrCode, error) { | ||||||
endpoint := fmt.Sprintf(identitySessionQrCodeCreation, sessionID) | ||||||
|
||||||
|
@@ -113,3 +114,34 @@ func CreateShareQrCode(httpClient requests.HttpClient, sessionID string, clientS | |||||
err = json.Unmarshal(responseBytes, qrCode) | ||||||
return qrCode, err | ||||||
} | ||||||
|
||||||
// GetShareSessionQrCode is used to fetch the qr code by id. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
extra space |
||||||
func GetShareSessionQrCode(httpClient requests.HttpClient, qrCodeId string, clientSdkId, apiUrl string, key *rsa.PrivateKey) (fetchedQrCode ShareSessionQrCode, err error) { | ||||||
endpoint := fmt.Sprintf(identitySessionQrCodeRetrieval, qrCodeId) | ||||||
headers := requests.AuthHeader(clientSdkId) | ||||||
request, err := requests.SignedRequest{ | ||||||
Key: key, | ||||||
HTTPMethod: http.MethodGet, | ||||||
BaseURL: apiUrl, | ||||||
Endpoint: endpoint, | ||||||
Headers: headers, | ||||||
}.Request() | ||||||
if err != nil { | ||||||
return fetchedQrCode, err | ||||||
} | ||||||
|
||||||
response, err := requests.Execute(httpClient, request) | ||||||
if err != nil { | ||||||
return fetchedQrCode, err | ||||||
} | ||||||
defer response.Body.Close() | ||||||
|
||||||
responseBytes, err := io.ReadAll(response.Body) | ||||||
if err != nil { | ||||||
return fetchedQrCode, err | ||||||
} | ||||||
|
||||||
err = json.Unmarshal(responseBytes, &fetchedQrCode) | ||||||
|
||||||
return fetchedQrCode, err | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -111,7 +111,7 @@ func TestGetShareSession(t *testing.T) { | |||||
|
||||||
} | ||||||
|
||||||
func TestCreateQrCode(t *testing.T) { | ||||||
func TestCreateShareQrCode(t *testing.T) { | ||||||
key := test.GetValidKey("../test/test-key.pem") | ||||||
mockSessionID := "SOME_SESSION_ID" | ||||||
|
||||||
|
@@ -127,3 +127,22 @@ func TestCreateQrCode(t *testing.T) { | |||||
_, err := CreateShareQrCode(client, mockSessionID, "sdkId", "https://apiurl", key) | ||||||
assert.NilError(t, err) | ||||||
} | ||||||
|
||||||
func TestGetQrCode(t *testing.T) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
key := test.GetValidKey("../test/test-key.pem") | ||||||
mockQrId := "SOME_QR_CODE_ID" | ||||||
mockClientSdkId := "SOME_CLIENT_SDK_ID" | ||||||
mockApiUrl := "https://example.com/api" | ||||||
client := &mockHTTPClient{ | ||||||
do: func(*http.Request) (*http.Response, error) { | ||||||
return &http.Response{ | ||||||
StatusCode: 201, | ||||||
Body: io.NopCloser(strings.NewReader(`{}`)), | ||||||
}, nil | ||||||
}, | ||||||
} | ||||||
|
||||||
_, err := GetShareSessionQrCode(client, mockQrId, mockClientSdkId, mockApiUrl, key) | ||||||
assert.NilError(t, err) | ||||||
|
||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package digitalidentity | ||
|
||
type ShareSessionQrCode struct { | ||
ID string `json:"id"` | ||
Expiry string `json:"expiry"` | ||
Policy string `json:"policy"` | ||
Extensions []interface{} `json:"extensions"` | ||
Session struct { | ||
ID string `json:"id"` | ||
Status string `json:"status"` | ||
Expiry string `json:"expiry"` | ||
} `json:"session"` | ||
RedirectURI string `json:"redirectUri"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment + func name (i haven't checked other sdks so happy to just have it all align with whatever they have)