Skip to content

Commit

Permalink
Merge branch 'cpp-update' of https://github.com/agracio/edge-js into …
Browse files Browse the repository at this point in the history
…cpp-update
  • Loading branch information
agracio committed May 3, 2024
2 parents 3b11f10 + cceb361 commit bdfbe4c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 28 deletions.
81 changes: 57 additions & 24 deletions samples/203_x509store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,67 @@

var edge = require('../lib/edge');

var listCertificates = edge.func(function() {/*
#r "System.dll"
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
async (dynamic data) =>
{
X509Store store = new X509Store(
(string)data.storeName,
(StoreLocation)Enum.Parse(typeof(StoreLocation), (string)data.storeLocation));
store.Open(OpenFlags.ReadOnly);
try
// var listCertificates = edge.func(function() {/*
// //#r "System.Security.Cryptography"

// using System.Security.Cryptography;
// using System.Collections.Generic;
// using System.Security.Cryptography.X509Certificates;

// async (dynamic data) =>
// {
// X509Store store = new X509Store(
// (string)data.storeName,
// (StoreLocation)Enum.Parse(typeof(StoreLocation), (string)data.storeLocation));
// store.Open(OpenFlags.ReadOnly);
// try
// {
// List<string> result = new List<string>();
// foreach (X509Certificate2 certificate in store.Certificates)
// {
// result.Add(certificate.Subject);
// }

// return result;
// }
// finally
// {
// store.Close();
// }
// }
// */});

var listCertificates = edge.func({
source: function() {/*
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
async (dynamic data) =>
{
List<string> result = new List<string>();
foreach (X509Certificate2 certificate in store.Certificates)
X509Store store = new X509Store(
(string)data.storeName,
(StoreLocation)Enum.Parse(typeof(StoreLocation), (string)data.storeLocation));
store.Open(OpenFlags.ReadOnly);
try
{
result.Add(certificate.Subject);
}
List<string> result = new List<string>();
foreach (X509Certificate2 certificate in store.Certificates)
{
result.Add(certificate.Subject);
}
return result;
}
finally
{
store.Close();
return result;
}
finally
{
store.Close();
}
}
}
*/});
*/},
references: [ 'System.Security.Cryptography' ]
});

var result = listCertificates({ storeName: 'My', storeLocation: 'LocalMachine' }, true);
console.log(result);
8 changes: 4 additions & 4 deletions test/104_csx.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('edge-cs', function () {
var func = edge.func({
source: process.env.EDGE_USE_CORECLR ?
function () {/*
//#r "System.Data.Common"
#r "System.Data.Common"
using System.Threading.Tasks;
using System.Data;
Expand All @@ -213,7 +213,7 @@ describe('edge-cs', function () {
}
*/} :
function () {/*
//#r "System.Data.dll"
#r "System.Data.dll"
using System.Threading.Tasks;
using System.Data;
Expand Down Expand Up @@ -277,15 +277,15 @@ describe('edge-cs', function () {
var func = edge.func({
source: process.env.EDGE_USE_CORECLR ?
function () {/*
//#r "System.Data.Common"
#r "System.Data.Common"
async (input) =>
{
return "Hello, " + input.ToString();
}
*/} :
function () {/*
//#r "System.Data.dll"
#r "System.Data.dll"
async (input) =>
{
Expand Down

0 comments on commit bdfbe4c

Please sign in to comment.