webcrypto-core
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -5,5 +5,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkDerivedKeyParams(algorithm: AesKeyGenParams): void; | ||
abstract onGenerateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onGenerateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
} |
@@ -7,4 +7,4 @@ import { KeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: AesCbcParams): void; | ||
abstract onEncrypt(algorithm: AesCbcParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesCbcParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onEncrypt(algorithm: AesCbcParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesCbcParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -7,4 +7,4 @@ import { KeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: AesCmacParams): void; | ||
abstract onSign(algorithm: AesCmacParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: AesCmacParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
abstract onSign(algorithm: AesCmacParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: AesCmacParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
} |
@@ -7,4 +7,4 @@ import { KeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: AesCtrParams): void; | ||
abstract onEncrypt(algorithm: AesCtrParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesCtrParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onEncrypt(algorithm: AesCtrParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesCtrParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -6,4 +6,4 @@ import { KeyUsages } from "../types"; | ||
usages: KeyUsages; | ||
abstract onEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -7,4 +7,4 @@ import { KeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: AesGcmParams): void; | ||
abstract onEncrypt(algorithm: AesGcmParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesGcmParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onEncrypt(algorithm: AesGcmParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: AesGcmParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -25,7 +25,7 @@ import { KeyAlgorithm } from "../key"; | ||
checkDerivedKeyParams(algorithm: DesDerivedKeyParams): void; | ||
abstract onGenerateKey(algorithm: DesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: DesImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onEncrypt(algorithm: DesParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: DesParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onGenerateKey(algorithm: DesKeyGenParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: DesImportParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onEncrypt(algorithm: DesParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: DesParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -6,5 +6,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkNamedCurve(namedCurve: string): void; | ||
abstract onGenerateKey(algorithm: EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: EcKeyImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onGenerateKey(algorithm: EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKeyPair>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: EcKeyImportParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
} |
@@ -9,3 +9,3 @@ import { CryptoKey } from "../key"; | ||
checkAlgorithmParams(algorithm: EcdhKeyDeriveParams): void; | ||
abstract onDeriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
abstract onDeriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -9,4 +9,4 @@ import { ProviderKeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: EcdsaParams): void; | ||
abstract onSign(algorithm: EcdsaParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: EcdsaParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
abstract onSign(algorithm: EcdsaParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: EcdsaParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
} |
@@ -8,5 +8,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkAlgorithmParams(algorithm: HkdfParams): void; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): void; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onDeriveBits(algorithm: HkdfParams, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): void; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onDeriveBits(algorithm: HkdfParams, baseKey: CryptoKey, length: number, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -14,5 +14,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkImportParams(algorithm: HmacImportParams): void; | ||
abstract onGenerateKey(algorithm: HmacKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: HmacImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onGenerateKey(algorithm: HmacKeyGenParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: HmacImportParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
} |
@@ -8,5 +8,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkAlgorithmParams(algorithm: Pbkdf2Params): void; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): void; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onDeriveBits(algorithm: Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): void; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
abstract onDeriveBits(algorithm: Pbkdf2Params, baseKey: CryptoKey, length: number, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -14,30 +14,30 @@ import { KeyUsages, ProviderKeyUsages } from "./types"; | ||
abstract readonly usages: ProviderKeyUsages; | ||
digest(algorithm: Algorithm, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
digest(algorithm: Algorithm, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
checkDigest(algorithm: Algorithm, data: ArrayBuffer): void; | ||
onDigest(algorithm: Algorithm, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
generateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>; | ||
checkGenerateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): void; | ||
generateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKeyPair | CryptoKey>; | ||
checkGenerateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): void; | ||
checkGenerateKeyParams(algorithm: Algorithm): void; | ||
onGenerateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>; | ||
sign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
checkSign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): void; | ||
onSign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
verify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
checkVerify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): void; | ||
onVerify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
encrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions): Promise<ArrayBuffer>; | ||
checkEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions): void; | ||
onEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
decrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions): Promise<ArrayBuffer>; | ||
checkDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions): void; | ||
onDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number, options?: IProviderCheckOptions): Promise<ArrayBuffer>; | ||
checkDeriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number, options?: IProviderCheckOptions): void; | ||
onDeriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
exportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
checkExportKey(format: KeyFormat, key: CryptoKey): void; | ||
onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
importKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): void; | ||
onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
onGenerateKey(algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKeyPair | CryptoKey>; | ||
sign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
checkSign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): void; | ||
onSign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
verify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
checkVerify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): void; | ||
onVerify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
encrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions, ...args: any[]): Promise<ArrayBuffer>; | ||
checkEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions, ...args: any[]): void; | ||
onEncrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
decrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions, ...args: any[]): Promise<ArrayBuffer>; | ||
checkDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, options?: IProviderCheckOptions, ...args: any[]): void; | ||
onDecrypt(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
deriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number, options?: IProviderCheckOptions, ...args: any[]): Promise<ArrayBuffer>; | ||
checkDeriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number, options?: IProviderCheckOptions, ...args: any[]): void; | ||
onDeriveBits(algorithm: Algorithm, baseKey: CryptoKey, length: number, ...args: any[]): Promise<ArrayBuffer>; | ||
exportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
checkExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): void; | ||
onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
importKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
checkImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): void; | ||
onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
checkAlgorithmName(algorithm: Algorithm): void; | ||
@@ -44,0 +44,0 @@ checkAlgorithmParams(algorithm: Algorithm): void; |
@@ -6,5 +6,5 @@ import { ProviderCrypto } from "../provider"; | ||
checkImportParams(algorithm: RsaHashedImportParams): void; | ||
abstract onGenerateKey(algorithm: RsaHashedKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>; | ||
abstract onGenerateKey(algorithm: RsaHashedKeyGenParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKeyPair>; | ||
abstract onExportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
abstract onImportKey(format: KeyFormat, keyData: JsonWebKey | ArrayBuffer, algorithm: RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKey>; | ||
} |
@@ -7,4 +7,4 @@ import { ProviderKeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: RsaOaepParams): void; | ||
abstract onEncrypt(algorithm: RsaOaepParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: RsaOaepParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onEncrypt(algorithm: RsaOaepParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onDecrypt(algorithm: RsaOaepParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
} |
@@ -7,4 +7,4 @@ import { ProviderKeyUsages } from "../types"; | ||
checkAlgorithmParams(algorithm: RsaPssParams): void; | ||
abstract onSign(algorithm: RsaPssParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: RsaPssParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
abstract onSign(algorithm: RsaPssParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: RsaPssParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
} |
@@ -8,4 +8,4 @@ import { ProviderKeyUsages } from "../types"; | ||
usages: ProviderKeyUsages; | ||
abstract onSign(algorithm: RsaSsaParams, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: RsaSsaParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>; | ||
abstract onSign(algorithm: RsaSsaParams, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
abstract onVerify(algorithm: RsaSsaParams, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
} |
@@ -8,16 +8,16 @@ import { ProviderCrypto } from "./provider"; | ||
protected providers: ProviderStorage; | ||
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>; | ||
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | globalThis.CryptoKey>; | ||
sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>; | ||
verify(algorithm: AlgorithmIdentifier, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>; | ||
encrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>; | ||
decrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>; | ||
deriveBits(algorithm: AlgorithmIdentifier, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
deriveKey(algorithm: AlgorithmIdentifier, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<globalThis.CryptoKey>; | ||
exportKey(format: "raw" | "spki" | "pkcs8", key: CryptoKey): Promise<ArrayBuffer>; | ||
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>; | ||
exportKey(format: KeyFormat, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>; | ||
importKey(format: KeyFormat, keyData: JsonWebKey | BufferSource, algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<globalThis.CryptoKey>; | ||
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): Promise<ArrayBuffer>; | ||
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<globalThis.CryptoKey>; | ||
digest(algorithm: AlgorithmIdentifier, data: BufferSource, ...args: any[]): Promise<ArrayBuffer>; | ||
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<CryptoKeyPair | globalThis.CryptoKey>; | ||
sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource, ...args: any[]): Promise<ArrayBuffer>; | ||
verify(algorithm: AlgorithmIdentifier, key: CryptoKey, signature: BufferSource, data: BufferSource, ...args: any[]): Promise<boolean>; | ||
encrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource, ...args: any[]): Promise<ArrayBuffer>; | ||
decrypt(algorithm: AlgorithmIdentifier, key: CryptoKey, data: BufferSource, ...args: any[]): Promise<ArrayBuffer>; | ||
deriveBits(algorithm: AlgorithmIdentifier, baseKey: CryptoKey, length: number, ...args: any[]): Promise<ArrayBuffer>; | ||
deriveKey(algorithm: AlgorithmIdentifier, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<globalThis.CryptoKey>; | ||
exportKey(format: "raw" | "spki" | "pkcs8", key: CryptoKey, ...args: any[]): Promise<ArrayBuffer>; | ||
exportKey(format: "jwk", key: CryptoKey, ...args: any[]): Promise<JsonWebKey>; | ||
exportKey(format: KeyFormat, key: CryptoKey, ...args: any[]): Promise<JsonWebKey | ArrayBuffer>; | ||
importKey(format: KeyFormat, keyData: JsonWebKey | BufferSource, algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<globalThis.CryptoKey>; | ||
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier, ...args: any[]): Promise<ArrayBuffer>; | ||
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[], ...args: any[]): Promise<globalThis.CryptoKey>; | ||
protected checkRequiredArguments(args: any[], size: number, methodName: string): void; | ||
@@ -24,0 +24,0 @@ protected prepareAlgorithm(algorithm: AlgorithmIdentifier): Algorithm | HashedAlgorithm; |
@@ -115,3 +115,3 @@ /** | ||
} | ||
checkGenerateKey(algorithm, extractable, keyUsages) { | ||
checkGenerateKey(algorithm, extractable, keyUsages, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -133,3 +133,3 @@ this.checkGenerateKeyParams(algorithm); | ||
} | ||
async onGenerateKey(algorithm, extractable, keyUsages) { | ||
async onGenerateKey(algorithm, extractable, keyUsages, ...args) { | ||
throw new UnsupportedOperationError("generateKey"); | ||
@@ -141,3 +141,3 @@ } | ||
} | ||
checkSign(algorithm, key, data) { | ||
checkSign(algorithm, key, data, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -147,3 +147,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onSign(algorithm, key, data) { | ||
async onSign(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("sign"); | ||
@@ -155,3 +155,3 @@ } | ||
} | ||
checkVerify(algorithm, key, signature, data) { | ||
checkVerify(algorithm, key, signature, data, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -161,3 +161,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onVerify(algorithm, key, signature, data) { | ||
async onVerify(algorithm, key, signature, data, ...args) { | ||
throw new UnsupportedOperationError("verify"); | ||
@@ -169,3 +169,3 @@ } | ||
} | ||
checkEncrypt(algorithm, key, data, options = {}) { | ||
checkEncrypt(algorithm, key, data, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -175,3 +175,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onEncrypt(algorithm, key, data) { | ||
async onEncrypt(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("encrypt"); | ||
@@ -183,3 +183,3 @@ } | ||
} | ||
checkDecrypt(algorithm, key, data, options = {}) { | ||
checkDecrypt(algorithm, key, data, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -189,3 +189,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onDecrypt(algorithm, key, data) { | ||
async onDecrypt(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("decrypt"); | ||
@@ -197,3 +197,3 @@ } | ||
} | ||
checkDeriveBits(algorithm, baseKey, length, options = {}) { | ||
checkDeriveBits(algorithm, baseKey, length, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -206,3 +206,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onDeriveBits(algorithm, baseKey, length) { | ||
async onDeriveBits(algorithm, baseKey, length, ...args) { | ||
throw new UnsupportedOperationError("deriveBits"); | ||
@@ -214,3 +214,3 @@ } | ||
} | ||
checkExportKey(format, key) { | ||
checkExportKey(format, key, ...args) { | ||
this.checkKeyFormat(format); | ||
@@ -222,3 +222,3 @@ this.checkCryptoKey(key); | ||
} | ||
async onExportKey(format, key) { | ||
async onExportKey(format, key, ...args) { | ||
throw new UnsupportedOperationError("exportKey"); | ||
@@ -230,3 +230,3 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
this.checkKeyFormat(format); | ||
@@ -240,3 +240,3 @@ this.checkKeyData(format, keyData); | ||
} | ||
async onImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
async onImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
throw new UnsupportedOperationError("importKey"); | ||
@@ -678,6 +678,6 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); | ||
if (extractable) { | ||
throw new SyntaxError("extractable: Must be False"); | ||
throw new SyntaxError("extractable: Must be 'false'"); | ||
} | ||
@@ -706,6 +706,6 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); | ||
if (extractable) { | ||
throw new SyntaxError("extractable: Must be False"); | ||
throw new SyntaxError("extractable: Must be 'false'"); | ||
} | ||
@@ -771,7 +771,7 @@ } | ||
this.checkRequiredArguments(args, 2, "digest"); | ||
const [algorithm, data] = args; | ||
const [algorithm, data, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const preparedData = BufferSourceConverter.toArrayBuffer(data); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.digest(preparedAlgorithm, preparedData); | ||
const result = await provider.digest(preparedAlgorithm, preparedData, ...params); | ||
return result; | ||
@@ -781,6 +781,6 @@ } | ||
this.checkRequiredArguments(args, 3, "generateKey"); | ||
const [algorithm, extractable, keyUsages] = args; | ||
const [algorithm, extractable, keyUsages, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
return result; | ||
@@ -790,3 +790,3 @@ } | ||
this.checkRequiredArguments(args, 3, "sign"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -796,3 +796,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData); | ||
const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData, ...params); | ||
return result; | ||
@@ -802,3 +802,3 @@ } | ||
this.checkRequiredArguments(args, 4, "verify"); | ||
const [algorithm, key, signature, data] = args; | ||
const [algorithm, key, signature, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -809,3 +809,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData); | ||
const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData, ...params); | ||
return result; | ||
@@ -815,3 +815,3 @@ } | ||
this.checkRequiredArguments(args, 3, "encrypt"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -821,3 +821,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }); | ||
const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -827,3 +827,3 @@ } | ||
this.checkRequiredArguments(args, 3, "decrypt"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -833,3 +833,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }); | ||
const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -839,7 +839,7 @@ } | ||
this.checkRequiredArguments(args, 3, "deriveBits"); | ||
const [algorithm, baseKey, length] = args; | ||
const [algorithm, baseKey, length, ...params] = args; | ||
this.checkCryptoKey(baseKey); | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }); | ||
const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -849,3 +849,3 @@ } | ||
this.checkRequiredArguments(args, 5, "deriveKey"); | ||
const [algorithm, baseKey, derivedKeyType, extractable, keyUsages] = args; | ||
const [algorithm, baseKey, derivedKeyType, extractable, keyUsages, ...params] = args; | ||
const preparedDerivedKeyType = this.prepareAlgorithm(derivedKeyType); | ||
@@ -857,11 +857,11 @@ const importProvider = this.getProvider(preparedDerivedKeyType.name); | ||
provider.checkCryptoKey(baseKey, "deriveKey"); | ||
const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length, { keyUsage: false }); | ||
return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages); | ||
const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length, { keyUsage: false }, ...params); | ||
return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages, ...params); | ||
} | ||
async exportKey(...args) { | ||
this.checkRequiredArguments(args, 2, "exportKey"); | ||
const [format, key] = args; | ||
const [format, key, ...params] = args; | ||
this.checkCryptoKey(key); | ||
const provider = this.getProvider(key.algorithm.name); | ||
const result = await provider.exportKey(format, key); | ||
const result = await provider.exportKey(format, key, ...params); | ||
return result; | ||
@@ -871,3 +871,3 @@ } | ||
this.checkRequiredArguments(args, 5, "importKey"); | ||
const [format, keyData, algorithm, extractable, keyUsages] = args; | ||
const [format, keyData, algorithm, extractable, keyUsages, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
@@ -877,3 +877,3 @@ const provider = this.getProvider(preparedAlgorithm.name); | ||
const preparedData = BufferSourceConverter.toArrayBuffer(keyData); | ||
return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
} | ||
@@ -885,6 +885,6 @@ else { | ||
} | ||
return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
} | ||
async wrapKey(format, key, wrappingKey, wrapAlgorithm) { | ||
let keyData = await this.exportKey(format, key); | ||
async wrapKey(format, key, wrappingKey, wrapAlgorithm, ...args) { | ||
let keyData = await this.exportKey(format, key, ...args); | ||
if (format === "jwk") { | ||
@@ -897,9 +897,9 @@ const json = JSON.stringify(keyData); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }); | ||
return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }, ...args); | ||
} | ||
async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages) { | ||
async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, ...args) { | ||
const preparedAlgorithm = this.prepareAlgorithm(unwrapAlgorithm); | ||
const preparedData = BufferSourceConverter.toArrayBuffer(wrappedKey); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }); | ||
let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }, ...args); | ||
if (format === "jwk") { | ||
@@ -915,3 +915,3 @@ try { | ||
} | ||
return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages); | ||
return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages, ...args); | ||
} | ||
@@ -918,0 +918,0 @@ checkRequiredArguments(args, size, methodName) { |
@@ -118,3 +118,3 @@ /** | ||
} | ||
checkGenerateKey(algorithm, extractable, keyUsages) { | ||
checkGenerateKey(algorithm, extractable, keyUsages, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -136,3 +136,3 @@ this.checkGenerateKeyParams(algorithm); | ||
} | ||
async onGenerateKey(algorithm, extractable, keyUsages) { | ||
async onGenerateKey(algorithm, extractable, keyUsages, ...args) { | ||
throw new UnsupportedOperationError("generateKey"); | ||
@@ -144,3 +144,3 @@ } | ||
} | ||
checkSign(algorithm, key, data) { | ||
checkSign(algorithm, key, data, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -150,3 +150,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onSign(algorithm, key, data) { | ||
async onSign(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("sign"); | ||
@@ -158,3 +158,3 @@ } | ||
} | ||
checkVerify(algorithm, key, signature, data) { | ||
checkVerify(algorithm, key, signature, data, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -164,3 +164,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onVerify(algorithm, key, signature, data) { | ||
async onVerify(algorithm, key, signature, data, ...args) { | ||
throw new UnsupportedOperationError("verify"); | ||
@@ -172,3 +172,3 @@ } | ||
} | ||
checkEncrypt(algorithm, key, data, options = {}) { | ||
checkEncrypt(algorithm, key, data, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -178,3 +178,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onEncrypt(algorithm, key, data) { | ||
async onEncrypt(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("encrypt"); | ||
@@ -186,3 +186,3 @@ } | ||
} | ||
checkDecrypt(algorithm, key, data, options = {}) { | ||
checkDecrypt(algorithm, key, data, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -192,3 +192,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onDecrypt(algorithm, key, data) { | ||
async onDecrypt(algorithm, key, data, ...args) { | ||
throw new UnsupportedOperationError("decrypt"); | ||
@@ -200,3 +200,3 @@ } | ||
} | ||
checkDeriveBits(algorithm, baseKey, length, options = {}) { | ||
checkDeriveBits(algorithm, baseKey, length, options = {}, ...args) { | ||
this.checkAlgorithmName(algorithm); | ||
@@ -209,3 +209,3 @@ this.checkAlgorithmParams(algorithm); | ||
} | ||
async onDeriveBits(algorithm, baseKey, length) { | ||
async onDeriveBits(algorithm, baseKey, length, ...args) { | ||
throw new UnsupportedOperationError("deriveBits"); | ||
@@ -217,3 +217,3 @@ } | ||
} | ||
checkExportKey(format, key) { | ||
checkExportKey(format, key, ...args) { | ||
this.checkKeyFormat(format); | ||
@@ -225,3 +225,3 @@ this.checkCryptoKey(key); | ||
} | ||
async onExportKey(format, key) { | ||
async onExportKey(format, key, ...args) { | ||
throw new UnsupportedOperationError("exportKey"); | ||
@@ -233,3 +233,3 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
this.checkKeyFormat(format); | ||
@@ -243,3 +243,3 @@ this.checkKeyData(format, keyData); | ||
} | ||
async onImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
async onImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
throw new UnsupportedOperationError("importKey"); | ||
@@ -681,6 +681,6 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); | ||
if (extractable) { | ||
throw new SyntaxError("extractable: Must be False"); | ||
throw new SyntaxError("extractable: Must be 'false'"); | ||
} | ||
@@ -709,6 +709,6 @@ } | ||
} | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages) { | ||
checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { | ||
super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); | ||
if (extractable) { | ||
throw new SyntaxError("extractable: Must be False"); | ||
throw new SyntaxError("extractable: Must be 'false'"); | ||
} | ||
@@ -774,7 +774,7 @@ } | ||
this.checkRequiredArguments(args, 2, "digest"); | ||
const [algorithm, data] = args; | ||
const [algorithm, data, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.digest(preparedAlgorithm, preparedData); | ||
const result = await provider.digest(preparedAlgorithm, preparedData, ...params); | ||
return result; | ||
@@ -784,6 +784,6 @@ } | ||
this.checkRequiredArguments(args, 3, "generateKey"); | ||
const [algorithm, extractable, keyUsages] = args; | ||
const [algorithm, extractable, keyUsages, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
return result; | ||
@@ -793,3 +793,3 @@ } | ||
this.checkRequiredArguments(args, 3, "sign"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -799,3 +799,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData); | ||
const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData, ...params); | ||
return result; | ||
@@ -805,3 +805,3 @@ } | ||
this.checkRequiredArguments(args, 4, "verify"); | ||
const [algorithm, key, signature, data] = args; | ||
const [algorithm, key, signature, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -812,3 +812,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData); | ||
const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData, ...params); | ||
return result; | ||
@@ -818,3 +818,3 @@ } | ||
this.checkRequiredArguments(args, 3, "encrypt"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -824,3 +824,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }); | ||
const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -830,3 +830,3 @@ } | ||
this.checkRequiredArguments(args, 3, "decrypt"); | ||
const [algorithm, key, data] = args; | ||
const [algorithm, key, data, ...params] = args; | ||
this.checkCryptoKey(key); | ||
@@ -836,3 +836,3 @@ const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }); | ||
const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -842,7 +842,7 @@ } | ||
this.checkRequiredArguments(args, 3, "deriveBits"); | ||
const [algorithm, baseKey, length] = args; | ||
const [algorithm, baseKey, length, ...params] = args; | ||
this.checkCryptoKey(baseKey); | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }); | ||
const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }, ...params); | ||
return result; | ||
@@ -852,3 +852,3 @@ } | ||
this.checkRequiredArguments(args, 5, "deriveKey"); | ||
const [algorithm, baseKey, derivedKeyType, extractable, keyUsages] = args; | ||
const [algorithm, baseKey, derivedKeyType, extractable, keyUsages, ...params] = args; | ||
const preparedDerivedKeyType = this.prepareAlgorithm(derivedKeyType); | ||
@@ -860,11 +860,11 @@ const importProvider = this.getProvider(preparedDerivedKeyType.name); | ||
provider.checkCryptoKey(baseKey, "deriveKey"); | ||
const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length, { keyUsage: false }); | ||
return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages); | ||
const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length, { keyUsage: false }, ...params); | ||
return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages, ...params); | ||
} | ||
async exportKey(...args) { | ||
this.checkRequiredArguments(args, 2, "exportKey"); | ||
const [format, key] = args; | ||
const [format, key, ...params] = args; | ||
this.checkCryptoKey(key); | ||
const provider = this.getProvider(key.algorithm.name); | ||
const result = await provider.exportKey(format, key); | ||
const result = await provider.exportKey(format, key, ...params); | ||
return result; | ||
@@ -874,3 +874,3 @@ } | ||
this.checkRequiredArguments(args, 5, "importKey"); | ||
const [format, keyData, algorithm, extractable, keyUsages] = args; | ||
const [format, keyData, algorithm, extractable, keyUsages, ...params] = args; | ||
const preparedAlgorithm = this.prepareAlgorithm(algorithm); | ||
@@ -880,3 +880,3 @@ const provider = this.getProvider(preparedAlgorithm.name); | ||
const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(keyData); | ||
return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
} | ||
@@ -888,6 +888,6 @@ else { | ||
} | ||
return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages); | ||
return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); | ||
} | ||
async wrapKey(format, key, wrappingKey, wrapAlgorithm) { | ||
let keyData = await this.exportKey(format, key); | ||
async wrapKey(format, key, wrappingKey, wrapAlgorithm, ...args) { | ||
let keyData = await this.exportKey(format, key, ...args); | ||
if (format === "jwk") { | ||
@@ -900,9 +900,9 @@ const json = JSON.stringify(keyData); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }); | ||
return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }, ...args); | ||
} | ||
async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages) { | ||
async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, ...args) { | ||
const preparedAlgorithm = this.prepareAlgorithm(unwrapAlgorithm); | ||
const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(wrappedKey); | ||
const provider = this.getProvider(preparedAlgorithm.name); | ||
let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }); | ||
let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }, ...args); | ||
if (format === "jwk") { | ||
@@ -918,3 +918,3 @@ try { | ||
} | ||
return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages); | ||
return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages, ...args); | ||
} | ||
@@ -921,0 +921,0 @@ checkRequiredArguments(args, size, methodName) { |
{ | ||
"name": "webcrypto-core", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Common layer to be used by crypto libraries based on WebCrypto API for input validation.", | ||
@@ -5,0 +5,0 @@ "main": "build/webcrypto-core.js", |
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
131290