🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@pakt/sdk

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pakt/sdk

Pakt Official SDK for AI and Developer Integration to the API of Prompt-to-Build businesses

latest
Source
npmnpm
Version
0.1.55-beta
Version published
Maintainers
4
Created
Source

Alt PAKT

PAKT SDK

PAKT SDK is a comprehensive software development kit for building applications on the PAKT Operating System. It provides a complete suite of tools for project collaboration, blockchain payments, user management, and more.collaboration, blockchain payments, user management, and more.

Installation

To install PAKT SDK, simply

npm install pakt-sdk
# OR
yarn add pakt-sdk
# OR
pnpm add pakt-sdk

Quick Start

import { PaktSDK } from "pakt-sdk";

const sdk = await PaktSDK.init({
  baseUrl: "https://api.pakt.world", // Required: API base URL
  verbose: true, // Optional: Enable detailed logging
  testnet: false, // Optional: Use testnet environment
});

// Now you can use all SDK features
const loginResponse = await sdk.auth.login({
  email: "user@example.com",
  password: "yourpassword",
});

Table of Contents

Authentication

The authentication module provides complete user registration, login, password management, and OAuth integration.

Login

import { LoginPayload } from "pakt-sdk";

const loginData: LoginPayload = {
  email: "user@example.com",
  password: "yourpassword",
};

const sdkInit = await PaktSDK.init(configData);
const response = await sdk.auth.login(loginData);

if (response.status === "success") {
  console.log("Logged in successfully");
  console.log("User data:", response.data);
  // Token is automatically stored for subsequent requests
}

Login With TwoFA

import { LoginTwoFAPayload } from "pakt-sdk";

const loginData: LoginTwoFAPayload = {
  code: "123456",
  tempToken:
    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1OWJlYTQRmZWQ4IiwiaWF0IjoxNzA0Nzg3MjkwLCJleHAiOjE3Nzc4NjAwMzB9.cPkZ-",
};

const sdkInit = await PaktSDK.init(configData);
const response = await sdk.auth.loginTwoFa(loginData);

if (response.status === "success") {
  console.log("Logged in successfully");
  console.log("User data:", response.data);
  // Token is automatically stored for subsequent requests
}

Registration

import { RegisterPayload } from "pakt-sdk";

const registrationData: RegisterPayload = {
  firstName: "John",
  lastName: "Doe",
  email: "john@example.com",
  password: "securepassword",
  confirmPassword: "securepassword",
  referral: "optional-referral-code", // Optional
  type: "talent", // Optional: "talent" or "business"
};

const sdkInit = await PaktSDK.init(configData);

const response = await sdk.auth.register(registrationData);

if (response.status === "success") {
  // Registration successful, but account needs verification
  console.log("Registration successful, check email for verification");
}

Account Verification

After registration, users need to verify their account:

const verificationResponse = await sdk.auth.verifyAccount({
  tempToken: "token-from-registration",
  token: "verification-token-from-email",
});

if (verificationResponse.status === "success") {
  console.log("Account verified successfully");
  // User is now fully authenticated
}

Password Management

Reset Password

// Send password reset email
await sdk.auth.resetPassword({
  email: "user@example.com",
});

// Change password with reset token
await sdk.auth.changePassword({
  token: "reset-token-from-email",
  tempToken: "temp-token",
  password: "newpassword",
});

Resend Reset Password

If the initial password reset email is not received, you can resend it:

import { ResetPasswordPayload, ResponseDto, ResetDto } from "pakt-sdk";

const resendData: ResetPasswordPayload = {
  email: "user@example.com",
};

const response: ResponseDto<ResetDto> = await sdk.auth.resendResetPassword(resendData);

if (response.status === "success") {
  console.log("Reset password email resent successfully");
  console.log("Temp token:", response.data.tempToken.token);
  console.log("Token type:", response.data.tempToken.token_type);
  console.log("Expires in:", response.data.tempToken.expiresIn);
}

Google OAuth Integration

// Step 1: Generate OAuth URL
const oauthResponse = await sdk.auth.googleOAuthGenerateState();
const { googleAuthUrl, state } = oauthResponse.data;

// Redirect user to googleAuthUrl

// Step 2: Validate OAuth callback
const validationResponse = await sdk.auth.googleOAuthValidateState({
  state: "state-from-step-1",
  code: "authorization-code-from-callback",
});

if (validationResponse.data.type === "sign_up") {
  // New user registered via Google
} else {
  // Existing user signed in
}

Referral Validation

const referralResponse = await sdk.auth.validateReferral("referral-token");

if (referralResponse.data.valid) {
  console.log(`Valid referral from user ${referralResponse.data.userId}`);
  console.log(
    `Referral counts: ${referralResponse.data.referralCounts}/${referralResponse.data.totalAllowedReferrals}`,
  );
}

Account Management

Example

Get Current User Profile

const userProfile = await sdk.account.getUser();
console.log("Current user:", userProfile.data);

Update User Profile

import { UpdateUserDto } from "pakt-sdk";

const profileUpdate: UpdateUserDto = {
  profile: {
    contact: {
      city: "New York",
      state: "NY",
      country: "USA",
      phone: "+1234567890",
    },
    bio: {
      title: "Full-Stack Developer",
      description: "Experienced developer with expertise in React and Node.js",
    },
    talent: {
      availability: "available", // "available" | "busy" | "working"
      tags: ["React", "Node.js", "TypeScript"],
      tagsIds: ["tag-id-1", "tag-id-2"],
      tagsCategory: "development",
      about: "I love building scalable web applications",
    },
    socials: {
      github: "https://github.com/username",
      linkedin: "https://linkedin.com/in/username",
      twitter: "https://twitter.com/username",
    },
  },
  isPrivate: false,
};

const response = await sdk.account.updateAccount(profileUpdate);

User Onboarding

Complete the initial onboarding process:

import { UserOnboardDto } from "pakt-sdk";

const onboardingData: UserOnboardDto = {
  profile: {
    bio: {
      title: "Software Developer",
      description: "Building amazing applications",
    },
    talent: {
      availability: "available",
      tags: ["JavaScript", "React"],
      tagsCategory: "development",
    },
  },
};

await sdk.account.onboardEndpoint(onboardingData);

Two-Factor Authentication (2FA)

Setup 2FA

// Initiate 2FA setup
const twoFAResponse = await sdk.account.initate2FA({
  type: "google_auth", // or "email"
  password: "current-password",
});

// For Google Authenticator, use the provided QR code
console.log("QR Code:", twoFAResponse.data.qrCode);

// Activate 2FA with verification code
await sdk.account.activate2FA({
  code: "123456", // Code from authenticator app
  type: "google_auth",
});

Use 2FA for Login

// When 2FA is enabled, use email 2FA
await sdk.account.sendEmailTwoFA({
  type: "email",
  tempToken: "temp-token-from-login",
});
```

### User Search and Discovery

````typescript
import { FilterUserDto } from "pakt-sdk";

const searchFilters: FilterUserDto = {
  tags: ["React", "Node.js"],
  type: "talent",
  scoreRange: { min: 80, max: 100 },
  limit: 20,
  offset: 0,
};

const users = await sdk.account.getUsers(searchFilters);

Collections (Projects)

Collections are the core entity representing projects, jobs, or collaborative work in the PAKT ecosystem.

Create a Collection

import { CreateCollectionDto } from "pakt-sdk";

const newCollection: CreateCollectionDto = {
  name: "E-commerce Website Development",
  description: "Build a modern e-commerce platform",
  collectionType: "development-project",
  isPrivate: false,
  deliveryDate: new Date("2024-12-31"),
  tags: ["React", "Node.js", "E-commerce"],
  maxParticipants: 3,
  budget: {
    amount: 5000,
    currency: "USD",
  },
};

const collection = await sdk.collection.create(newCollection);
console.log("Collection created:", collection.data._id);

Get Collections

// Get all collections with filters
const collections = await sdk.collection.getAll({
  status: "ongoing",
  limit: 10,
  offset: 0,
});

// Get specific collection
const collection = await sdk.collection.getById("collectionId");

Update Collection

import { UpdateCollectionDto } from "pakt-sdk";

const updates: UpdateCollectionDto = {
  description: "Updated project description",
  status: "ongoing",
  deliveryDate: new Date("2024-12-31"),
};

await sdk.collection.updateCollection("collection-id", updates);
```

