🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@libp2p/crypto

Package Overview
Dependencies
Maintainers
6
Versions
857
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/crypto - npm Package Compare versions

Comparing version
5.1.18
to
5.1.19-404c7824a
+1
-1
dist/src/ciphers/aes-gcm.browser.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"aes-gcm.browser.d.ts","sourceRoot":"","sources":["../../../src/ciphers/aes-gcm.browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAYvE,eAAO,MAAM,uBAAuB;;;;;;CAOnC,CAAA;AAID,wBAAgB,MAAM,CAAE,IAAI,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAyFhE"}
{"version":3,"file":"aes-gcm.browser.d.ts","sourceRoot":"","sources":["../../../src/ciphers/aes-gcm.browser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAYvE,eAAO,MAAM,uBAAuB;;;;;;CAOnC,CAAA;AAID,wBAAgB,MAAM,CAAE,IAAI,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAyFhE"}
import { concat } from 'uint8arrays/concat';
import { fromString } from 'uint8arrays/from-string';
import webcrypto from '../webcrypto/index.js';
import { withArrayBuffer } from 'uint8arrays/with-array-buffer';
import webcrypto from "../webcrypto/index.js";
// WebKit on Linux does not support deriving a key from an empty PBKDF2 key.

@@ -48,3 +49,3 @@ // So, as a workaround, we provide the generated key as a constant. We test that

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey']);
cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['encrypt']);

@@ -59,7 +60,7 @@ }

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };
const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);
const rawKey = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey']);
cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['encrypt']);
}
// Encrypt the string.
const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, data);
const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, withArrayBuffer(data));
return concat([salt, aesGcm.iv, new Uint8Array(ciphertext)]);

@@ -85,3 +86,3 @@ }

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey']);
cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['decrypt']);

@@ -96,7 +97,7 @@ }

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } };
const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey']);
const rawKey = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey']);
cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['decrypt']);
}
// Decrypt the string.
const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, ciphertext);
const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, withArrayBuffer(ciphertext));
return new Uint8Array(plaintext);

@@ -103,0 +104,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"aes-gcm.browser.js","sourceRoot":"","sources":["../../../src/ciphers/aes-gcm.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAG7C,4EAA4E;AAC5E,gFAAgF;AAChF,4DAA4D;AAC5D,iBAAiB;AACjB,uCAAuC;AACvC,mCAAmC;AACnC,kGAAkG;AAClG,yGAAyG;AACzG,sEAAsE;AACtE,IAAI;AACJ,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,IAAI;IACT,qCAAqC;IACrC,CAAC,EAAE,wBAAwB;IAC3B,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC/B,GAAG,EAAE,KAAK;CACX,CAAA;AAED,yFAAyF;AAEzF,MAAM,UAAU,MAAM,CAAE,IAA6B;IACnD,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,SAAS,CAAA;IAC9C,IAAI,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAA;IACrC,MAAM,WAAW,GAAG,IAAI,EAAE,WAAW,IAAI,EAAE,CAAA;IAC3C,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,SAAS,CAAA;IACxC,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAA;IACzC,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,KAAK,CAAA;IAE5C,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,EAAE,CAAA;IAC9B,SAAS,IAAI,CAAC,CAAA,CAAC,4CAA4C;IAE3D;;;OAGG;IACH,KAAK,UAAU,OAAO,CAAE,IAAgB,EAAE,QAA6B;QACrE,M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AAA;AACf,CAAC"}

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../src/hmac/index.browser.ts"],"names":[],"mappings":"AAcA,wBAAsB,MAAM,CAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBpK"}
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../src/hmac/index.browser.ts"],"names":[],"mappings":"AAeA,wBAAsB,MAAM,CAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBpK"}

@@ -1,2 +0,3 @@

import webcrypto from '../webcrypto/index.js';
import { withArrayBuffer } from 'uint8arrays/with-array-buffer';
import webcrypto from "../webcrypto/index.js";
import lengths from "./lengths.js";

