@ipshipyard/keychain
    Preparing search index...

    Interface Keychain

    interface Keychain {
        exportKey(name: string, options?: AbortOptions): Promise<PrivateKey>;
        generateKey(
            name: string,
            options?: AbortOptions & Record<string, any>,
        ): Promise<PrivateKey>;
        importKey(
            name: string,
            key: PrivateKey,
            options?: AbortOptions,
        ): Promise<PrivateKey>;
        listKeys(options?: AbortOptions): AsyncGenerator<KeyInfo>;
        loadPublicKeyFromProtobuf(
            buf: Uint8Array,
            options?: AbortOptions,
        ): Promise<PublicKey>;
        removeKey(name: string, options?: AbortOptions): Promise<void>;
        renameKey(
            oldName: string,
            newName: string,
            options?: AbortOptions,
        ): Promise<void>;
        rotateKeychainPass(password: string, options?: AbortOptions): Promise<void>;
    }
    Index

    Methods

    • Import a new private key.

      The type parameter must match a supported cryptography implementation.

      The default supported key types are Ed25519 and RSA, others may be added through configuration.

      Parameters

      Returns Promise<PrivateKey>

      const key = await crypto.subtle.generateKey('Ed25519', true, ['sign', 'verify'])
      const raw = await crypto.subtle.exportKey('raw', key)
      await helia.keychain.importKey('my-key', 'Ed25519', raw)
    • Rename a key in the keychain. This is done in a batch commit with rollback so errors thrown during the operation will not cause key loss.

      Parameters

      Returns Promise<void>

      await helia.keychain.renameKey('oldName', 'newName')
      
    • Re-encrypt all keys in the keychain using a crypto graphic key derived from the password

      Parameters

      Returns Promise<void>

      await helia.keychain.rotateKeychainPass('newPassword')