### Collection Types

````typescript
// Get all available collection types
const types = await sdk.collection.getTypes();

// Get specific collection type
const type = await sdk.collection.getACollectionType("_id");

Bulk Operations

// Create multiple collections
const collectionsData = [
  /* array of CreateCollectionDto */
];
await sdk.collection.createMany(collectionsData);

// Update multiple collections
const updates = [
  /* array of updates with IDs */
];
await sdk.collection.updateManyCollections(updates);

Collection Schema

Collection schemas define the structure and fields for custom data models in your collections. They allow you to create typed, validated data structures with field definitions.

Get All Collection Schemas

import { filterCollectionSchemaDto } from "pakt-sdk";

const filters: filterCollectionSchemaDto = {
  page: "1",
  limit: "20",
  name: "user-profile", // Optional: filter by schema name
};

const schemas = await sdk.collectionSchema.getAll("your-auth-token", filters);

schemas.data.data.forEach((schema) => {
  console.log(`Schema: ${schema.name}`);
  console.log(`Reference: ${schema.reference}`);
  console.log(`Description: ${schema.description}`);
  console.log(`Fields: ${schema.schema.length}`);
});

Get Collection Schema by ID

const schema = await sdk.collectionSchema.getById("your-auth-token", "schema-id");

if (schema.status === "success") {
  console.log("Schema name:", schema.data.name);
  console.log("Schema reference:", schema.data.reference);
  console.log("Field definitions:", schema.data.schema);
}

Create Collection Schema

import { CreateCollectionSchemaDto, FieldDefinitionDto } from "pakt-sdk";

// Define field structure
const fields: FieldDefinitionDto[] = [
  {
    name: "email",
    type: "string",
    required: true,
    unique: true,
    default: "",
  },
  {
    name: "fullName",
    type: "string",
    required: true,
    unique: false,
    default: "",
  },
  {
    name: "age",
    type: "number",
    required: false,
    unique: false,
    default: "0",
  },
  {
    name: "isActive",
    type: "boolean",
    required: false,
    unique: false,
    default: "true",
  },
];

const newSchema: CreateCollectionSchemaDto = {
  name: "User Profile Schema",
  description: "Schema for storing user profile information",
  schema: fields,
};

const createdSchema = await sdk.collectionSchema.create(newSchema);

if (createdSchema.status === "success") {
  console.log("Schema created with reference:", createdSchema.data.reference);
  console.log("Schema ID:", createdSchema.data._id);
}

Update Collection Schema

import { UpdateCollectionSchemaDto, FieldDefinitionDto } from "pakt-sdk";

const updatedFields: FieldDefinitionDto[] = [
  {
    name: "email",
    type: "string",
    required: true,
    unique: true,
    default: "",
  },
  {
    name: "fullName",
    type: "string",
    required: true,
    unique: false,
    default: "",
  },
  {
    name: "phoneNumber",
    type: "string",
    required: false,
    unique: false,
    default: "",
  },
];

const schemaUpdate: UpdateCollectionSchemaDto = {
  description: "Updated user profile schema with phone number",
  schema: updatedFields,
};

await sdk.collectionSchema.update("schema-id", schemaUpdate);

Delete Collection Schema

const deleteResponse = await sdk.collectionSchema.delete("schema-id");

if (deleteResponse.status === "success") {
  console.log("Schema deleted successfully");
}

Field Definition Types

Collection schemas support various field types:

  • string: Text data
  • number: Numeric values
  • boolean: True/false values
  • date: Date and time values
  • array: Lists of values
  • object: Nested object structures

Each field can be configured with:

  • name: Field identifier
  • type: Data type
  • required: Whether the field is mandatory
  • unique: Whether values must be unique across documents
  • default: Default value if not provided

Collection Store

Collection stores manage actual data instances based on collection schemas. They provide a flexible, schema-based data storage system.

Get All Store Items

import { filterCollectionStoreDto } from "pakt-sdk";

const schemaReference = "user-profile"; // Reference from schema

const filters: filterCollectionStoreDto = {
  page: "1",
  limit: "20",
  // Add any custom filters based on your schema fields
  isActive: true,
};