@@ -9,3 +10,3 @@ const hashTypes = {

const sign = async (key, data) => {
const buf = await webcrypto.get().subtle.sign({ name: 'HMAC' }, key, data);
const buf = await webcrypto.get().subtle.sign({ name: 'HMAC' }, key, withArrayBuffer(data));
return new Uint8Array(buf, 0, buf.byteLength);

@@ -15,3 +16,3 @@ };

const hash = hashTypes[hashType];
const key = await webcrypto.get().subtle.importKey('raw', secret, {
const key = await webcrypto.get().subtle.importKey('raw', withArrayBuffer(secret), {
name: 'HMAC',

@@ -18,0 +19,0 @@ hash: { name: hash }

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../src/hmac/index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MA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AAG;IAChB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;CAClB,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,EAAE,GAAc,EAAE,IAAgB,EAAuB,EAAE;IAC3E,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3F,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAE,QAAsC,EAAE,MAAkB;IACtF,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;IAEhC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAChD,KAAK,EACL,eAAe,CAAC,MAAM,CAAC,EACvB;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KACrB,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAA;IAED,OAAO;QACL,KAAK,CAAC,MAAM,CAAE,IAAgB;YAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACxB,CAAC;QACD,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;KAC1B,CAAA;AACH,CAAC"}
import type { Curve } from './index.ts';
import type { ECDHKey } from '../interface.js';
import type { ECDHKey } from '../interface.ts';
export declare function generateEphemeralKeyPair(curve: Curve): Promise<ECDHKey>;
//# sourceMappingURL=index.browser.d.ts.map

@@ -5,4 +5,4 @@ import { InvalidParametersError } from '@libp2p/interface';

import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
import { base64urlToBuffer } from '../../util.js';
import webcrypto from '../../webcrypto/index.js';
import { base64urlToBuffer } from "../../util.js";
import webcrypto from "../../webcrypto/index.js";
const curveLengths = {

@@ -9,0 +9,0 @@ 'P-256': 32,

@@ -1,2 +0,2 @@

import type { ECDHKey } from '../interface.js';
import type { ECDHKey } from '../interface.ts';
export type Curve = 'P-256' | 'P-384' | 'P-521';

@@ -3,0 +3,0 @@ /**

@@ -5,3 +5,3 @@ import { base58btc } from 'multiformats/bases/base58';

import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
import { publicKeyToProtobuf } from '../index.js';
import { publicKeyToProtobuf } from "../index.js";
import { hashAndVerify, hashAndSign } from "./index.js";

@@ -8,0 +8,0 @@ import { privateKeyToPKIMessage, publicKeyToPKIMessage } from "./utils.js";

@@ -1,2 +0,2 @@

import type { JWKKeyPair } from '../interface.js';
import type { JWKKeyPair } from '../interface.ts';
import type { AbortOptions } from '@libp2p/interface';

@@ -3,0 +3,0 @@ import type { Uint8ArrayList } from 'uint8arraylist';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/keys/ecdsa/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAE/C,eAAO,MAAM,eAAe,wBAAwB,CAAA;AACpD,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAC7C,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAE7C,wBAAsB,gBAAgB,CAAE,KAAK,GAAE,KAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAUnF;AAED,wBAAsB,WAAW,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAgBjI;AAED,wBAAsB,aAAa,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBjJ"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/keys/ecdsa/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAE/C,eAAO,MAAM,eAAe,wBAAwB,CAAA;AACpD,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAC7C,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAE7C,wBAAsB,gBAAgB,CAAE,KAAK,GAAE,KAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAUnF;AAED,wBAAsB,WAAW,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAgBjI;AAED,wBAAsB,aAAa,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBjJ"}

@@ -0,1 +1,2 @@

import { withArrayBuffer } from 'uint8arrays/with-array-buffer';
export const ECDSA_P_256_OID = '1.2.840.10045.3.1.7';

@@ -25,3 +26,3 @@ export const ECDSA_P_384_OID = '1.3.132.0.34';

}
}, privateKey, msg.subarray());
}, privateKey, withArrayBuffer(msg.subarray()));
options?.signal?.throwIfAborted();

@@ -41,3 +42,3 @@ return new Uint8Array(signature, 0, signature.byteLength);

}
}, publicKey, sig, msg.subarray());
}, publicKey, withArrayBuffer(sig), withArrayBuffer(msg.subarray()));
options?.signal?.throwIfAborted();

@@ -44,0 +45,0 @@ return result;

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/keys/ecdsa/index.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAA;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAA;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAA;AAE7C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAE,QAAe,OAAO;IAC5D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QAC9C,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,KAAK;KAClB,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE5B,OAAO;QACL,SAAS,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC;QAClE,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC;KACrE,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAE,GAAe,EAAE,GAAgC,EAAE,OAAsB;IAC1G,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE;QAC3D,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,GAAG,CAAC,GAAG,IAAI,OAAO;KAC/B,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IACnB,OAAO,EAAE,MAA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AC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAE,GAAe,EAAE,GAAe,EAAE,GAAgC,EAAE,OAAsB;IAC7H,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE;QAC1D,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,GAAG,CAAC,GAAG,IAAI,OAAO;KAC/B,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IACrB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;IAEjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACxC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;SAChB;KACF,EAAE,SAAS,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACpE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;IAEjC,OAAO,MAAM,CAAA;AACf,CAAC"}

@@ -1,2 +0,2 @@

import type { Curve } from '../ecdh/index.js';
import type { Curve } from '../ecdh/index.ts';
import type { ECDSAPublicKey, ECDSAPrivateKey } from '@libp2p/interface';

@@ -3,0 +3,0 @@ export declare function unmarshalECDSAPrivateKey(bytes: Uint8Array): ECDSAPrivateKey;

@@ -5,3 +5,3 @@ import { InvalidParametersError } from '@libp2p/interface';

import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
import { decodeDer, encodeBitString, encodeInteger, encodeOctetString, encodeSequence } from '../rsa/der.js';
import { decodeDer, encodeBitString, encodeInteger, encodeOctetString, encodeSequence } from "../rsa/der.js";
import { ECDSAPrivateKey as ECDSAPrivateKeyClass, ECDSAPublicKey as ECDSAPublicKeyClass } from "./ecdsa.js";

@@ -8,0 +8,0 @@ import { generateECDSAKey } from "./index.js";

@@ -6,3 +6,3 @@ import { base58btc } from 'multiformats/bases/base58';

import { isPromise } from "../../util.js";
import { publicKeyToProtobuf } from '../index.js';
import { publicKeyToProtobuf } from "../index.js";
import * as crypto from "./index.js";

@@ -9,0 +9,0 @@ import { ensureEd25519Key } from "./utils.js";

@@ -1,2 +0,2 @@

import type { Uint8ArrayKeyPair } from '../interface.js';
import type { Uint8ArrayKeyPair } from '../interface.ts';
import type { Uint8ArrayList } from 'uint8arraylist';

@@ -3,0 +3,0 @@ declare const PUBLIC_KEY_BYTE_LENGTH = 32;

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../../src/keys/ed25519/index.browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,QAAA,MAAM,sBAAsB,KAAK,CAAA;AACjC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAGlC,OAAO,EAAE,sBAAsB,IAAI,eAAe,EAAE,CAAA;AACpD,OAAO,EAAE,uBAAuB,IAAI,gBAAgB,EAAE,CAAA;AAatD,wBAAgB,WAAW,IAAK,iBAAiB,CAYhD;AAED,wBAAgB,mBAAmB,CAAE,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAiBxE;AAyBD,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,CAItG;AAED,wBAAsB,WAAW,CAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAUhH;AAYD,wBAAgB,kBAAkB,CAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAErH;AAED,wBAAsB,aAAa,CAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAU/H"}
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../../src/keys/ed25519/index.browser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,QAAA,MAAM,sBAAsB,KAAK,CAAA;AACjC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAGlC,OAAO,EAAE,sBAAsB,IAAI,eAAe,EAAE,CAAA;AACpD,OAAO,EAAE,uBAAuB,IAAI,gBAAgB,EAAE,CAAA;AAatD,wBAAgB,WAAW,IAAK,iBAAiB,CAYhD;AAED,wBAAgB,mBAAmB,CAAE,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAiBxE;AAyBD,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,CAItG;AAED,wBAAsB,WAAW,CAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAUhH;AAYD,wBAAgB,kBAAkB,CAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAErH;AAED,wBAAsB,aAAa,CAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAU/H"}
import { ed25519 as ed } from '@noble/curves/ed25519.js';
import { toString as uint8arrayToString } from 'uint8arrays/to-string';
import crypto from '../../webcrypto/index.js';
import { withArrayBuffer } from 'uint8arrays/with-array-buffer';
import crypto from "../../webcrypto/index.js";
const PUBLIC_KEY_BYTE_LENGTH = 32;

@@ -64,3 +65,3 @@ const PRIVATE_KEY_BYTE_LENGTH = 64; // private key is actually 32 bytes but for historical reasons we concat private and public keys

const key = await crypto.get().subtle.importKey('jwk', jwk, { name: 'Ed25519' }, true, ['sign']);
const sig = await crypto.get().subtle.sign({ name: 'Ed25519' }, key, msg instanceof Uint8Array ? msg : msg.subarray());
const sig = await crypto.get().subtle.sign({ name: 'Ed25519' }, key, withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()));
return new Uint8Array(sig, 0, sig.byteLength);

@@ -84,3 +85,3 @@ }

const key = await crypto.get().subtle.importKey('raw', publicKey.buffer, { name: 'Ed25519' }, false, ['verify']);
const isValid = await crypto.get().subtle.verify({ name: 'Ed25519' }, key, sig, msg instanceof Uint8Array ? msg : msg.subarray());
const isValid = await crypto.get().subtle.verify({ name: 'Ed25519' }, key, withArrayBuffer(sig), withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()));
return isValid;

@@ -87,0 +88,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../../src/keys/ed25519/index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAI7C,MAAM,sBAAsB,GAAG,EAAE,CAAA;AACjC,MAAM,uBAAuB,GAAG,EAAE,CAAA,CAAC,gGAAgG;AACnI,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAE3B,OAAO,EAAE,sBAAsB,IAAI,eAAe,EAAE,CAAA;AACpD,OAAO,EAAE,uBAAuB,IAAI,gBAAgB,EAAE,CAAA;AAEtD,+EAA+E;AAC/E,IAAI,gBAAqC,CAAA;AACzC,MAAM,gCAAgC,GAAG,CAAC,KAAK,IAAI,EAAE;IACnD,IAAI,CAAC;QACH,MA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M,UAAU,kBAAkB,CAAE,SAAqB,EAAE,GAAe,EAAE,GAAgC;IAC1G,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAA;AACpF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAE,SAAqB,EAAE,GAAe,EAAE,GAAgC;IAC3G,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,gBAAgB,GAAG,MAAM,gCAAgC,CAAA;IAC3D,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,sBAAsB,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACpD,CAAC;IAED,OAAO,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,UAAU,CAAE,aAAyB,EAAE,SAAqB;IACnE,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;QAChC,UAAU,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}

@@ -1,2 +0,2 @@

import type { Uint8ArrayKeyPair } from '../interface.js';
import type { Uint8ArrayKeyPair } from '../interface.ts';
import type { Uint8ArrayList } from 'uint8arraylist';

@@ -3,0 +3,0 @@ declare const PUBLIC_KEY_BYTE_LENGTH = 32;

import { InvalidParametersError } from '@libp2p/interface';
import { concat as uint8ArrayConcat } from 'uint8arrays/concat';
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
import * as hmac from '../hmac/index.js';
import * as hmac from "../hmac/index.js";
const cipherMap = {

@@ -6,0 +6,0 @@ 'AES-128': {

@@ -1,4 +0,4 @@

import randomBytes from '../../random-bytes.js';
import randomBytes from '../../random-bytes.ts';
import * as utils from './utils.ts';
import type { JWKKeyPair } from '../interface.js';
import type { JWKKeyPair } from '../interface.ts';
import type { AbortOptions } from '@libp2p/interface';

@@ -5,0 +5,0 @@ import type { Uint8ArrayList } from 'uint8arraylist';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../../src/keys/rsa/index.browser.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,uBAAuB,CAAA;AAE/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,eAAO,MAAM,oBAAoB,yBAAyB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wBAAsB,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB/F;AAED,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,CAAA;AAEzC,wBAAsB,WAAW,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAqBjI;AAED,wBAAsB,aAAa,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBjJ;AAgBD,wBAAgB,UAAU,CAAE,GAAG,EAAE,UAAU,GAAG,MAAM,CAQnD"}
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../../../src/keys/rsa/index.browser.ts"],"names":[],"mappings":"AAGA,OAAO,WAAW,MAAM,uBAAuB,CAAA;AAE/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,eAAO,MAAM,oBAAoB,yBAAyB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wBAAsB,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB/F;AAED,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,CAAA;AAEzC,wBAAsB,WAAW,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAqBjI;AAED,wBAAsB,aAAa,CAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBjJ;AAgBD,wBAAgB,UAAU,CAAE,GAAG,EAAE,UAAU,GAAG,MAAM,CAQnD"}
import { InvalidParametersError } from '@libp2p/interface';
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
import randomBytes from '../../random-bytes.js';
import webcrypto from '../../webcrypto/index.js';
import { withArrayBuffer } from 'uint8arrays/with-array-buffer';
import randomBytes from "../../random-bytes.js";
import webcrypto from "../../webcrypto/index.js";
import * as utils from "./utils.js";

@@ -29,3 +30,3 @@ export const RSAES_PKCS1_V1_5_OID = '1.2.840.113549.1.1.1';

options?.signal?.throwIfAborted();
const sig = await webcrypto.get().subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, privateKey, msg instanceof Uint8Array ? msg : msg.subarray());
const sig = await webcrypto.get().subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, privateKey, withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()));
options?.signal?.throwIfAborted();

@@ -40,3 +41,3 @@ return new Uint8Array(sig, 0, sig.byteLength);

options?.signal?.throwIfAborted();
const result = await webcrypto.get().subtle.verify({ name: 'RSASSA-PKCS1-v1_5' }, publicKey, sig, msg instanceof Uint8Array ? msg : msg.subarray());
const result = await webcrypto.get().subtle.verify({ name: 'RSASSA-PKCS1-v1_5' }, publicKey, withArrayBuffer(sig), withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()));
options?.signal?.throwIfAborted();

@@ -43,0 +44,0 @@ return result;

@@ -1,1 +0,1 @@

{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../../../src/keys/rsa/index.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,WAAW,MAAM,uBAAuB,CAAA;AAC/C,OAAO,SAAS,MAAM,0BAA0B,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAKnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,MAAM,CAAC,KAAK,UAAU,cAAc,CAAE,IAAY,EAAE,OAAsB;IACxE,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CACnD;QACE,IAAI,EAAE,mBAAmB;QACzB,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CAAC;QACtB,MAAM,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;IACtD,CAAC;SAAM,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,sBAAsB,CAAC,qBAAqB,CAAC,CAAA;IACzD,CAAC;IACD,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAA;IACtD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;AACzB,CAAC"}

@@ -1,4 +0,4 @@

import randomBytes from '../../random-bytes.js';
import randomBytes from '../../random-bytes.ts';
import * as utils from './utils.ts';
import type { JWKKeyPair } from '../interface.js';
import type { JWKKeyPair } from '../interface.ts';
import type { AbortOptions } from '@libp2p/interface';

@@ -5,0 +5,0 @@ import type { Uint8ArrayList } from 'uint8arraylist';

@@ -5,3 +5,3 @@ import crypto from 'node:crypto';

import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
import randomBytes from '../../random-bytes.js';
import randomBytes from "../../random-bytes.js";
import * as utils from "./utils.js";

@@ -8,0 +8,0 @@ const keypair = promisify(crypto.generateKeyPair);

@@ -1,2 +0,2 @@

import type { JWKKeyPair } from '../interface.js';
import type { JWKKeyPair } from '../interface.ts';
import type { RSAPrivateKey, RSAPublicKey } from '@libp2p/interface';

@@ -3,0 +3,0 @@ import type { Digest } from 'multiformats/hashes/digest';

@@ -6,3 +6,3 @@ import { InvalidParametersError, InvalidPublicKeyError } from '@libp2p/interface';

import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
import * as pb from '../keys.js';
import * as pb from "../keys.js";
import { decodeDer, encodeBitString, encodeInteger, encodeSequence } from "./der.js";

@@ -9,0 +9,0 @@ import { generateRSAKey, rsaKeySize } from "./index.js";

import { secp256k1 as secp } from '@noble/curves/secp256k1.js';
import { sha256 } from 'multiformats/hashes/sha2';
import { SigningError, VerificationError } from '../../errors.js';
import { isPromise } from '../../util.js';
import { SigningError, VerificationError } from "../../errors.js";
import { isPromise } from "../../util.js";
const PUBLIC_KEY_BYTE_LENGTH = 33;

@@ -6,0 +6,0 @@ const PRIVATE_KEY_BYTE_LENGTH = 32;

import crypto from 'node:crypto';
import { secp256k1 as secp } from '@noble/curves/secp256k1.js';
import { SigningError, VerificationError } from '../../errors.js';
import { SigningError, VerificationError } from "../../errors.js";
const PUBLIC_KEY_BYTE_LENGTH = 33;

@@ -5,0 +5,0 @@ const PRIVATE_KEY_BYTE_LENGTH = 32;

@@ -5,3 +5,3 @@ import { base58btc } from 'multiformats/bases/base58';

import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
import { publicKeyToProtobuf } from '../index.js';
import { publicKeyToProtobuf } from "../index.js";
import { hashAndVerify, hashAndSign } from "./index.js";

@@ -8,0 +8,0 @@ import { validateSecp256k1PublicKey, compressSecp256k1PublicKey, computeSecp256k1PublicKey, validateSecp256k1PrivateKey } from "./utils.js";

/**
* Generates a Uint8Array with length `number` populated by random bytes
*
* @deprecated use `crypto.getRandomValues()` instead
*/
export default function randomBytes(length: number): Uint8Array;
//# sourceMappingURL=random-bytes.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"random-bytes.d.ts","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAK/D"}
{"version":3,"file":"random-bytes.d.ts","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAK/D"}
import { InvalidParametersError } from '@libp2p/interface';
import { randomBytes as randB } from '@noble/hashes/utils.js';
/**
* Generates a Uint8Array with length `number` populated by random bytes
*
* @deprecated use `crypto.getRandomValues()` instead
*/

@@ -10,4 +11,4 @@ export default function randomBytes(length) {

}
return randB(length);
return crypto.getRandomValues(new Uint8Array(length));
}
//# sourceMappingURL=random-bytes.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE7D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAc;IACjD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,sBAAsB,CAAC,oDAAoD,CAAC,CAAA;IACxF,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC"}
{"version":3,"file":"random-bytes.js","sourceRoot":"","sources":["../../src/random-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,MAAc;IACjD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,sBAAsB,CAAC,oDAAoD,CAAC,CAAA;IACxF,CAAC;IACD,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;AACvD,CAAC"}

@@ -1,3 +0,5 @@

import webcrypto from './webcrypto.ts';
export default webcrypto;
declare const _default: {
get(win?: typeof globalThis): Crypto;
};
export default _default;
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/webcrypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC,eAAe,SAAS,CAAA"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/webcrypto/index.ts"],"names":[],"mappings":";kCAK0B,MAAM;;AADhC,wBAgBC"}

@@ -1,3 +0,17 @@

import webcrypto from "./webcrypto.js";
export default webcrypto;
import { WebCryptoMissingError } from "../errors.js";
// Check native crypto exists and is enabled (in insecure browser contexts
// `globalThis.crypto` exists but `globalThis.crypto.subtle` does not).
export default {
get(win = globalThis) {
const nativeCrypto = win.crypto;
if (nativeCrypto?.subtle == null) {
throw new WebCryptoMissingError('Missing Web Crypto API. ' +
'The most likely cause of this error is that this page is being accessed ' +
'from an insecure context (i.e. not HTTPS). For more information and ' +
'possible resolutions see ' +
'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api');
}
return nativeCrypto;
}
};
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webcrypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC,eAAe,SAAS,CAAA"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webcrypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,0EAA0E;AAC1E,uEAAuE;AACvE,eAAe;IACb,GAAG,CAAE,GAAG,GAAG,UAAU;QACnB,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAA;QAE/B,IAAI,YAAY,EAAE,MAAM,IAAI,IAAI,EAAE,CAAC;YACjC,MAAM,IAAI,qBAAqB,CAC7B,0BAA0B;gBAC1B,0EAA0E;gBAC1E,sEAAsE;gBACtE,2BAA2B;gBAC3B,wFAAwF,CACzF,CAAA;QACH,CAAC;QAED,OAAO,YAAY,CAAA;IACrB,CAAC;CACF,CAAA"}
{
"name": "@libp2p/crypto",
"version": "5.1.18",
"version": "5.1.19-404c7824a",
"description": "Crypto primitives for libp2p",

@@ -93,16 +93,16 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@libp2p/interface": "^3.2.2",
"@libp2p/interface": "3.2.3-404c7824a",
"@noble/curves": "^2.0.1",
"@noble/hashes": "^2.0.1",
"multiformats": "^13.4.0",
"protons-runtime": "^6.0.1",
"uint8arraylist": "^2.4.8",
"uint8arrays": "^5.1.0"
"multiformats": "^14.0.0",
"protons-runtime": "^7.0.0",
"uint8arraylist": "^3.0.2",
"uint8arrays": "^6.1.1"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"aegir": "^47.0.22",
"aegir": "^48.0.11",
"asn1js": "^3.0.6",
"benchmark": "^2.1.4",
"protons": "^8.1.1"
"protons": "^9.0.1"
},

@@ -115,6 +115,5 @@ "browser": {

"./dist/src/keys/rsa/index.js": "./dist/src/keys/rsa/index.browser.js",
"./dist/src/keys/secp256k1/index.js": "./dist/src/keys/secp256k1/index.browser.js",
"./dist/src/webcrypto/webcrypto.js": "./dist/src/webcrypto/webcrypto.browser.js"
"./dist/src/keys/secp256k1/index.js": "./dist/src/keys/secp256k1/index.browser.js"
},
"sideEffects": false
}
import { concat } from 'uint8arrays/concat'
import { fromString } from 'uint8arrays/from-string'
import webcrypto from '../webcrypto/index.js'
import { withArrayBuffer } from 'uint8arrays/with-array-buffer'
import webcrypto from '../webcrypto/index.ts'
import type { CreateAESCipherOptions, AESCipher } from './interface.ts'

@@ -56,3 +57,3 @@

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } }
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey'])
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey'])
cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['encrypt'])

@@ -65,3 +66,3 @@ } catch {

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } }
const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey'])
const rawKey = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey'])
cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['encrypt'])

@@ -71,3 +72,3 @@ }

// Encrypt the string.
const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, data)
const ciphertext = await crypto.subtle.encrypt(aesGcm, cryptoKey, withArrayBuffer(data))
return concat([salt, aesGcm.iv, new Uint8Array(ciphertext)])

@@ -96,3 +97,3 @@ }

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } }
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey'])
const runtimeDerivedEmptyPassword = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey'])
cryptoKey = await crypto.subtle.deriveKey(deriveParams, runtimeDerivedEmptyPassword, { name: algorithm, length: keyLength }, true, ['decrypt'])

@@ -105,3 +106,3 @@ } catch {

const deriveParams = { name: 'PBKDF2', salt, iterations, hash: { name: digest } }
const rawKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveKey'])
const rawKey = await crypto.subtle.importKey('raw', withArrayBuffer(password), { name: 'PBKDF2' }, false, ['deriveKey'])
cryptoKey = await crypto.subtle.deriveKey(deriveParams, rawKey, { name: algorithm, length: keyLength }, true, ['decrypt'])

@@ -111,3 +112,3 @@ }

// Decrypt the string.
const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, ciphertext)
const plaintext = await crypto.subtle.decrypt(aesGcm, cryptoKey, withArrayBuffer(ciphertext))
return new Uint8Array(plaintext)

@@ -114,0 +115,0 @@ }

@@ -1,2 +0,3 @@

import webcrypto from '../webcrypto/index.js'
import { withArrayBuffer } from 'uint8arrays/with-array-buffer'
import webcrypto from '../webcrypto/index.ts'
import lengths from './lengths.ts'

@@ -11,3 +12,3 @@

const sign = async (key: CryptoKey, data: Uint8Array): Promise<Uint8Array> => {
const buf = await webcrypto.get().subtle.sign({ name: 'HMAC' }, key, data)
const buf = await webcrypto.get().subtle.sign({ name: 'HMAC' }, key, withArrayBuffer(data))
return new Uint8Array(buf, 0, buf.byteLength)

@@ -21,3 +22,3 @@ }

'raw',
secret,
withArrayBuffer(secret),
{

@@ -24,0 +25,0 @@ name: 'HMAC',

@@ -5,6 +5,6 @@ import { InvalidParametersError } from '@libp2p/interface'

import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { base64urlToBuffer } from '../../util.js'
import webcrypto from '../../webcrypto/index.js'
import { base64urlToBuffer } from '../../util.ts'
import webcrypto from '../../webcrypto/index.ts'
import type { Curve } from './index.ts'
import type { ECDHKey, ECDHKeyPair, JWKEncodedPrivateKey, JWKEncodedPublicKey } from '../interface.js'
import type { ECDHKey, ECDHKeyPair, JWKEncodedPrivateKey, JWKEncodedPublicKey } from '../interface.ts'

@@ -11,0 +11,0 @@ const curveLengths = {

import crypto from 'crypto'
import { InvalidParametersError } from '@libp2p/interface'
import type { ECDHKey, ECDHKeyPair } from '../interface.js'
import type { ECDHKey, ECDHKeyPair } from '../interface.ts'

@@ -5,0 +5,0 @@ export type Curve = 'P-256' | 'P-384' | 'P-521'

@@ -5,3 +5,3 @@ import { base58btc } from 'multiformats/bases/base58'

import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { publicKeyToProtobuf } from '../index.js'
import { publicKeyToProtobuf } from '../index.ts'
import { hashAndVerify, hashAndSign } from './index.ts'

@@ -8,0 +8,0 @@ import { privateKeyToPKIMessage, publicKeyToPKIMessage } from './utils.ts'

@@ -1,2 +0,3 @@

import type { JWKKeyPair } from '../interface.js'
import { withArrayBuffer } from 'uint8arrays/with-array-buffer'
import type { JWKKeyPair } from '../interface.ts'
import type { AbortOptions } from '@libp2p/interface'

@@ -35,3 +36,3 @@ import type { Uint8ArrayList } from 'uint8arraylist'

}
}, privateKey, msg.subarray())
}, privateKey, withArrayBuffer(msg.subarray()))
options?.signal?.throwIfAborted()

