mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-01-30 03:14:25 +01:00
53 lines
954 B
Markdown
53 lines
954 B
Markdown
# Pubky
|
|
|
|
JavaScript implementation of [Pubky](https://github.com/pubky/pubky).
|
|
|
|
## Install
|
|
|
|
```bash
|
|
npm install @synonymdev/pubky
|
|
```
|
|
|
|
## Getting started
|
|
|
|
```js
|
|
import PubkyClient from "@synonymdev/pubky";
|
|
|
|
// Initialize PubkyClient with Pkarr relay(s).
|
|
let client = new PubkyClient();
|
|
|
|
// Generate a keypair
|
|
let keypair = Keypair.random();
|
|
|
|
// Create a new account
|
|
let homeserver = PublicKey.try_from("8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo");
|
|
|
|
await client.signup(keypair, homeserver)
|
|
|
|
// Verify that you are signed in.
|
|
const session = await client.session(publicKey)
|
|
```
|
|
|
|
## Test and Development
|
|
|
|
For test and development, you can run a local homeserver in a test network.
|
|
|
|
If you don't have Cargo Installed, start by installing it:
|
|
|
|
```bash
|
|
curl https://sh.rustup.rs -sSf | sh
|
|
```
|
|
|
|
Clone the Pubky repository:
|
|
|
|
```bash
|
|
git clone https://github.com/pubky/pubky
|
|
cd pubky/pkg
|
|
```
|
|
|
|
Run the local testnet server
|
|
|
|
```bash
|
|
npm run testnet
|
|
```
|