const items = await sdk.collectionStore.getAll("your-auth-token", schemaReference, filters);

console.log(`Total items: ${items.data.total}`);
console.log(`Current page: ${items.data.page}`);
console.log(`Total pages: ${items.data.pages}`);

items.data.data.forEach((item) => {
  console.log("Item ID:", item._id);
  // Access custom fields based on your schema
  console.log("Custom data:", item);
});

Get Store Item by ID

const schemaReference = "user-profile";
const itemId = "item-id";

const item = await sdk.collectionStore.getById("your-auth-token", schemaReference, itemId);

if (item.status === "success") {
  console.log("Item found:", item.data);
  console.log("Created at:", item.data.createdAt);
  console.log("Updated at:", item.data.updatedAt);
}

Get Item Count

import { filterCollectionStoreDto } from "pakt-sdk";

const schemaReference = "user-profile";

const filters: filterCollectionStoreDto = {
  isActive: true, // Custom filter based on schema
};

const count = await sdk.collectionStore.getCount("your-auth-token", schemaReference, filters);

if (count.status === "success") {
  console.log(`Total matching items: ${count.data}`);
}

Create Store Item

import { CreateCollectionStoreDto } from "pakt-sdk";

const schemaReference = "user-profile";

// Create data matching your schema structure
const newItem: CreateCollectionStoreDto = {
  email: "john.doe@example.com",
  fullName: "John Doe",
  age: 30,
  isActive: true,
  // Add any additional fields defined in your schema
};

const createdItem = await sdk.collectionStore.create("your-auth-token", schemaReference, newItem);

if (createdItem.status === "success") {
  console.log("Item created with ID:", createdItem.data._id);
  console.log("Item data:", createdItem.data);
}

Update Store Item

import { UpdateCollectionStoreDto } from "pakt-sdk";

const schemaReference = "user-profile";
const itemId = "item-id";

const updates: UpdateCollectionStoreDto = {
  age: 31,
  phoneNumber: "+1234567890",
  // Update any fields from your schema
};

const updatedItem = await sdk.collectionStore.update("your-auth-token", schemaReference, itemId, updates);

if (updatedItem.status === "success") {
  console.log("Item updated:", updatedItem.data);
}

Delete Store Item

const schemaReference = "user-profile";
const itemId = "item-id";

const deleteResponse = await sdk.collectionStore.delete("your-auth-token", schemaReference, itemId);

if (deleteResponse.status === "success") {
  console.log("Item deleted successfully");
}

Complete Example: Schema + Store

Here's a complete workflow showing how to create a schema and manage data:

// Step 1: Create a schema
const userSchema = await sdk.collectionSchema.create({
  name: "User Profiles",
  description: "Store user profile information",
  schema: [
    { name: "email", type: "string", required: true, unique: true, default: "" },
    { name: "displayName", type: "string", required: true, unique: false, default: "" },
    { name: "bio", type: "string", required: false, unique: false, default: "" },
    { name: "verified", type: "boolean", required: false, unique: false, default: "false" },
  ],
});

const schemaRef = userSchema.data.reference;

// Step 2: Create items in the store
const user1 = await sdk.collectionStore.create("auth-token", schemaRef, {
  email: "alice@example.com",
  displayName: "Alice Smith",
  bio: "Software developer",
  verified: true,
});

const user2 = await sdk.collectionStore.create("auth-token", schemaRef, {
  email: "bob@example.com",
  displayName: "Bob Jones",
  bio: "Product manager",
  verified: false,
});

// Step 3: Query the store
const allUsers = await sdk.collectionStore.getAll("auth-token", schemaRef, {
  limit: "10",
});

// Step 4: Update an item
await sdk.collectionStore.update("auth-token", schemaRef, user2.data._id, {
  verified: true,
});

// Step 5: Get count
const verifiedCount = await sdk.collectionStore.getCount("auth-token", schemaRef, {
  verified: true,
});

console.log(`Verified users: ${verifiedCount.data}`);

Wallet & Payments

Comprehensive blockchain-based payment system with multi-cryptocurrency support.

Wallet Management

// Get all user wallets
const wallets = await sdk.wallet.getWallets();

