0.1.3 • Published 5 months ago

@stackso/core v0.1.3

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

@stackso/core

@stackso/core provides a wrapper for the Stack API.

Install packages

pnpm i @stackso/core

Usage

Set environment variables:

STACK_API_KEY=<stack api key>

Usage

import { StackApiClient } from '@stackso/core'

const api = new StackApiClient({
  apiKey: process.env.STACK_API_KEY
});

await api.members.signup({
  email,
  password,
  communityLabel
});

Signup via wallet:

import { StackApiClient } from '@stackso/core';
import crypto from "crypto";

const api = new StackApiClient({
  apiKey: process.env.STACK_API_KEY
});

const communityLabel = "community-label";
const loginMessage = await api.messages.members.signupViaWallet({
  communityLabel
});

const signature = sign(loginMessage); // use wagmi or other library to get signed message

// Returns a JWT that can be used in header 
const { token } = await api.members.signupViaWallet({
  displayName,
  walletAddress,
  signature,
  communityLabel
});

Login via wallet:

import { StackApiClient } from '@stackso/core';
import crypto from "crypto";

let walletAddress; // set to the address signing in

const api = new StackApiClient({
  apiKey: process.env.STACK_API_KEY
});

const nonce = crypto.randomUUID();
const loginMessage = await api.messages.auth.loginViaWallet({
  nonce,
  walletAddress,
});

const signature = sign(loginMessage); // use wagmi or other library to get signed message


// Returns a JWT that can be used in header 
const { token } = await api.auth.loginViawWallet({
  walletAddress,
  signature,
  nonce,
});
0.1.3

5 months ago

0.1.1

6 months ago

0.1.0

7 months ago

0.0.4

7 months ago

0.0.3

8 months ago

0.0.1

8 months ago