Socket
Socket
Sign inDemoInstall

@civic/casper-did

Package Overview
Dependencies
2
Maintainers
16
Versions
3
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
245
decreased by-63.05%
Maintainers
16
Install size
27.5 kB
Created
Weekly downloads
 

Readme

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

Last updated on 04 Jun 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