wallets.data.forEach((wallet) => {
  console.log(`${wallet.coin.toUpperCase()}: $${wallet.balance.spendable} available`);
  console.log(`Locked: $${wallet.balance.locked}`);
});

// Get specific wallet by cryptocurrency
const usdcWallet = await sdk.wallet.getSingleWalletByCoin("usdc");
const avaxWallet = await sdk.wallet.getSingleWalletByCoin("avax");

Payment Processing

import { ICreatePaymentDto } from "pakt-sdk";

// Create payment order
const paymentOrder: ICreatePaymentDto = {
  coin: "usdc", // or "avax"
  collectionId: "collectionId",
};

const payment = await sdk.payment.create(paymentOrder);

if (payment.status === "success") {
  console.log("Payment order created");
  console.log("Amount to pay:", payment.data.amount);
  console.log("Blockchain address:", payment.data.address);
  console.log("Required confirmations:", payment.data.confirmation);
}

Payment Validation & Release

// Validate payment transaction
const validation = await sdk.payment.validate({
  paymentId: "payment-id",
  transactionHash: "blockchain-tx-hash",
});

// Release escrowed payment (for collection completion)
await sdk.payment.release({
  collectionId: "collectionId",
  recipientId: "user-id",
});

Transaction History

// Get all transactions
const transactions = await sdk.wallet.getTransactions({
  limit: 50,
  offset: 0,
  type: "sent", // Optional: filter by transaction type
});

// Get specific transaction
const transaction = await sdk.wallet.getATransaction("transaction-id");

// Get transaction statistics
const stats = await sdk.wallet.getTransactionStats("usdc");
console.log("Total sent:", stats.data.totalSent);
console.log("Total received:", stats.data.totalReceived);

Cryptocurrency Exchange Rates

// Get current exchange rates
const exchange = await sdk.wallet.getExchange();

console.log("USDC to USD:", exchange.data.usdc.usd);
console.log("AVAX to USD:", exchange.data.avax.usd);

Withdrawals

import { CreateWithdrawal } from "pakt-sdk";

const withdrawalRequest: CreateWithdrawal = {
  coin: "usdc",
  amount: 100.5,
  address: "0x742d35Cc6634C0532925a3b8D6cf1C4394c64DF8",
  password: "account-password",
};

const withdrawal = await sdk.withdrawal.createWithdrawal(withdrawalRequest);

// Check withdrawal status
const withdrawals = await sdk.withdrawal.fetchWithdrawal({
  limit: 10,
  offset: 0,
});

Direct Deposits

Direct deposits allow for streamlined collection funding and validation without going through the traditional escrow process.

Create Direct Deposit

import { ICreateDirectDepositPayload } from "pakt-sdk";

const directDepositData: ICreateDirectDepositPayload = {
  collectionType: "development-project",
  amount: 1000,
  coin: "usdc", // or "avax"
  name: "Project Direct Funding",
  description: "Direct deposit for project completion",
  owner: "user-id",
  systemDeposit: true,
};

const directDeposit = await sdk.directDeposit.createDirectDeposit({
  authToken: "your-auth-token",
  payload: directDepositData,
});

if (directDeposit.status === "success") {
  console.log("Direct deposit created");
  console.log("Collection ID:", directDeposit.data.collectionId);
  console.log("Payment address:", directDeposit.data.address);
  console.log("Amount to pay:", directDeposit.data.amountToPay);
  console.log("Expected fee:", directDeposit.data.expectedFee);
  console.log("Chain ID:", directDeposit.data.chainId);
}

Validate Direct Deposit

import { IValidateDirectDepositPayload } from "pakt-sdk";

const validationData: IValidateDirectDepositPayload = {
  collection: "collection-id",
  method: "blockchain", // validation method
  status: "completed", // deposit status
  owner: "owner-user-id",
  meta: {
    transactionHash: "0x...",
    blockNumber: 123456,
  },
  release: true, // whether to release funds immediately
};

const validation = await sdk.directDeposit.validateDirectDeposit({
  authToken: "your-auth-token",
  payload: validationData,
});

if (validation.status === "success") {
  console.log("Direct deposit validated");
  console.log("Collection updated:", validation.data);
}

