Skip to content

Commit

Permalink
mutex, crypto params
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Apr 22, 2023
1 parent 345ef8c commit 523c717
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@hazae41/bytes": "^1.0.4",
"@hazae41/mutex": "^1.0.2"
"@hazae41/mutex": "^1.2.1"
},
"peerDependencies": {
"react": ">=17"
Expand Down
4 changes: 2 additions & 2 deletions src/mods/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Core extends Ortho<string, State | undefined> {
readonly #counts = new Map<string, number>()
readonly #timeouts = new Map<string, NodeJS.Timeout>()

readonly #mutexes = new Map<string, Mutex>()
readonly #mutexes = new Map<string, Mutex<undefined>>()
readonly #aborters = new Map<string, AbortController>()

#mounted = true
Expand Down Expand Up @@ -52,7 +52,7 @@ export class Core extends Ortho<string, State | undefined> {
let mutex = this.#mutexes.get(cacheKey)

if (mutex === undefined) {
mutex = new Mutex()
mutex = new Mutex(undefined)
this.#mutexes.set(cacheKey, mutex)
}

Expand Down
2 changes: 1 addition & 1 deletion src/mods/serializers/crypto/aes/gcm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class AesGcmCoder implements AsyncCoder<unknown> {
readonly key: CryptoKey
) { }

static async fromPBKDF2(pbkdf2: CryptoKey, salt: Uint8Array, iterations = 100_000) {
static async fromPBKDF2(pbkdf2: CryptoKey, salt: Uint8Array, iterations: number) {
const key = await crypto.subtle.deriveKey({
name: "PBKDF2",
salt: salt,
Expand Down
2 changes: 1 addition & 1 deletion src/mods/serializers/crypto/hmac/hmac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class HmacEncoder implements AsyncEncoder<string> {
readonly key: CryptoKey
) { }

static async fromPBKDF2(pbkdf2: CryptoKey, salt: Uint8Array, iterations = 100_000) {
static async fromPBKDF2(pbkdf2: CryptoKey, salt: Uint8Array, iterations: number) {
const key = await crypto.subtle.deriveKey({
name: "PBKDF2",
salt: salt,
Expand Down
2 changes: 1 addition & 1 deletion src/mods/serializers/crypto/pbkdf2/pbkdf2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Bytes } from "@hazae41/bytes";
export namespace PBKDF2 {

export async function from(password: string) {
return await crypto.subtle.importKey("raw", Bytes.fromUtf8(password), { name: "PBKDF2" }, false, ["deriveKey"])
return await crypto.subtle.importKey("raw", Bytes.fromUtf8(password), { name: "PBKDF2" }, false, ["deriveKey", "deriveBits"])
}

}

0 comments on commit 523c717

Please sign in to comment.