kernl API
    Preparing search index...

    Class KernlAccountManager

    An AccountManager that refuses accounts whose persistence would write a plaintext key, and persists the rest to kernl's storage.

    const manager = new KernlAccountManager();
    manager.addAccount(PasswordAccount.fromNcryptsec(pubkey, ncryptsec));
    manager.addAccount(PrivateKeyAccount.fromKey(secretKey)); // throws 'denied:plaintext-key-persistence'

    Hierarchy

    • AccountManager
      • KernlAccountManager
    Index
    accounts$: BehaviorSubject<IAccount<any, any, any>[]>
    active$: BehaviorSubject<IAccount<any, any, any> | undefined>
    disableQueue?: boolean

    Disable request queueing for any accounts added to this manager

    signer: ISigner

    Proxy signer for currently active account

    types: Map<string, IAccountConstructor<any, any, any>>
    • get accounts(): IAccount<any, any, Metadata>[]

      Returns IAccount<any, any, Metadata>[]

    • get active(): IAccount<any, any, Metadata> | undefined

      Returns IAccount<any, any, Metadata> | undefined

    • Add an account, refusing plaintext-key types.

      Parameters

      • account: IAccount

        The account to add.

      Returns void

      denied:plaintext-key-persistence for PrivateKeyAccount and SeedWordsAccount.

    • Removes all metadata on the account

      Parameters

      • id: string | IAccount<any, any, any>

      Returns void

    • Clears the currently active account

      Returns void

    • Restores all accounts from an array of serialized accounts NOTE: this will clear all existing accounts

      Parameters

      • accounts: SerializedAccount<any, any>[]
      • Optionalquite: boolean

      Returns void

    • gets an account in the manager

      Type Parameters

      • Signer extends ISigner

      Parameters

      • id: string | IAccount<Signer, any, any>

      Returns IAccount<Signer, any, any> | undefined

    • Return the first account for a pubkey

      Parameters

      • pubkey: string

      Returns IAccount<any, any, any> | undefined

    • sets the metadata on an account

      Parameters

      • id: string | IAccount<any, any, any>

      Returns any

    • Returns all accounts for a pubkey

      Parameters

      • pubkey: string

      Returns IAccount<any, any, any>[]

    • Returns the currently active account

      Returns IAccount<any, any, any> | undefined

    • Add account type class

      Type Parameters

      • S extends ISigner

      Parameters

      • accountType: IAccountConstructor<S, any, any>

      Returns void

    • Removes an account from the manager

      Parameters

      • account: string | IAccount<any, any, any>

      Returns void

    • Replaces an account with another

      Parameters

      • old: string | IAccount<any, any, any>
      • account: IAccount<any, any, any>

      Returns void

    • sets the metadata on an account

      Parameters

      • id: string | IAccount<any, any, any>
      • metadata: any

      Returns void

    • Sets the currently active account

      Parameters

      • id: string | IAccount<any, any, any>

      Returns void

    • Returns an array of serialized accounts

      Parameters

      • Optionalquite: boolean

      Returns SerializedAccount<any, any>[]

    • Remove account type

      Parameters

      • type: string

      Returns void

    • Create an account from a types array and a serialized account

      Type Parameters

      • Signer extends ISigner = ISigner
      • SignerData extends unknown = any
      • Metadata extends unknown = any

      Parameters

      • types: IAccountConstructor<any, any, any>[]
      • json: SerializedAccount<SignerData, Metadata>

      Returns IAccount<Signer, SignerData, Metadata>