-
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
SDK-2259:added retrieve qr code #290
Conversation
digitalidentity/service.go
Outdated
return share, err | ||
} | ||
|
||
err = json.Unmarshal(responseBytes, &share) |
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.
share
? This as instance of ShareSessionFetchedQrCode
should be named accordinly
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.
updated
digitalidentity/service_test.go
Outdated
|
||
func TestGetQrCode(t *testing.T) { | ||
key := test.GetValidKey("../test/test-key.pem") | ||
mockQrId := "SOME_SESSION_ID" |
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.
SOME_QR_CODE_ID
or similiar
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.
updated
package digitalidentity | ||
|
||
// ShareSessionCreated Share Session QR Result | ||
type ShareSessionCreated struct { |
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.
I don't know how GO architecture works but I'm pretty sure there is a way to reuse the response obj from the session creation
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.
there is, but the session object here is smaller than what's returned for session created - unless the api docs are mistaken?
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.
we have made this struct inline so i think this is now unnecessary
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.
dunno what API u're referring to but both Session
creation and QR
fetch response (limited to the session) are
{
"id": "",
"status": "",
"expiry": ""
}
where the full response for the QR fetch endpoint is
{
"id": "",
"expiry": "",
"policy": "",
"extensions": [ ],
"session": {
"id": "",
"status": "",
"expiry": ""
},
"redirectUri": ""
}
would something like the below work?
type session struct {
id string
status string
expiry string
}
type qr struct {
id string
expiry string
policy string
session
...
}
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.
when you fetch the session, the session resource seems to be larger than what is returned in the fetch qr code
response (what you posted), we could embed it and just have it unmarshal the whole thing, but some extra fields will just be empty for the RP, imo it's better to avoid it if the API itself specifically limits the fields and not give the RP any cause for confusion or incorrect expectations.
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.
sorry I thought I answered this but I must have not pushed the button. I meant this session created response
digitalidentity/service.go
Outdated
// Get Share QR info using the supplied sessionID | ||
func GetShareQr(httpClient requests.HttpClient, sessionID string, clientSdkId, apiUrl string, key *rsa.PrivateKey) (share ShareSessionFetchedQrCode, err error) { |
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.
Both the function and the comment use the wrong id
. This is not the sessionId
but the qrId
from the qr code creation endpoint
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.
updated
digital_identity_client.go
Outdated
// Get session QR code based on generated Qr ID | ||
func (client *DigitalIdentityClient) GetQrCode(qrCodeId string) (share digitalidentity.ShareSessionFetchedQrCode, err error) { |
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.
// Get session QR code based on generated Qr ID | |
func (client *DigitalIdentityClient) GetQrCode(qrCodeId string) (share digitalidentity.ShareSessionFetchedQrCode, err error) { | |
// GetShareSessionQrCode retrieves a session QR code based on generated Qr ID | |
func (client *DigitalIdentityClient) GetShareSessionQrCode(qrCodeId string) (share digitalidentity.ShareSessionQrCode, err error) { |
might aswell keep the naming consistent "ShareSession"
everywhere
// Get session QR code based on generated Qr ID | ||
func (client *DigitalIdentityClient) GetQrCode(qrCodeId string) (share digitalidentity.ShareSessionQrCode, err error) { |
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.
// Get session QR code based on generated Qr ID | |
func (client *DigitalIdentityClient) GetQrCode(qrCodeId string) (share digitalidentity.ShareSessionQrCode, err error) { | |
// GetShareSessionQrCode retrieves a session QR code based on generated Qr ID | |
func (client *DigitalIdentityClient) GetShareSessionQrCode(qrCodeId string) (share digitalidentity.ShareSessionQrCode, err error) { |
comment + func name (i haven't checked other sdks so happy to just have it all align with whatever they have)
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
func TestGetQrCode(t *testing.T) { | |
func GetShareSessionQrCode(t *testing.T) { |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
// GetShareSessionQrCode is used to fetch the qr code by id. | |
// GetShareSessionQrCode is used to fetch the qr code by id. |
extra space
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.
couple minor fixes we can still do, but after that LGTM
…to SDK-2259-go-retrieve-qr-code
…dling, simplified some functions
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
…nto base func. etc
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Co-authored-by: Klaidas Urbanavicius <[email protected]>
Sdk 2235 share v 2 retrieve receipt
No description provided.