public override void SaveToStream(Stream s) { using (BinaryWriter bw = new BinaryWriter(s, Encoding.ASCII, true)) { bw.Write(SignerAccount); bw.Write(TargetAccount); bw.Write((ushort)TransactionType); bw.Write(NumberOfOperations); if (TransactionType == TransactionType.ListAccountForSale) { bw.Write(AccountPrice); bw.Write(AccountToPay); AccountKey.SaveToStream(s, false); if (NewPublicKey.CurveType != CurveType.Empty) { NewPublicKey.SaveToStream(s); } else { bw.Write((ushort)0); } bw.Write(LockedUntilBlock); } bw.Write(Fee); Payload.SaveToStream(bw); Signature.SaveToStream(s); } }
public override byte[] GetHash() { using (MemoryStream ms = new MemoryStream()) { using (BinaryWriter bw = new BinaryWriter(ms)) { bw.Write(SignerAccount); bw.Write(TargetAccount); bw.Write(NumberOfOperations); bw.Write(AccountPrice); bw.Write(AccountToPay); bw.Write(Fee); Payload.SaveToStream(bw, false); if (AccountKey?.PublicKey.X != null && AccountKey.PublicKey.X.Length > 0 && AccountKey.PublicKey.Y.Length > 0) { bw.Write((ushort)AccountKey.CurveType); bw.Write((byte[])AccountKey.PublicKey.X); bw.Write((byte[])AccountKey.PublicKey.Y); } else { bw.Write((ushort)0); } NewPublicKey.SaveToStream(ms, false); bw.Write(LockedUntilBlock); ms.Position = 0; return(ms.ToArray()); } } }
/// <summary> /// Create a public key <see cref="NewPublicKey"/>. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#create-a-public-key /// </remarks> /// <param name="newKey">The SSH Key contents</param> /// <returns>Creates a public key.</returns> public IObservable<PublicKey> Create(NewPublicKey newKey) { Ensure.ArgumentNotNull(newKey, "newKey"); return _client.Create(newKey).ToObservable(); }
/// <summary> /// Create a public key <see cref="NewPublicKey"/>. /// </summary> /// <remarks> /// https://developer.github.com/v3/users/keys/#create-a-public-key /// </remarks> /// <param name="newKey">The SSH Key contents</param> /// <returns></returns> public IObservable <PublicKey> Create(NewPublicKey newKey) { Ensure.ArgumentNotNull(newKey, "newKey"); return(_client.Create(newKey).ToObservable()); }