Constructors

  • Parameters

    • gun: IGunInstance<any>
    • appScope: string = "shogun"

    Returns GunInstance

Properties

_rxjs?: GunRxJS
crypto: __module
gun: IGunInstance<any>
node: IGunChain<any, IGunInstance<any>, IGunInstance<any>, string>
onAuthCallbacks: (user: any) => void[] = []
user: null | IGunUserInstance<any, any, any, any> = null
utils: __module
Errors: __module = GunErrors

Methods

  • Returns void

  • Adds a new peer to the network

    Parameters

    • peer: string

      URL of the peer to add

    Returns void

  • Check if a username already exists in the system

    Parameters

    • username: string

      Username to check

    Returns Promise<any>

    Promise resolving to user data if exists, null otherwise

  • Decrypts data with Gun.SEA

    Parameters

    • encryptedData: string

      Encrypted data

    • key: string

      Decryption key

    Returns Promise<any>

    Promise that resolves with the decrypted data

  • Derive cryptographic keys from password and optional extras Supports multiple key derivation algorithms: P-256, secp256k1 (Bitcoin), secp256k1 (Ethereum)

    Parameters

    • password: any

      Password or seed for key derivation

    • Optionalextra: any

      Additional entropy (string or array of strings)

    • Optionaloptions: DeriveOptions

      Derivation options to specify which key types to generate

    Returns Promise<any>

    Promise resolving to derived keys object

  • Derive all supported key types

    Parameters

    • password: any

      Password for key derivation

    • Optionalextra: any

      Additional entropy

    Returns Promise<any>

    Promise resolving to all key types

  • Derive Bitcoin secp256k1 keys with P2PKH address

    Parameters

    • password: any

      Password for key derivation

    • Optionalextra: any

      Additional entropy

    Returns Promise<any>

    Promise resolving to Bitcoin keys and address

  • Derive Ethereum secp256k1 keys with Keccak256 address

    Parameters

    • password: any

      Password for key derivation

    • Optionalextra: any

      Additional entropy

    Returns Promise<any>

    Promise resolving to Ethereum keys and address

  • Derive P-256 keys (default Gun.SEA behavior)

    Parameters

    • password: any

      Password for key derivation

    • Optionalextra: any

      Additional entropy

    Returns Promise<any>

    Promise resolving to P-256 keys

  • Encrypts data with Gun.SEA

    Parameters

    • data: any

      Data to encrypt

    • key: string

      Encryption key

    Returns Promise<string>

    Promise that resolves with the encrypted data

  • Recovers password hint using security question answers

    Parameters

    • username: string

      Username

    • securityAnswers: string[]

      Array of answers to security questions

    Returns Promise<{ error?: string; hint?: string; success: boolean }>

    Promise resolving with the password hint

  • Gets a node at the specified path

    Parameters

    • path: string

      Path to the node

    Returns any

    Gun node

  • Gets the list of all configured peers (connected and disconnected)

    Returns string[]

    Array of peer URLs

  • Gets the list of currently connected peers

    Returns string[]

    Array of peer URLs

  • Gets the current user

    Returns any

    Current user object or null

  • Gets the Gun instance

    Returns IGunInstance<any>

    Gun instance

  • Gets detailed information about all peers

    Returns { [peer: string]: { connected: boolean; status: string } }

    Object with peer information

  • Gets the current user instance

    Returns any

    User instance

  • Gets user data from the specified path

    Parameters

    • path: string

      Path to get the data from (supports nested paths like "test/data/marco")

    Returns Promise<any>

    Promise that resolves with the data

  • Hashes text with Gun.SEA

    Parameters

    • text: string

      Text to hash

    Returns Promise<any>

    Promise that resolves with the hashed text

  • Checks if a user is currently logged in

    Returns boolean

    True if logged in

  • Logs in a user using direct Gun authentication

    Parameters

    • username: string

      Username

    • password: string

      Password

    • Optionalcallback: (result: any) => void

      Optional callback for login result

    Returns Promise<any>

    Promise resolving to login result

  • Logs out the current user using direct Gun authentication

    Returns void

  • Helper method to navigate to a nested path by splitting and chaining .get() calls

    Parameters

    • node: any

      Starting Gun node

    • path: string

      Path string (e.g., "test/data/marco")

    Returns any

    Gun node at the specified path

  • Parameters

    • pub: string

    Returns void

  • Registers an authentication callback

    Parameters

    • callback: (user: any) => void

      Function to call on auth events

    Returns () => void

    Function to unsubscribe the callback

  • Puts data at the specified path

    Parameters

    • path: string

      Path to store data

    • data: any

      Data to store

    Returns Promise<any>

    Promise resolving to operation result

  • Reconnects to a specific peer

    Parameters

    • peer: string

      URL of the peer to reconnect

    Returns void

  • Removes data at the specified path

    Parameters

    • path: string

      Path to remove

    Returns Promise<any>

    Promise resolving to operation result

  • Removes a peer from the network

    Parameters

    • peer: string

      URL of the peer to remove

    Returns void

  • Clears all peers and optionally adds new ones

    Parameters

    • OptionalnewPeers: string[]

      Optional array of new peers to add

    Returns void

  • Attempts to restore user session from local storage

    Returns Promise<{ error?: string; success: boolean; userPub?: string }>

    Promise resolving to session restoration result

  • Returns Promise<void>

  • Accesses the RxJS module for reactive programming

    Returns GunRxJS

    GunRxJS instance

  • Saves user data at the specified path

    Parameters

    • path: string

      Path to save the data (supports nested paths like "test/data/marco")

    • data: any

      Data to save

    Returns Promise<void>

    Promise that resolves when the data is saved

  • Sets data at the specified path

    Parameters

    • path: string

      Path to store data

    • data: any

      Data to store

    Returns Promise<any>

    Promise resolving to operation result

  • Sets up security questions and password hint

    Parameters

    • username: string

      Username

    • password: string

      Current password

    • hint: string

      Password hint

    • securityQuestions: string[]

      Array of security questions

    • securityAnswers: string[]

      Array of answers to security questions

    Returns Promise<{ error?: string; success: boolean }>

    Promise resolving with the operation result

  • Signs up a new user using direct Gun authentication

    Parameters

    • username: string

      Username

    • password: string

      Password

    Returns Promise<any>

    Promise resolving to signup result

  • Returns void