|
|
@ -23,16 +23,16 @@ async function main() {
|
|
|
|
|
|
|
|
|
|
|
|
const client = new Client("c1")
|
|
|
|
const client = new Client("c1")
|
|
|
|
client.addTlsClientCertAndKey({
|
|
|
|
client.addTlsClientCertAndKey({
|
|
|
|
url: "grpcs://peer0.org1.example.com:7051",
|
|
|
|
url: "grpcs://peer1.org1.example.com:7051",
|
|
|
|
pem: "-----BEGIN CERTIFICATE-----MIIChTCCAiygAwIBAgIQVV+CR63zERwI+FLYFwBgmjAKBggqhkjOPQQDAjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTAeFw0yMDA3MTcxODE5MDBaFw0zMDA3MTUxODE5MDBaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEF4+/4lAVh7w2djxoer+rsmD6ejYG9MI3XH2s+vCEPd7AXZJoDq9UuCXZ7lU1dqEZldQN8564YsKa4sZ9EDDFvKOBtjCBszAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgMOm16EK5pSMRsbTTBkNFZvjBrd1hQaET+ZAA29zvkxIwRwYDVR0RBEAwPoIWcGVlcjAub3JnMS5leGFtcGxlLmNvbYIFcGVlcjCCFnBlZXIwLm9yZzEuZXhhbXBsZS5jb22CBXBlZXIwMAoGCCqGSM49BAMCA0cAMEQCICxAltMHintLLtqgF97c4KNXwH5QZRF8uWtlEGDwSkACAiA9FpumEzjlkaOen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h9iFRrW1zWIxLbH+FLerQUWd/bveuhIS8koYab+3+a3twzYzwwx-----END PRIVATE KEY-----",
|
|
|
|
clientKey:"-----BEGIN PRIVATE KEY-----MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOQEb55wiTX74p7cAMi33at2kDn0hgN2Q9lWutWRjTm+hRANCAATZEXMExJbwUnRYm6Mha/hrjnXgbhLKLAkmwh9iFRrW1zWIxLbH+FLerQUWd/bveuhIS8koYab+3+a3twzYzwwx-----END PRIVATE KEY-----",
|
|
|
|
clientCert: "-----BEGIN CERTIFICATE-----MIICOzCCAeKgAwIBAgIRAPUP28xYwbLj0OAzFk4wlvgwCgYIKoZIzj0EAwIwdjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRsc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzE3MTgxOTAwWhcNMzAwNzE1MTgxOTAwWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNkRcwTElvBSdFiboyFr+GuOdeBuEsosCSbCH2IVGtbXNYjEtsf4Ut6tBRZ39u966EhLyShhpv7f5re3DNjPDDGjbDBqMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCAw6bXoQrmlIxGxtNMGQ0Vm+MGt3WFBoRP5kADb3O+TEjAKBggqhkjOPQQDAgNHADBEAiAYQu0XAzDyrnlcJophUUV2HxnudmUGOXSLFONm4fa+6QIgRxeA7O1JDy9Yy2uM3aX5kNe9+WjSySGnp07ceLuRak4=-----END CERTIFICATE-----"
|
|
|
|
clientCert: "-----BEGIN CERTIFICATE-----MIICOzCCAeKgAwIBAgIRAPUP28xYwbLj0OAzFk4wlvgwCgYIKoZIzj0EAwIwdjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRsc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzE3MTgxOTAwWhcNMzAwNzE1MTgxOTAwWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNkRcwTElvBSdFiboyFr+GuOdeBuEsosCSbCH2IVGtbXNYjEtsf4Ut6tBRZ39u966EhLyShhpv7f5re3DNjPDDGjbDBqMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCAw6bXoQrmlIxGxtNMGQ0Vm+MGt3WFBoRP5kADb3O+TEjAKBggqhkjOPQQDAgNHADBEAiAYQu0XAzDyrnlcJophUUV2HxnudmUGOXSLFONm4fa+6QIgRxeA7O1JDy9Yy2uM3aX5kNe9+WjSySGnp07ceLuRak4=-----END CERTIFICATE-----"
|
|
|
|
})
|
|
|
|
})
|
|
|
|
client.setTlsClientCertAndKey("-----BEGIN CERTIFICATE-----MIICOzCCAeKgAwIBAgIRAPUP28xYwbLj0OAzFk4wlvgwCgYIKoZIzj0EAwIwdjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRsc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzE3MTgxOTAwWhcNMzAwNzE1MTgxOTAwWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNkRcwTElvBSdFiboyFr+GuOdeBuEsosCSbCH2IVGtbXNYjEtsf4Ut6tBRZ39u966EhLyShhpv7f5re3DNjPDDGjbDBqMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCAw6bXoQrmlIxGxtNMGQ0Vm+MGt3WFBoRP5kADb3O+TEjAKBggqhkjOPQQDAgNHADBEAiAYQu0XAzDyrnlcJophUUV2HxnudmUGOXSLFONm4fa+6QIgRxeA7O1JDy9Yy2uM3aX5kNe9+WjSySGnp07ceLuRak4=-----END CERTIFICATE-----","-----BEGIN PRIVATE KEY-----MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOQEb55wiTX74p7cAMi33at2kDn0hgN2Q9lWutWRjTm+hRANCAATZEXMExJbwUnRYm6Mha/hrjnXgbhLKLAkmwh9iFRrW1zWIxLbH+FLerQUWd/bveuhIS8koYab+3+a3twzYzwwx-----END PRIVATE KEY-----")
|
|
|
|
client.setTlsClientCertAndKey("-----BEGIN CERTIFICATE-----MIICOzCCAeKgAwIBAgIRAPUP28xYwbLj0OAzFk4wlvgwCgYIKoZIzj0EAwIwdjELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRsc2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzE3MTgxOTAwWhcNMzAwNzE1MTgxOTAwWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNkRcwTElvBSdFiboyFr+GuOdeBuEsosCSbCH2IVGtbXNYjEtsf4Ut6tBRZ39u966EhLyShhpv7f5re3DNjPDDGjbDBqMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCAw6bXoQrmlIxGxtNMGQ0Vm+MGt3WFBoRP5kADb3O+TEjAKBggqhkjOPQQDAgNHADBEAiAYQu0XAzDyrnlcJophUUV2HxnudmUGOXSLFONm4fa+6QIgRxeA7O1JDy9Yy2uM3aX5kNe9+WjSySGnp07ceLuRak4=-----END CERTIFICATE-----","-----BEGIN PRIVATE KEY-----MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOQEb55wiTX74p7cAMi33at2kDn0hgN2Q9lWutWRjTm+hRANCAATZEXMExJbwUnRYm6Mha/hrjnXgbhLKLAkmwh9iFRrW1zWIxLbH+FLerQUWd/bveuhIS8koYab+3+a3twzYzwwx-----END PRIVATE KEY-----")
|
|
|
|
|
|
|
|
|
|
|
|
const endPoint = new Endpoint({url:"grpcs://peer0.org1.example.com", pem:"-----BEGIN CERTIFICATE-----MIIChTCCAiygAwIBAgIQVV+CR63zERwI+FLYFwBgmjAKBggqhkjOPQQDAjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTAeFw0yMDA3MTcxODE5MDBaFw0zMDA3MTUxODE5MDBaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEF4+/4lAVh7w2djxoer+rsmD6ejYG9MI3XH2s+vCEPd7AXZJoDq9UuCXZ7lU1dqEZldQN8564YsKa4sZ9EDDFvKOBtjCBszAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgMOm16EK5pSMRsbTTBkNFZvjBrd1hQaET+ZAA29zvkxIwRwYDVR0RBEAwPoIWcGVlcjAub3JnMS5leGFtcGxlLmNvbYIFcGVlcjCCFnBlZXIwLm9yZzEuZXhhbXBsZS5jb22CBXBlZXIwMAoGCCqGSM49BAMCA0cAMEQCICxAltMHintLLtqgF97c4KNXwH5QZRF8uWtlEGDwSkACAiA9FpumEzjlkaOenA69IeQSPhPKvYtXSvHrvDmMyaBJAg==-----END CERTIFICATE-----", requestTimeout:300})
|
|
|
|
const endPoint = new Endpoint({url:"grpcs://peer1.org1.example.com:7051", pem:"-----BEGIN CERTIFICATE----- MIICVzCCAf2gAwIBAgIQQaMCImEphSvSI+GHAJmxqjAKBggqhkjOPQQDAjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTAeFw0yMDA3MTcxODE5MDBaFw0zMDA3MTUxODE5 MDBaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVmrLLrpumifDP5gJfjVK3+RPl2W67+7NS/CV0rRfCG8d4xx+QvCRlaW/ 3LyIpcBMfGe7G9UgiaIVhhYHh+eNXKNtMGswDgYDVR0PAQH/BAQDAgGmMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1Ud DgQiBCAw6bXoQrmlIxGxtNMGQ0Vm+MGt3WFBoRP5kADb3O+TEjAKBggqhkjOPQQDAgNIADBFAiBkhGF4Adl6z0QfQlcAM85D2yFPVzC3/9WMJo/Qtjil9QIhAOfrSbTl IlN1ytBONKWl30rCv0pFOd6nTN7BOwllhWZq -----END CERTIFICATE-----", requestTimeout:30000})
|
|
|
|
|
|
|
|
|
|
|
|
const endorser = new Endorser("peer0-org1", client,"org1MSP")
|
|
|
|
const endorser = new Endorser("peer1-org1", client,"org1MSP")
|
|
|
|
await endorser.connect(endPoint)
|
|
|
|
await endorser.connect(endPoint)
|
|
|
|
// use the loaded connection profile
|
|
|
|
// use the loaded connection profile
|
|
|
|
//const gateway = new Gateway();
|
|
|
|
//const gateway = new Gateway();
|
|
|
|