Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions types/frida-gum/frida-gum-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,16 @@ const checksum = new Checksum("sha512");
// $ExpectType Checksum
checksum.update("abc");
checksum.update(new Uint8Array([1, 2, 3]).buffer).update([4, 5, 6]);
// $ExpectType Checksum
checksum.copy();
// $ExpectType string
checksum.getString();
// $ExpectType string
checksum.peekString();
// $ExpectType ArrayBuffer
checksum.getDigest();
// $ExpectType ArrayBuffer
checksum.peekDigest();
// @ts-expect-error
new Checksum("unknown-type");

Expand Down
20 changes: 20 additions & 0 deletions types/frida-gum/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3099,6 +3099,12 @@ declare class Checksum {
*/
update(data: string | ArrayBuffer | number[]): Checksum;

/**
* Creates a copy of the checksum instance. The copy is in the same state as
* the original, so a "closed" checksum is copied as "closed".
*/
copy(): Checksum;

/**
* Gets the digest as an all-lowercase hexadecimal string. The length of the
* digest depends on the type of checksum.
Expand All @@ -3108,6 +3114,13 @@ declare class Checksum {
*/
getString(): string;

/**
* Gets the digest as an all-lowercase hexadecimal string, without closing
* the checksum. Unlike `getString()`, the instance may still be updated
* with `update()` afterwards.
*/
peekString(): string;

/**
* Gets the digest as a raw binary vector. The size of the digest depends
* on the type of checksum.
Expand All @@ -3116,6 +3129,13 @@ declare class Checksum {
* with `update()`.
*/
getDigest(): ArrayBuffer;

/**
* Gets the digest as a raw binary vector, without closing the checksum.
* Unlike `getDigest()`, the instance may still be updated with `update()`
* afterwards.
*/
peekDigest(): ArrayBuffer;
}

type ChecksumType =
Expand Down
2 changes: 1 addition & 1 deletion types/frida-gum/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/frida-gum",
"version": "19.7.9999",
"version": "19.8.9999",
"nonNpm": true,
"nonNpmDescription": "frida-gum",
"projects": [
Expand Down
Loading