Skip to content

Instantly share code, notes, and snippets.

@v0l
v0l / NostrAuth.cs
Created March 31, 2023 09:20
Nostr auth handler for ASP.NET
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Text.Json;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Options;
using NNostr.Client;
public static class NostrAuth
{
public const string Scheme = "Nostr";
use bitcoin::consensus::Decodable;
use bitcoin::hashes::hex::FromHex;
use bitcoin::hashes::hex::ToHex;
use bitcoin::Transaction;
use bitcoin::util::psbt::serialize::Serialize;
fn main() {
let amount = 100_000_000u64;
println!();
use std::str::FromStr;
use bitcoin::util::bip32::ExtendedPubKey;
use bitcoin::util::bip32::DerivationPath;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::secp256k1::ffi::types::AlignedType;
use slip132::FromSlip132;
fn main() {
let network = bitcoin::Network::Bitcoin;
@v0l
v0l / NppSerializer
Last active June 24, 2016 15:57
A c# Binary serializer using attribute flags, usefull if you need to do network communication with C++ applications that copy structs directly from memory.
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
namespace npid
{
[AttributeUsage(AttributeTargets.Struct)]