🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@didtools/multidid

Package Overview
Dependencies
Maintainers
6
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@didtools/multidid

Multidid is a representation strategy for DIDs and DID URLs that is very compact and extensible. It allows any DID method to be represented as a string of bytes. Reference [specification](https://github.com/ChainAgnostic/multidid).

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
6
Created
Source

Multidid

Multidid is a representation strategy for DIDs and DID URLs that is very compact and extensible. It allows any DID method to be represented as a string of bytes. Reference specification.

This library is a multidid utility library to encode and decode multidids to their byte and string representation and convert from did strings to multidid representations.

Installation

npm install --save @didtools/multidid

Usage

import { Multidid } from '@didtools/multidid'
 
const didString = "did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp#z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp"
 
// Multidid instance from did string
const multidid = Multidid.fromString(didString)
 
// Encode to bytes
multidid.toBytes() 
 
// Decode from bytes to multidid instance
Multidid.fromBytes(bytes)
 
// Encode as a multibase base16 string 
const mdStr = multidid.toMultibase('base16')
console.log(mdStr)
//f9d1aed013b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29307a364d6b6954427a31796d75657041513448454859534631483871754735474c5656515233646a6458336d446f6f5770
 
// Multidid instance from base encoded string 
Multidid.fromMultibase(mdStr)
 
// DID string from multidid
multidid.toString() 

License

Apache-2.0 OR MIT

Keywords

DID

FAQs

Package last updated on 04 Jan 2024

Did you know?

Socket

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