Skip to content
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

[JS] Add details to README in certificate samples #427

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format code
  • Loading branch information
JhontSouth committed Jun 6, 2024
commit c29429516401b952daa26e64a6e2f5a94289eb54
14 changes: 7 additions & 7 deletions samples/javascript_nodejs/85.bot-authentication-sni/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

const path = require('path');
const fs = require('fs');
// const fs = require('fs');
const { createPrivateKey } = require('crypto');
const dotenv = require('dotenv');
const restify = require('restify');
Expand Down Expand Up @@ -31,7 +31,7 @@ const { AuthBot } = require('./authBot');
server.use(restify.plugins.bodyParser());

server.listen(process.env.port || process.env.PORT || 3978, () => {
console.log(`\n${server.name} listening to ${server.url}`);
console.log(`\n${ server.name } listening to ${ server.url }`);
console.log('\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator');
console.log('\nTo talk to your bot, open the emulator select "Open Bot"');
});
Expand All @@ -41,7 +41,7 @@ const { AuthBot } = require('./authBot');
const credential = new DefaultAzureCredential();

const vaultName = process.env.KeyVaultName;
const keyVaultUrl = `https://${vaultName}.vault.azure.net`;
const keyVaultUrl = `https://${ vaultName }.vault.azure.net`;

const certificateName = process.env.CertificateName;

Expand All @@ -58,7 +58,7 @@ const { AuthBot } = require('./authBot');

// Create a private key object from the certificate
var certificateKey = createPrivateKey(cert);
//Convert the private key object to a string format
// Convert the private key object to a string format
const privateKey = certificateKey.export({
type: 'pkcs8', // Can also be 'pkcs1' depending on your format requirements
format: 'pem'
Expand All @@ -70,7 +70,7 @@ const { AuthBot } = require('./authBot');
cert,
privateKey,
process.env.MicrosoftAppTenantId
)
);

const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(process.env, serviceClientCredentialsFactory);

Expand All @@ -83,12 +83,12 @@ const { AuthBot } = require('./authBot');
// NOTE: In production environment, you should consider logging this to Azure
// application insights. See https://aka.ms/bottelemetry for telemetry
// configuration instructions.
console.error(`\n [onTurnError] unhandled error: ${error}`);
console.error(`\n [onTurnError] unhandled error: ${ error }`);

// Send a trace activity, which will be displayed in Bot Framework Emulator
await context.sendTraceActivity(
'OnTurnError Trace',
`${error}`,
`${ error }`,
'https://www.botframework.com/schemas/error',
'TurnError'
);
Expand Down
Loading