How to use the @polkadot/util-crypto/random/asU8a function in @polkadot/util-crypto

To help you get started, we’ve selected a few @polkadot/util-crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / apps / packages / ui-identicon / src / demo.ts View on Github external
function generateIcon (seed: Uint8Array = randomAsU8a(32)): void {
  const start = Date.now();

  if (isNull(element)) {
    throw new Error('Unable to find #demo element');
  }

  element.appendChild(
    identicon(seed, 100, 'padded')
  );

  console.log(`Icon generated in ${(Date.now() - start)}ms`);
}
github polkadot-js / apps / packages / ui-react / src / IdentityIcon / Demo.tsx View on Github external
render () {
    const identities: Array = [new Uint8Array(32)];

    while (identities.length !== 10) {
      identities.push(
        addressEncode(randomAsU8a(32))
      );
    }

    return (
      ',
          value: '{...}'
        }}
        attrsReq={[
          'value'
        ]}
      >
        {
          identities.map((value) => (