@@ -54,3 +55,3 @@

}
}, publicKey, sig, msg.subarray())
}, publicKey, withArrayBuffer(sig), withArrayBuffer(msg.subarray()))
options?.signal?.throwIfAborted()

@@ -57,0 +58,0 @@

@@ -5,6 +5,6 @@ import { InvalidParametersError } from '@libp2p/interface'

import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { decodeDer, encodeBitString, encodeInteger, encodeOctetString, encodeSequence } from '../rsa/der.js'
import { decodeDer, encodeBitString, encodeInteger, encodeOctetString, encodeSequence } from '../rsa/der.ts'
import { ECDSAPrivateKey as ECDSAPrivateKeyClass, ECDSAPublicKey as ECDSAPublicKeyClass } from './ecdsa.ts'
import { generateECDSAKey } from './index.ts'
import type { Curve } from '../ecdh/index.js'
import type { Curve } from '../ecdh/index.ts'
import type { ECDSAPublicKey, ECDSAPrivateKey } from '@libp2p/interface'

@@ -11,0 +11,0 @@

@@ -6,3 +6,3 @@ import { base58btc } from 'multiformats/bases/base58'

import { isPromise } from '../../util.ts'
import { publicKeyToProtobuf } from '../index.js'
import { publicKeyToProtobuf } from '../index.ts'
import * as crypto from './index.ts'

