@gjsify/crypto 0.6.1 → 0.7.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{SUPPORTED_HASHES as e,getNobleHash as t,normalizeAlgorithm as n}from"./algos.js";import{Buffer as r}from"node:buffer";var i=class Hash{_algorithm;_hasher;_finalized=!1;constructor(e){
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{SUPPORTED_HASHES as e,getNobleHash as t,normalizeAlgorithm as n}from"./algos.js";import{Buffer as r}from"node:buffer";var i=class Hash{_algorithm;_hasher;_finalized=!1;constructor(e,r){this._algorithm=n(e),this._hasher=r??t(e).create()}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;return n=typeof e==`string`?r.from(e,t??`utf8`):e instanceof Uint8Array?e:r.from(e),this._hasher.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._hasher.digest(),n=r.from(t);return e?n.toString(e):n}copy(){if(this._finalized)throw Error(`Digest already called`);return new Hash(this._algorithm,this._hasher.clone())}};function createHash(e){return new i(e)}function getHashes(){return[...e]}function hash(e,t,n){return new i(e).update(t).digest(n)}export{i as Hash,createHash,getHashes,hash};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
+
interface NobleHasher {
|
|
3
|
+
update(data: Uint8Array): this;
|
|
4
|
+
digest(): Uint8Array;
|
|
5
|
+
clone(): NobleHasher;
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* Hash backed by @noble/hashes — fully synchronous, zero native deps.
|
|
4
9
|
* Compatible with the Node.js Hash API subset expected by NS consumers.
|
|
@@ -7,7 +12,7 @@ export declare class Hash {
|
|
|
7
12
|
private _algorithm;
|
|
8
13
|
private _hasher;
|
|
9
14
|
private _finalized;
|
|
10
|
-
constructor(algorithm: string);
|
|
15
|
+
constructor(algorithm: string, existing?: NobleHasher);
|
|
11
16
|
update(data: string | Buffer | Uint8Array, inputEncoding?: BufferEncoding): this;
|
|
12
17
|
digest(encoding?: BufferEncoding): Buffer | string;
|
|
13
18
|
copy(): Hash;
|
|
@@ -15,3 +20,4 @@ export declare class Hash {
|
|
|
15
20
|
export declare function createHash(algorithm: string): Hash;
|
|
16
21
|
export declare function getHashes(): string[];
|
|
17
22
|
export declare function hash(algorithm: string, data: string | Buffer | Uint8Array, encoding?: BufferEncoding): Buffer | string;
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Buffer } from 'node:buffer';
|
|
2
1
|
export declare function createCipher(..._args: unknown[]): never;
|
|
3
2
|
export declare function createCipheriv(..._args: unknown[]): never;
|
|
4
3
|
export declare function createDecipher(..._args: unknown[]): never;
|
|
@@ -51,4 +50,3 @@ export declare function createPrivateKey(..._args: unknown[]): never;
|
|
|
51
50
|
export declare class X509Certificate {
|
|
52
51
|
constructor();
|
|
53
52
|
}
|
|
54
|
-
export type { Buffer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/crypto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Node.js crypto module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -74,17 +74,17 @@
|
|
|
74
74
|
"crypto"
|
|
75
75
|
],
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@gjsify/cli": "^0.
|
|
78
|
-
"@gjsify/unit": "^0.
|
|
77
|
+
"@gjsify/cli": "^0.7.0",
|
|
78
|
+
"@gjsify/unit": "^0.7.0",
|
|
79
79
|
"@types/diffie-hellman": "^5.0.3",
|
|
80
80
|
"@types/node": "^25.9.2",
|
|
81
81
|
"typescript": "^6.0.3"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@girs/glib-2.0": "2.88.0-4.0.4",
|
|
85
|
-
"@gjsify/buffer": "^0.
|
|
86
|
-
"@gjsify/stream": "^0.
|
|
87
|
-
"@gjsify/utils": "^0.
|
|
85
|
+
"@gjsify/buffer": "^0.7.0",
|
|
86
|
+
"@gjsify/stream": "^0.7.0",
|
|
87
|
+
"@gjsify/utils": "^0.7.0",
|
|
88
88
|
"@noble/hashes": "^1.5.0"
|
|
89
89
|
},
|
|
90
90
|
"gjsify": {
|