Gjsify LogoGjsify Logo

A value containing a secret

A #SecretValue contains a password or other secret value.

Use [methodValue.get] to get the actual secret data, such as a password. The secret data is not necessarily null-terminated, unless the content type is "text/plain".

Each #SecretValue has a content type. For passwords, this is text/plain. Use [methodValue.get_content_type] to look at the content type.

#SecretValue is reference counted and immutable. The secret data is only freed when all references have been released via [methodValue.unref].

record

Hierarchy

  • Value

Index

Constructors

  • new Value(secret: string, length: number, contentType: string): Secret.Value
  • Create a #SecretValue for the secret data passed in.

    The secret data is copied into non-pageable 'secure' memory.

    If the length is less than zero, then secret is assumed to be null-terminated.

    Parameters

    • secret: string

      the secret data

    • length: number

      the length of the data

    • contentType: string

      the content type of the data

    Returns Secret.Value

Properties

name: string

Methods

  • get(): Uint8Array
  • Get the secret data in the #SecretValue.

    The value is not necessarily null-terminated unless it was created with [ctorValue.new] or a null-terminated string was passed to [ctorValue.new_full].

    Returns Uint8Array

  • getContentType(): string
  • Get the content type of the secret value, such as text/plain.

    Returns string

  • getText(): string
  • Get the secret data in the #SecretValue if it contains a textual value.

    The content type must be text/plain.

    Returns string

  • Add another reference to the #SecretValue.

    For each reference [methodValue.unref] should be called to unreference the value.

    Returns Secret.Value

  • unref(): void
  • Unreference a #SecretValue.

    When the last reference is gone, then the value will be freed.

    Returns void

  • unrefToPassword(length: number): [string, number]
  • Unreference a #SecretValue and steal the secret data in #SecretValue as nonpageable memory.

    Parameters

    • length: number

      the length of the secret

    Returns [string, number]

  • new(secret: string, length: number, contentType: string): Secret.Value
  • Create a #SecretValue for the secret data passed in.

    The secret data is copied into non-pageable 'secure' memory.

    If the length is less than zero, then secret is assumed to be null-terminated.

    Parameters

    • secret: string

      the secret data

    • length: number

      the length of the data

    • contentType: string

      the content type of the data

    Returns Secret.Value

  • Create a #SecretValue for the secret data passed in.

    The secret data is not copied, and will later be freed with the destroy function.

    If the length is less than zero, then secret is assumed to be null-terminated.

    Parameters

    • secret: string

      the secret data

    • length: number

      the length of the data

    • contentType: string

      the content type of the data

    • destroy: GLib.DestroyNotify

      function to call to free the secret data

    Returns Secret.Value

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method