@@ -9,0 +9,0 @@ import { ensureEd25519Key } from './utils.ts'

import { ed25519 as ed } from '@noble/curves/ed25519.js'
import { toString as uint8arrayToString } from 'uint8arrays/to-string'
import crypto from '../../webcrypto/index.js'
import type { Uint8ArrayKeyPair } from '../interface.js'
import { withArrayBuffer } from 'uint8arrays/with-array-buffer'
import crypto from '../../webcrypto/index.ts'
import type { Uint8ArrayKeyPair } from '../interface.ts'
import type { Uint8ArrayList } from 'uint8arraylist'

@@ -76,3 +77,3 @@

const key = await crypto.get().subtle.importKey('jwk', jwk, { name: 'Ed25519' }, true, ['sign'])
const sig = await crypto.get().subtle.sign({ name: 'Ed25519' }, key, msg instanceof Uint8Array ? msg : msg.subarray())
const sig = await crypto.get().subtle.sign({ name: 'Ed25519' }, key, withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()))

@@ -103,3 +104,3 @@ return new Uint8Array(sig, 0, sig.byteLength)

const key = await crypto.get().subtle.importKey('raw', publicKey.buffer, { name: 'Ed25519' }, false, ['verify'])
const isValid = await crypto.get().subtle.verify({ name: 'Ed25519' }, key, sig, msg instanceof Uint8Array ? msg : msg.subarray())
const isValid = await crypto.get().subtle.verify({ name: 'Ed25519' }, key, withArrayBuffer(sig), withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray()))
return isValid

@@ -106,0 +107,0 @@ }

@@ -6,3 +6,3 @@ import crypto from 'crypto'

