Skip to content

Slow: should encrypt private keys with password #5

Description

@leonardocustodio

Moving the following issue https://github.com/paritytech/bcts/issues/82 from @cadorn here.

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 })

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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