Skip to content

Conversation

@Allen-Cherian
Copy link
Contributor

No description provided.

'peerId': peerId,
'orgName': orgName,
});
var response = await http.post(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need a try catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http post can fail too, we need catch for that case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

}

class OrgAccessToken {
static final int _accessTokenMaxAge = 30; // days
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token age might be something we have to worry about but not during a poc. We need to come back on this.

return Response.ok('Transaction request received');
}

Future<bool> externalApi({required String did,required String peerId,required String orgName,required String callBackUrl,required Token orgAccessToken })async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should be named fireAuthCallback or something similar. It
doesn't need orgName
did and peerId need not be separate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will make these changes and put a new commit.

@vyshnavsdeepak
Copy link
Contributor

Also generate protos again to fix the conflicts, I had merged a pending PR to avoid confusion


Future<bool> externalApi({required String did,required String peerId,required String orgName,required String callBackUrl,required Token orgAccessToken })async {
var bodyJsonStr = jsonEncode({
'did': did,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

session id too

Uri.http(callBackUrl),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Bearer $orgAccessToken',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token should move to body. We are giving a token for them to access our apis

Future<bool> externalApi({required String did,required String peerId,required String orgName,required String callBackUrl,required Token orgAccessToken })async {
var bodyJsonStr = jsonEncode({
'did': did,
'peerId': peerId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add chain too. also add chain in access token

return Response.ok('Transaction request received');
}

Future<bool> externalApi({required String did,required String peerId,required String orgName,required String callBackUrl,required Token orgAccessToken })async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the last, this function shall move to another file as it is generic. Shall create a new module, - sky_outgoing_calls

@Allen-Cherian Allen-Cherian force-pushed the feat/externalorgaccess branch from a68e34c to f56cb65 Compare April 14, 2023 11:54
return false;
}
}catch(e){
print(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print stack trace too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@Allen-Cherian Allen-Cherian force-pushed the feat/externalorgaccess branch from 85a87f0 to 03a49ac Compare April 14, 2023 12:25
@Allen-Cherian Allen-Cherian force-pushed the feat/externalorgaccess branch from 03a49ac to dbdf580 Compare April 14, 2023 12:30
});
try{
var response = await http.post(
Uri.http(callBackUrl),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Uri.parse

var bodyJsonStr = jsonEncode({
'did': '$did.$peerId',
'session_id': sessionId,
'token': orgAccessToken,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orgAccessToken is of Token class, we just need the token value inside it which is a string, that is what we can pass through an api.

Future<OrgStatus> approveOrgAuthRequest(
ServiceCall call, OrgAuthRequest request) async {
var user = RubixService.getAuthUser(call);
const rubix = 'rubix';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must have been coming from phone,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, no, not need as this is rubix ext rpc. But could have simply passed this to the next function without having to store it in a variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will make that change.

@Allen-Cherian Allen-Cherian force-pushed the feat/externalorgaccess branch from 38c1334 to 350c94f Compare April 21, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants