@solana/assertions
Advanced tools
Comparing version 2.0.0-experimental.7d79aca to 2.0.0-experimental.89b2a1e
@@ -31,2 +31,8 @@ // src/subtle-crypto.ts | ||
} | ||
async function assertDigestCapabilityIsAvailable() { | ||
assertIsSecureContext(); | ||
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") { | ||
throw new Error("No digest implementation could be found"); | ||
} | ||
} | ||
async function assertKeyGenerationIsAvailable() { | ||
@@ -62,4 +68,4 @@ assertIsSecureContext(); | ||
export { assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
export { assertDigestCapabilityIsAvailable, assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.browser.js.map |
@@ -35,2 +35,8 @@ this.globalThis = this.globalThis || {}; | ||
} | ||
async function assertDigestCapabilityIsAvailable() { | ||
assertIsSecureContext(); | ||
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") { | ||
throw new Error("No digest implementation could be found"); | ||
} | ||
} | ||
async function assertKeyGenerationIsAvailable() { | ||
@@ -66,2 +72,3 @@ assertIsSecureContext(); | ||
exports.assertDigestCapabilityIsAvailable = assertDigestCapabilityIsAvailable; | ||
exports.assertKeyExporterIsAvailable = assertKeyExporterIsAvailable; | ||
@@ -68,0 +75,0 @@ exports.assertKeyGenerationIsAvailable = assertKeyGenerationIsAvailable; |
@@ -24,2 +24,7 @@ // src/subtle-crypto.ts | ||
} | ||
async function assertDigestCapabilityIsAvailable() { | ||
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") { | ||
throw new Error("No digest implementation could be found"); | ||
} | ||
} | ||
async function assertKeyGenerationIsAvailable() { | ||
@@ -51,4 +56,4 @@ if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") { | ||
export { assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
export { assertDigestCapabilityIsAvailable, assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
@@ -24,2 +24,7 @@ // src/subtle-crypto.ts | ||
} | ||
async function assertDigestCapabilityIsAvailable() { | ||
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") { | ||
throw new Error("No digest implementation could be found"); | ||
} | ||
} | ||
async function assertKeyGenerationIsAvailable() { | ||
@@ -51,4 +56,4 @@ if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") { | ||
export { assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
export { assertDigestCapabilityIsAvailable, assertKeyExporterIsAvailable, assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
@@ -5,12 +5,13 @@ this.globalThis = this.globalThis || {}; | ||
function o(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}var e;async function i(n){return e===void 0&&(e=new Promise(t=>{n.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{t(e=!1);}).then(()=>{t(e=!0);});})),typeof e=="boolean"?e:await e}async function a(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await i(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs. | ||
function o(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}var e;async function r(n){return e===void 0&&(e=new Promise(t=>{n.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{t(e=!1);}).then(()=>{t(e=!0);});})),typeof e=="boolean"?e:await e}async function a(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!="function")throw new Error("No digest implementation could be found")}async function l(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await r(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs. | ||
Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519. | ||
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function l(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function p(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function c(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")} | ||
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function p(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function c(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function u(){if(o(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")} | ||
exports.assertKeyExporterIsAvailable = l; | ||
exports.assertKeyGenerationIsAvailable = a; | ||
exports.assertSigningCapabilityIsAvailable = p; | ||
exports.assertVerificationCapabilityIsAvailable = c; | ||
exports.assertDigestCapabilityIsAvailable = a; | ||
exports.assertKeyExporterIsAvailable = p; | ||
exports.assertKeyGenerationIsAvailable = l; | ||
exports.assertSigningCapabilityIsAvailable = c; | ||
exports.assertVerificationCapabilityIsAvailable = u; | ||
@@ -17,0 +18,0 @@ return exports; |
@@ -0,1 +1,2 @@ | ||
export declare function assertDigestCapabilityIsAvailable(): Promise<void>; | ||
export declare function assertKeyGenerationIsAvailable(): Promise<void>; | ||
@@ -2,0 +3,0 @@ export declare function assertKeyExporterIsAvailable(): Promise<void>; |
{ | ||
"name": "@solana/assertions", | ||
"version": "2.0.0-experimental.7d79aca", | ||
"version": "2.0.0-experimental.89b2a1e", | ||
"description": "Helpers for asserting that a JavaScript environment supports certain features necessary for the operation of the Solana JavaScript SDK", | ||
@@ -53,4 +53,3 @@ "exports": { | ||
"@solana/eslint-config-solana": "^1.0.2", | ||
"@swc/core": "^1.3.71", | ||
"@swc/jest": "^0.2.26", | ||
"@swc/jest": "^0.2.27", | ||
"@types/jest": "^29.5.3", | ||
@@ -62,3 +61,2 @@ "@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"eslint-plugin-jest": "^27.2.3", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-sort-keys-fix": "^1.1.2", | ||
@@ -69,5 +67,3 @@ "jest": "^29.6.1", | ||
"jest-runner-prettier": "^1.0.0", | ||
"postcss": "^8.4.12", | ||
"prettier": "^2.8.8", | ||
"ts-node": "^10.9.1", | ||
"tsup": "6.7.0", | ||
@@ -74,0 +70,0 @@ "typescript": "^5.1.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56635
20
476