0.2.3 • Published 1 year ago

@publicspace/solana v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Solana Developer Toolkit

GitHub license

Light-weight toolkit for Solana development

Installation

Install @publicspace/solana with npm:

npm install @publicspace/solana

Sign In With Solana

Use Server

Import:

import SIWS from "@publicspace/solana"

Prepare user authentication message:

SIWS.prepare({ domain, address });

Generate user token for 30 minutes:

SIWS.token({ domain, address, statement, signature });

Generate user token with custom expiration:

SIWS.token({ domain, address, statement, signature, expiration });

Verify user certificate:

SIWS.certificate({ token });

Response with HTTP Status Code

Import:

import SIWS, { Utils } from "@publicspace/solana"

Usage on certificate:

const cert = SIWS.certificate({ token: token });

return new Response(Utils.response(cert), {
	headers: { "Content-Type": "application/json" }
});

Generate Address or Verify Message

Use Client

Import:

import Wallet from "@publicspace/solana"

Generate mnemonic:

Wallet.mnemonic();

Generate keypair:

Wallet.keypair();

Generate keypair from mnemonic:

Wallet.keypairFromMnemonic({ mnemonic });

Generate keypair from mnemonic and passphrase:

Wallet.keypairFromMnemonic({ mnemonic, passphrase });

Sign message:

Wallet.sign({ message, privateKey });

Verify message:

Wallet.verify({ message, signature, publicKey });
0.2.3

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.2

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago