Othent
  • 👋Welcome to Othent
  • 🥪JS SDK
    • Getting Started
    • Events
    • Error Handling
    • Binary Data Types Utils
    • TypeScript Types
    • Config Constants
  • 🥪JS SDK API
    • constructor()
    • startTabSynching()
    • completeConnectionAfterRedirect()
    • connect()
    • disconnect()
    • requireAuth()
    • isAuthenticated
    • getActiveAddress()
    • getActivePublicKey()
    • getAllAddresses()
    • getWalletNames()
    • getUserDetails()
    • getSyncActiveAddress()
    • getSyncActivePublicKey()
    • getSyncAllAddresses()
    • getSyncWalletNames()
    • getSyncUserDetails()
    • sign() (transaction)
    • dispatch() (transaction)
    • encrypt()
    • decrypt()
    • signature()
    • signDataItem()
    • signMessage()
    • verifyMessage()
    • privateHash()
    • walletName
    • walletVersion
    • config
    • getArweaveConfig()
    • getPermissions()
  • Demos
    • 🍏SDK playground / demo
    • 🍏SDK playground / demo GitHub
    • 🍎File upload app example
    • 🍎File upload app example GitHub
  • 📚External libraries
    • arweave-js
    • Arweave Wallet Kit
  • Additional Links
    • 🌐Othent.io
    • 🌐Discord
    • 🌐GitHub
    • 🌐X
Powered by GitBook
On this page
  • othent.types.ts
  • Events
  • Dispatch
  • DataItem
  • config.types
  • auth0.types.ts
  • common.types.ts
  • arconnect.types.ts
  • error.ts
  • url.types
  1. JS SDK

TypeScript Types

Othent exported TypeScript types.

PreviousBinary Data Types UtilsNextConfig Constants

Last updated 8 months ago

Events

See .

type OthentEventType = "auth" | "error"
type AuthListener = (
    userDetails: UserDetails | null,
    isAuthenticated: boolean,
) => void;
type ErrorListener = (err: Error | OthentError) => void;

Dispatch

See ;

interface DispatchOptions {
  arweave?: Arweave;
  node?: UrlString;
}
interface ArDriveBundledTransactionResponseData {
  id: string;
  timestamp: number;
  winc: string;
  version: string;
  deadlineHeight: number;
  dataCaches: string[];
  fastFinalityIndexes: string[];
  public: string;
  signature: string;
  owner: string;
}
interface ArDriveBundledTransactionData
  extends ArDriveBundledTransactionResponseData {
  type: "BUNDLED";
}
interface UploadedTransactionData {
  type: "BASE";
  id: string;
  signature: string;
  owner: string;
}

DataItem

type OthentEventType = "auth" | "error";
interface TagData {
  name: string;
  value: string;
}
interface DataItem {
  data: string | Uint8Array;
  target?: string;
  anchor?: string;
  tags?: TagData[];
}
type OthentStorageKey = `othent${string}`;
type Auth0Strategy = "cross-site-cookies" | "refresh-tokens";
type Auth0Cache = "memory" | "localstorage" | ICache;
type Auth0CacheType = "memory" | "localstorage" | "custom";
type Auth0RedirectUri =
  | UrlString
  | `${string}.auth0://${string}/ios/${string}/callback`
  | `${string}.auth0://${string}/android/${string}/callback`;
type Auth0RedirectUriWithParams = `${Auth0RedirectUri}?${string}`;
type Auth0LogInMethod = "popup" | "redirect";
type AutoConnect = "eager" | "lazy" | "off";
interface AppInfo {
  name: string;
  version: string;
  env: string;
  logo?: UrlString;
}
interface OthentConfig { ... } // Listed in constructor()'s docs page.
interface OthentOptions { ... } // Listed in constructor()'s docs page.
type Auth0Provider =
  | `apple`
  | `auth0`
  | `google-oauth2`
  | `<LinkedIn>`
  | `<X>`
  | `<Meta>`
  | `<Twitch>`
  | `github`;
type Auth0Sub = `${Auth0Provider}|(${string})`;
type Auth0ProviderLabel =
  | `Apple`
  | `E-Mail`
  | `Google`
  | `LinkedIn`
  | `X`
  | `Meta`
  | `Twitch`
  | `GitHub`
  | `Unknown Provider`;
type Auth0WalletAddressLabel = `${Auth0ProviderLabel} (${string})`;
type ANSDomain = `${string}.ar`;
type OthentWalletAddressLabel = Auth0WalletAddressLabel | ANSDomain;
export interface UserDetails {
  // Default from Auth0's User:
  sub: Auth0Sub;
  name: string;
  givenName: string;
  middleName: string;
  familyName: string;
  nickname: string;
  preferredUsername: string;
  profile: string;
  picture: string;
  website: string;
  locale: string;
  updatedAt: string;
  email: string;
  emailVerified: boolean;

  // Custom from Auth0's Add User Metadata action:
  owner: B64UrlString;
  walletAddress: B64UrlString;
  walletAddressLabel: OthentWalletAddressLabel;
  authSystem: "KMS";
  authProvider: Auth0Provider;
}

These types are only exported for backwards compatibility with @othent/kms version 1.X.X and to facilitate the migration to version 2 for those that might have stored this BufferObject entity.

interface BufferObject {
  type: "Buffer";
  data: number[];
}
function isBufferObject(obj: any): obj is BufferObject {
  return (
    obj.type === "Buffer" &&
    Array.isArray(obj.data) &&
    typeof obj[0] === "number"
  );
}
type PermissionType =
  | "ACCESS_ADDRESS"
  | "ACCESS_PUBLIC_KEY"
  | "ACCESS_ALL_ADDRESSES"
  | "SIGN_TRANSACTION"
  | "ENCRYPT"
  | "DECRYPT"
  | "SIGNATURE"
  | "ACCESS_ARWEAVE_CONFIG"
  | "DISPATCH";
interface GatewayConfig {
  host: string;
  port: number;
  protocol: "http" | "https";
}
interface SignMessageOptions {
  hashAlgorithm?: "SHA-256" | "SHA-384" | "SHA-512";
}

An enum OthentErrorID and class OthentError (extends Error) are exported from error.ts.

type UrlString = `http://${string}` | `https://${string}`;

See ;

See and .

See .

Note that the DispatchResult, AppInfo and DateItem types defined in are not exported as Othent overrides and extends them.

See .

🥪
othent.types.ts
Events
dispatch()
signDataItem()
config.types
auth0.types.ts
common.types.ts
arconnect.types.ts
arconnect / arconnectio/types
error.ts
Error Handling
url.types
config
constructor()
getUserDetails()