Socket
Socket
Sign inDemoInstall

@arcblock/did-motif

Package Overview
Dependencies
2
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @arcblock/did-motif

A javascript library for generating [DID](https://github.com/ArcBlock/ABT-DID-Protocol) identicons.


Version published
Weekly downloads
877
decreased by-16.87%
Maintainers
4
Created
Weekly downloads
 

Readme

Source

DID Motif

A javascript library for generating DID identicons.

Installation

npm i @arcblock/did-motif
# Or Yarn
yarn add @arcblock/did-motif

Usage

render DID Motif:

import { update } from '@arcblock/did-motif';

const element = document.getElementById('my-canvas');
// or const element = document.getElementById('my-svg');
update(element, 'z35n6X6rDp8rWWCGSiXZgvd42bixdLULmX8oX', { size: 36 });

render DID Motif with animation:

import { update } from '@arcblock/did-motif';

const element = document.getElementById('my-canvas');
// or const element = document.getElementById('my-svg');
update(element, 'z35n6X6rDp8rWWCGSiXZgvd42bixdLULmX8oX', { size: 36, animation: true });

use toDataURL to convert a DID to an image data URL, we can assign the DataURL as the value of the src attribute of <img> element.

import { toDataURL } from '@arcblock/did-motif';

const img = document.getElementById('my-img');
img.src = toDataURL({ did: 'z35n6X6rDp8rWWCGSiXZgvd42bixdLULmX8oX', size: 36 });

See more examples and options of working with @arcblock/did-motif here.

License

Copyright 2018-2022 ArcBlock

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

FAQs

Last updated on 06 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc