UNPKG

lightningdevkit

Version:
60 lines (59 loc) 2.34 kB
import { Result_HumanReadableNameNoneZ } from '../structs/Result_HumanReadableNameNoneZ.mjs'; import { Result_HumanReadableNameDecodeErrorZ } from '../structs/Result_HumanReadableNameDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; /** * A struct containing the two parts of a BIP 353 Human Readable Name - the user and domain parts. * * The `user` and `domain` parts, together, cannot exceed 232 bytes in length, and both must be * non-empty. * * To protect against [Homograph Attacks], both parts of a Human Readable Name must be plain * ASCII. * * [Homograph Attacks]: https://en.wikipedia.org/wiki/IDN_homograph_attack */ export declare class HumanReadableName extends CommonBase { clone_ptr(): bigint; /** * Creates a copy of the HumanReadableName */ clone(): HumanReadableName; /** * Generates a non-cryptographic 64-bit hash of the HumanReadableName. */ hash(): bigint; /** * Checks if two HumanReadableNames contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ eq(b: HumanReadableName): boolean; /** * Constructs a new [`HumanReadableName`] from the `user` and `domain` parts. See the * struct-level documentation for more on the requirements on each. */ static constructor_new(user: string, domain: string): Result_HumanReadableNameNoneZ; /** * Constructs a new [`HumanReadableName`] from the standard encoding - `user`@`domain`. * * If `user` includes the standard BIP 353 ₿ prefix it is automatically removed as required by * BIP 353. */ static constructor_from_encoded(encoded: string): Result_HumanReadableNameNoneZ; /** * Gets the `user` part of this Human Readable Name */ user(): string; /** * Gets the `domain` part of this Human Readable Name */ domain(): string; /** * Serialize the HumanReadableName object into a byte array which can be read by HumanReadableName_read */ write(): Uint8Array; /** * Read a HumanReadableName from a byte array, created by HumanReadableName_write */ static constructor_read(ser: Uint8Array): Result_HumanReadableNameDecodeErrorZ; }