Skip to content

Commit

Permalink
Hadi/sdk docs (#9)
Browse files Browse the repository at this point in the history
* fix: origin in create-justaname-app

* fix: yarn lock

* feat: api docs for sdk

* feat: sdk docs

* feat: core sdk

* feat: docs latest changes
  • Loading branch information
HadiKhai authored Mar 27, 2024
1 parent 953eb28 commit 83a8338
Show file tree
Hide file tree
Showing 83 changed files with 540 additions and 384 deletions.
2 changes: 1 addition & 1 deletion docs/docs/api-reference/sidebar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions docs/docs/api-reference/title.info.mdx

This file was deleted.

3 changes: 3 additions & 0 deletions docs/docs/sdk/core/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
label: "Core SDK"
position: 2
collapsed: false
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const configuration = {

#### Defined in

[lib/justaname/index.ts:40](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L40)
[lib/justaname/index.ts:40](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L40)

## Properties

Expand All @@ -61,7 +61,7 @@ const configuration = {

#### Defined in

[lib/justaname/index.ts:30](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L30)
[lib/justaname/index.ts:30](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L30)

___

Expand All @@ -77,7 +77,7 @@ JustaName

#### Defined in

[lib/justaname/index.ts:38](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L38)
[lib/justaname/index.ts:38](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L38)

## Methods

Expand Down Expand Up @@ -105,7 +105,7 @@ Checks if the API key is present.

#### Defined in

[lib/justaname/index.ts:73](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L73)
[lib/justaname/index.ts:73](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L73)

___

Expand Down Expand Up @@ -137,7 +137,7 @@ Checks the health of the API.

#### Defined in

[lib/justaname/index.ts:87](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L87)
[lib/justaname/index.ts:87](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L87)

___

Expand Down Expand Up @@ -167,4 +167,4 @@ Initializes the JustaName SDK.

#### Defined in

[lib/justaname/index.ts:56](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L56)
[lib/justaname/index.ts:56](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/justaname/index.ts#L56)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Sends a request to initiate a challenge.

#### Defined in

[lib/features/siwe/index.ts:19](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/siwe/index.ts#L19)
[lib/features/siwe/index.ts:19](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/siwe/index.ts#L19)

___

Expand All @@ -62,4 +62,4 @@ Sends a request to verify a specific address using SIWE.

#### Defined in

[lib/features/siwe/index.ts:32](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/siwe/index.ts#L32)
[lib/features/siwe/index.ts:32](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/siwe/index.ts#L32)
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const configuration = {

#### Defined in

[lib/features/subnames/index.ts:30](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L30)
[lib/features/subnames/index.ts:30](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L30)

## Properties

Expand All @@ -59,7 +59,7 @@ const configuration = {

#### Defined in

[lib/features/subnames/index.ts:28](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L28)
[lib/features/subnames/index.ts:28](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L28)

## Methods

Expand All @@ -80,7 +80,7 @@ const configuration = {

#### Defined in

[lib/features/subnames/index.ts:60](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L60)
[lib/features/subnames/index.ts:60](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L60)

___

Expand All @@ -100,7 +100,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:146](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L146)
[lib/features/subnames/index.ts:146](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L146)

___

Expand All @@ -121,7 +121,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:34](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L34)
[lib/features/subnames/index.ts:34](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L34)

___

Expand All @@ -141,7 +141,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:128](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L128)
[lib/features/subnames/index.ts:128](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L128)

___

Expand All @@ -161,7 +161,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:110](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L110)
[lib/features/subnames/index.ts:110](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L110)

___

Expand All @@ -181,7 +181,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:119](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L119)
[lib/features/subnames/index.ts:119](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L119)

___

Expand All @@ -201,7 +201,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:137](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L137)
[lib/features/subnames/index.ts:137](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L137)

___

Expand All @@ -227,7 +227,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:156](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L156)
[lib/features/subnames/index.ts:156](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L156)

___

Expand All @@ -247,7 +247,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:48](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L48)
[lib/features/subnames/index.ts:48](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L48)

___

Expand All @@ -268,7 +268,7 @@ ___

#### Defined in

[lib/features/subnames/index.ts:96](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L96)
[lib/features/subnames/index.ts:96](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L96)

___

Expand All @@ -289,4 +289,4 @@ ___

#### Defined in

[lib/features/subnames/index.ts:82](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L82)
[lib/features/subnames/index.ts:82](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/features/subnames/index.ts#L82)
File renamed without changes.
105 changes: 105 additions & 0 deletions docs/docs/sdk/core/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
id: "index"
title: "@justaname.id/sdk"
sidebar_label: "Readme"
sidebar_position: 0
custom_edit_url: null
---

# JustaName Core SDK

The JustaName Core SDK empowers developers to seamlessly integrate robust digital identity and subnaming features into their Web3 applications. It simplifies the complexities of blockchain addresses by enabling the use of human-readable subdomains within the Ethereum Name Service (ENS).

## Key Features
- **User-Friendly Addresses**: Replace unwieldy blockchain addresses with memorable subnames (e.g., 'yourname.eth').
- **Secure Sign-In (SIWE)**: Implement Ethereum-based authentication without centralized systems.
- **Subname Management**: Create, reserve, update, and revoke subdomains with ease.
- **Cross-Chain Compatibility**: Support interactions across various blockchain networks.

## Installation

```bash
npm install @justaname.id/sdk
```

## Configuration

Obtain an API Key and initialize the SDK:

```typescript
import { JustaName } from '@justaname.id/sdk';

async function main() {
const apiKey = 'your-api-key';
const justaName = await JustaName.init({ apiKey });
// Your SDK is now ready to be used!
}

main();
```

## Usage Examples

### SIWE: Request a Secure Sign-In Challenge

```typescript
const requestChallengeResponse = await justaName.siwe.requestChallenge({
chainId: 1,
origin: 'http://localhost:3333',
address: '0x59c44836630760F97b74b569B379ca94c37B93ca',
domain: 'justaname.id',
});
```

### Subnames: Add a New Subname

```typescript
const addedUser = await justaName.subnames.addSubname({
username: 'testuser',
ensDomain: 'justaname.id',
chainId: 1,
});
```

## Error Handling

```typescript
try {
// SDK operations
} catch (error) {
console.error("Error:", error.message);
}
```

## Security

The JustaName SDK prioritizes security and privacy with encrypted communication and responsible data handling practices.

## Get Started!

Explore the full documentation and in-depth examples on the JustaName Developer Portal: [https://docs.justaname.io](https://docs.justaname.io).

## Core Methods

A key functionality aspect of the SDK revolves around its methods. Below is a list of available methods within the JustaName SDK's primary classes:

### `Siwe` Class Methods

- requestChallenge
- verifyChallenge

### `Subnames` Class Methods
- claimSubname
- reserveSubname
- addSubname
- updateSubname
- revokeSubname
- getByDomainNameChainId
- getBySubname
- getAllByAddress
- getInvitations
- checkSubnameAvailable

## Conclusion

For more detailed documentation and additional use cases, please visit [JustaName's Documentation](https://docs.justaname.io).
24 changes: 0 additions & 24 deletions docs/docs/sdk/core/index.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ custom_edit_url: null

#### Defined in

[lib/types/subnames/claim.ts:5](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/claim.ts#L5)
[lib/types/subnames/claim.ts:5](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/claim.ts#L5)

___

Expand All @@ -24,4 +24,4 @@ ___

#### Defined in

[lib/types/subnames/claim.ts:7](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/claim.ts#L7)
[lib/types/subnames/claim.ts:7](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/claim.ts#L7)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ custom_edit_url: null

#### Defined in

[lib/types/subnames/get-by-domain-name-chainId.ts:8](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L8)
[lib/types/subnames/get-by-domain-name-chainId.ts:8](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L8)

___

Expand All @@ -24,7 +24,7 @@ ___

#### Defined in

[lib/types/subnames/get-by-domain-name-chainId.ts:6](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L6)
[lib/types/subnames/get-by-domain-name-chainId.ts:6](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L6)

___

Expand All @@ -34,7 +34,7 @@ ___

#### Defined in

[lib/types/subnames/get-by-domain-name-chainId.ts:10](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L10)
[lib/types/subnames/get-by-domain-name-chainId.ts:10](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L10)

___

Expand All @@ -44,4 +44,4 @@ ___

#### Defined in

[lib/types/subnames/get-by-domain-name-chainId.ts:4](https://github.com/JustaName-id/JustaName-sdk/blob/d3b91b5/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L4)
[lib/types/subnames/get-by-domain-name-chainId.ts:4](https://github.com/JustaName-id/JustaName-sdk/blob/5db266b/packages/@justaname.id/sdk/src/lib/types/subnames/get-by-domain-name-chainId.ts#L4)
Loading

0 comments on commit 83a8338

Please sign in to comment.