Get Payment Methods

// Get available blockchain payment methods for direct deposits
const paymentMethods = await sdk.directDeposit.fetchPaymentMethods("your-auth-token");

paymentMethods.data.forEach((coin) => {
  console.log(`${coin.name} (${coin.symbol})`);
  console.log(`Contract: ${coin.contractAddress}`);
  console.log(`Chain ID: ${coin.rpcChainId}`);
  console.log(`Active: ${coin.active}`);
});

Get Active RPC Configuration

// Get current blockchain RPC server configuration
const rpcConfig = await sdk.directDeposit.fetchActiveRPC("your-auth-token");

if (rpcConfig.status === "success") {
  console.log("RPC Name:", rpcConfig.data.rpcName);
  console.log("Chain ID:", rpcConfig.data.rpcChainId);
  console.log("RPC URLs:", rpcConfig.data.rpcUrls);
  console.log("Block Explorer:", rpcConfig.data.blockExplorerUrls);
  console.log("Native Currency:", rpcConfig.data.rpcNativeCurrency);
}

Direct Deposit vs Regular Payment

Direct deposits offer several advantages over regular escrow payments:

  • Faster Processing: No escrow holding period
  • Lower Fees: Reduced transaction costs
  • Immediate Release: Funds can be released immediately upon validation
  • Simplified Workflow: Direct collection funding without complex escrow management

Use direct deposits when:

  • You have established trust with the collection owner
  • The project requires immediate funding
  • You want to minimize transaction fees and complexity

Communication

Invitations

Send and manage project collaboration invites:

import { SendInviteDto } from "pakt-sdk";

// Send invite
const inviteData: SendInviteDto = {
  receiverId: "user-id",
  collectionId: "project-id",
};

const invite = await sdk.invite.sendInvite(inviteData);

// Manage invites
await sdk.invite.acceptInvite("invite-id");
await sdk.invite.declineInvite("invite-id");
await sdk.invite.cancelInvite("invite-id");

// Get all invites
const invites = await sdk.invite.getAll({
  status: "pending",
  limit: 10,
});

Chat System

// Get user messages/conversations
const messages = await sdk.chat.getUserMessages({
  limit: 50,
  offset: 0,
});

messages.data.forEach((conversation) => {
  console.log("Conversation with:", conversation.recipients);
  conversation.messages.forEach((message) => {
    console.log(`${message.sender}: ${message.content}`);
  });
});

Notifications

// Get all notifications
const notifications = await sdk.notifications.getAll({
  limit: 20,
  offset: 0,
});

// Mark notifications as read
await sdk.notifications.markAll(); // Mark all as read
await sdk.notifications.markOneAsRead("notification-id"); // Mark specific notification

Activity Feeds

import { CreateFeedDto } from "pakt-sdk";

// Create feed entry
const feedEntry: CreateFeedDto = {
  type: "COLLECTION_CREATED",
  title: "New Project Created",
  description: "Started working on e-commerce platform",
  isPublic: true,
  data: "collectionId",
};

await sdk.feed.create(feedEntry);

// Get activity feeds
const feeds = await sdk.feed.getAll({
  limit: 10,
  isPublic: true,
});

// Dismiss feeds
await sdk.feed.dismissAFeed("feed-id");
await sdk.feed.dismissAllFeeds();

File Management

File Upload

import { CreateFileUpload } from "pakt-sdk";

const fileData: CreateFileUpload = {
  file: fileBuffer, // or file data
  fileName: "document.pdf",
  fileType: "application/pdf",
};

const upload = await sdk.file.fileUpload(fileData);
console.log("File uploaded:", upload.data.url);

File Management

// Get all uploaded files
const files = await sdk.file.getFileUploads({
  limit: 20,
  offset: 0,
});

// Get specific file
const file = await sdk.file.getAFileUpload("file-id");

User Verification

Complete identity verification system using third-party verification services.

Start Verification Session

import { ICreateSessionPayload } from "pakt-sdk";

const verificationData: ICreateSessionPayload = {
  firstName: "John",
  lastName: "Doe",
  dateOfBirth: "1990-01-01",
  address: {
    street: "123 Main St",
    city: "New York",
    state: "NY",
    postalCode: "10001",
    country: "US",
  },
  documentType: "passport", // or "driving_license", "national_id"
  documentCountry: "US",
};

