1.1.1 • Published 10 months ago

llmas-auth v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

llmas-auth

llmas auth is a simple implementation of the standard auth mechanism for authentication of react web applications.

Installing

using Yarn

yarn add llmas-auth

Usage

import { SignButton, Signature, getProvider } from "llmas-auth";

Get provider and connect to wallet

const provider = getProvider();
if (!provider) {
  window.open("https://phantom.app/", "_blank");
}

const resp = await provider.connect();
console.log("Connect", resp.publicKey.toString()); // get the public key

Create and validate the signature

const noneUnit8 = Signature.create(uniqueValue);
const { signature } = await provider.signMessage(noneUnit8);
const serializedSignature = bs58.encode(signature);

const isValidate = await Signature.validate(
  {
    signature: serializedSignature,
    publicKey,
  },
  noneUnit8
);
if (!isValidate) {
  //
}

Example

read tutorial here

1.1.1

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago