Plugin per la gestione delle funzionalità WebAuthn in ShogunCore

Hierarchy (View Summary)

Implements

Constructors

Properties

_category?: PluginCategory

Categoria del plugin

core: null | ShogunCore = null

Riferimento all'istanza di ShogunCore

description: string = "Provides WebAuthn authentication functionality for ShogunCore"

Descrizione opzionale del plugin

name: string = "webauthn"

Nome univoco del plugin - deve essere implementato dalle sottoclassi

signer: null | WebAuthnSigner = null
version: string = "1.0.0"

Versione del plugin - deve essere implementata dalle sottoclassi

webauthn: null | Webauthn = null

Methods

  • Verifica che il plugin sia stato inizializzato prima di usare il core

    Returns ShogunCore

    L'istanza di ShogunCore non null

    Error se il plugin non è stato inizializzato

  • Private

    Assicura che il signer sia inizializzato

    Returns WebAuthnSigner

  • Private

    Assicura che il modulo WebAuthn sia inizializzato

    Returns Webauthn

  • Autentica un utente con WebAuthn

    Parameters

    • username: string

      Nome utente

    • salt: null | string

      Salt per l'autenticazione

    • Optionaloptions: any

      Opzioni per l'operazione

    Returns Promise<CredentialResult>

    Promise con il risultato dell'autenticazione

  • Crea un nuovo account WebAuthn

    Parameters

    • username: string

      Nome utente

    • credentials: null | WebAuthnCredentials

      Credenziali WebAuthn

    • isNewDevice: boolean = false

      Flag che indica se è un nuovo dispositivo

    Returns Promise<CredentialResult>

    Promise con il risultato dell'operazione

  • Parameters

    • credentialId: string

    Returns (data: any) => Promise<AuthenticatorAssertionResponse>

  • Parameters

    • credentialId: string
    • username: string
    • Optionalextra: string[]

    Returns Promise<{ epriv: string; epub: string; priv: string; pub: string }>

  • Creates a Gun user from WebAuthn signing credential This ensures the SAME user is created as with normal approach

    Parameters

    • credentialId: string
    • username: string

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

  • Parameters

    • username: string

    Returns Promise<WebAuthnSigningCredential>

  • Distrugge il plugin e libera le risorse

    Returns void

  • Emits an event with arguments

    Parameters

    • event: EventType
    • Optionaldata: unknown

    Returns boolean

  • Genera credenziali WebAuthn

    Parameters

    • username: string

      Nome utente

    • OptionalexistingCredential: null | WebAuthnCredentials

      Credenziali esistenti (opzionale)

    • isLogin: boolean = false

      Flag che indica se è per login

    Returns Promise<CredentialResult>

    Promise con il risultato dell'operazione

  • Get the Gun user public key for a signing credential

    Parameters

    • credentialId: string

    Returns undefined | string

  • Get the hashed credential ID (for consistency checking)

    Parameters

    • credentialId: string

    Returns undefined | string

  • Parameters

    • credentialId: string

    Returns undefined | WebAuthnSigningCredential

  • Verifica se WebAuthn è supportato nel browser corrente

    Returns boolean

    true se WebAuthn è supportato, false altrimenti

  • Returns WebAuthnSigningCredential[]

  • Login with WebAuthn This is the recommended method for WebAuthn authentication

    Parameters

    • username: string

      Username

    Returns Promise<AuthResult>

    Authentication result

    Authenticates user using WebAuthn credentials. Requires browser support for WebAuthn and existing credentials.

  • Removes an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers a one-time event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Removes all listeners for an event or all events

    Parameters

    • Optionalevent: EventType

    Returns void

  • Rimuove un dispositivo WebAuthn

    Parameters

    • username: string

      Nome utente

    • credentialId: string

      ID della credenziale

    • credentials: WebAuthnCredentials

      Credenziali WebAuthn

    Returns Promise<{ success: boolean; updatedCredentials?: WebAuthnCredentials }>

    Promise con il risultato dell'operazione

  • Parameters

    • credentialId: string

    Returns boolean

  • Complete oneshot workflow that creates the SAME Gun user as normal approach This is the recommended method for oneshot signing with full consistency

    Parameters

    • username: string

    Returns Promise<
        {
            authenticator: (data: any) => Promise<AuthenticatorAssertionResponse>;
            credential: WebAuthnSigningCredential;
            gunUser: { error?: string; success: boolean; userPub?: string };
            hashedCredentialId: string;
            pub: string;
        },
    >

  • Register new user with WebAuthn This is the recommended method for WebAuthn registration

    Parameters

    • username: string

      Username

    Returns Promise<AuthResult>

    Registration result

    Creates a new user account using WebAuthn credentials. Requires browser support for WebAuthn.

  • Parameters

    • data: any
    • credentialId: string
    • username: string
    • Optionalextra: string[]

    Returns Promise<string>

  • Verify consistency between oneshot and normal approaches This ensures both approaches create the same Gun user

    Parameters

    • credentialId: string
    • username: string
    • OptionalexpectedUserPub: string

    Returns Promise<
        {
            actualUserPub?: string;
            consistent: boolean;
            expectedUserPub?: string;
        },
    >