@stellar/typescript-wallet-sdk-km
TypeScript icon, indicating that this package has built-in type declarations

1.9.0 • Public • Published

Stellar Typescript Wallet Key Manager SDK npm version

The Typescript Wallet Key Manager SDK is a library that allows developers to use key managing functionality in their wallet applications. It works in conjuction with the main Typescript Wallet SDK to hold all the functionality a developer would need to create a wallet for the stellar network.

Dependency

The library is available via npm. To import typescript-wallet-sdk-km you need to add it as a dependency to your code:

yarn:

yarn add @stellar/typescript-wallet-sdk-km

npm:

npm install @stellar/typescript-wallet-sdk-km

Introduction

Here's a small example on how to use the KeyManager to store and retrieve a key:

Import the package:

import { KeyManager, MemoryKeyStore } from "@stellar/typescript-wallet-sdk-km";

Creating a KeyManager class using simple memory key storage:

const testStore = new MemoryKeyStore();
const testKeyManager = new KeyManager({ keyStore: testStore });

Store an encrypted key:

const id = "this is a my test id";
testKeyManager.registerEncrypter(IdentityEncrypter);
await testKeyManager.storeKey({
  key: {
    id,
    type: KeyType.plaintextKey,
    publicKey: "TestPublicKey",
    privateKey: "TestPrivateKey",
  },
  password: "test",
  encrypterName: "IdentityEncrypter",
});

Retrieve the stored key:

const keyData = await testKeyManager.loadKey(id, password);

Readme

Keywords

none

Package Sidebar

Install

npm i @stellar/typescript-wallet-sdk-km

Weekly Downloads

92

Version

1.9.0

License

Apache-2.0

Unpacked Size

8.19 MB

Total Files

71

Last publish

Collaborators

  • stellar-npm-ci
  • stellar-npm
  • bartekn
  • quietbits
  • jacekn
  • fnando_sdf
  • cassiomg
  • piyalbasu