From fa1f3f8ad04ff63aa401147f13bbc413e081913e Mon Sep 17 00:00:00 2001 From: Maciej Zielinski Date: Wed, 28 Apr 2021 13:49:10 +0200 Subject: [PATCH] Support Signer's disconnectFromSite --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/@types/casperlabsSigner.d.ts | 7 ++++++- src/lib/Signer.ts | 7 +++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5f6d964..815aa5165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to casper-client-sdk. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.0.44 + +### Added + +- Support `disconnectFromSite` method from the Signer. + ## 1.0.43 ### Fixed diff --git a/package.json b/package.json index baf295ff1..f86e6abbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "casper-client-sdk", - "version": "1.0.43", + "version": "1.0.44", "license": "Apache 2.0", "description": "SDK to interact with the Casper blockchain", "main": "dist/lib.node.js", diff --git a/src/@types/casperlabsSigner.d.ts b/src/@types/casperlabsSigner.d.ts index f4e3fd2dd..b583e1ac1 100644 --- a/src/@types/casperlabsSigner.d.ts +++ b/src/@types/casperlabsSigner.d.ts @@ -26,7 +26,12 @@ interface CasperLabsHelper { * Retrieve the active public key. * @returns {string} Hex-encoded public key with algorithm prefix. */ - getActivePublicKey: () => Promise; + getActivePublicKey: () => Promise; + + /* + * Forces Signer to disconnect from the currently open site. + */ + disconnectFromSite: () => void; } interface SignerTestingHelper { diff --git a/src/lib/Signer.ts b/src/lib/Signer.ts index 6cd84947f..719c6e8ab 100644 --- a/src/lib/Signer.ts +++ b/src/lib/Signer.ts @@ -53,6 +53,13 @@ export const sign: ( return window.casperlabsHelper!.sign(messageBase16, publicKeyBase64); }; +/* + * Forces Signer to disconnect from the currently open site. + */ +export const disconnectFromSite: () => void = () => { + return window.casperlabsHelper!.disconnectFromSite(); +}; + export const forceConnection: () => void = () => { return window.signerTestingHelper!.forceConnection(); };