Skip to content

Commit

Permalink
including ncryptsec return type for nip49
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioconselheiro committed Jun 17, 2024
1 parent 929ece5 commit eadfcd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nip49.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { xchacha20poly1305 } from '@noble/ciphers/chacha'
import { concatBytes, randomBytes } from '@noble/hashes/utils'
import { Bech32MaxSize, encodeBytes } from './nip19.ts'
import { bech32 } from '@scure/base'
import { Ncryptsec } from './core.ts'

export function encrypt(sec: Uint8Array, password: string, logn: number = 16, ksb: 0x00 | 0x01 | 0x02 = 0x02): string {
export function encrypt(sec: Uint8Array, password: string, logn: number = 16, ksb: 0x00 | 0x01 | 0x02 = 0x02): Ncryptsec {
let salt = randomBytes(16)
let n = 2 ** logn
let key = scrypt(password.normalize('NFKC'), salt, { N: n, r: 8, p: 1, dkLen: 32 })
Expand Down

0 comments on commit eadfcd0

Please sign in to comment.