@aleph-sdk/monorepo
    Preparing search index...

    Class NULS2Account

    NULS2Account implements the Account class for the NULS2 protocol. It is used to represent a NULS2 account when publishing a message on the Aleph network.

    Hierarchy

    • ECIESAccount
      • NULS2Account
    Index

    Constructors

    • Parameters

      • address: string
      • publicKey: string
      • privateKey: string

      Returns NULS2Account

    Properties

    address: string
    publicKey: undefined | string

    Methods

    • Ask for a Provider Account a read Access to its encryption publicKey. As NULS2 currently doesn't support instantiation through a provider, this method has no effect.

      Returns Promise<void>

    • Decrypt a given content using a NULS2 account.

      Parameters

      • encryptedContent: string | Buffer<ArrayBufferLike>

        The encrypted content to decrypt.

      Returns Promise<Buffer<ArrayBufferLike>>

    • Encrypt a content using the user's public key for a NULS2 account.

      Parameters

      • content: Buffer

        The content to encrypt.

      • OptionaldelegateSupport: string | ECIESAccount

        Optional, if you want to encrypt data for another ECIESAccount (Can also be directly a public key)

      Returns Promise<Buffer<ArrayBufferLike>>

    • The Sign method provides a way to sign a given Aleph message using a NULS2 account. The full message is not used as the payload, only fields of the BaseMessage type are.

      The message's signature is based on secp256k1 package.

      Parameters

      • message: SignableMessage

        The Aleph message to sign, using some of its fields.

      Returns Promise<string>

    • Extract an address from a given hash.

      Parameters

      • hash: Uint8Array

        The hash containing the address.

      • Optionalprefix: string

        The optional address prefix.

      Returns string

    • Creates a hash from a message.

      Parameters

      • message: Buffer

        The message used to create the hash.

      • messagePrefix: string | Buffer<ArrayBufferLike> = '\u0018NULS Signed Message:\n'

        The optional message's hash prefix.

      Returns Buffer

    • Creates a hash from a user's public key.

      Parameters

      • publicKey: Uint8Array

        The public key used to create the hash.

      • __namedParameters: ChainNAddress = ...

      Returns Buffer