@fortmatic/admin
Advanced tools
Comparing version 0.0.1 to 0.0.3
@@ -6,4 +6,4 @@ import { ChallengeMessageService } from '../types'; | ||
validateToken(DecentralizedAccessToken: string): Promise<void>; | ||
invalidateToken(DecentralizedAccessToken: string): Promise<any>; | ||
invalidateTokenBySignerAddress(userPublicAddress: string): Promise<any>; | ||
invalidateToken(DecentralizedAccessToken: string): Promise<boolean>; | ||
invalidateTokenBySignerAddress(userPublicAddress: string): Promise<boolean>; | ||
decodeToken(DecentralizedAccessToken: string): any[]; | ||
@@ -10,0 +10,0 @@ getUserPublicAddress(authorizationHeader: string): string; |
@@ -135,4 +135,3 @@ "use strict"; | ||
userPublicAddress = (_b = (_a = claim) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.addr; | ||
this.cms.resetChallengeMessage(userPublicAddress); | ||
return [2 /*return*/]; | ||
return [2 /*return*/, this.cms.resetChallengeMessage(userPublicAddress)]; | ||
} | ||
@@ -139,0 +138,0 @@ }); |
{ | ||
"name": "@fortmatic/admin", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "Fortmatic Javascript Admin SDK", | ||
@@ -5,0 +5,0 @@ "author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)", |
# Fortmatic Admin Javascript SDK | ||
Fortmatic JavaScript SDK lets developers conveniently connect their web apps | ||
to the Ethereum blockchain - allowing end-users to interact with their apps on | ||
any modern browser, without requiring them to download any browser extensions or | ||
mobile dApp browsers. | ||
Fortmatic Admin JavaScript SDK lets developers secure endpoints in their Express-based NodeJS application via easy-to-use middleware. | ||
## Documentation | ||
See the [Developer Documentation](https://developers.fortmatic.com). | ||
See the [Developer Documentation](https://docs.fortmatic.com). | ||
## Installation | ||
Integrating your NodeJS application with Fortmatic Auth will require our NPM package: | ||
```zsh | ||
npm install --save @fortmatic/admin | ||
``` | ||
## Usage | ||
Sign up or log in to your [Developer Dashboard](https://dashboard.fortmatic.com) to receive API keys that will allow your app to interact with the Ethereum blockchain through Fortmatic. | ||
You can then integrate by simply replacing your web3 provider with Fortmatic | ||
provider. Now instead of the MetaMask Chrome Extension opening, a Fortmatic | ||
modal will open instead - requiring no extra user downloads, and works on all | ||
modern desktop and mobile Chrome, Safari and Firefox browsers. | ||
```jspx | ||
import Fortmatic from 'fortmatic'; | ||
const Fortmatic = require('@fortmatic/admin'); | ||
// Create a Fortmatic Admin instance | ||
const fm = new Fortmatic(‘YOUR_DEVELOPER_SECRET_KEY’); | ||
// Create client and replace web3 provider | ||
const fm = new Fortmatic('YOUR_API_KEY'); | ||
web3 = new Web3(fm.getProvider()); | ||
// Send transactions the way your are used to | ||
web3.eth.sendTransaction({/* ... */}); | ||
// Apply middleware | ||
app.use(fortmatic.expressMiddleware); | ||
``` |
@@ -50,10 +50,10 @@ import ethSigUtil from 'eth-sig-util'; | ||
public async invalidateToken(DecentralizedAccessToken: string): Promise<any> { | ||
public async invalidateToken(DecentralizedAccessToken: string): Promise<boolean> { | ||
await this.validateToken(DecentralizedAccessToken); | ||
const claim = this.decodeToken(DecentralizedAccessToken)[1]; | ||
const userPublicAddress = claim?.message?.addr; | ||
this.cms.resetChallengeMessage(userPublicAddress); | ||
return this.cms.resetChallengeMessage(userPublicAddress); | ||
} | ||
public invalidateTokenBySignerAddress(userPublicAddress: string): Promise<any> { | ||
public invalidateTokenBySignerAddress(userPublicAddress: string): Promise<boolean> { | ||
return this.cms.resetChallengeMessage(userPublicAddress); | ||
@@ -60,0 +60,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
46208
790
29
1