🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@civic/casper-did

Package Overview
Dependencies
Maintainers
16
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@civic/casper-did

A simple library for converting casper keys to W3C compliant DIDs and vice versa.

latest
npmnpm
Version
0.0.4
Version published
Maintainers
16
Created
Source

Casper-DID

A simple library for converting casper keys to W3C compliant DIDs and vice versa.

Usage

import {
    convertCasperPubkeyToDid,
    convertDidToCasperPubkey,
} from "@civic/casper-did";

// Handles Secp256k1 keys (prefixed with 02 in casper addresses)
convertCasperPubkeyToDid("0202a9288f6be41767209b9b0a80e5253ac2ebe00c31d175345ecab9dfa231de6c59")
// did:key:zQ3shYo7XemChSbyT2y4K9m5PUj576JYpKiPm9ZHRY5uJoDBe

convertDidToCasperPubkey("did:key:zQ3shYo7XemChSbyT2y4K9m5PUj576JYpKiPm9ZHRY5uJoDBe")
// 0202a9288f6be41767209b9b0a80e5253ac2ebe00c31d175345ecab9dfa231de6c59

// Handles Ed25519 keys (prefixed with 01 in casper addresses)
convertCasperPubkeyToDid("01053ce2369857632f86575d657ee4f24b1efb3e9ba865d3fbf1fed986bf7a2601")
// did:key:z6Mkeohvt1YAgyWbmk8YB63c787HmXfsC7k81h2u24FNYqck

convertDidToCasperPubkey("did:key:z6Mkeohvt1YAgyWbmk8YB63c787HmXfsC7k81h2u24FNYqck")
// 01053ce2369857632f86575d657ee4f24b1efb3e9ba865d3fbf1fed986bf7a2601

FAQs

Package last updated on 04 Jun 2023

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