import { toString as uint8arrayToString } from 'uint8arrays/to-string'
import type { Uint8ArrayKeyPair } from '../interface.js'
import type { Uint8ArrayKeyPair } from '../interface.ts'
import type { Uint8ArrayList } from 'uint8arraylist'

@@ -9,0 +9,0 @@

import { InvalidParametersError } from '@libp2p/interface'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as hmac from '../hmac/index.js'
import * as hmac from '../hmac/index.ts'
import type { EnhancedKey, EnhancedKeyPair } from './interface.ts'

@@ -6,0 +6,0 @@

import { InvalidParametersError } from '@libp2p/interface'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import randomBytes from '../../random-bytes.js'
import webcrypto from '../../webcrypto/index.js'
import { withArrayBuffer } from 'uint8arrays/with-array-buffer'
import randomBytes from '../../random-bytes.ts'
import webcrypto from '../../webcrypto/index.ts'
import * as utils from './utils.ts'
import type { JWKKeyPair } from '../interface.js'
import type { JWKKeyPair } from '../interface.ts'
import type { AbortOptions } from '@libp2p/interface'

@@ -52,3 +53,3 @@ import type { Uint8ArrayList } from 'uint8arraylist'

privateKey,
msg instanceof Uint8Array ? msg : msg.subarray()
withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray())
)

@@ -76,4 +77,4 @@ options?.signal?.throwIfAborted()

publicKey,
sig,
msg instanceof Uint8Array ? msg : msg.subarray()
withArrayBuffer(sig),
withArrayBuffer(msg instanceof Uint8Array ? msg : msg.subarray())
)

@@ -80,0 +81,0 @@ options?.signal?.throwIfAborted()

@@ -5,5 +5,5 @@ import crypto from 'node:crypto'

import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import randomBytes from '../../random-bytes.js'
import randomBytes from '../../random-bytes.ts'
import * as utils from './utils.ts'
import type { JWKKeyPair } from '../interface.js'
import type { JWKKeyPair } from '../interface.ts'
import type { AbortOptions } from '@libp2p/interface'

@@ -10,0 +10,0 @@ import type { Uint8ArrayList } from 'uint8arraylist'

@@ -6,7 +6,7 @@ import { InvalidParametersError, InvalidPublicKeyError } from '@libp2p/interface'

import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import * as pb from '../keys.js'
import * as pb from '../keys.ts'
import { decodeDer, encodeBitString, encodeInteger, encodeSequence } from './der.ts'
import { generateRSAKey, rsaKeySize } from './index.ts'
import { RSAPrivateKey as RSAPrivateKeyClass, RSAPublicKey as RSAPublicKeyClass } from './rsa.ts'
import type { JWKKeyPair } from '../interface.js'
import type { JWKKeyPair } from '../interface.ts'
import type { RSAPrivateKey, RSAPublicKey } from '@libp2p/interface'

@@ -13,0 +13,0 @@ import type { Digest } from 'multiformats/hashes/digest'

import { secp256k1 as secp } from '@noble/curves/secp256k1.js'
import { sha256 } from 'multiformats/hashes/sha2'
import { SigningError, VerificationError } from '../../errors.js'
import { isPromise } from '../../util.js'
import { SigningError, VerificationError } from '../../errors.ts'
import { isPromise } from '../../util.ts'
import type { AbortOptions } from '@libp2p/interface'

@@ -6,0 +6,0 @@ import type { Uint8ArrayList } from 'uint8arraylist'

import crypto from 'node:crypto'
import { secp256k1 as secp } from '@noble/curves/secp256k1.js'
import { SigningError, VerificationError } from '../../errors.js'
import { SigningError, VerificationError } from '../../errors.ts'
import type { AbortOptions } from '@libp2p/interface'

@@ -5,0 +5,0 @@ import type { Uint8ArrayList } from 'uint8arraylist'

@@ -5,3 +5,3 @@ import { base58btc } from 'multiformats/bases/base58'

import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { publicKeyToProtobuf } from '../index.js'
import { publicKeyToProtobuf } from '../index.ts'
import { hashAndVerify, hashAndSign } from './index.ts'

@@ -8,0 +8,0 @@ import { validateSecp256k1PublicKey, compressSecp256k1PublicKey, computeSecp256k1PublicKey, validateSecp256k1PrivateKey } from './utils.ts'

import { InvalidParametersError } from '@libp2p/interface'
import { randomBytes as randB } from '@noble/hashes/utils.js'
/**
* Generates a Uint8Array with length `number` populated by random bytes
*
* @deprecated use `crypto.getRandomValues()` instead
*/

@@ -11,3 +12,3 @@ export default function randomBytes (length: number): Uint8Array {

}
return randB(length)
return crypto.getRandomValues(new Uint8Array(length))
}

@@ -1,3 +0,21 @@

