Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Elrond-Giants/erdjs-auth
https://github.com/Elrond-Giants/erdjs-auth
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/Elrond-Giants/erdjs-auth
- Owner: elrond-giants
- License: mit
- Created: 2022-06-07T11:10:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-20T07:18:42.000Z (5 months ago)
- Last Synced: 2024-09-21T14:05:16.980Z (4 months ago)
- Language: TypeScript
- Size: 214 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-multiversx-dev-resources - erdjs-auth - This library aims to make it easy to authenticate and sign transactions. It offers a common interface for all auth providers. (MultiversX community / SDKs and dev tools)
README
# MultiversX Auth Providers
### Overview
This library aims to make it easy to authenticate and sign transactions on MultiversX network. It offers a common interface
for all auth providers.### Install
```bash
npm install @elrond-giants/erdjs-auth
```### Usage
The library comes with simple provider factories for all providers. You can customize them by extending them, or you can
choose not to use them at all.```typescript
import {ExtensionProviderFactory} from "@elrond-giants/erdjs-auth";const provider = new ExtensionProviderFactory().createProvider();
await provider.init();// you can pass a token to be included in auth signature
const token = "some-token";
await provider.login(token);
```````typescript
const address = provider.getAddress();
const authSignature = provider.getSignature();
```Event listeners can be set for login/logout events.
```typescript
import {WalletConnectProviderFactory} from "@elrond-giants/erdjs-auth";const provider = new WalletConnectProviderFactory({
chainId: "D",
projectId: "yourProjectId"
}).createProvider();provider.on(
"login",
() => {
const {address} = provider.toJson();
console.log(address);
}
);
const initialized = await provider.init();
```If you are using a react-based framework we recommend using the `@elrond-giants/erd-react-hooks` package as it makes the
authentication process even easier.