signature : Change lib to allow import from password
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
This commit is contained in:
@@ -4,7 +4,6 @@ import {SecretWrap, type Key} from 'boxes/secret-wrap'
|
||||
|
||||
import * as sym from 'boxes/symmetric'
|
||||
import * as asym from 'boxes/asymmetric'
|
||||
import * as signature from 'signature'
|
||||
import * as pwrap from 'boxes/private-wrap'
|
||||
|
||||
let k1!: Key;
|
||||
@@ -12,13 +11,11 @@ let k2!: Key;
|
||||
|
||||
let kw_wrap!: sym.Key;
|
||||
let kw_sym!: sym.Key;
|
||||
let kw_sig!: signature.KeyPair;
|
||||
let kw_asym!: asym.KeyPair;
|
||||
let kw_priv!: pwrap.KeyPair;
|
||||
|
||||
let kw_wrap_non!: sym.Key;
|
||||
let kw_sym_non!: sym.Key;
|
||||
let kw_sig_non!: signature.KeyPair;
|
||||
let kw_asym_non!: asym.KeyPair;
|
||||
let kw_priv_non!: pwrap.KeyPair;
|
||||
|
||||
@@ -37,8 +34,6 @@ beforeAll(async () => {
|
||||
expect(kw_priv[0].extractable).toBe(true)
|
||||
kw_sym = await sym.SecretBox.gen_key(true)
|
||||
expect(kw_sym.extractable).toBe(true)
|
||||
kw_sig = await signature.gen_keypair(true)
|
||||
expect(kw_sig[0].extractable).toBe(true)
|
||||
|
||||
kw_wrap_non = await sym.SecretBox.gen_key(false)
|
||||
expect(kw_wrap_non.extractable).toBe(false)
|
||||
@@ -48,8 +43,6 @@ beforeAll(async () => {
|
||||
expect(kw_priv_non[0].extractable).toBe(false)
|
||||
kw_sym_non = await sym.SecretBox.gen_key(false)
|
||||
expect(kw_sym_non.extractable).toBe(false)
|
||||
kw_sig_non = await signature.gen_keypair(false)
|
||||
expect(kw_sig_non[0].extractable).toBe(false)
|
||||
})
|
||||
|
||||
test('base case', async () => {
|
||||
@@ -64,7 +57,6 @@ test('base case', async () => {
|
||||
await testit(kw_asym[0])
|
||||
await testit(kw_priv[0])
|
||||
await testit(kw_sym)
|
||||
await testit(kw_sig[0])
|
||||
})
|
||||
test("toString and fromString and inverses", async () => {
|
||||
const testit = async (key: CryptoKey) => {
|
||||
@@ -79,7 +71,6 @@ test("toString and fromString and inverses", async () => {
|
||||
await testit(kw_asym[0])
|
||||
await testit(kw_priv[0])
|
||||
await testit(kw_sym)
|
||||
await testit(kw_sig[0])
|
||||
})
|
||||
test("Can't unwrap with wrong key", async () => {
|
||||
const wrapped = (await SecretWrap.wrap_key(k1, kw_wrap)).expect("Should wrap the key")
|
||||
@@ -90,7 +81,6 @@ test("Can't wrap if key is not extractable", async () => {
|
||||
;(await SecretWrap.wrap_key(k1, kw_asym_non[0])).expect_err("Shouldn't wrap if key is not extractable")
|
||||
;(await SecretWrap.wrap_key(k1, kw_priv_non[0])).expect_err("Shouldn't wrap if key is not extractable")
|
||||
;(await SecretWrap.wrap_key(k1, kw_sym_non)).expect_err("Shouldn't wrap if key is not extractable")
|
||||
;(await SecretWrap.wrap_key(k1, kw_sig_non[0])).expect_err("Shouldn't wrap if key is not extractable")
|
||||
})
|
||||
test("tampered IV", async () => {
|
||||
const wrapped = (await SecretWrap.wrap_key(k1, kw_wrap)).expect("Should wrap the key")
|
||||
|
||||
Reference in New Issue
Block a user