import webcrypto from './webcrypto.ts'
import { WebCryptoMissingError } from '../errors.ts'
export default webcrypto
// Check native crypto exists and is enabled (in insecure browser contexts
// `globalThis.crypto` exists but `globalThis.crypto.subtle` does not).
export default {
get (win = globalThis): Crypto {
const nativeCrypto = win.crypto
if (nativeCrypto?.subtle == null) {
throw new WebCryptoMissingError(
'Missing Web Crypto API. ' +
'The most likely cause of this error is that this page is being accessed ' +
'from an insecure context (i.e. not HTTPS). For more information and ' +
'possible resolutions see ' +
'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api'
)
}
return nativeCrypto
}
}
declare const _default: {
get(win?: typeof globalThis): Crypto;
};
export default _default;
//# sourceMappingURL=webcrypto.browser.d.ts.map
{"version":3,"file":"webcrypto.browser.d.ts","sourceRoot":"","sources":["../../../src/webcrypto/webcrypto.browser.ts"],"names":[],"mappings":";;;AAMA,wBAgBC"}
/* eslint-env browser */
import { WebCryptoMissingError } from '../errors.js';
// Check native crypto exists and is enabled (In insecure context `self.crypto`
// exists but `self.crypto.subtle` does not).
export default {
get(win = globalThis) {
const nativeCrypto = win.crypto;
if (nativeCrypto?.subtle == null) {
throw new WebCryptoMissingError('Missing Web Crypto API. ' +
'The most likely cause of this error is that this page is being accessed ' +
'from an insecure context (i.e. not HTTPS). For more information and ' +
'possible resolutions see ' +
'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api');
}
return nativeCrypto;
}
};
//# sourceMappingURL=webcrypto.browser.js.map
{"version":3,"file":"webcrypto.browser.js","sourceRoot":"","sources":["../../../src/webcrypto/webcrypto.browser.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,+EAA+E;AAC/E,6CAA6C;AAC7C,eAAe;IACb,GAAG,CAAE,GAAG,GAAG,UAAU;QACnB,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAA;QAE/B,IAAI,YAAY,EAAE,MAAM,IAAI,IAAI,EAAE,CAAC;YACjC,MAAM,IAAI,qBAAqB,CAC7B,0BAA0B;gBAC1B,0EAA0E;gBAC1E,sEAAsE;gBACtE,2BAA2B;gBAC3B,wFAAwF,CACzF,CAAA;QACH,CAAC;QAED,OAAO,YAAY,CAAA;IACrB,CAAC;CACF,CAAA"}
import { webcrypto } from 'crypto';
declare const _default: {
get(win?: typeof globalThis): webcrypto.Crypto;
};
export default _default;
//# sourceMappingURL=webcrypto.d.ts.map
{"version":3,"file":"webcrypto.d.ts","sourceRoot":"","sources":["../../../src/webcrypto/webcrypto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;;;;AAIlC,wBAIC"}
/* eslint-env browser */
import { webcrypto } from 'crypto';
// globalThis `SubtleCrypto` shipped in node.js 19.x, Electron currently uses
// v18.x so this override file is necessary until Electron updates
export default {
get(win = globalThis) {
return webcrypto;
}
};
//# sourceMappingURL=webcrypto.js.map
{"version":3,"file":"webcrypto.js","sourceRoot":"","sources":["../../../src/webcrypto/webcrypto.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,6EAA6E;AAC7E,kEAAkE;AAClE,eAAe;IACb,GAAG,CAAE,GAAG,GAAG,UAAU;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;CACF,CAAA"}
{
"AESCipher": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.ciphers.AES_GCM.AESCipher.html",
"CreateAESCipherOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.ciphers.AES_GCM.CreateAESCipherOptions.html",
"create": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.ciphers.AES_GCM.create.html",
"HMAC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.hmac.HMAC.html",
"./hmac:HMAC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.hmac.HMAC.html",
"./hmac:create": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.hmac.create.html",
"pbkdf2": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.index.pbkdf2.html",
"randomBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.index.randomBytes.html",
"ECDHKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.ECDHKey.html",
"ECDHKeyPair": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.ECDHKeyPair.html",
"EnhancedKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.EnhancedKey.html",
"EnhancedKeyPair": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_crypto.keys.EnhancedKeyPair.html",
"Curve": "https://libp2p.github.io/js-libp2p/types/_libp2p_crypto.keys.Curve.html",
"generateEphemeralKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateEphemeralKeyPair.html",
"generateKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPair.html",
"./keys:generateKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPair.html",
"generateKeyPairFromSeed": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPairFromSeed.html",
"./keys:generateKeyPairFromSeed": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.generateKeyPairFromSeed.html",
"keyStretcher": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.keyStretcher.html",
"privateKeyFromCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromCryptoKeyPair.html",
"./keys:privateKeyFromCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromCryptoKeyPair.html",
"privateKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromProtobuf.html",
"./keys:privateKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromProtobuf.html",
"privateKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromRaw.html",
"./keys:privateKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyFromRaw.html",
"privateKeyToCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToCryptoKeyPair.html",
"./keys:privateKeyToCryptoKeyPair": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToCryptoKeyPair.html",
"privateKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToProtobuf.html",
"./keys:privateKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.privateKeyToProtobuf.html",
"publicKeyFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromMultihash.html",
"./keys:publicKeyFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromMultihash.html",
"publicKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromProtobuf.html",
"./keys:publicKeyFromProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromProtobuf.html",
"publicKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromRaw.html",
"./keys:publicKeyFromRaw": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyFromRaw.html",
"publicKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyToProtobuf.html",
"./keys:publicKeyToProtobuf": "https://libp2p.github.io/js-libp2p/functions/_libp2p_crypto.keys.publicKeyToProtobuf.html",
"default": "https://libp2p.github.io/js-libp2p/variables/_libp2p_crypto.webcrypto.default.html"
}
/* eslint-env browser */
import { WebCryptoMissingError } from '../errors.js'
// Check native crypto exists and is enabled (In insecure context `self.crypto`
// exists but `self.crypto.subtle` does not).
export default {
get (win = globalThis) {
const nativeCrypto = win.crypto
if (nativeCrypto?.subtle == null) {
throw new WebCryptoMissingError(
'Missing Web Crypto API. ' +
'The most likely cause of this error is that this page is being accessed ' +
'from an insecure context (i.e. not HTTPS). For more information and ' +
'possible resolutions see ' +
'https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api'
)
}
return nativeCrypto
}
}
/* eslint-env browser */
import { webcrypto } from 'crypto'
// globalThis `SubtleCrypto` shipped in node.js 19.x, Electron currently uses
// v18.x so this override file is necessary until Electron updates
export default {
get (win = globalThis) {
return webcrypto
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display