Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

feature request: exposing crypto interface directly #49

Closed
SmartLayer opened this issue Jun 28, 2020 · 2 comments
Closed

feature request: exposing crypto interface directly #49

SmartLayer opened this issue Jun 28, 2020 · 2 comments

Comments

@SmartLayer
Copy link

I wrote a simple test that erred:

const crypto = require("webcrypto");
var iv = crypto.getRandomValues(new Uint8Array(16))
console.log(iv)

turns out I should do this:

const crypto = require("webcrypto");
var iv = crypto.crypto.getRandomValues(new Uint8Array(16))
console.log(iv)

compared to the straightforward interface provided by trust-webcrypto

const crypto = require("@trust/webcrypto");
var iv = crypto.getRandomValues(new Uint8Array(16))
console.log(iv)

I think it's more intuitive to provide crypto object directly.

@tniessen
Copy link
Member

It just takes two more characters:

const { crypto } = require("webcrypto");

@SmartLayer
Copy link
Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants