@girs/glib-2.0 2.82.2-4.0.0-beta.19 → 2.82.4-4.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/glib-2.0.d.ts +70 -12
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/glib-2.0)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for GLib-2.0, generated from library version 2.82.2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.19.
8
+ GJS TypeScript type definitions for GLib-2.0, generated from library version 2.82.4 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.20.
9
9
 
10
10
 
11
11
  ## Install
package/glib-2.0.d.ts CHANGED
@@ -4609,6 +4609,11 @@ export namespace GLib {
4609
4609
  * If the reference was the last one, it will call `clear_func`
4610
4610
  * to clear the contents of `mem_block,` and then will free the
4611
4611
  * resources allocated for `mem_block`.
4612
+ *
4613
+ * Note that implementing weak references via `clear_func` is not thread-safe:
4614
+ * clearing a pointer to the memory from the callback can race with another
4615
+ * thread trying to access it as `mem_block` already has a reference count of 0
4616
+ * when the callback is called and will be freed.
4612
4617
  * @param mem_block a pointer to reference counted data
4613
4618
  */
4614
4619
  function atomic_rc_box_release_full(mem_block: any): void;
@@ -8992,14 +8997,6 @@ export namespace GLib {
8992
8997
  * @param prgname the name of the program.
8993
8998
  */
8994
8999
  function set_prgname(prgname: string): void;
8995
- /**
8996
- * If g_get_prgname() is not set, this is the same as setting
8997
- * the name via g_set_prgname() and %TRUE is returned. Otherwise,
8998
- * does nothing and returns %FALSE. This is thread-safe.
8999
- * @param prgname the name of the program.
9000
- * @returns whether g_prgname was initialized by the call.
9001
- */
9002
- function set_prgname_once(prgname: string): boolean;
9003
9000
  /**
9004
9001
  * Sets an environment variable. On UNIX, both the variable's name and
9005
9002
  * value can be arbitrary byte strings, except that the variable's name
@@ -17270,24 +17267,85 @@ export namespace GLib {
17270
17267
  steal(): void;
17271
17268
  }
17272
17269
 
17270
+ /**
17271
+ * HMACs should be used when producing a cookie or hash based on data
17272
+ * and a key. Simple mechanisms for using SHA1 and other algorithms to
17273
+ * digest a key and data together are vulnerable to various security
17274
+ * issues.
17275
+ * [HMAC](http://en.wikipedia.org/wiki/HMAC)
17276
+ * uses algorithms like SHA1 in a secure way to produce a digest of a
17277
+ * key and data.
17278
+ *
17279
+ * Both the key and data are arbitrary byte arrays of bytes or characters.
17280
+ *
17281
+ * Support for HMAC Digests has been added in GLib 2.30, and support for SHA-512
17282
+ * in GLib 2.42. Support for SHA-384 was added in GLib 2.52.
17283
+ *
17284
+ * To create a new `GHmac`, use [ctor`GLib`.Hmac.new]. To free a `GHmac`, use
17285
+ * [method`GLib`.Hmac.unref].
17286
+ */
17273
17287
  class Hmac {
17274
17288
  static $gtype: GObject.GType<Hmac>;
17275
17289
 
17276
17290
  // Constructors
17277
17291
 
17278
- constructor(digest_type: ChecksumType, key: number, key_len: number);
17292
+ constructor(digest_type: ChecksumType, key: Uint8Array | string);
17279
17293
  _init(...args: any[]): void;
17280
17294
 
17281
- static ['new'](digest_type: ChecksumType, key: number, key_len: number): Hmac;
17295
+ static ['new'](digest_type: ChecksumType, key: Uint8Array | string): Hmac;
17282
17296
 
17283
17297
  // Methods
17284
17298
 
17299
+ /**
17300
+ * Copies a #GHmac. If `hmac` has been closed, by calling
17301
+ * g_hmac_get_string() or g_hmac_get_digest(), the copied
17302
+ * HMAC will be closed as well.
17303
+ * @returns the copy of the passed #GHmac. Use g_hmac_unref() when finished using it.
17304
+ */
17285
17305
  copy(): Hmac;
17286
- get_digest(buffer: number, digest_len: number): void;
17306
+ /**
17307
+ * Gets the digest from `checksum` as a raw binary array and places it
17308
+ * into `buffer`. The size of the digest depends on the type of checksum.
17309
+ *
17310
+ * Once this function has been called, the #GHmac is closed and can
17311
+ * no longer be updated with g_checksum_update().
17312
+ * @param buffer output buffer
17313
+ */
17314
+ get_digest(buffer: Uint8Array | string): void;
17315
+ /**
17316
+ * Gets the HMAC as a hexadecimal string.
17317
+ *
17318
+ * Once this function has been called the #GHmac can no longer be
17319
+ * updated with g_hmac_update().
17320
+ *
17321
+ * The hexadecimal characters will be lower case.
17322
+ * @returns the hexadecimal representation of the HMAC. The returned string is owned by the HMAC and should not be modified or freed.
17323
+ */
17287
17324
  get_string(): string;
17325
+ /**
17326
+ * Atomically increments the reference count of `hmac` by one.
17327
+ *
17328
+ * This function is MT-safe and may be called from any thread.
17329
+ * @returns the passed in #GHmac.
17330
+ */
17288
17331
  ref(): Hmac;
17332
+ /**
17333
+ * Atomically decrements the reference count of `hmac` by one.
17334
+ *
17335
+ * If the reference count drops to 0, all keys and values will be
17336
+ * destroyed, and all memory allocated by the hash table is released.
17337
+ * This function is MT-safe and may be called from any thread.
17338
+ * Frees the memory allocated for `hmac`.
17339
+ */
17289
17340
  unref(): void;
17290
- update(data: number, length: number): void;
17341
+ /**
17342
+ * Feeds `data` into an existing #GHmac.
17343
+ *
17344
+ * The HMAC must still be open, that is g_hmac_get_string() or
17345
+ * g_hmac_get_digest() must not have been called on `hmac`.
17346
+ * @param data buffer used to compute the checksum
17347
+ */
17348
+ update(data: Uint8Array | string): void;
17291
17349
  }
17292
17350
 
17293
17351
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@girs/glib-2.0",
3
- "version": "2.82.2-4.0.0-beta.19",
4
- "description": "GJS TypeScript type definitions for GLib-2.0, generated from library version 2.82.2",
3
+ "version": "2.82.4-4.0.0-beta.20",
4
+ "description": "GJS TypeScript type definitions for GLib-2.0, generated from library version 2.82.4",
5
5
  "type": "module",
6
6
  "module": "glib-2.0.js",
7
7
  "main": "glib-2.0.js",
@@ -31,8 +31,8 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.0.0-beta.19",
35
- "@girs/gobject-2.0": "^2.82.2-4.0.0-beta.19"
34
+ "@girs/gjs": "^4.0.0-beta.20",
35
+ "@girs/gobject-2.0": "^2.82.4-4.0.0-beta.20"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "*"