oopsy back to the actual current repo domain name
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// DecodeAddressTag unpacks the contents of an `a` tag.
|
||||
|
||||
@@ -23,7 +23,7 @@ package atomic_test
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/atomic"
|
||||
"realy.lol/atomic"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/event"
|
||||
"realy.mleku.dev/kind"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/tag"
|
||||
"realy.mleku.dev/tags"
|
||||
"realy.mleku.dev/timestamp"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/event"
|
||||
"realy.lol/kind"
|
||||
"realy.lol/log"
|
||||
"realy.lol/tag"
|
||||
"realy.lol/tags"
|
||||
"realy.lol/timestamp"
|
||||
)
|
||||
|
||||
// GenerateChallenge creates a reasonable, 96 byte base64 challenge string
|
||||
|
||||
@@ -3,8 +3,8 @@ package auth
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/p256k"
|
||||
)
|
||||
|
||||
func TestCreateUnsigned(t *testing.T) {
|
||||
|
||||
@@ -3,13 +3,13 @@ package bech32encoding
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
btcec "realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/bech32"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/chk"
|
||||
btcec "realy.lol/ec"
|
||||
"realy.lol/ec/bech32"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
func TestConvertBits(t *testing.T) {
|
||||
|
||||
@@ -4,17 +4,17 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
"realy.mleku.dev/bech32encoding/pointers"
|
||||
"realy.mleku.dev/bech32encoding/tlv"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec/bech32"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/eventid"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/kind"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/bech32encoding/pointers"
|
||||
"realy.lol/bech32encoding/tlv"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec/bech32"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/eventid"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/kind"
|
||||
"realy.lol/log"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/bech32encoding/pointers"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/eventid"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/kind"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/bech32encoding/pointers"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/eventid"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/kind"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
func TestEncodeNpub(t *testing.T) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package pointers
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/eventid"
|
||||
"realy.mleku.dev/kind"
|
||||
"realy.lol/eventid"
|
||||
"realy.lol/kind"
|
||||
)
|
||||
|
||||
// Profile pointer is a combination of pubkey and relay list.
|
||||
|
||||
@@ -6,7 +6,7 @@ package tlv
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.lol/chk"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -3,7 +3,7 @@ package bin
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.lol/errorf"
|
||||
)
|
||||
|
||||
// Append is a straight append with length prefix.
|
||||
|
||||
307
bunker/client.go
Normal file
307
bunker/client.go
Normal file
@@ -0,0 +1,307 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/puzpuzpuz/xsync/v3"
|
||||
|
||||
"relay.mleku.dev/atomic"
|
||||
"relay.mleku.dev/chk"
|
||||
"relay.mleku.dev/context"
|
||||
"relay.mleku.dev/encryption"
|
||||
"relay.mleku.dev/errorf"
|
||||
"relay.mleku.dev/event"
|
||||
"relay.mleku.dev/filter"
|
||||
"relay.mleku.dev/filters"
|
||||
"relay.mleku.dev/hex"
|
||||
"relay.mleku.dev/keys"
|
||||
"relay.mleku.dev/kind"
|
||||
"relay.mleku.dev/kinds"
|
||||
"relay.mleku.dev/p256k"
|
||||
"relay.mleku.dev/signer"
|
||||
"relay.mleku.dev/tag"
|
||||
"relay.mleku.dev/tags"
|
||||
"relay.mleku.dev/timestamp"
|
||||
"relay.mleku.dev/ws"
|
||||
)
|
||||
|
||||
type BunkerClient struct {
|
||||
serial atomic.Uint64
|
||||
clientSecretKey signer.I
|
||||
target []byte
|
||||
pool *ws.Pool
|
||||
relays []string
|
||||
conversationKey []byte // nip44
|
||||
listeners *xsync.MapOf[string, chan Response]
|
||||
expectingAuth *xsync.MapOf[string, struct{}]
|
||||
idPrefix string
|
||||
onAuth func(string)
|
||||
// memoized
|
||||
getPublicKeyResponse string
|
||||
// SkipSignatureCheck can be set if you don't want to double-check incoming signatures
|
||||
SkipSignatureCheck bool
|
||||
}
|
||||
|
||||
// ConnectBunker establishes an RPC connection to a NIP-46 signer using the relays and secret provided in the bunkerURL.
|
||||
// pool can be passed to reuse an existing pool, otherwise a new pool will be created.
|
||||
func ConnectBunker(
|
||||
ctx context.T,
|
||||
clientSecretKey signer.I,
|
||||
bunkerURLOrNIP05 string,
|
||||
pool *ws.Pool,
|
||||
onAuth func(string),
|
||||
) (client *BunkerClient, err error) {
|
||||
var parsed *url.URL
|
||||
if parsed, err = url.Parse(bunkerURLOrNIP05); chk.E(err) {
|
||||
return
|
||||
}
|
||||
// assume it's a bunker url (will fail later if not)
|
||||
secret := parsed.Query().Get("secret")
|
||||
relays := parsed.Query()["relay"]
|
||||
targetPublicKey := parsed.Host
|
||||
if parsed.Scheme == "" {
|
||||
// could be a NIP-05
|
||||
var pubkey string
|
||||
var relays_ []string
|
||||
if pubkey, relays_, err = queryWellKnownNostrJson(ctx, bunkerURLOrNIP05); chk.E(err) {
|
||||
return
|
||||
}
|
||||
targetPublicKey = pubkey
|
||||
relays = relays_
|
||||
} else if parsed.Scheme == "bunker" {
|
||||
// this is what we were expecting, so just move on
|
||||
} else {
|
||||
// otherwise fail here
|
||||
err = errorf.E("wrong scheme '%s', must be bunker://", parsed.Scheme)
|
||||
return
|
||||
}
|
||||
if !keys.IsValidPublicKey(targetPublicKey) {
|
||||
err = errorf.E("'%s' is not a valid public key hex", targetPublicKey)
|
||||
return
|
||||
}
|
||||
var targetPubkey, sec []byte
|
||||
if targetPubkey, err = keys.HexPubkeyToBytes(targetPublicKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if sec, err = hex.Dec(secret); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if client, err = NewBunker(
|
||||
ctx,
|
||||
clientSecretKey,
|
||||
targetPubkey,
|
||||
relays,
|
||||
pool,
|
||||
onAuth,
|
||||
); chk.E(err) {
|
||||
return
|
||||
}
|
||||
_, err = client.RPC(ctx, "connect", [][]byte{targetPubkey, sec})
|
||||
return
|
||||
}
|
||||
|
||||
func NewBunker(
|
||||
ctx context.T,
|
||||
clientSecretKey signer.I,
|
||||
targetPublicKey []byte,
|
||||
relays []string,
|
||||
pool *ws.Pool,
|
||||
onAuth func(string),
|
||||
) (client *BunkerClient, err error) {
|
||||
if pool == nil {
|
||||
pool = ws.NewPool(ctx)
|
||||
}
|
||||
clientSecret := new(p256k.Signer)
|
||||
if err = clientSecret.InitSec(clientSecretKey.Sec()); chk.E(err) {
|
||||
return
|
||||
}
|
||||
clientPubkey := clientSecret.Pub()
|
||||
var conversationKey, sharedSecret []byte
|
||||
if sharedSecret, err = encryption.ComputeSharedSecret(targetPublicKey,
|
||||
clientSecretKey.Sec()); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if conversationKey, err = encryption.GenerateConversationKey(targetPublicKey,
|
||||
clientSecret.Sec()); chk.E(err) {
|
||||
return
|
||||
}
|
||||
client = &BunkerClient{
|
||||
pool: pool,
|
||||
clientSecretKey: clientSecretKey,
|
||||
target: targetPublicKey,
|
||||
relays: relays,
|
||||
conversationKey: conversationKey,
|
||||
listeners: xsync.NewMapOf[string, chan Response](),
|
||||
expectingAuth: xsync.NewMapOf[string, struct{}](),
|
||||
onAuth: onAuth,
|
||||
idPrefix: "gn-" + strconv.Itoa(rand.Intn(65536)),
|
||||
}
|
||||
go func() {
|
||||
now := timestamp.Now()
|
||||
events := pool.SubMany(ctx, relays, filters.New(&filter.T{
|
||||
Tags: tags.New(tag.New([]byte("p"), clientPubkey)),
|
||||
Kinds: kinds.New(kind.NostrConnect),
|
||||
Since: now,
|
||||
}), ws.WithLabel("bunker46client"))
|
||||
for ev := range events {
|
||||
if !ev.Event.Kind.Equal(kind.NostrConnect) {
|
||||
err = errorf.E("event kind is %s, but we expected %s",
|
||||
ev.Event.Kind.Name(), kind.NostrConnect.Name())
|
||||
continue
|
||||
}
|
||||
var plain []byte
|
||||
if plain, err = encryption.Decrypt(ev.Event.Content, conversationKey); chk.E(err) {
|
||||
if plain, err = encryption.DecryptNip4(ev.Event.Content,
|
||||
sharedSecret); chk.E(err) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
var resp Response
|
||||
if err = json.Unmarshal(plain, &resp); chk.E(err) {
|
||||
continue
|
||||
}
|
||||
if resp.Result == "auth_url" {
|
||||
// special case
|
||||
authURL := resp.Error
|
||||
if _, ok := client.expectingAuth.Load(resp.ID); ok {
|
||||
client.onAuth(authURL)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if dispatcher, ok := client.listeners.Load(resp.ID); ok {
|
||||
dispatcher <- resp
|
||||
continue
|
||||
}
|
||||
}
|
||||
}()
|
||||
return
|
||||
}
|
||||
|
||||
func (client *BunkerClient) RPC(ctx context.T, method string,
|
||||
params [][]byte) (result string, err error) {
|
||||
id := client.idPrefix + "-" + strconv.FormatUint(client.serial.Add(1), 10)
|
||||
var req []byte
|
||||
if req, err = json.Marshal(Request{
|
||||
ID: id,
|
||||
Method: method,
|
||||
Params: params,
|
||||
}); chk.E(err) {
|
||||
return
|
||||
}
|
||||
var content []byte
|
||||
if content, err = encryption.Encrypt(req, client.conversationKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
ev := &event.T{
|
||||
Content: content,
|
||||
CreatedAt: timestamp.Now(),
|
||||
Kind: kind.NostrConnect,
|
||||
Tags: tags.New(tag.New([]byte("p"), client.target)),
|
||||
}
|
||||
if err = ev.Sign(client.clientSecretKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
respWaiter := make(chan Response)
|
||||
client.listeners.Store(id, respWaiter)
|
||||
defer func() {
|
||||
client.listeners.Delete(id)
|
||||
close(respWaiter)
|
||||
}()
|
||||
hasWorked := make(chan struct{})
|
||||
for _, url := range client.relays {
|
||||
go func(url string) {
|
||||
var relay *ws.Client
|
||||
relay, err = client.pool.EnsureRelay(url)
|
||||
if err == nil {
|
||||
if err = relay.Publish(ctx, ev); chk.E(err) {
|
||||
return
|
||||
}
|
||||
select {
|
||||
case hasWorked <- struct{}{}: // todo: shouldn't this be after success?
|
||||
default:
|
||||
}
|
||||
}
|
||||
}(url)
|
||||
}
|
||||
select {
|
||||
case <-hasWorked:
|
||||
// continue
|
||||
case <-ctx.Done():
|
||||
err = errorf.E("couldn't connect to any relay")
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
err = errorf.E("context canceled")
|
||||
return
|
||||
case resp := <-respWaiter:
|
||||
if resp.Error != "" {
|
||||
err = errorf.E("response error: %s", resp.Error)
|
||||
return
|
||||
}
|
||||
result = resp.Result
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (client *BunkerClient) Ping(ctx context.T) (err error) {
|
||||
if _, err = client.RPC(ctx, "ping", [][]byte{}); chk.E(err) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (client *BunkerClient) GetPublicKey(ctx context.T) (resp string, err error) {
|
||||
if client.getPublicKeyResponse != "" {
|
||||
resp = client.getPublicKeyResponse
|
||||
return
|
||||
}
|
||||
resp, err = client.RPC(ctx, "get_public_key", [][]byte{})
|
||||
client.getPublicKeyResponse = resp
|
||||
return
|
||||
}
|
||||
|
||||
func (client *BunkerClient) SignEvent(ctx context.T, evt *event.T) (err error) {
|
||||
var resp string
|
||||
if resp, err = client.RPC(ctx, "sign_event", [][]byte{evt.Serialize()}); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if err = json.Unmarshal([]byte(resp), evt); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if !client.SkipSignatureCheck {
|
||||
var valid bool
|
||||
if valid, err = evt.Verify(); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if !valid {
|
||||
err = errorf.E("sign_event response from bunker has invalid signature")
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (client *BunkerClient) NIP44Encrypt(ctx context.T,
|
||||
targetPublicKey, plaintext []byte) (string, error) {
|
||||
return client.RPC(ctx, "nip44_encrypt", [][]byte{targetPublicKey, plaintext})
|
||||
}
|
||||
|
||||
func (client *BunkerClient) NIP44Decrypt(ctx context.T,
|
||||
targetPublicKey, ciphertext []byte) (string, error) {
|
||||
return client.RPC(ctx, "nip44_decrypt", [][]byte{targetPublicKey, ciphertext})
|
||||
}
|
||||
|
||||
func (client *BunkerClient) NIP04Encrypt(ctx context.T,
|
||||
targetPublicKey, plaintext []byte) (string, error) {
|
||||
return client.RPC(ctx, "nip04_encrypt", [][]byte{targetPublicKey, plaintext})
|
||||
}
|
||||
|
||||
func (client *BunkerClient) NIP04Decrypt(ctx context.T,
|
||||
targetPublicKey, ciphertext []byte) (string, error) {
|
||||
return client.RPC(ctx, "nip04_decrypt", [][]byte{targetPublicKey, ciphertext})
|
||||
}
|
||||
69
bunker/main.go
Normal file
69
bunker/main.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"relay.mleku.dev/chk"
|
||||
"relay.mleku.dev/context"
|
||||
"relay.mleku.dev/event"
|
||||
"relay.mleku.dev/keys"
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID string `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params [][]byte `json:"params"`
|
||||
}
|
||||
|
||||
func (r *Request) String() (s string) {
|
||||
var j []byte
|
||||
var err error
|
||||
if j, err = json.Marshal(r); chk.E(err) {
|
||||
return
|
||||
}
|
||||
return string(j)
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
ID string `json:"id"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Result string `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
func (r *Response) String() (s string) {
|
||||
var j []byte
|
||||
var err error
|
||||
if j, err = json.Marshal(r); chk.E(err) {
|
||||
return
|
||||
}
|
||||
return string(j)
|
||||
}
|
||||
|
||||
type Signer interface {
|
||||
GetSession(clientPubkey string) (*Session, bool)
|
||||
HandleRequest(context.T, *event.T) (req *Request, resp *Response,
|
||||
eventResponse *event.T, err error)
|
||||
}
|
||||
|
||||
type RelayReadWrite struct {
|
||||
Read, Write bool
|
||||
}
|
||||
|
||||
func IsValidBunkerURL(input string) bool {
|
||||
p, err := url.Parse(input)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if p.Scheme != "bunker" {
|
||||
return false
|
||||
}
|
||||
if !keys.IsValidPublicKey(p.Host) {
|
||||
return false
|
||||
}
|
||||
if !strings.Contains(p.RawQuery, "relay=") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
24
bunker/nip46_test.go
Normal file
24
bunker/nip46_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestValidBunkerURL(t *testing.T) {
|
||||
valid := IsValidBunkerURL("bunker://3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d?relay=wss%3A%2F%2Frelay.damus.io&relay=wss%3A%2F%2Frelay.snort.social&relay=wss%3A%2F%2Frelay.nsecbunker.com")
|
||||
assert.True(t, valid, "should be valid")
|
||||
|
||||
inValid := IsValidBunkerURL("askjdbkajdbv")
|
||||
assert.False(t, inValid, "should be invalid")
|
||||
|
||||
inValid1 := IsValidBunkerURL("asdjasbndksa@asjdnksa.com")
|
||||
assert.False(t, inValid1, "should be invalid")
|
||||
|
||||
inValid2 := IsValidBunkerURL("https://hello.com?relays=wss://xxxxxx.xxxx")
|
||||
assert.False(t, inValid2, "should be invalid")
|
||||
|
||||
inValid3 := IsValidBunkerURL("bunker://fa883d107ef9e558472c4eb9aaaefa459d?relay=wss%3A%2F%2Frelay.damus.io&relay=wss%3A%2F%2Frelay.snort.social&relay=wss%3A%2F%2Frelay.nsecbunker.com")
|
||||
assert.False(t, inValid3, "should be invalid")
|
||||
}
|
||||
61
bunker/session.go
Normal file
61
bunker/session.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"relay.mleku.dev/chk"
|
||||
"relay.mleku.dev/encryption"
|
||||
"relay.mleku.dev/event"
|
||||
"relay.mleku.dev/kind"
|
||||
"relay.mleku.dev/tag"
|
||||
"relay.mleku.dev/tags"
|
||||
"relay.mleku.dev/timestamp"
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
Pubkey, SharedKey, ConversationKey []byte
|
||||
}
|
||||
|
||||
func (s *Session) ParseRequest(ev *event.T) (req *Request, err error) {
|
||||
var b []byte
|
||||
if b, err = encryption.Decrypt(ev.Content, s.ConversationKey); chk.E(err) {
|
||||
if b, err = encryption.DecryptNip4(ev.Content, s.SharedKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if err = json.Unmarshal(b, &req); chk.E(err) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Session) MakeResponse(id, requester, result string,
|
||||
rErr error) (resp *Response, ev *event.T, err error) {
|
||||
if rErr != nil {
|
||||
resp = &Response{
|
||||
ID: id,
|
||||
Result: rErr.Error(),
|
||||
}
|
||||
} else if len(result) > 0 {
|
||||
resp = &Response{
|
||||
ID: id,
|
||||
Result: result,
|
||||
}
|
||||
}
|
||||
// todo: what if the response is empty? this shouldn't happen i think?
|
||||
var j []byte
|
||||
if j, err = json.Marshal(resp); chk.E(err) {
|
||||
return
|
||||
}
|
||||
var ciphertext []byte
|
||||
if ciphertext, err = encryption.Encrypt(j, s.ConversationKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
ev = &event.T{
|
||||
Content: ciphertext,
|
||||
CreatedAt: timestamp.Now(),
|
||||
Kind: kind.NostrConnect,
|
||||
Tags: tags.New(tag.New("p", requester)),
|
||||
}
|
||||
return
|
||||
}
|
||||
206
bunker/static.go
Normal file
206
bunker/static.go
Normal file
@@ -0,0 +1,206 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"relay.mleku.dev/chk"
|
||||
"relay.mleku.dev/context"
|
||||
"relay.mleku.dev/ec/schnorr"
|
||||
"relay.mleku.dev/encryption"
|
||||
"relay.mleku.dev/errorf"
|
||||
"relay.mleku.dev/event"
|
||||
"relay.mleku.dev/hex"
|
||||
"relay.mleku.dev/keys"
|
||||
"relay.mleku.dev/kind"
|
||||
"relay.mleku.dev/signer"
|
||||
)
|
||||
|
||||
var _ Signer = (*StaticKeySigner)(nil)
|
||||
|
||||
type StaticKeySigner struct {
|
||||
sync.Mutex
|
||||
secretKey signer.I
|
||||
sessions map[string]*Session
|
||||
RelaysToAdvertise map[string]RelayReadWrite
|
||||
AuthorizeRequest func(harmless bool, from, secret []byte) bool
|
||||
}
|
||||
|
||||
func NewStaticKeySigner(secretKey signer.I) *StaticKeySigner {
|
||||
return &StaticKeySigner{secretKey: secretKey,
|
||||
RelaysToAdvertise: make(map[string]RelayReadWrite)}
|
||||
}
|
||||
|
||||
func (p *StaticKeySigner) GetSession(clientPubkey string) (s *Session, exists bool) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
s, exists = p.sessions[clientPubkey]
|
||||
return
|
||||
}
|
||||
|
||||
func (p *StaticKeySigner) getOrCreateSession(clientPubkey []byte) (s *Session, err error) {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
s = new(Session)
|
||||
var exists bool
|
||||
if s, exists = p.sessions[string(clientPubkey)]; exists {
|
||||
return
|
||||
}
|
||||
if s.SharedKey, err = encryption.ComputeSharedSecret(clientPubkey,
|
||||
p.secretKey.Sec()); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if s.ConversationKey, err = encryption.GenerateConversationKey(clientPubkey,
|
||||
p.secretKey.Pub()); chk.E(err) {
|
||||
return
|
||||
}
|
||||
s.Pubkey = p.secretKey.Pub()
|
||||
// add to pool
|
||||
p.sessions[string(clientPubkey)] = s
|
||||
return
|
||||
}
|
||||
|
||||
func (p *StaticKeySigner) HandleRequest(_ context.T, ev *event.T) (req *Request, res *Response,
|
||||
eventResponse *event.T, err error) {
|
||||
if !ev.Kind.Equal(kind.NostrConnect) {
|
||||
err = errorf.E("event kind is %s, but we expected %s",
|
||||
ev.Kind.Name(), kind.NostrConnect.Name())
|
||||
return
|
||||
}
|
||||
var session *Session
|
||||
if session, err = p.getOrCreateSession(ev.Pubkey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if req, err = session.ParseRequest(ev); chk.E(err) {
|
||||
return
|
||||
}
|
||||
var secret, result []byte
|
||||
var harmless bool
|
||||
var rErr error
|
||||
switch req.Method {
|
||||
case "connect":
|
||||
if len(req.Params) >= 2 {
|
||||
secret = req.Params[1]
|
||||
}
|
||||
result = []byte("ack")
|
||||
harmless = true
|
||||
case "get_public_key":
|
||||
result = session.Pubkey
|
||||
harmless = true
|
||||
case "sign_event":
|
||||
if len(req.Params) != 1 {
|
||||
rErr = errorf.E("wrong number of arguments to 'sign_event'")
|
||||
break
|
||||
}
|
||||
evt := &event.T{}
|
||||
if rErr = json.Unmarshal(req.Params[0], evt); chk.E(rErr) {
|
||||
break
|
||||
}
|
||||
if rErr = evt.Sign(p.secretKey); chk.E(rErr) {
|
||||
break
|
||||
}
|
||||
result = evt.Serialize()
|
||||
case "get_relays":
|
||||
if result, rErr = json.Marshal(p.RelaysToAdvertise); chk.E(rErr) {
|
||||
break
|
||||
}
|
||||
harmless = true
|
||||
case "nip44_encrypt":
|
||||
var pk, sharedSecret []byte
|
||||
if pk, rErr = CheckParamsAndKey(req); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if sharedSecret, rErr = p.GetConversationKey(pk); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if result, rErr = encryption.Encrypt(req.Params[1], sharedSecret); chk.E(err) {
|
||||
break
|
||||
}
|
||||
case "nip44_decrypt":
|
||||
var pk, sharedSecret []byte
|
||||
if pk, rErr = CheckParamsAndKey(req); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if sharedSecret, rErr = p.GetConversationKey(pk); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if result, err = encryption.Decrypt(req.Params[1], sharedSecret); chk.E(err) {
|
||||
break
|
||||
}
|
||||
case "nip04_encrypt":
|
||||
var pk, sharedSecret []byte
|
||||
if pk, rErr = CheckParamsAndKey(req); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if sharedSecret, rErr = p.ComputeSharedSecret(pk); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if result, rErr = encryption.EncryptNip4(req.Params[1],
|
||||
sharedSecret); chk.E(err) {
|
||||
break
|
||||
}
|
||||
case "nip04_decrypt":
|
||||
var pk, sharedSecret []byte
|
||||
if pk, rErr = CheckParamsAndKey(req); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if sharedSecret, rErr = p.ComputeSharedSecret(pk); chk.E(err) {
|
||||
break
|
||||
}
|
||||
if result, rErr = encryption.DecryptNip4(req.Params[1],
|
||||
sharedSecret); chk.E(err) {
|
||||
break
|
||||
}
|
||||
case "ping":
|
||||
result = []byte("pong")
|
||||
harmless = true
|
||||
default:
|
||||
rErr = errorf.E("unknown method '%s'", req.Method)
|
||||
}
|
||||
if rErr == nil && p.AuthorizeRequest != nil {
|
||||
if !p.AuthorizeRequest(harmless, ev.Pubkey, secret) {
|
||||
rErr = fmt.Errorf("unauthorized")
|
||||
}
|
||||
}
|
||||
if res, eventResponse, err = session.MakeResponse(req.ID, hex.Enc(ev.Pubkey),
|
||||
string(result), rErr); chk.E(err) {
|
||||
return
|
||||
}
|
||||
if err = eventResponse.Sign(p.secretKey); chk.E(err) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *StaticKeySigner) GetConversationKey(pk []byte) (sharedSecret []byte, rErr error) {
|
||||
if sharedSecret, rErr = encryption.GenerateConversationKey(pk,
|
||||
p.secretKey.Sec()); chk.E(rErr) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *StaticKeySigner) ComputeSharedSecret(pk []byte) (sharedSecret []byte, rErr error) {
|
||||
if sharedSecret, rErr = encryption.ComputeSharedSecret(pk,
|
||||
p.secretKey.Sec()); chk.E(rErr) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func CheckParamsAndKey(req *Request) (pk []byte, rErr error) {
|
||||
if len(req.Params) != 2 {
|
||||
rErr = errorf.E("wrong number of arguments to 'nip04_decrypt'")
|
||||
return
|
||||
}
|
||||
if !keys.IsValidPublicKey(req.Params[0]) {
|
||||
rErr = errorf.E("first argument to 'nip04_decrypt' is not a pubkey string")
|
||||
return
|
||||
}
|
||||
pk = make([]byte, schnorr.PubKeyBytesLen)
|
||||
if _, rErr = hex.DecBytes(pk, req.Params[0]); chk.E(rErr) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
30
bunker/wellknownnostrjson.go
Normal file
30
bunker/wellknownnostrjson.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package bunker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"relay.mleku.dev/chk"
|
||||
"relay.mleku.dev/dns"
|
||||
"relay.mleku.dev/errorf"
|
||||
)
|
||||
|
||||
func queryWellKnownNostrJson(ctx context.Context, fullname string) (pubkey string,
|
||||
relays []string, err error) {
|
||||
var result *dns.WellKnownResponse
|
||||
var name string
|
||||
if result, name, err = dns.Fetch(ctx, fullname); chk.E(err) {
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
if pubkey, ok = result.Names[name]; !ok {
|
||||
return "", nil, fmt.Errorf("no entry found for the '%s' name", name)
|
||||
}
|
||||
if relays, _ = result.NIP46[pubkey]; !ok {
|
||||
err = errorf.E("no bunker relays found for the '%s' name", name)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
package chk
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/lol"
|
||||
"realy.lol/lol"
|
||||
)
|
||||
|
||||
var F, E, W, I, D, T lol.Chk
|
||||
|
||||
@@ -26,14 +26,14 @@ import (
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/cmd/lerproxy/buf"
|
||||
"realy.mleku.dev/cmd/lerproxy/hsts"
|
||||
"realy.mleku.dev/cmd/lerproxy/reverse"
|
||||
"realy.mleku.dev/cmd/lerproxy/tcpkeepalive"
|
||||
"realy.mleku.dev/cmd/lerproxy/util"
|
||||
"realy.mleku.dev/context"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/cmd/lerproxy/buf"
|
||||
"realy.lol/cmd/lerproxy/hsts"
|
||||
"realy.lol/cmd/lerproxy/reverse"
|
||||
"realy.lol/cmd/lerproxy/tcpkeepalive"
|
||||
"realy.lol/cmd/lerproxy/util"
|
||||
"realy.lol/context"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
type runArgs struct {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
||||
"realy.mleku.dev/cmd/lerproxy/util"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/cmd/lerproxy/util"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
// NewSingleHostReverseProxy is a copy of httputil.NewSingleHostReverseProxy
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/cmd/lerproxy/timeout"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/cmd/lerproxy/timeout"
|
||||
)
|
||||
|
||||
// Period can be changed prior to opening a Listener to alter its'
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.lol/chk"
|
||||
)
|
||||
|
||||
// Conn extends deadline after successful read or write operations
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/bech32encoding"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/httpauth"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.mleku.dev/signer"
|
||||
"realy.lol/bech32encoding"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/httpauth"
|
||||
"realy.lol/log"
|
||||
"realy.lol/p256k"
|
||||
"realy.lol/signer"
|
||||
)
|
||||
|
||||
const secEnv = "NOSTR_SECRET_KEY"
|
||||
|
||||
@@ -10,16 +10,16 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
realy_lol "realy.mleku.dev"
|
||||
"realy.mleku.dev/bech32encoding"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/httpauth"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.mleku.dev/signer"
|
||||
realy_lol "realy.lol"
|
||||
"realy.lol/bech32encoding"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/httpauth"
|
||||
"realy.lol/log"
|
||||
"realy.lol/p256k"
|
||||
"realy.lol/sha256"
|
||||
"realy.lol/signer"
|
||||
)
|
||||
|
||||
const secEnv = "NOSTR_SECRET_KEY"
|
||||
|
||||
@@ -17,22 +17,22 @@ import (
|
||||
|
||||
"github.com/adrg/xdg"
|
||||
|
||||
realy_lol "realy.mleku.dev"
|
||||
"realy.mleku.dev/bech32encoding"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/config"
|
||||
"realy.mleku.dev/context"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/interrupt"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/lol"
|
||||
"realy.mleku.dev/openapi"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.mleku.dev/ratel"
|
||||
"realy.mleku.dev/realy"
|
||||
"realy.mleku.dev/servemux"
|
||||
"realy.mleku.dev/socketapi"
|
||||
"realy.mleku.dev/units"
|
||||
realy_lol "realy.lol"
|
||||
"realy.lol/bech32encoding"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/config"
|
||||
"realy.lol/context"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/interrupt"
|
||||
"realy.lol/log"
|
||||
"realy.lol/lol"
|
||||
"realy.lol/openapi"
|
||||
"realy.lol/p256k"
|
||||
"realy.lol/ratel"
|
||||
"realy.lol/realy"
|
||||
"realy.lol/servemux"
|
||||
"realy.lol/socketapi"
|
||||
"realy.lol/units"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -14,14 +14,14 @@ import (
|
||||
|
||||
"github.com/alexflint/go-arg"
|
||||
|
||||
"realy.mleku.dev/atomic"
|
||||
"realy.mleku.dev/bech32encoding"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec/bech32"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/interrupt"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/atomic"
|
||||
"realy.lol/bech32encoding"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec/bech32"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/interrupt"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
var prefix = append(bech32encoding.PubHRP, '1')
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"github.com/pkg/profile"
|
||||
"go-simpler.org/env"
|
||||
|
||||
"realy.mleku.dev"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/config/keyvalue"
|
||||
"realy.lol"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/config/keyvalue"
|
||||
)
|
||||
|
||||
// C is the configuration for a realy. Note that it is absolutely minimal. More complex
|
||||
|
||||
10
dns/nip05.go
10
dns/nip05.go
@@ -9,11 +9,11 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"realy.mleku.dev/bech32encoding/pointers"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/context"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/keys"
|
||||
"realy.lol/bech32encoding/pointers"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/context"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/keys"
|
||||
)
|
||||
|
||||
// Nip05Regex is an regular expression that matches up with the same pattern as
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/bech32encoding/pointers"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/keys"
|
||||
"realy.lol/bech32encoding/pointers"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/keys"
|
||||
)
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
realy.mleku.dev/pkg/ec
|
||||
realy.lol/pkg/ec
|
||||
=====
|
||||
|
||||
This is a full drop-in replacement for
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/base58"
|
||||
"realy.lol/ec/base58"
|
||||
)
|
||||
|
||||
var stringTests = []struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/base58"
|
||||
"realy.lol/ec/base58"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -7,7 +7,7 @@ package base58
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
// ErrChecksum indicates that the checksum of a check-encoded string does not verify against
|
||||
|
||||
@@ -7,7 +7,7 @@ package base58_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/base58"
|
||||
"realy.lol/ec/base58"
|
||||
)
|
||||
|
||||
var checkEncodingStringTests = []struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ package base58_test
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/ec/base58"
|
||||
"realy.lol/ec/base58"
|
||||
)
|
||||
|
||||
// This example demonstrates how to decode modified base58 encoded data.
|
||||
|
||||
@@ -2,7 +2,7 @@ bech32
|
||||
==========
|
||||
|
||||
[](http://copyfree.org)
|
||||
[](http://godoc.org/realy.mleku.dev/pkg/ec/bech32)
|
||||
[](http://godoc.org/realy.lol/pkg/ec/bech32)
|
||||
|
||||
Package bech32 provides a Go implementation of the bech32 format specified in
|
||||
[BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki).
|
||||
@@ -17,9 +17,9 @@ $ go get -u mleku.dev/pkg/ec/bech32
|
||||
|
||||
## Examples
|
||||
|
||||
* [Bech32 decode Example](http://godoc.org/realy.mleku.dev/pkg/ec/bech32#example-Bech32Decode)
|
||||
* [Bech32 decode Example](http://godoc.org/realy.lol/pkg/ec/bech32#example-Bech32Decode)
|
||||
Demonstrates how to decode a bech32 encoded string.
|
||||
* [Bech32 encode Example](http://godoc.org/realy.mleku.dev/pkg/ec/bech32#example-BechEncode)
|
||||
* [Bech32 encode Example](http://godoc.org/realy.lol/pkg/ec/bech32#example-BechEncode)
|
||||
Demonstrates how to encode data into a bech32 string.
|
||||
|
||||
## License
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// setHex decodes the passed big-endian hex string into the internal field value
|
||||
|
||||
@@ -20,7 +20,7 @@ package btcec
|
||||
// reverse the transform than to operate in affine coordinates.
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// KoblitzCurve provides an implementation for secp256k1 that fits the ECC
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/ec/wire"
|
||||
"realy.lol/ec/wire"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -3,8 +3,8 @@ package chaincfg
|
||||
import (
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/wire"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/wire"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/wire"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/wire"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package chainhash
|
||||
|
||||
import "realy.mleku.dev/sha256"
|
||||
import "realy.lol/sha256"
|
||||
|
||||
// HashB calculates hash(b) and returns the resulting bytes.
|
||||
func HashB(b []byte) []byte {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package btcec
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// GenerateSharedSecret generates a shared secret based on a secret key and a
|
||||
|
||||
@@ -6,7 +6,7 @@ package btcec
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// JacobianPoint is an element of the group formed by the secp256k1 curve in
|
||||
|
||||
@@ -8,8 +8,8 @@ package ecdsa
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// hexToModNScalar converts the passed hex string into a ModNScalar and will
|
||||
|
||||
@@ -8,7 +8,7 @@ package ecdsa
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// References:
|
||||
|
||||
@@ -15,9 +15,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// hexToBytes converts the passed hex string into bytes and will panic if there
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package btcec
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// Error identifies an error related to public key cryptography using a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package btcec
|
||||
|
||||
import "realy.mleku.dev/ec/secp256k1"
|
||||
import "realy.lol/ec/secp256k1"
|
||||
|
||||
// FieldVal implements optimized fixed-precision arithmetic over the secp256k1
|
||||
// finite field. This means all arithmetic is performed modulo
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// TestIsZero ensures that checking if a field IsZero works as expected.
|
||||
|
||||
@@ -11,7 +11,7 @@ package btcec
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
func FuzzParsePubKey(f *testing.F) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package btcec
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// ModNScalar implements optimized 256-bit constant-time fixed-precision
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -5,9 +5,9 @@ package musig2
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/schnorr"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/schnorr"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
type nonceGenTestCase struct {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/schnorr"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/schnorr"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package btcec
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// These constants define the lengths of serialized public keys.
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
// hexToBytes converts the passed hex string into bytes and will panic if there
|
||||
|
||||
@@ -8,8 +8,8 @@ package schnorr
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// These constants define the lengths of serialized public keys.
|
||||
|
||||
@@ -5,10 +5,10 @@ package schnorr
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/chainhash"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
type bip340Test struct {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package btcec
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.lol/ec/secp256k1"
|
||||
)
|
||||
|
||||
// SecretKey wraps an ecdsa.SecretKey as a convenience mainly for signing things with the secret key without having to
|
||||
|
||||
@@ -8,7 +8,7 @@ package secp256k1
|
||||
import (
|
||||
"math/bits"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// References:
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
// This example demonstrates use of GenerateSharedSecret to encrypt a message
|
||||
|
||||
@@ -52,7 +52,7 @@ package secp256k1
|
||||
// ordinarily would. See the documentation for FieldVal for more details.
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// Constants used to make the code more readable.
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// SetHex decodes the passed big-endian hex string into the internal field value
|
||||
|
||||
@@ -7,7 +7,7 @@ package secp256k1
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// References:
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/hex"
|
||||
)
|
||||
|
||||
// SetHex interprets the provided hex string as a 256-bit big-endian unsigned
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"bytes"
|
||||
"hash"
|
||||
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
// References:
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
// hexToBytes converts the passed hex string into bytes and will panic if there
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
"math/big"
|
||||
"os"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec/secp256k1"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec/secp256k1"
|
||||
"realy.lol/log"
|
||||
)
|
||||
|
||||
// curveParams houses the secp256k1 curve parameters for convenient access.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"crypto/rand"
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.lol/chk"
|
||||
)
|
||||
|
||||
// SecretKey provides facilities for working with secp256k1 secret keys within
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/ec/bech32"
|
||||
"realy.mleku.dev/ec/chaincfg"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/ec/bech32"
|
||||
"realy.lol/ec/chaincfg"
|
||||
)
|
||||
|
||||
// AddressSegWit is the base address type for all SegWit addresses.
|
||||
|
||||
@@ -3,7 +3,7 @@ package wire
|
||||
import (
|
||||
"time"
|
||||
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.lol/ec/chainhash"
|
||||
)
|
||||
|
||||
// BlockHeader defines information about a block and is used in the bitcoin
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package wire
|
||||
|
||||
import (
|
||||
"realy.mleku.dev/ec/chainhash"
|
||||
"realy.lol/ec/chainhash"
|
||||
)
|
||||
|
||||
// OutPoint defines a bitcoin data type that is used to track previous
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
|
||||
"lukechampine.com/frand"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/p256k"
|
||||
)
|
||||
|
||||
// ComputeSharedSecret returns a shared secret key used to encrypt messages. The private and public keys should be hex
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"golang.org/x/crypto/chacha20"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/hex"
|
||||
"realy.mleku.dev/keys"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/hex"
|
||||
"realy.lol/keys"
|
||||
"realy.lol/sha256"
|
||||
)
|
||||
|
||||
func assertCryptPriv(t *testing.T,
|
||||
|
||||
2
env/config.go
vendored
2
env/config.go
vendored
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.lol/chk"
|
||||
)
|
||||
|
||||
// Env is a key/value map used to represent environment variables. This is
|
||||
|
||||
@@ -5,13 +5,13 @@ package authenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
envs "realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/event"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/text"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
envs "realy.lol/envelopes"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/event"
|
||||
"realy.lol/log"
|
||||
"realy.lol/text"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/auth"
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/p256k"
|
||||
"realy.lol/auth"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/p256k"
|
||||
)
|
||||
|
||||
const relayURL = "wss://example.com"
|
||||
|
||||
@@ -6,11 +6,11 @@ package closedenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.mleku.dev/text"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
"realy.lol/text"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"lukechampine.com/frand"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
var messages = [][]byte{
|
||||
|
||||
@@ -5,10 +5,10 @@ package closeenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/filters"
|
||||
"realy.mleku.dev/ints"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.mleku.dev/text"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/filters"
|
||||
"realy.lol/ints"
|
||||
"realy.lol/subscription"
|
||||
"realy.lol/text"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/filters"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/filters"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
func TestRequest(t *testing.T) {
|
||||
|
||||
@@ -7,10 +7,10 @@ package eoseenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -5,12 +5,12 @@ package eventenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/event"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/event"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/event"
|
||||
"realy.mleku.dev/event/examples"
|
||||
"realy.mleku.dev/subscription"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/event"
|
||||
"realy.lol/event/examples"
|
||||
"realy.lol/subscription"
|
||||
)
|
||||
|
||||
func TestSubmission(t *testing.T) {
|
||||
|
||||
@@ -6,10 +6,10 @@ package noticeenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/text"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/text"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/envelopes/messages"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/envelopes/messages"
|
||||
)
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
@@ -6,14 +6,14 @@ package okenvelope
|
||||
import (
|
||||
"io"
|
||||
|
||||
"realy.mleku.dev/chk"
|
||||
"realy.mleku.dev/codec"
|
||||
"realy.mleku.dev/envelopes"
|
||||
"realy.mleku.dev/errorf"
|
||||
"realy.mleku.dev/eventid"
|
||||
"realy.mleku.dev/log"
|
||||
"realy.mleku.dev/sha256"
|
||||
"realy.mleku.dev/text"
|
||||
"realy.lol/chk"
|
||||
"realy.lol/codec"
|
||||
"realy.lol/envelopes"
|
||||
"realy.lol/errorf"
|
||||
"realy.lol/eventid"
|
||||
"realy.lol/log"
|
||||
"realy.lol/sha256"
|
||||
"realy.lol/text"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user