Constructors

  • Parameters

    • options: Partial<GunDBOptions> = {}

    Returns GunDB

Properties

_authenticating: boolean = false
_collections?: GunCollections
_consensus?: GunConsensus
_rxjs?: GunRxJS
authToken?: string
gun: IGunInstance<any>
onAuthCallbacks: (user: any) => void[] = []
retryConfig: RetryConfig
user: null | IGunUserInstance<any, any, any, any> = null
Errors: __module = GunErrors

Methods

  • Returns void

  • Parameters

    • value: boolean

    Returns void

  • Aggiunge dati allo spazio Frozen utilizzando l'hash del contenuto come chiave Combina content addressing e immutabilità per massima integrità dei dati

    Parameters

    • node: string

      Nome del nodo

    • data: any

      Dati da salvare

    Returns Promise<string>

    Promise che risolve con l'hash generato

  • Adds a new peer to the network

    Parameters

    • peer: string

      URL of the peer to add

    Returns void

  • Aggiunge dati allo spazio Frozen Frozen Space contiene dati che possono essere solo aggiunti, non modificati o rimossi. Utilizza un pattern specifico con ::: per indicare dati immutabili.

    Parameters

    • node: string

      Node name

    • key: string

      Key to store at

    • data: any

      Data to save

    Returns Promise<any>

    Promise resolving to operation result

  • Clears the encryption cache

    Returns void

  • Accesses the Collections module for collection management

    Returns GunCollections

    GunCollections instance

  • Accesses the Consensus module for distributed consensus

    Parameters

    • Optionalconfig: any

      Optional consensus configuration

    Returns GunConsensus

    GunConsensus instance

  • Decrypts data between sender and receiver

    Parameters

    • data: any

      Data to decrypt

    • sender: any

      Sender

    • receiver: any

      Receiver

    Returns Promise<any>

    Promise resolving to decrypted data

  • Decrypts a value

    Parameters

    • value: string

      Value to decrypt

    • epriv: any

      Private key

    Returns Promise<any>

    Promise resolving to decrypted value

  • Encrypts data between sender and receiver

    Parameters

    • data: any

      Data to encrypt

    • sender: any

      Sender

    • receiver: any

      Receiver

    Returns Promise<any>

    Promise resolving to encrypted data

  • Encrypts a value

    Parameters

    • value: any

      Value to encrypt

    • epriv: any

      Private key

    Returns Promise<string>

    Promise resolving to encrypted value

  • Extracts policy from a certificate

    Parameters

    • cert: string

      Certificate

    Returns Promise<any>

    Promise resolving to extracted policy

  • Recupera il suggerimento della password utilizzando le risposte alle domande di sicurezza

    Parameters

    • username: string

      Nome utente

    • securityAnswers: string[]

      Array di risposte alle domande di sicurezza

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

    Promise che risolve con il suggerimento della password

  • Generates multiple certificates

    Parameters

    • options: {
          list: { dot?: string; personal?: boolean; tag: string; users?: string }[];
          pair: any;
      }

      Generation options

    Returns Promise<Record<string, string>>

    Promise resolving to generated certificates

  • Genera un nuovo set di coppie di chiavi

    Returns Promise<any>

    Promise resolving to generated key pair

  • Gets a node at the specified path

    Parameters

    • path: string

      Path to the node

    Returns any

    Gun node

  • Gets the current user

    Returns any

    Current user object or null

  • Ottiene dati dallo spazio Frozen

    Parameters

    • node: string

      Node name

    • key: string

      Key to retrieve

    Returns Promise<any>

    Promise resolving to retrieved data

  • Gets the Gun instance

    Returns IGunInstance<any>

    Gun instance

  • Recupera dati hash-addressable dallo spazio Frozen

    Parameters

    • node: string

      Nome del nodo

    • hash: string

      Hash del contenuto

    • verifyIntegrity: boolean = false

      Se true, verifica che l'hash corrisponda ai dati recuperati

    Returns Promise<any>

    Promise che risolve con i dati recuperati

  • Gets data from public space

    Parameters

    • node: string

      Node name

    • key: string

      Key to retrieve

    Returns Promise<any>

    Promise resolving to retrieved data

  • Generates a short hash

    Parameters

    • text: string

      Text to hash

    • Optionalsalt: string

      Optional salt

    Returns Promise<string>

    Promise resolving to short hash

  • Gets the current user instance

    Returns any

    User instance

  • Gets data from user's space

    Parameters

    • path: string

      Path in user space

    Returns Promise<any>

    Promise resolving to retrieved data

  • Generates a hash for an object

    Parameters

    • obj: any

      Object to hash

    Returns Promise<any>

    Promise resolving to hash and serialized object

  • Generates a hash for text

    Parameters

    • text: string

      Text to hash

    Returns Promise<string>

    Promise resolving to generated hash

  • Returns boolean

  • Checks if a string is a hash

    Parameters

    • str: any

      String to check

    Returns boolean

    True if valid hash

  • Checks if a user is currently logged in

    Returns boolean

    True if logged in

  • Issues a certificate

    Parameters

    • options: { dot?: string; pair: any; personal?: boolean; tag?: string; users?: string }

      Certificate options

    Returns Promise<string>

    Promise resolving to generated certificate

  • Logs in a user

    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

    Returns void

  • 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

  • Parameters

    • node: any

    Returns Promise<any>

  • Removes data at the specified path

    Parameters

    • path: string

      Path to remove

    Returns Promise<any>

    Promise resolving to operation result

  • Creates a typed repository

    Type Parameters

    • T
    • R extends GunRepository<T>

    Parameters

    • collection: string

      Collection name

    • repository: new (gun: GunDB, collection: string, options?: any) => R

      Repository constructor

    • Optionaloptions: any

      Repository options

    Returns R

    Typed repository instance

  • Type Parameters

    • T

    Parameters

    • operation: () => Promise<T>
    • context: string

    Returns Promise<T>

  • Accesses the RxJS module for reactive programming

    Returns GunRxJS

    GunRxJS instance

  • Converts a hash to URL-safe format

    Parameters

    • unsafe: undefined | string

      Hash to convert

    Returns undefined | string

    Safe hash

  • Safely parses JSON

    Parameters

    • input: any

      Input to parse

    • def: {} = {}

      Default value

    Returns any

    Parsed object

  • Parameters

    • node: any
    • data: any

    Returns Promise<any>

  • Saves data to public space

    Parameters

    • node: string

      Node name

    • key: string

      Key to store at

    • data: any

      Data to save

    Returns Promise<any>

    Promise resolving to saved data

  • Saves data to user's space

    Parameters

    • path: string

      Path in user space

    • data: any

      Data to save

    Returns Promise<any>

    Promise resolving to saved data

  • 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

  • Imposta le domande di sicurezza e il suggerimento per la password

    Parameters

    • username: string

      Nome utente

    • password: string

      Password corrente

    • hint: string

      Suggerimento per la password

    • securityQuestions: string[]

      Array di domande di sicurezza

    • securityAnswers: string[]

      Array di risposte alle domande di sicurezza

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

    Promise che risolve con il risultato dell'operazione

  • Signs data

    Parameters

    • data: any

      Data to sign

    • pair: { priv: string; pub: string }

      Key pair

    Returns Promise<string>

    Promise resolving to signed data

  • Signs up a new user

    Parameters

    • username: string

      Username

    • password: string

      Password

    Returns Promise<any>

    Promise resolving to signup result

  • Returns void

  • Converts a safe hash back to original format

    Parameters

    • safe: undefined | string

      Safe hash

    Returns undefined | string

    Original hash

  • Unsets a node at the specified path

    Parameters

    • path: string

      Path to unset

    • node: any

      Node to unset

    Returns Promise<any>

    Promise resolving to operation result

  • Verifies signed data

    Parameters

    • signed: string

      Signed data

    • pub: string | { pub: string }

      Public key

    Returns Promise<any>

    Promise resolving to verified data

  • Verifies a certificate

    Parameters

    • cert: string

      Certificate to verify

    • pub: string | { pub: string }

      Public key

    Returns Promise<any>

    Promise resolving to verification result

  • Creates a new GunDB instance with specified peers

    Parameters

    • peers: string[] = CONFIG.PEERS

      Array of peer URLs to connect to

    Returns GunDB

    New GunDB instance