diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e751dd5..03b5819 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,31 +26,31 @@ jobs: - name: Initialize run: make github-init - # - name: Extract current version - # id: get_version - # run: | - # CURRENT_VERSION=$(cat version | awk '{$1=$1;print}') - # echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV - - # - name: Config Git - # run: | - # git config --local user.name "bot" - # git config --local user.email "bot@arcblock.io" - - # - name: Publish to NPM - # run: | - # npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}" - # VERSION=$(cat version | awk '{$1=$1;print}') - # echo "publish version ${VERSION}" - # lerna version ${CURRENT_VERSION} --exact --no-push --force-publish --yes - # lerna publish from-git --yes - # curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"did-connect packages v${VERSION} was successfully published\"}" ${{ secrets.SLACK_WEBHOOK }} - - # - name: Push Version - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GIT_HUB_TOKEN }} - # branch: ${{ github.ref }} + - name: Extract current version + id: get_version + run: | + CURRENT_VERSION=$(cat version | awk '{$1=$1;print}') + echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV + + - name: Config Git + run: | + git config --local user.name "bot" + git config --local user.email "bot@arcblock.io" + + - name: Publish to NPM + run: | + npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}" + VERSION=$(cat version | awk '{$1=$1;print}') + echo "publish version ${VERSION}" + lerna version ${CURRENT_VERSION} --exact --no-push --force-publish --yes + lerna publish from-git --yes + curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"did-connect packages v${VERSION} was successfully published\"}" ${{ secrets.SLACK_WEBHOOK }} + + - name: Push Version + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GIT_HUB_TOKEN }} + branch: ${{ github.ref }} # - name: Bundle Blocklets # run: make bundle diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f99951..b5a22c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.3 (April 09, 2024) + +- fix(playground): footer should be fullwidth + ## 2.2.2 (April 09, 2024) - chore: update ci diff --git a/playground/react/api/routes/auth/request-transaction-signature.js b/playground/react/api/routes/auth/request-transaction-signature.js index 85bfb18..7a37fe6 100644 --- a/playground/react/api/routes/auth/request-transaction-signature.js +++ b/playground/react/api/routes/auth/request-transaction-signature.js @@ -1,7 +1,8 @@ /* eslint-disable no-console */ const { toTypeInfo } = require('@arcblock/did'); const { fromPublicKey } = require('@ocap/wallet'); -const { fromBase58, toBase58 } = require('@ocap/util'); +const { toTxHash } = require('@ocap/mcrypto'); +const { toBase58 } = require('@ocap/util'); const logger = require('../../libs/logger'); const env = require('../../libs/env'); @@ -15,6 +16,7 @@ module.exports = { signature: async ({ userPk, userDid }) => { const value = await client.fromTokenToUnit(1); const type = toTypeInfo(userDid); + const encoded = await client.encodeTransferV2Tx({ tx: { itx: { @@ -29,6 +31,7 @@ module.exports = { }, wallet: fromPublicKey(userPk, type), }); + const origin = toBase58(encoded.buffer); return { @@ -42,20 +45,17 @@ module.exports = { // eslint-disable-next-line consistent-return onAuth: ({ userDid, userPk, claims, updateSession }) => { const claim = claims.find((x) => x.type === 'signature'); + const tx = client.decodeTx(claim.origin); logger.info(`${action}.onAuth`, { userPk, userDid, claim }); - - // if (claim.origin) { - // const type = toTypeInfo(userDid); - // const user = fromPublicKey(userPk, type); - // if (user.verify(claim.origin, claim.sig, claim.method !== 'none') === false) { - // throw new Error('Origin 签名错误'); - // } - // } + const buffer = Buffer.from(claim.origin); + const hash = toTxHash(buffer); updateSession({ result: { - transaction: fromBase58(claim.origin).toString(), + hash, + tx, + origin: claim.origin, sig: claim.sig, }, }); diff --git a/playground/react/blocklet.md b/playground/react/blocklet.md index e2262b0..686914f 100644 --- a/playground/react/blocklet.md +++ b/playground/react/blocklet.md @@ -1,3 +1,7 @@ -# template-react +# DID Connect Playground -A react template for creating a new blocklet project. +A Playground shows Simple DID Connect workflow + +![step-1](./screenshots/1-step_1.png) + +![step-2](./screenshots/2-step_2.png) diff --git a/playground/react/blocklet.yml b/playground/react/blocklet.yml index c2a77f5..2dacf69 100644 --- a/playground/react/blocklet.yml +++ b/playground/react/blocklet.yml @@ -1,5 +1,5 @@ name: z2qa7dZjxsMMCXMCUG9NFDooAMPjzSE2XYsZ4 -title: DID Connect Playground React +title: DID Connect Playground description: A Blocklet show DID Connect Playground keywords: - blocklet @@ -17,7 +17,7 @@ repository: type: git url: git+https://github.com/arcblock/did-connect.git specVersion: 1.2.8 -version: 2.2.2 +version: 2.2.3 logo: logo.png files: - dist diff --git a/playground/react/screenshots/2-step_2.png b/playground/react/screenshots/2-step_2.png index 1ad8c77..307336a 100644 Binary files a/playground/react/screenshots/2-step_2.png and b/playground/react/screenshots/2-step_2.png differ diff --git a/playground/react/src/components/layout.jsx b/playground/react/src/components/layout.jsx index 45ada44..71de3f9 100644 --- a/playground/react/src/components/layout.jsx +++ b/playground/react/src/components/layout.jsx @@ -7,11 +7,18 @@ import Footer from '@blocklet/ui-react/lib/Footer'; export default function Layout({ children }) { return ( -
+
{children} -