6.0.1 • Published 8 months ago

@cef-ebsi/wallet-lib v6.0.1

Weekly downloads
-
License
EUPL-1.2
Repository
-
Last release
8 months ago

EBSI Logo

Wallet Library

The Wallet Library is a TypeScript reference library implementing some generic EBSI-compliant wallet capabilities.

Table of Contents

  1. Installation
  2. Usage
  3. License

Installation

npm install @cef-ebsi/wallet-lib

Usage

Create a Legal Entity DID

import { EbsiWallet } from "@cef-ebsi/wallet-lib";

// Create a random Legal Entity DID
const did = EbsiWallet.createDid();
console.log(did);
// prints "did:ebsi:zsSgDXeYPhZ3AuKhTFneDf1"

// Create a random Legal Entity DID (same as `EbsiWallet.createDid()`)
const did = EbsiWallet.createDid("LEGAL_ENTITY");

Create a Natural Person DID

import { EbsiWallet } from "@cef-ebsi/wallet-lib";
import { calculateJwkThumbprint, exportJWK, generateKeyPair } from "jose";
import { base64url } from "multiformats/bases/base64";

// Create a Natural Person DID based on the provided JWK
const { publicKey } = await generateKeyPair("ES256K");
const jwk = await exportJWK(publicKey);
const did = EbsiWallet.createDid("NATURAL_PERSON", jwk);

Create a wallet

import { EbsiWallet } from "@cef-ebsi/wallet-lib";

// Instantiating a new instance of EBSI Wallet
const privateKey =
  "0a9a229c18f1777949243bbe875b754b77fb9cb3612c8b5c37876888f54f9731";
const wallet = new EbsiWallet(privateKey);

// Get wallet's public key (different formats)
const publicKey = wallet.getPublicKey();
/*
046a6457531aefa19d1840cca004f9ef1cf50d30c508d960a63fceedf336da829501b3c54c16b2d4f325c602e23f17da353ad0ccba6397f082be1e3eaab07cf3c1
*/

const publicKeyPem = wallet.getPublicKey({ format: "pem" });
/*
-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEamRXUxrvoZ0YQMygBPnvHPUNMMUI2WCm
P87t8zbagpUBs8VMFrLU8yXGAuI/F9o1OtDMumOX8IK+Hj6qsHzzwQ==
-----END PUBLIC KEY-----
*/

const publicKeyJwk = wallet.getPublicKey({ format: "jwk" });
/*
{
  kty: "EC",
  crv: "secp256k1",
  x: "amRXUxrvoZ0YQMygBPnvHPUNMMUI2WCmP87t8zbagpU",
  y: "AbPFTBay1PMlxgLiPxfaNTrQzLpjl_CCvh4-qrB888E",
}
*/

// Get wallet's Ethereum address
const publicKey = wallet.getEthereumAddress();
// returns 0xA2aa80C25AebE7d3b9984ef45179b4F39737fFBa

License

Copyright (C) 2025 European Union

This program is free software: you can redistribute it and/or modify it under the terms of the EUROPEAN UNION PUBLIC LICENCE v. 1.2 as published by the European Union.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the EUROPEAN UNION PUBLIC LICENCE v. 1.2 for further details.

You should have received a copy of the EUROPEAN UNION PUBLIC LICENCE v. 1.2. along with this program. If not, see https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12.

6.0.0-alpha.3

1 year ago

6.0.0-alpha.4

12 months ago

6.0.0-alpha.1

1 year ago

6.0.0-alpha.2

1 year ago

5.0.6

1 year ago

6.0.1-alpha.0

10 months ago

6.0.1-alpha.1

10 months ago

6.0.1

8 months ago

6.0.0

11 months ago

5.0.5

1 year ago

5.0.4

1 year ago

6.0.0-alpha.0

1 year ago

5.0.3

1 year ago

5.0.3-alpha.0

1 year ago

5.0.2

1 year ago

5.0.1

2 years ago

5.0.1-alpha.2

2 years ago

5.0.1-alpha.1

2 years ago

5.0.1-alpha.0

2 years ago

5.0.0

2 years ago

5.0.0-alpha.4

2 years ago

5.0.0-alpha.3

2 years ago

5.0.0-alpha.2

2 years ago

5.0.0-alpha.1

2 years ago

5.0.0-alpha.0

2 years ago

4.2.0

2 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-alpha.4

3 years ago

3.1.1

3 years ago

4.0.0-alpha.3

3 years ago

4.0.0-alpha.1

3 years ago

4.0.0-alpha.2

3 years ago

4.0.0-alpha.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.0.1

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

2.0.0-alpha.0

4 years ago

2.0.0

4 years ago

1.0.0-rc.8

4 years ago

1.0.0-rc.7

4 years ago

1.0.0-rc.5

4 years ago

1.0.0-rc.6

4 years ago

1.0.0-rc.4

4 years ago

1.0.0-rc.3

4 years ago

1.0.0-rc.2

4 years ago

1.0.0-rc.1

4 years ago

1.0.0-rc.0

5 years ago