Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public expand(prk: Uint8Array, info: string, outputLen: number): Uint8Array {
const prkBuffer = Buffer.from(prk)
const okm = hkdf.expand(this.hashAlgorithm, this.hashLength, prkBuffer, outputLen, info)
return new Uint8Array(okm)
}
public expand(prk: Uint8Array, info: BuffString, outputLen: number): Uint8Array {
const prkBuffer = Buffer.from(prk);
const okm = this.hashAlgorithm.toLowerCase() === 'sha3-256'
? this.sha3_256Expand(prkBuffer, outputLen, info)
: hkdf.expand(this.hashAlgorithm, this.hashLength, prkBuffer, outputLen, info)
return new Uint8Array(okm);
}
public extract(ikm: Uint8Array, salt: string): Uint8Array {
const ikmBuffer = Buffer.from(ikm)
const prk = hkdf.extract(this.hashAlgorithm, this.hashLength, ikmBuffer, salt)
return new Uint8Array(prk)
}
public extract(ikm: Uint8Array, salt: string): Uint8Array {
const ikmBuffer = Buffer.from(ikm);
const prk = this.hashAlgorithm.toLowerCase() === 'sha3-256'
? this.sha3_256Extract(ikmBuffer, salt)
: hkdf.extract(this.hashAlgorithm, this.hashLength, ikmBuffer, salt)
return new Uint8Array(prk);
}
get hashLength(): number {
return hkdf.hash_length(this.hashAlgorithm);
}
}
get hashLength(): number {
return hkdf.hash_length(this.hashAlgorithm)
}
}