iron-webcrypto
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -0,1 +1,13 @@ | ||
interface _Crypto { | ||
readonly subtle: _SubtleCrypto; | ||
getRandomValues: (array: Uint8Array) => Uint8Array; | ||
} | ||
interface _SubtleCrypto { | ||
decrypt: (algorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams, key: CryptoKey, data: Uint8Array) => Promise<ArrayBuffer>; | ||
deriveBits: (algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number) => Promise<ArrayBuffer>; | ||
encrypt: (algorithm: AesCbcParams | AesCtrParams | AesGcmParams | AlgorithmIdentifier | RsaOaepParams, key: CryptoKey, data: Uint8Array) => Promise<ArrayBuffer>; | ||
importKey: (format: Exclude<KeyFormat, 'jwk'>, keyData: ArrayBuffer | Uint8Array, algorithm: AesKeyAlgorithm | AlgorithmIdentifier | EcKeyImportParams | HmacImportParams | RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[]) => Promise<CryptoKey>; | ||
sign: (algorithm: AlgorithmIdentifier | EcdsaParams | RsaPssParams, key: CryptoKey, data: Uint8Array) => Promise<ArrayBuffer>; | ||
} | ||
/** | ||
@@ -140,3 +152,3 @@ * seal() method options. | ||
*/ | ||
declare const randomBits: (_crypto: Crypto, bits: number) => Uint8Array; | ||
declare const randomBits: (_crypto: _Crypto, bits: number) => Uint8Array; | ||
/** | ||
@@ -149,3 +161,3 @@ * Generates a key from the password. | ||
*/ | ||
declare const generateKey: (_crypto: Crypto, password: Password, options: GenerateKeyOptions) => Promise<Key>; | ||
declare const generateKey: (_crypto: _Crypto, password: Password, options: GenerateKeyOptions) => Promise<Key>; | ||
/** | ||
@@ -159,3 +171,3 @@ * Encrypts data. | ||
*/ | ||
declare const encrypt: (_crypto: Crypto, password: Password, options: GenerateKeyOptions, data: string) => Promise<{ | ||
declare const encrypt: (_crypto: _Crypto, password: Password, options: GenerateKeyOptions, data: string) => Promise<{ | ||
encrypted: Uint8Array; | ||
@@ -172,3 +184,3 @@ key: Key; | ||
*/ | ||
declare const decrypt: (_crypto: Crypto, password: Password, options: GenerateKeyOptions, data: Uint8Array | string) => Promise<string>; | ||
declare const decrypt: (_crypto: _Crypto, password: Password, options: GenerateKeyOptions, data: Uint8Array | string) => Promise<string>; | ||
/** | ||
@@ -182,3 +194,3 @@ * Calculates a HMAC digest. | ||
*/ | ||
declare const hmacWithPassword: (_crypto: Crypto, password: Password, options: GenerateKeyOptions, data: string) => Promise<HMacResult>; | ||
declare const hmacWithPassword: (_crypto: _Crypto, password: Password, options: GenerateKeyOptions, data: string) => Promise<HMacResult>; | ||
/** | ||
@@ -192,3 +204,3 @@ * Serializes, encrypts, and signs objects into an iron protocol string. | ||
*/ | ||
declare const seal: (_crypto: Crypto, object: unknown, password: RawPassword, options: SealOptions) => Promise<string>; | ||
declare const seal: (_crypto: _Crypto, object: unknown, password: RawPassword, options: SealOptions) => Promise<string>; | ||
/** | ||
@@ -202,4 +214,4 @@ * Verifies, decrypts, and reconstruct an iron protocol string into an object. | ||
*/ | ||
declare const unseal: (_crypto: Crypto, sealed: string, password: Password | password.Hash, options: SealOptions) => Promise<unknown>; | ||
declare const unseal: (_crypto: _Crypto, sealed: string, password: Password | password.Hash, options: SealOptions) => Promise<unknown>; | ||
export { GenerateKeyOptions, HMacResult, Key, Password, RawPassword, SealOptions, SealOptionsSub, algorithms, base64urlDecode, base64urlEncode, bufferToString, clone, decrypt, defaults, encrypt, generateKey, hmacWithPassword, macFormatVersion, macPrefix, password, randomBits, seal, stringToBuffer, unseal }; |
@@ -93,3 +93,3 @@ // node_modules/.pnpm/@smithy+util-base64@2.0.0/node_modules/@smithy/util-base64/dist-es/constants.browser.js | ||
}; | ||
var base64urlEncode = (value) => toBase64(value instanceof Uint8Array ? value : stringToBuffer(value)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); | ||
var base64urlEncode = (value) => toBase64(typeof value === "string" ? stringToBuffer(value) : value).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); | ||
var base64urlDecode = (value) => fromBase64( | ||
@@ -96,0 +96,0 @@ value.replace(/-/g, "+").replace(/_/g, "/") + Array((4 - value.length % 4) % 4 + 1).join("=") |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "iron-webcrypto", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "a cryptographic utility for sealing-unsealing a JSON object using symmetric key encryption with message integrity verification", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "^0.8.0", | ||
"@arethetypeswrong/cli": "^0.9.0", | ||
"@commitlint/cli": "^17.7.1", | ||
@@ -68,7 +68,7 @@ "@commitlint/config-conventional": "^17.7.0", | ||
"tsup": "^7.2.0", | ||
"tsx": "^3.12.7", | ||
"tsx": "^3.12.8", | ||
"typescript": "^5.2.2" | ||
}, | ||
"packageManager": "pnpm@8.7.0", | ||
"packageManager": "pnpm@8.7.1", | ||
"runkitExampleFilename": "dist/example.js" | ||
} |
@@ -27,3 +27,3 @@ # iron-webcrypto (beta) [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue?style=flat-square)](https://www.jsdocs.io/package/iron-webcrypto) [![downloads](https://img.shields.io/npm/dm/iron-webcrypto?style=flat-square)](https://www.npmjs.com/package/iron-webcrypto) [![npm](https://img.shields.io/npm/v/iron-webcrypto?style=flat-square)](https://www.npmjs.com/package/iron-webcrypto) | ||
```ts | ||
import * as Iron from 'https://esm.sh/iron-webcrypto@0.8.1' | ||
import * as Iron from 'https://esm.sh/iron-webcrypto@0.9.0' | ||
``` | ||
@@ -30,0 +30,0 @@ |
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
47096
837