const session = await sdk.userVerification.createSession(verificationData);
console.log("Verification session created:", session.data.sessionId);

Upload Verification Documents

import { ISendSessionMedia } from "pakt-sdk";

// Upload document photo
const documentMedia: ISendSessionMedia = {
  sessionId: "session-id",
  mediaType: "document",
  file: documentImageBuffer,
};

await sdk.userVerification.sendSessionMedia(documentMedia);

// Upload face photo for verification
const faceMedia: ISendSessionMedia = {
  sessionId: "session-id",
  mediaType: "face",
  file: facePhotoBuffer,
};

await sdk.userVerification.sendSessionMedia(faceMedia);

Check Verification Status

// Get verification attempts
const attempts = await sdk.userVerification.getSessionAttempts({
  limit: 10,
  offset: 0,
});

// Get user verification status
const verifications = await sdk.userVerification.getUserVerifications({
  limit: 5,
  offset: 0,
});

verifications.data.forEach((verification) => {
  console.log("Status:", verification.status);
  console.log("Provider:", verification.provider);
  console.log("Document verified:", verification.documentVerified);
  console.log("Face verified:", verification.faceVerified);
});

Bookmarks

import { createBookMarkDto } from "pakt-sdk";

// Create bookmark
const bookmark: createBookMarkDto = {
  data: "collectionId", // or feed-id, user-id, invite-id
  type: "collection", // or "feed", "user", "invite"
};

await sdk.bookmark.create(bookmark);

// Get bookmarks
const bookmarks = await sdk.bookmark.getAll({
  type: "collection",
  limit: 10,
});

// Delete bookmark
await sdk.bookmark.delete("bookmark-id");

Reviews & Ratings

import { AddReviewDto } from "pakt-sdk";

// Add review for completed collection
const reviewData: AddReviewDto = {
  collectionId: "collection-id",
  receiverId: "user-id",
  rating: 5, // 1-5 scale
  text: "Excellent work, highly recommended!",
};

await sdk.review.addReview(reviewData);

// Get reviews
const reviews = await sdk.review.viewAll({
  collectionId: "collection-id",
  limit: 10,
});

Additional Features

Connection Filtering

import { CreateConnectionFilterDto } from "pakt-sdk";

// Create automatic connection filter
const filter: CreateConnectionFilterDto = {
  event: "CREATE_CONVERSATION",
  key: "afroScore",
  value: "80",
  decider: "greater_than", // Only connect with users having score > 80
};

await sdk.connectionFilter.create(filter);

// Get user's connection filters
const filters = await sdk.connectionFilter.getForAUser("user-id");

Error Handling

All SDK methods return a consistent response format:

interface ResponseDto<T> {
  status: "success" | "error";
  message: string;
  data: T;
  statusCode?: number;
  code?: number;
}

// Example error handling
try {
  const response = await sdk.auth.login(loginData);

  if (response.status === "error") {
    console.error("Login failed:", response.message);
    return;
  }

  // Success - use response.data
  console.log("User:", response.data);
} catch (error) {
  console.error("Network or unexpected error:", error);
}

TypeScript Support

The SDK is built with TypeScript and provides comprehensive type definitions:

import { PaktSDK, LoginPayload, RegisterPayload, CreateCollectionDto, IUser, IWalletDto, ResponseDto } from "pakt-sdk";

// All interfaces and types are available for import
const loginPayload: LoginPayload = {
  email: "user@example.com",
  password: "password",
};

const response: ResponseDto<LoginDto> = await sdk.auth.login(loginPayload);

Configuration Options

interface PaktConfig {
  baseUrl: string; // Required: API base URL
  testnet?: boolean; // Optional: Use testnet environment (default: false)
  verbose?: boolean; // Optional: Enable detailed logging (default: false)
}

const sdk = await PaktSDK.init({
  baseUrl: "https://api.pakt.world",
  testnet: false,
  verbose: true,
});

License

BSD-3-Clause © PAKT

Keywords

pakt

FAQs

Package last updated on 30 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts