You've already forked onion-auth-gen
							
							initial commit
This commit is contained in:
		
							
								
								
									
										19
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
// Generate key pair for onion service auth
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"crypto/ecdh"
 | 
			
		||||
	"crypto/rand"
 | 
			
		||||
	"encoding/base32"
 | 
			
		||||
	"fmt"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
 | 
			
		||||
	key, err := ecdh.X25519().GenerateKey(rand.Reader)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Printf("private key 	  : %s\n", base32.StdEncoding.EncodeToString(key.Bytes())[:52])
 | 
			
		||||
	fmt.Printf("public descriptor : descriptor:x25519:%s\n", base32.StdEncoding.EncodeToString(key.PublicKey().Bytes())[:52])
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user