Skip to content

Commit

Permalink
fix: identities/CommandAuthenticate is logic now more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Mar 15, 2024
1 parent 908cb28 commit 9017511
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/identities/CommandAuthenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,27 @@ class CommandAuthenticate extends CommandPolykey {
'Use any additional additional properties to complete authentication\n',
);
identitiesUtils.browser(message.request.url);
process.stdout.write(
binUtils.outputFormatter({
type: options.format === 'json' ? 'json' : 'dict',
data: {
url: message.request.url,
...(options.format === 'json'
? { dataMap: message.request.dataMap }
: message.request.dataMap),
},
}),
);
if (options.format === 'json') {
process.stdout.write(
binUtils.outputFormatter({
type: 'json',
data: {
url: message.request.url,
dataMap: message.request.dataMap,
},
}),
);
} else {
process.stdout.write(
binUtils.outputFormatter({
type: 'dict',
data: {
url: message.request.url,
...message.request.dataMap,
},
}),
);
}
} else if (message.response != null) {
process.stderr.write(
`Authenticated digital identity provider ${providerId}\n`,
Expand Down

0 comments on commit 9017511

Please sign in to comment.