Rust SDK for NextID

Components supported

Usage

In Cargo.toml : toml [dependencies] nextid_sdk = "1.0.0-rc1"

ProofService

Find binding records by given platform and identity.

```rust use nextidsdk::{proofservice::Endpoint, types::Result};

[tokio::main]

async fn main() -> Result<()> { let ps = Endpoint::Production; // Or use your own ProofService instance: // let ps = Endpoint::Custom("https://my-proof-service.example.com".to_string());

let avatars = ps.find_by("twitter", "yeiwb", 1).await?; } ```

Submit a ProofChain modification to ProofService server.

Run cargo run --example proof_procedure to play an interactive demo.

See examples/proof_procedure.rs for more info.

KVService

Find KV by given avatar

```rust use nextidsdk::{ types::Result, kvservice::Endpoint, util::crypto::Secp256k1KeyPair };

[tokio::main]

async fn main() -> Result<()> {

let avatar = Secp256k1KeyPair::frompkhex("0x047e55e1b78e873c6f7d585064b41cd2735000bacc0092fe947c11ab7742ed351fef59c4f5d558d14a031bb09e44877f9e61f89993f895eb8fa6cfaafe74f6f55c");

let result = Endpoint::Staging.findbyavatar(&avatar).await?;

Ok(()) } ```

Find KV by given platform / identity pair

```rust use nextidsdk::{ types::Result, kvservice::Endpoint, proof_service::Platform, };

[tokio::main]

async fn main() -> Result<()> {

let result = Endpoint::Staging.findbyplatform_identity(Platform::Twitter, "yeiwb").await?;

Ok(()) } ```

Submit a KV modification to remote KVService server.

Run cargo run --example kv_procedure to play an interactive demo.

See examples/kv_procedure.rs

Toolkits

You may find many useful functions under nextid_sdk::util namespaces.