@gjsify/crypto 0.3.16 → 0.3.17
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.
- package/lib/esm/asn1.js +2 -630
- package/lib/esm/bigint-math.js +1 -43
- package/lib/esm/cipher.js +1 -1295
- package/lib/esm/constants.js +1 -14
- package/lib/esm/crypto-utils.js +1 -65
- package/lib/esm/dh.js +1 -451
- package/lib/esm/ecdh.js +1 -438
- package/lib/esm/ecdsa.js +1 -152
- package/lib/esm/hash.js +1 -111
- package/lib/esm/hkdf.js +1 -76
- package/lib/esm/hmac.js +1 -98
- package/lib/esm/index.js +1 -85
- package/lib/esm/key-object.js +1 -371
- package/lib/esm/mgf1.js +1 -33
- package/lib/esm/pbkdf2.js +1 -75
- package/lib/esm/public-encrypt.js +1 -222
- package/lib/esm/random.js +1 -151
- package/lib/esm/rsa-oaep.js +1 -102
- package/lib/esm/rsa-pss.js +1 -107
- package/lib/esm/scrypt.js +1 -135
- package/lib/esm/sign.js +1 -278
- package/lib/esm/timing-safe-equal.js +1 -18
- package/lib/esm/x509.js +1 -223
- package/package.json +8 -8
- package/tsconfig.tsbuildinfo +1 -1
package/lib/esm/hash.js
CHANGED
|
@@ -1,111 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Buffer } from "node:buffer";
|
|
3
|
-
import GLib from "@girs/glib-2.0";
|
|
4
|
-
import { Transform } from "node:stream";
|
|
5
|
-
import { normalizeEncoding } from "@gjsify/utils";
|
|
6
|
-
|
|
7
|
-
//#region src/hash.ts
|
|
8
|
-
const CHECKSUM_TYPES = {
|
|
9
|
-
md5: GLib.ChecksumType.MD5,
|
|
10
|
-
sha1: GLib.ChecksumType.SHA1,
|
|
11
|
-
sha256: GLib.ChecksumType.SHA256,
|
|
12
|
-
sha384: GLib.ChecksumType.SHA384,
|
|
13
|
-
sha512: GLib.ChecksumType.SHA512
|
|
14
|
-
};
|
|
15
|
-
function getChecksumType(algorithm) {
|
|
16
|
-
const normalized = normalizeAlgorithm(algorithm);
|
|
17
|
-
const type = CHECKSUM_TYPES[normalized];
|
|
18
|
-
if (type === undefined) {
|
|
19
|
-
const err = new Error(`Unknown message digest: ${algorithm}`);
|
|
20
|
-
err.code = "ERR_CRYPTO_HASH_UNKNOWN";
|
|
21
|
-
throw err;
|
|
22
|
-
}
|
|
23
|
-
return type;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Creates and returns a Hash object that can be used to generate hash digests
|
|
27
|
-
* using the given algorithm.
|
|
28
|
-
*/
|
|
29
|
-
var Hash = class Hash extends Transform {
|
|
30
|
-
_algorithm;
|
|
31
|
-
_checksum;
|
|
32
|
-
_finalized = false;
|
|
33
|
-
constructor(algorithm) {
|
|
34
|
-
super();
|
|
35
|
-
const normalized = normalizeAlgorithm(algorithm);
|
|
36
|
-
const type = getChecksumType(normalized);
|
|
37
|
-
this._algorithm = normalized;
|
|
38
|
-
this._checksum = new GLib.Checksum(type);
|
|
39
|
-
}
|
|
40
|
-
/** Update the hash with data. */
|
|
41
|
-
update(data, inputEncoding) {
|
|
42
|
-
if (this._finalized) {
|
|
43
|
-
throw new Error("Digest already called");
|
|
44
|
-
}
|
|
45
|
-
let bytes;
|
|
46
|
-
if (typeof data === "string") {
|
|
47
|
-
const enc = normalizeEncoding(inputEncoding);
|
|
48
|
-
bytes = Buffer.from(data, enc);
|
|
49
|
-
} else {
|
|
50
|
-
bytes = data instanceof Uint8Array ? data : Buffer.from(data);
|
|
51
|
-
}
|
|
52
|
-
this._checksum.update(bytes);
|
|
53
|
-
return this;
|
|
54
|
-
}
|
|
55
|
-
/** Calculate the digest of all data passed to update(). */
|
|
56
|
-
digest(encoding) {
|
|
57
|
-
if (this._finalized) {
|
|
58
|
-
throw new Error("Digest already called");
|
|
59
|
-
}
|
|
60
|
-
this._finalized = true;
|
|
61
|
-
const hexStr = this._checksum.get_string();
|
|
62
|
-
const buf = Buffer.from(hexStr, "hex");
|
|
63
|
-
if (encoding) return buf.toString(encoding);
|
|
64
|
-
return buf;
|
|
65
|
-
}
|
|
66
|
-
/** Copy this hash to a new Hash object. */
|
|
67
|
-
copy() {
|
|
68
|
-
if (this._finalized) {
|
|
69
|
-
throw new Error("Digest already called");
|
|
70
|
-
}
|
|
71
|
-
const copy = Object.create(Hash.prototype);
|
|
72
|
-
Transform.call(copy);
|
|
73
|
-
copy._algorithm = this._algorithm;
|
|
74
|
-
copy._finalized = false;
|
|
75
|
-
copy._checksum = this._checksum.copy();
|
|
76
|
-
return copy;
|
|
77
|
-
}
|
|
78
|
-
_transform(chunk, encoding, callback) {
|
|
79
|
-
try {
|
|
80
|
-
this.update(chunk, encoding);
|
|
81
|
-
callback();
|
|
82
|
-
} catch (err) {
|
|
83
|
-
callback(err);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
_flush(callback) {
|
|
87
|
-
try {
|
|
88
|
-
this.push(this.digest());
|
|
89
|
-
callback();
|
|
90
|
-
} catch (err) {
|
|
91
|
-
callback(err);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
/** Get the list of supported hash algorithms. */
|
|
96
|
-
function getHashes() {
|
|
97
|
-
return [
|
|
98
|
-
"md5",
|
|
99
|
-
"sha1",
|
|
100
|
-
"sha256",
|
|
101
|
-
"sha384",
|
|
102
|
-
"sha512"
|
|
103
|
-
];
|
|
104
|
-
}
|
|
105
|
-
/** Convenience: one-shot hash (Node 21+). */
|
|
106
|
-
function hash(algorithm, data, encoding) {
|
|
107
|
-
return new Hash(algorithm).update(data).digest(encoding);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
//#endregion
|
|
111
|
-
export { Hash, getHashes, hash };
|
|
1
|
+
import{normalizeAlgorithm as e}from"./crypto-utils.js";import{Buffer as t}from"node:buffer";import n from"@girs/glib-2.0";import{Transform as r}from"node:stream";import{normalizeEncoding as i}from"@gjsify/utils";const a={md5:n.ChecksumType.MD5,sha1:n.ChecksumType.SHA1,sha256:n.ChecksumType.SHA256,sha384:n.ChecksumType.SHA384,sha512:n.ChecksumType.SHA512};function o(t){let n=a[e(t)];if(n===void 0){let e=Error(`Unknown message digest: ${t}`);throw e.code=`ERR_CRYPTO_HASH_UNKNOWN`,e}return n}var s=class a extends r{_algorithm;_checksum;_finalized=!1;constructor(t){super();let r=e(t),i=o(r);this._algorithm=r,this._checksum=new n.Checksum(i)}update(e,n){if(this._finalized)throw Error(`Digest already called`);let r;if(typeof e==`string`){let a=i(n);r=t.from(e,a)}else r=e instanceof Uint8Array?e:t.from(e);return this._checksum.update(r),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let n=this._checksum.get_string(),r=t.from(n,`hex`);return e?r.toString(e):r}copy(){if(this._finalized)throw Error(`Digest already called`);let e=Object.create(a.prototype);return r.call(e),e._algorithm=this._algorithm,e._finalized=!1,e._checksum=this._checksum.copy(),e}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}};function c(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`]}function l(e,t,n){return new s(e).update(t).digest(n)}export{s as Hash,c as getHashes,l as hash};
|
package/lib/esm/hkdf.js
CHANGED
|
@@ -1,76 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Hmac } from "./hmac.js";
|
|
3
|
-
import { Buffer } from "node:buffer";
|
|
4
|
-
|
|
5
|
-
//#region src/hkdf.ts
|
|
6
|
-
function hmacDigest(algo, key, data) {
|
|
7
|
-
const hmac = new Hmac(algo, key);
|
|
8
|
-
hmac.update(data);
|
|
9
|
-
return hmac.digest();
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* HKDF-Extract: PRK = HMAC-Hash(salt, IKM)
|
|
13
|
-
*/
|
|
14
|
-
function hkdfExtract(algo, ikm, salt) {
|
|
15
|
-
return hmacDigest(algo, salt, ikm);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* HKDF-Expand: OKM = T(1) || T(2) || ... || T(N)
|
|
19
|
-
* T(i) = HMAC-Hash(PRK, T(i-1) || info || i)
|
|
20
|
-
*/
|
|
21
|
-
function hkdfExpand(algo, prk, info, length, hashLen) {
|
|
22
|
-
const n = Math.ceil(length / hashLen);
|
|
23
|
-
if (n > 255) {
|
|
24
|
-
throw new Error("HKDF cannot generate more than 255 * HashLen bytes");
|
|
25
|
-
}
|
|
26
|
-
const okm = Buffer.allocUnsafe(n * hashLen);
|
|
27
|
-
let prev = Buffer.alloc(0);
|
|
28
|
-
for (let i = 1; i <= n; i++) {
|
|
29
|
-
const input = Buffer.concat([
|
|
30
|
-
prev,
|
|
31
|
-
info,
|
|
32
|
-
Buffer.from([i])
|
|
33
|
-
]);
|
|
34
|
-
prev = hmacDigest(algo, prk, input);
|
|
35
|
-
prev.copy(okm, (i - 1) * hashLen);
|
|
36
|
-
}
|
|
37
|
-
return Buffer.from(okm.buffer, okm.byteOffset, length);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Synchronous HKDF key derivation.
|
|
41
|
-
*/
|
|
42
|
-
function hkdfSync(digest, ikm, salt, info, keylen) {
|
|
43
|
-
const algo = normalizeAlgorithm(digest);
|
|
44
|
-
const hashLen = DIGEST_SIZES[algo];
|
|
45
|
-
if (!SUPPORTED_ALGORITHMS.has(algo) || hashLen === undefined) {
|
|
46
|
-
throw new TypeError(`Unknown message digest: ${digest}`);
|
|
47
|
-
}
|
|
48
|
-
if (typeof keylen !== "number" || keylen < 0) {
|
|
49
|
-
throw new TypeError("keylen must be a non-negative number");
|
|
50
|
-
}
|
|
51
|
-
const ikmBuf = toBuffer(ikm);
|
|
52
|
-
const saltBuf = toBuffer(salt);
|
|
53
|
-
const infoBuf = toBuffer(info);
|
|
54
|
-
const effectiveSalt = saltBuf.length === 0 ? Buffer.alloc(hashLen, 0) : saltBuf;
|
|
55
|
-
const prk = hkdfExtract(algo, ikmBuf, effectiveSalt);
|
|
56
|
-
const okm = hkdfExpand(algo, prk, infoBuf, keylen, hashLen);
|
|
57
|
-
const result = new ArrayBuffer(okm.length);
|
|
58
|
-
new Uint8Array(result).set(okm);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Asynchronous HKDF key derivation.
|
|
63
|
-
*/
|
|
64
|
-
function hkdf(digest, ikm, salt, info, keylen, callback) {
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
try {
|
|
67
|
-
const result = hkdfSync(digest, ikm, salt, info, keylen);
|
|
68
|
-
callback(null, result);
|
|
69
|
-
} catch (err) {
|
|
70
|
-
callback(err instanceof Error ? err : new Error(String(err)));
|
|
71
|
-
}
|
|
72
|
-
}, 0);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
|
-
export { hkdf, hkdfSync };
|
|
1
|
+
import{DIGEST_SIZES as e,SUPPORTED_ALGORITHMS as t,normalizeAlgorithm as n,toBuffer as r}from"./crypto-utils.js";import{Hmac as i}from"./hmac.js";import{Buffer as a}from"node:buffer";function o(e,t,n){let r=new i(e,t);return r.update(n),r.digest()}function s(e,t,n){return o(e,n,t)}function c(e,t,n,r,i){let s=Math.ceil(r/i);if(s>255)throw Error(`HKDF cannot generate more than 255 * HashLen bytes`);let c=a.allocUnsafe(s*i),l=a.alloc(0);for(let r=1;r<=s;r++)l=o(e,t,a.concat([l,n,a.from([r])])),l.copy(c,(r-1)*i);return a.from(c.buffer,c.byteOffset,r)}function l(i,o,l,u,d){let f=n(i),p=e[f];if(!t.has(f)||p===void 0)throw TypeError(`Unknown message digest: ${i}`);if(typeof d!=`number`||d<0)throw TypeError(`keylen must be a non-negative number`);let m=r(o),h=r(l),g=r(u),_=c(f,s(f,m,h.length===0?a.alloc(p,0):h),g,d,p),v=new ArrayBuffer(_.length);return new Uint8Array(v).set(_),v}function u(e,t,n,r,i,a){setTimeout(()=>{try{a(null,l(e,t,n,r,i))}catch(e){a(e instanceof Error?e:Error(String(e)))}},0)}export{u as hkdf,l as hkdfSync};
|
package/lib/esm/hmac.js
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Hash } from "./hash.js";
|
|
3
|
-
import { Buffer } from "node:buffer";
|
|
4
|
-
import { Transform } from "node:stream";
|
|
5
|
-
import { normalizeEncoding } from "@gjsify/utils";
|
|
6
|
-
|
|
7
|
-
//#region src/hmac.ts
|
|
8
|
-
/**
|
|
9
|
-
* Creates and returns an Hmac object that uses the given algorithm and key.
|
|
10
|
-
* Implemented using createHash (GLib.Checksum) since GLib.Hmac bindings are broken in GJS.
|
|
11
|
-
*/
|
|
12
|
-
var Hmac = class extends Transform {
|
|
13
|
-
_algorithm;
|
|
14
|
-
_innerHash;
|
|
15
|
-
_outerKeyPad;
|
|
16
|
-
_finalized = false;
|
|
17
|
-
constructor(algorithm, key) {
|
|
18
|
-
super();
|
|
19
|
-
const normalized = normalizeAlgorithm(algorithm);
|
|
20
|
-
if (!SUPPORTED_ALGORITHMS.has(normalized)) {
|
|
21
|
-
const err = new Error(`Unknown message digest: ${algorithm}`);
|
|
22
|
-
err.code = "ERR_CRYPTO_HASH_UNKNOWN";
|
|
23
|
-
throw err;
|
|
24
|
-
}
|
|
25
|
-
this._algorithm = normalized;
|
|
26
|
-
let keyBytes;
|
|
27
|
-
if (typeof key === "string") {
|
|
28
|
-
keyBytes = Buffer.from(key, "utf8");
|
|
29
|
-
} else {
|
|
30
|
-
keyBytes = key instanceof Uint8Array ? key : Buffer.from(key);
|
|
31
|
-
}
|
|
32
|
-
const blockSize = BLOCK_SIZES[normalized];
|
|
33
|
-
if (keyBytes.length > blockSize) {
|
|
34
|
-
const h = new Hash(normalized);
|
|
35
|
-
h.update(keyBytes);
|
|
36
|
-
keyBytes = h.digest();
|
|
37
|
-
}
|
|
38
|
-
const paddedKey = new Uint8Array(blockSize);
|
|
39
|
-
paddedKey.set(keyBytes);
|
|
40
|
-
const iKeyPad = new Uint8Array(blockSize);
|
|
41
|
-
const oKeyPad = new Uint8Array(blockSize);
|
|
42
|
-
for (let i = 0; i < blockSize; i++) {
|
|
43
|
-
iKeyPad[i] = paddedKey[i] ^ 54;
|
|
44
|
-
oKeyPad[i] = paddedKey[i] ^ 92;
|
|
45
|
-
}
|
|
46
|
-
this._outerKeyPad = oKeyPad;
|
|
47
|
-
this._innerHash = new Hash(normalized);
|
|
48
|
-
this._innerHash.update(iKeyPad);
|
|
49
|
-
}
|
|
50
|
-
/** Update the HMAC with data. */
|
|
51
|
-
update(data, inputEncoding) {
|
|
52
|
-
if (this._finalized) {
|
|
53
|
-
throw new Error("Digest already called");
|
|
54
|
-
}
|
|
55
|
-
let bytes;
|
|
56
|
-
if (typeof data === "string") {
|
|
57
|
-
const enc = normalizeEncoding(inputEncoding);
|
|
58
|
-
bytes = Buffer.from(data, enc);
|
|
59
|
-
} else {
|
|
60
|
-
bytes = data instanceof Uint8Array ? data : Buffer.from(data);
|
|
61
|
-
}
|
|
62
|
-
this._innerHash.update(bytes);
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
/** Calculate the HMAC digest. */
|
|
66
|
-
digest(encoding) {
|
|
67
|
-
if (this._finalized) {
|
|
68
|
-
throw new Error("Digest already called");
|
|
69
|
-
}
|
|
70
|
-
this._finalized = true;
|
|
71
|
-
const innerDigest = this._innerHash.digest();
|
|
72
|
-
const outerHash = new Hash(this._algorithm);
|
|
73
|
-
outerHash.update(this._outerKeyPad);
|
|
74
|
-
outerHash.update(innerDigest);
|
|
75
|
-
const result = outerHash.digest();
|
|
76
|
-
if (encoding) return result.toString(encoding);
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
_transform(chunk, encoding, callback) {
|
|
80
|
-
try {
|
|
81
|
-
this.update(chunk, encoding);
|
|
82
|
-
callback();
|
|
83
|
-
} catch (err) {
|
|
84
|
-
callback(err);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
_flush(callback) {
|
|
88
|
-
try {
|
|
89
|
-
this.push(this.digest());
|
|
90
|
-
callback();
|
|
91
|
-
} catch (err) {
|
|
92
|
-
callback(err);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
export { Hmac };
|
|
1
|
+
import{BLOCK_SIZES as e,SUPPORTED_ALGORITHMS as t,normalizeAlgorithm as n}from"./crypto-utils.js";import{Hash as r}from"./hash.js";import{Buffer as i}from"node:buffer";import{Transform as a}from"node:stream";import{normalizeEncoding as o}from"@gjsify/utils";var s=class extends a{_algorithm;_innerHash;_outerKeyPad;_finalized=!1;constructor(a,o){super();let s=n(a);if(!t.has(s)){let e=Error(`Unknown message digest: ${a}`);throw e.code=`ERR_CRYPTO_HASH_UNKNOWN`,e}this._algorithm=s;let c;c=typeof o==`string`?i.from(o,`utf8`):o instanceof Uint8Array?o:i.from(o);let l=e[s];if(c.length>l){let e=new r(s);e.update(c),c=e.digest()}let u=new Uint8Array(l);u.set(c);let d=new Uint8Array(l),f=new Uint8Array(l);for(let e=0;e<l;e++)d[e]=u[e]^54,f[e]=u[e]^92;this._outerKeyPad=f,this._innerHash=new r(s),this._innerHash.update(d)}update(e,t){if(this._finalized)throw Error(`Digest already called`);let n;if(typeof e==`string`){let r=o(t);n=i.from(e,r)}else n=e instanceof Uint8Array?e:i.from(e);return this._innerHash.update(n),this}digest(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;let t=this._innerHash.digest(),n=new r(this._algorithm);n.update(this._outerKeyPad),n.update(t);let i=n.digest();return e?i.toString(e):i}_transform(e,t,n){try{this.update(e,t),n()}catch(e){n(e)}}_flush(e){try{this.push(this.digest()),e()}catch(t){e(t)}}};export{s as Hmac};
|
package/lib/esm/index.js
CHANGED
|
@@ -1,85 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { constants } from "./constants.js";
|
|
3
|
-
import { randomBytes, randomFill, randomFillSync, randomInt, randomUUID } from "./random.js";
|
|
4
|
-
import { DiffieHellman, DiffieHellmanGroup, createDiffieHellman, createDiffieHellmanGroup, getDiffieHellman } from "./dh.js";
|
|
5
|
-
import { createECDH, getCurves } from "./ecdh.js";
|
|
6
|
-
import { Hash, getHashes, hash } from "./hash.js";
|
|
7
|
-
import { Hmac } from "./hmac.js";
|
|
8
|
-
import { ecdsaSign, ecdsaVerify } from "./ecdsa.js";
|
|
9
|
-
import { hkdf, hkdfSync } from "./hkdf.js";
|
|
10
|
-
import { timingSafeEqual } from "./timing-safe-equal.js";
|
|
11
|
-
import { pbkdf2, pbkdf2Sync } from "./pbkdf2.js";
|
|
12
|
-
import { scrypt, scryptSync } from "./scrypt.js";
|
|
13
|
-
import { Sign, Verify, createSign, createVerify } from "./sign.js";
|
|
14
|
-
import { privateDecrypt, privateEncrypt, publicDecrypt, publicEncrypt } from "./public-encrypt.js";
|
|
15
|
-
import { mgf1 } from "./mgf1.js";
|
|
16
|
-
import { rsaPssSign, rsaPssVerify } from "./rsa-pss.js";
|
|
17
|
-
import { rsaOaepDecrypt, rsaOaepEncrypt } from "./rsa-oaep.js";
|
|
18
|
-
import { KeyObject, createPrivateKey, createPublicKey, createSecretKey } from "./key-object.js";
|
|
19
|
-
import { X509Certificate } from "./x509.js";
|
|
20
|
-
|
|
21
|
-
//#region src/index.ts
|
|
22
|
-
/** Create a Hash object for the given algorithm. */
|
|
23
|
-
function createHash(algorithm) {
|
|
24
|
-
return new Hash(algorithm);
|
|
25
|
-
}
|
|
26
|
-
/** Create an Hmac object for the given algorithm and key. */
|
|
27
|
-
function createHmac(algorithm, key) {
|
|
28
|
-
return new Hmac(algorithm, key);
|
|
29
|
-
}
|
|
30
|
-
var src_default = {
|
|
31
|
-
Hash,
|
|
32
|
-
getHashes,
|
|
33
|
-
hash,
|
|
34
|
-
Hmac,
|
|
35
|
-
randomBytes,
|
|
36
|
-
randomFill,
|
|
37
|
-
randomFillSync,
|
|
38
|
-
randomUUID,
|
|
39
|
-
randomInt,
|
|
40
|
-
timingSafeEqual,
|
|
41
|
-
constants,
|
|
42
|
-
pbkdf2,
|
|
43
|
-
pbkdf2Sync,
|
|
44
|
-
hkdf,
|
|
45
|
-
hkdfSync,
|
|
46
|
-
scrypt,
|
|
47
|
-
scryptSync,
|
|
48
|
-
createHash,
|
|
49
|
-
createHmac,
|
|
50
|
-
createCipher,
|
|
51
|
-
createCipheriv,
|
|
52
|
-
createDecipher,
|
|
53
|
-
createDecipheriv,
|
|
54
|
-
getCiphers,
|
|
55
|
-
Sign,
|
|
56
|
-
Verify,
|
|
57
|
-
createSign,
|
|
58
|
-
createVerify,
|
|
59
|
-
createDiffieHellman,
|
|
60
|
-
getDiffieHellman,
|
|
61
|
-
DiffieHellman,
|
|
62
|
-
DiffieHellmanGroup,
|
|
63
|
-
createDiffieHellmanGroup,
|
|
64
|
-
createECDH,
|
|
65
|
-
getCurves,
|
|
66
|
-
ecdsaSign,
|
|
67
|
-
ecdsaVerify,
|
|
68
|
-
publicEncrypt,
|
|
69
|
-
privateDecrypt,
|
|
70
|
-
privateEncrypt,
|
|
71
|
-
publicDecrypt,
|
|
72
|
-
rsaPssSign,
|
|
73
|
-
rsaPssVerify,
|
|
74
|
-
rsaOaepEncrypt,
|
|
75
|
-
rsaOaepDecrypt,
|
|
76
|
-
mgf1,
|
|
77
|
-
KeyObject,
|
|
78
|
-
createSecretKey,
|
|
79
|
-
createPublicKey,
|
|
80
|
-
createPrivateKey,
|
|
81
|
-
X509Certificate
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
export { DiffieHellman, DiffieHellmanGroup, Hash, Hmac, KeyObject, Sign, Verify, X509Certificate, constants, createCipher, createCipheriv, createDecipher, createDecipheriv, createDiffieHellman, createDiffieHellmanGroup, createECDH, createHash, createHmac, createPrivateKey, createPublicKey, createSecretKey, createSign, createVerify, src_default as default, ecdsaSign, ecdsaVerify, getCiphers, getCurves, getDiffieHellman, getHashes, hash, hkdf, hkdfSync, mgf1, pbkdf2, pbkdf2Sync, privateDecrypt, privateEncrypt, publicDecrypt, publicEncrypt, randomBytes, randomFill, randomFillSync, randomInt, randomUUID, rsaOaepDecrypt, rsaOaepEncrypt, rsaPssSign, rsaPssVerify, scrypt, scryptSync, timingSafeEqual };
|
|
1
|
+
import{createCipher as e,createCipheriv as t,createDecipher as n,createDecipheriv as r,getCiphers as i}from"./cipher.js";import{constants as a}from"./constants.js";import{randomBytes as o,randomFill as s,randomFillSync as c,randomInt as l,randomUUID as u}from"./random.js";import{DiffieHellman as d,DiffieHellmanGroup as f,createDiffieHellman as p,createDiffieHellmanGroup as m,getDiffieHellman as h}from"./dh.js";import{createECDH as g,getCurves as _}from"./ecdh.js";import{Hash as v,getHashes as y,hash as b}from"./hash.js";import{Hmac as x}from"./hmac.js";import{ecdsaSign as S,ecdsaVerify as C}from"./ecdsa.js";import{hkdf as w,hkdfSync as T}from"./hkdf.js";import{timingSafeEqual as E}from"./timing-safe-equal.js";import{pbkdf2 as D,pbkdf2Sync as O}from"./pbkdf2.js";import{scrypt as k,scryptSync as A}from"./scrypt.js";import{Sign as j,Verify as M,createSign as N,createVerify as P}from"./sign.js";import{privateDecrypt as F,privateEncrypt as I,publicDecrypt as L,publicEncrypt as R}from"./public-encrypt.js";import{mgf1 as z}from"./mgf1.js";import{rsaPssSign as B,rsaPssVerify as V}from"./rsa-pss.js";import{rsaOaepDecrypt as H,rsaOaepEncrypt as U}from"./rsa-oaep.js";import{KeyObject as W,createPrivateKey as G,createPublicKey as K,createSecretKey as q}from"./key-object.js";import{X509Certificate as J}from"./x509.js";function Y(e){return new v(e)}function X(e,t){return new x(e,t)}var Z={Hash:v,getHashes:y,hash:b,Hmac:x,randomBytes:o,randomFill:s,randomFillSync:c,randomUUID:u,randomInt:l,timingSafeEqual:E,constants:a,pbkdf2:D,pbkdf2Sync:O,hkdf:w,hkdfSync:T,scrypt:k,scryptSync:A,createHash:Y,createHmac:X,createCipher:e,createCipheriv:t,createDecipher:n,createDecipheriv:r,getCiphers:i,Sign:j,Verify:M,createSign:N,createVerify:P,createDiffieHellman:p,getDiffieHellman:h,DiffieHellman:d,DiffieHellmanGroup:f,createDiffieHellmanGroup:m,createECDH:g,getCurves:_,ecdsaSign:S,ecdsaVerify:C,publicEncrypt:R,privateDecrypt:F,privateEncrypt:I,publicDecrypt:L,rsaPssSign:B,rsaPssVerify:V,rsaOaepEncrypt:U,rsaOaepDecrypt:H,mgf1:z,KeyObject:W,createSecretKey:q,createPublicKey:K,createPrivateKey:G,X509Certificate:J};export{d as DiffieHellman,f as DiffieHellmanGroup,v as Hash,x as Hmac,W as KeyObject,j as Sign,M as Verify,J as X509Certificate,a as constants,e as createCipher,t as createCipheriv,n as createDecipher,r as createDecipheriv,p as createDiffieHellman,m as createDiffieHellmanGroup,g as createECDH,Y as createHash,X as createHmac,G as createPrivateKey,K as createPublicKey,q as createSecretKey,N as createSign,P as createVerify,Z as default,S as ecdsaSign,C as ecdsaVerify,i as getCiphers,_ as getCurves,h as getDiffieHellman,y as getHashes,b as hash,w as hkdf,T as hkdfSync,z as mgf1,D as pbkdf2,O as pbkdf2Sync,F as privateDecrypt,I as privateEncrypt,L as publicDecrypt,R as publicEncrypt,o as randomBytes,s as randomFill,c as randomFillSync,l as randomInt,u as randomUUID,H as rsaOaepDecrypt,U as rsaOaepEncrypt,B as rsaPssSign,V as rsaPssVerify,k as scrypt,A as scryptSync,E as timingSafeEqual};
|