Skip to content

Slow: should encrypt private keys with password #82

@cadorn

Description

@cadorn

Hi @leonardocustodio,

Wow you have done a lot of work! Amazing to see everything implemented!

I am running my tests and this is slow. Just want to make sure that is intentional?

✓ XID Document Lifecycle > 7. Private Key Options > should encrypt private keys with password [1675.06ms]

        it('should encrypt private keys with password', async function () {
            const password = new TextEncoder().encode('test_password')

            const envelope = await xid.toEnvelope({
                document: aliceDoc,
                privateKeyOptions: { type: XIDPrivateKeyOptions.Encrypt, password },
            })

            // Without password - no private key
            const docNoPassword = await xid.fromEnvelope({ envelope })
            const keyNoPassword = await xid.getInceptionKey({ document: docNoPassword })
            expect(keyNoPassword.hasPrivateKeys()).toBe(false)

            // With password - private key restored
            const docWithPassword = await xid.fromEnvelope({ envelope, password })
            const keyWithPassword = await xid.getInceptionKey({ document: docWithPassword })
            expect(keyWithPassword.hasPrivateKeys()).toBe(true)
        }, { timeout: 60_000 })

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions