public byte[] SignMessageByServiceKey(byte[] data, int chain, uint index) { return(BitcoinBasedCurrency .CreateExtKeyFromSeed(Seed) .Derive(new KeyPath(path: $"m/{ServicePurpose}'/0'/0'/{chain}/{index}")) .SignMessage(data)); }
public byte[] GetServicePublicKey(uint index) { var extKey = BitcoinBasedCurrency .CreateExtKeyFromSeed(Seed) .Derive(new KeyPath(path: $"m/{ServicePurpose}'/0'/0'/0/{index}")); extKey.GetPublicKey(out var publicKey); return(publicKey); }
public byte[] SignMessageByServiceKey(byte[] data, int chain, uint index) { using var masterKey = BitcoinBasedCurrency .CreateExtKeyFromSeed(Seed); using var derivedKey = masterKey .Derive(new KeyPath(path: $"m/{ServicePurpose}'/0'/0'/{chain}/{index}")); return(derivedKey.SignMessage(data)); }
public SecureBytes GetServicePublicKey(uint index) { using var masterKey = BitcoinBasedCurrency .CreateExtKeyFromSeed(Seed); using var extKey = masterKey .Derive(new KeyPath(path: $"m/{ServicePurpose}'/0'/0'/0/{index}")); return(extKey.GetPublicKey()); }
public byte[] GetDeterministicSecret(Currency currency, DateTime timeStamp) { var utcTimeStamp = timeStamp.ToUniversalTime(); var daysIndex = (int)(utcTimeStamp.Date - DateTime.MinValue).TotalDays; var secondsIndex = utcTimeStamp.Hour * 60 * 60 + utcTimeStamp.Minute * 60 + utcTimeStamp.Second; var msIndex = utcTimeStamp.Millisecond; using var masterKey = BitcoinBasedCurrency .CreateExtKeyFromSeed(Seed); using var extKey = masterKey .Derive(new KeyPath(path: $"m/{ServicePurpose}'/{currency.Bip44Code}'/0'/{daysIndex}/{secondsIndex}/{msIndex}")); using var securePublicKey = extKey.GetPublicKey(); using var publicKey = securePublicKey.ToUnsecuredBytes(); return(Sha512.Compute(publicKey)); }