Skip to content

A lightweight library to generate keys for the terra ecosystem.

License

Notifications You must be signed in to change notification settings

TerraMystics/Terra.Microsoft.Keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A lightweight library to generate keys commonly used for the terra ecosystem. RawKey, Mnemonic & CLI Key


GitHub GitHub GitHub

Explore the Docs »


Buy Me A Coffee

Features

  • Written in C#, with type definitions
  • Easy key management for anyone building on the Terra Ecosystem
  • Works with all .Net Environments

Installation & Configuration

Grab the latest version off Nuget

dotnet add package Terra.Microsoft.Keys

Please make sure to add the following nuget Packages into your .csproj file

<ItemGroup>
    <PackageReference Include="Cryptography.ECDSA.Secp256k1" Version="1.1.3" />
    <PackageReference Include="NBitcoin" Version="7.0.23" />
    <PackageReference Include="RandomStringCreator" Version="2.0.0" />
    <PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
    <PackageReference Include="Terra.Microsoft.Extensions" Version="1.0.1" />
    <PackageReference Include="Terra.Microsoft.ProtoBufs" Version="1.0.1" />
  </ItemGroup>

Usage

Terra.Microsoft.Keys can be used for Mobile & Web Developers, or SDK Developers looking to extend the Terra Platform. Supports all Microsoft Technologies from Xamarin, MAUI, ASP & Unity.

Generating a Mnemonic Key

MnemonicKey GenerateMnemonic() {

  // Create a key out of a mnemonic string (recovery words)
  string recoveryWords = "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
  
  // If creating a random mnemonic, don't pass the recovery words
  return new MnemonicKey(recoveryWords);
}

//ONLY FOR TESTING & DEVELOPMENT PURPOSES: DO NOT EXPOSE PRIVATE KEY, IT COULD RISK EXPOSING THE WALLET FUNDS IF LOST
MnemonicKey GenerateMnemonicWithPrivateKey() {

  string recoveryWords = "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
  
  // Create a key out of a mnemonic string (recovery words)
  var mnmonic =  new MnemonicKey(recoveryWords, exposePrivateKey: true);
    
  Console.WriteLine($"PrivateKey: {mnmonic.privateKeyExposed}");
    
  return mnmonic;
}

Terra.Microsoft.Keys For Unity Developers

If you are using Terra.Microsoft.Keys for Unity, please make sure to install the following asset in your project, and follow the installation instructions above

License

This software is licensed under the MIT license. See LICENSE for full disclosure.

© 2022 TerraMystics.

About

A lightweight library to generate keys for the terra ecosystem.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages