Skip to content

Commit

Permalink
Apply main branch changes following branch rename
Browse files Browse the repository at this point in the history
Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday committed Mar 8, 2023
1 parent dd6fff2 commit 1f8d86c
Show file tree
Hide file tree
Showing 84 changed files with 19,306 additions and 18,811 deletions.
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository:
name: fabric-sdk-node
description: Hyperledger Fabric SDK for Node https://wiki.hyperledger.org/display/fabric
homepage: https://hyperledger.github.io/fabric-sdk-node/
default_branch: master
default_branch: main
has_downloads: true
has_issues: false
has_projects: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Pull request
on:
pull_request:
branches:
- release-2.2
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Push
on:
push:
branches:
- release-2.2
- main

jobs:
build:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Scheduled

on:
schedule:
- cron: '30 23 * * *'

jobs:
main:
uses: ./.github/workflows/test.yml
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand All @@ -54,7 +53,6 @@ jobs:
with:
name: ${{ matrix.node-version }}-unit-test-debug.log
path: test/temp/debug.log

- name: "Archive scenario test debug log"
if: ${{ failure() }}
uses: actions/upload-artifact@v3
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/vulnerability_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Security vulnerability scan"

on:
schedule:
- cron: "20 0 * * *"

jobs:
npm-audit:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
package:
- fabric-ca-client
- fabric-common
- fabric-network
- fabric-protos
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Update npm
run: |
npm update --global npm
npm --version
- name: Scan
run: |
npm install --package-lock-only
npm audit --omit=dev
working-directory: ${{ matrix.package }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

Notable changes in each release are documented on the project's [GitHub releases](https://github.com/hyperledger/fabric-sdk-node/releases) page.
36 changes: 36 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[//]: # (SPDX-License-Identifier: Apache-2.0)

Maintainers
===========

See [the documentation on Maintainers](https://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html#maintainers) to learn about the role of the maintainers and the process to become one.

**Active Maintainers**

| Name | GitHub |
|------|--------|
| Andrew Coleman | [andrew-coleman][andrew-coleman] |
| Mark Lewis | [bestbeforetoday][bestbeforetoday] |


**Emeritus Maintainers**

| Name | GitHub |
|------|--------|
| Bret Harrison | [harrisob][harrisob] |
| Chaoyi Zhao | [zhaochy1990][zhaochy1990] |
| Chris Ferris | [christo4ferris][christo4ferris] |
| Gari Singh | [mastersingh24][mastersingh24] |
| Heather Pollard | [heatherlp][heatherlp] |
| Jonathan Levi | [hacera][hacera] |
| Keith Smith | [smithbk][smithbk] |

[andrew-coleman]: https://github.com/andrew-coleman
[bestbeforetoday]: https://github.com/bestbeforetoday
[christo4ferris]: https://github.com/christo4ferris
[hacera]: https://github.com/hacera
[harrisob]: https://github.com/harrisob
[heatherlp]: https://github.com/heatherlp
[mastersingh24]: https://github.com/mastersingh24
[smithbk]: https://github.com/smithbk
[zhaochy1990]: https://github.com/zhaochy1990
27 changes: 0 additions & 27 deletions MAINTAINERS.rst

This file was deleted.

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Hyperledger Fabric Client SDK for Node.js
## Hyperledger Fabric Client SDK for Node.js <a href="https://github.com/hyperledger/fabric-sdk-node/actions/workflows/scheduled.yml"><img src="https://github.com/hyperledger/fabric-sdk-node/actions/workflows/scheduled.yml/badge.svg" alt="Build status" style="float: right"></a>

[![Build Status](https://dev.azure.com/Hyperledger/Fabric-SDK-Node/_apis/build/status/hyperledger.fabric-sdk-node?branchName=master)](https://dev.azure.com/Hyperledger/Fabric-SDK-Node/_build/latest?definitionId=47&branchName=master)
> **Note:** When developing applications for Hyperledger Fabric v2.4 and later, you should use the [Fabric Gateway client API](https://hyperledger.github.io/fabric-gateway/).
The Hyperledger Fabric Client SDK makes it possible to use APIs to interact with a Hyperledger Fabric blockchain. This readme is directed towards a current or future contributor to this project, and gives an overview of setting up the project locally and running tests. For more information on the SDK, including features and an API reference, please visit the [SDK documentation](https://hyperledger.github.io/fabric-sdk-node/).

Expand All @@ -12,24 +12,20 @@ This project publishes the following npm packages:

## Build and Test
To build and test, the following pre-requisites must be installed first:
* Node.js, version 10 is supported from 10.15.3 and higher
* Node.js, version 12 is supported from 12.13.1 and higher
* npm tool version 6 or higher
* docker (only required for running integration tests, see below)
* Node.js
* Docker (only required for running integration tests, see below)

### Run unit tests
Clone the project and launch the following commands to install the dependencies and perform various tasks.

In the project root folder:
* Install all dependencies via `npm install`
* Optionally, to generate API docs via `npm run docs`
* To generate the required crypto material used by the tests, use one of the following patform specific commands:
* For Linux `npm run installAndGenerateCerts`
* For mac `npm run installAndGenerateCertsMac`
* To generate the required crypto material used by the tests, use the npm task `npm run installAndGenerateCerts`
* To run the unit tests that do not require any additional set up, use `npm run testHeadless`

### Run Integration Tests
Integration tests run on the master branch require the most recent stable Fabric images, which are hosted on Artifactory. A utility script is provided to retrieve non-published docker images, which may be run using the command `npm run pullFabricImages`
Integration tests run on the main branch require the most recent stable Fabric images, which are hosted on Artifactory. A utility script is provided to retrieve non-published docker images, which may be run using the command `npm run pullFabricImages`

Now you are ready to run the integration tests. It is advisable to clear out any previous key value stores that may have cached user enrollment certificates using the command (`rm -rf /tmp/hfc-*`, `rm -rf ~/.hfc-key-store`) prior to testing in isolation.

Expand Down Expand Up @@ -65,4 +61,3 @@ Check the `./release_notes` directory for the release notes of the specified rel
Check [the documentation](./CONTRIBUTING.md) on how to contribute to this project for the full details.

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
s
28 changes: 8 additions & 20 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,22 @@ Using v2.2 branch and last release of v2.2.3 as an example throughout.

## Pre-Check

Check top level `package.json` file properties **version** and **tag** are one above the current release and correct for publishing snapshots. Expect *2.2.4-snapshot* and *unstable-2.2*. If this is not the case then builds are likely to fail. Consider fixing and creating a PR or move straight onto submit a PR for a new release.
Check top level `package.json` file properties **version** and **tag** are one above the current release and correct for publishing snapshots. Expect *2.2.4-snapshot* and *unstable-2.2*. If this is not the case then builds are likely to fail. Consider fixing and creating a PR or move straight onto submit a PR for a new release.

## Submit Release PR

- Create a jira for publish - publish v2.2.4.
- Update the **version** and **tag** properties in the top-level `package.json` file to be the appropriate values - next release version *2.2.4* and release npm tag *latest*. **[NOTE: This would become latest-2.2 when a new branch supersedes as latest.]**
- Create `release_notes/v2.2.4.txt` file with appropriate text - "This is a maintenance release containing bug fixes".
- Git add, submit, push and create PR. The build once the PR is merged will do the npm publishing. Check it has npm published at https://www.npmjs.com/package/fabric-client and https://www.npmjs.com/package/fabric-common
- Update the **version** and **tag** properties in the top-level `package.json` file to be the appropriate values - next release version *2.2.4* and release npm tag *latest*. **[NOTE: This would become latest-2.2 when a new branch supersedes as latest.]**
- Git add, submit, push and create PR. Once the PR is merged, the build will do the npm publishing. Check it has npm published at https://www.npmjs.com/package/fabric-client and https://www.npmjs.com/package/fabric-common

## Tag Release

- Create in GitHub a release draft with similar text to the release_notes - "This is a maintenance release containing bug fixes":
- Code > Tags > Releases > Draft a new release
- Be sure to set:
- Title = v2.2.4
- Tag version = v2.2.4
- Target Branch = release-2.2 [NOTE: Check that no commits have gone into the branch since the commit that did the npm publishing as just just selecting the branch will tag the latest commit. If subsequent commits have gone in then the commit that did the publishing needs to be selected explicitly.]
- Create in GitHub a [release](https://github.com/hyperledger/fabric-sdk-node/releases) draft, referring to previous releases for appropriate text. Be sure to set:
- **Title**: v2.2.4
- **Tag version**: v2.2.4
- **Target Branch**: main *[NOTE: Check that no commits have gone into the branch since the commit that did the npm publishing as just selecting the branch will tag the latest commit. If subsequent commits have gone in then the commit that did the publishing needs to be selected explicitly.]*
- Save as draft initially.
- When ready 'Publish release'. Publishing the release in GitHub creates a corresponding Git tag.
- When ready 'Publish release'. Publishing the release in GitHub creates a corresponding Git tag.

## Post Release Clean-up

- Create a jira for Reset snapshot publishing to 2.2.5.
- Once the release is complete, create a PR to change the top-level `package.json` file's **version** and **tag** properties back to ones for publishing snapshots - *2.2.5-snapshot* and *unstable-2.2*.

## Post Release Announcement

Post a release notice on mailing list or slack channel if appropriate.



29 changes: 2 additions & 27 deletions docs/redirectTemplates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,10 @@
</style>
<head>
<meta charset="utf-8">
<title>Single Page Apps for GitHub Pages</title>
<script type="text/javascript">

let l = window.location;

// firstly need to check if we are in a loop
if (!l.search.match(/redirect=true/)){
let newUrl = l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '')
+ '/release-1.4/index.html?redirect=true'

let mapping = [FILENAME__MAPPING]
let release = "release-1.4";

// look up the maping
let requestedPage = l.pathname.split('/').slice(1)[0]

// if (mapping.indexOf(requestedPage)>-1) {
// newUrl = l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '')
// +'/release-1.4/fabric-shim.' + requestedPage+'?redirect=true';
// }

console.log(newUrl);
l.replace(newUrl);
}

</script>
<title>404: Page not found</title>
</head>
<body>
<h1>Sorry, a suitable documentation page can not be found</h1>
<h2>Please consult the main <a href="https://fabric-sdk-node.readthedocs.io/en/release-1.2/">Hyperledger Fabric documentation</a></h2>
<h2>Please consult the <a href="https://hyperledger.github.io/fabric-sdk-node/">Node SDK documentation</a></h2>
</body>
</html>
4 changes: 2 additions & 2 deletions docs/redirectTemplates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The SDK implements the Fabric programming model as described in the [Developing
## Documentation

Full documentation is published for each of the following versions:
- [2.1](https://hyperledger.github.io/fabric-sdk-node/master/module-fabric-network.html)
- [2.2](https://hyperledger.github.io/fabric-sdk-node/main/module-fabric-network.html)
- [1.4](https://hyperledger.github.io/fabric-sdk-node/release-1.4/module-fabric-network.html)


Expand All @@ -22,4 +22,4 @@ npm install fabric-network

## Samples

Sample Node.js client applications can be found in the _Fabcar_ and _Commercial Paper_ samples within the [fabric-samples repository](https://github.com/hyperledger/fabric-samples).
Sample Node.js client applications can be found in the _Asset Transfer_ samples within the [fabric-samples repository](https://github.com/hyperledger/fabric-samples).
2 changes: 1 addition & 1 deletion docs/tutorials/query-peers.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ The following sample code is in TypeScript to show the object types involved.
}
```

For a complete sample plug-in query handler implementation, see [sample-query-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/release-2.2/test/ts-scenario/config/handlers/sample-query-handler.ts).
For a complete sample plug-in query handler implementation, see [sample-query-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/config/handlers/sample-query-handler.ts).
2 changes: 1 addition & 1 deletion docs/tutorials/transaction-commit-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ listener to monitor commit events from endorsing peers by calling
[Network.addCommitListener](module-fabric-network.Network.html#addCommitListener).

For a complete sample plug-in event handler implementation, see
[sample-transaction-event-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/release-2.2/test/ts-scenario/config/handlers/sample-transaction-event-handler.ts).
[sample-transaction-event-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/config/handlers/sample-transaction-event-handler.ts).
3 changes: 1 addition & 2 deletions fabric-ca-client/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Hyperledger Fabric-CA Client for Node.js

[![NPM](https://nodei.co/npm/fabric-ca-client.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-fabric-ca-client/)
[![NPM](https://nodei.co/npm/fabric-ca-client.svg?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/fabric-ca-client/)

SDK for writing node.js applications to interact with [Hyperledger Fabric CA](http://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html).

Expand All @@ -14,4 +14,3 @@ Additional packages are also provided:
For application developer documentations, please visit [hyperledger.github.io/fabric-sdk-node/](https://hyperledger.github.io/fabric-sdk-node/)

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
s
36 changes: 35 additions & 1 deletion fabric-ca-client/lib/FabricCAClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,46 @@ const FabricCAClient = class {
}));
}

/**
* @typedef {Object} CAInfoResponse
* @property {string} caName The name of the CA.
* @property {string} caChain PEM-encoded certificate chain of the server's signing certificate
* @property {string} issuerPublicKey Proto bytes of the CA's Idemix issuer public key
* @property {string} issuerRevocationPublicKey PEM-encoded bytes of the CA's Idemix issuer
* revocation public key
* @property {string} version Version of the server
*/

/**
* Get info on the CA
* @param {SigningIdentity} signingIdentity The instance of a SigningIdentity encapsulating the
* signing certificate, hash algorithm and signature algorithm
* @returns {Promise<CAInfoResponse>}
*/
async getCaInfo(signingIdentity) {

if (arguments.length !== 1) {
return Promise.reject(new Error('Missing required parameters. \'signingIdentity\' is required.'));
}
const request = {
caname: this._caName
};
const response = await this.post('cainfo', request, signingIdentity);
return {
caName: response.result.CAName,
caChain: Buffer.from(response.result.CAChain, 'base64').toString(),
issuerPublicKey: Buffer.from(response.result.IssuerPublicKey, 'base64').toString(),
issuerRevocationPublicKey: Buffer.from(response.result.IssuerRevocationPublicKey, 'base64').toString(),
version: response.result.Version,
};
}

/*
* Generate authorization token required for accessing fabric-ca APIs
*/
generateAuthToken(reqBody, signingIdentity, path, method) {
// specific signing procedure is according to:
// https://github.com/hyperledger/fabric-ca/blob/master/util/util.go#L168
// https://github.com/hyperledger/fabric-ca/blob/main/util/util.go#L168
const cert = Buffer.from(signingIdentity._certificate).toString('base64');
let signString;
if (reqBody) {
Expand Down
Loading

0 comments on commit 1f8d86c

Please sign in to comment.