All Projects → MixinNetwork → bot-api-go-client

MixinNetwork / bot-api-go-client

Licence: Apache-2.0 license
🤖️ Mixin API for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to bot-api-go-client

hacker-news-mixin-bot
Post new hot stories from Hacker News to Mixin bot (Mixin ID: 7000100124)
Stars: ✭ 19 (-70.77%)
Mutual labels:  mixin, mixin-bot
go-traits
A concept package that helps implement mixin behavior using embedded structs and hook interfaces.
Stars: ✭ 21 (-67.69%)
Mutual labels:  mixin
mixomatic
Create mixins which work with instanceof (friendly for unit tests).
Stars: ✭ 21 (-67.69%)
Mutual labels:  mixin
pando
Pando is a decentralized financial network built with the MTG technology, and its underlying financial algorithm is inspired by Maker and Synthetix.
Stars: ✭ 12 (-81.54%)
Mutual labels:  mixin
flexbox-grid-mixins
Sass Mixins to generate Flexbox grid
Stars: ✭ 67 (+3.08%)
Mutual labels:  mixin
mixin-sdk-go
Golang sdk for Mixin Network & Mixin Messenger
Stars: ✭ 36 (-44.62%)
Mutual labels:  mixin
vue-mixin-tween
Vue mixin factory to tween component numerical data
Stars: ✭ 25 (-61.54%)
Mutual labels:  mixin
scss-font-lock
This is a SCSS mixin used to create CSS locks for responsive typography. To make in convenient to use it allows you to use both px and em as units and if anything goes wrong, it will let you know during the compile using scss @warn and also print an error message on top of the text in the application or website.
Stars: ✭ 18 (-72.31%)
Mutual labels:  mixin
ClientAPI
API designed to make Minecraft "Utility Mods" have Universal Support
Stars: ✭ 58 (-10.77%)
Mutual labels:  mixin
sloped-edge
Sass mixin that helps you build sloped section edges with a consistent angle.
Stars: ✭ 85 (+30.77%)
Mutual labels:  mixin
vue-component-style
A Vue mixin to add style section to components.
Stars: ✭ 16 (-75.38%)
Mutual labels:  mixin
vue-in-viewport-mixin
Vue 2 mixin to determine when a DOM element is visible in the client window
Stars: ✭ 99 (+52.31%)
Mutual labels:  mixin
ModernUI
Modern desktop framework from low-level 3D graphics API to high-level view model, for development of 2D/3D rendering software or game engine, with internationalization support and many new technologies.
Stars: ✭ 168 (+158.46%)
Mutual labels:  mixin
mixin bot
A simple API wrapper for Mixin Network in Ruby
Stars: ✭ 12 (-81.54%)
Mutual labels:  mixin
python-pyfields
Define fields in python classes. Easily.
Stars: ✭ 39 (-40%)
Mutual labels:  mixin
helm2-mixin
Helm mixin for Porter
Stars: ✭ 14 (-78.46%)
Mutual labels:  mixin
vertical-rhythm-reset
A Sass/SCSS library for responsive vertical rhythm grids, modular scale typography, and CSS normalization.
Stars: ✭ 65 (+0%)
Mutual labels:  mixin
mixcoin
Mixin Bot for OceanONE Exchange
Stars: ✭ 21 (-67.69%)
Mutual labels:  mixin-bot
ahr999-mixin
一个提供实时更新的Ahr999指数的mixin机器人,与一个提供历史ahr999指数的web页面。
Stars: ✭ 23 (-64.62%)
Mutual labels:  mixin-bot

Installation

go get github.com/MixinNetwork/bot-api-go-client

Quick Start

package main

import (
	"context"
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"encoding/base64"
	"encoding/pem"
	"fmt"
	"time"

	"github.com/MixinNetwork/bot-api-go-client"
)

const (
	appId         = ""
	appSessionId  = ""
	appPrivateKey = ``
)

func main() {
	ctx := context.Background()
	// Generate Ed25519 key pair.
	pub, privateKey, err := ed25519.GenerateKey(rand.Reader)
	if err != nil {
		return nil, "", err
	}
	sessionSecret := base64.RawURLEncoding.EncodeToString(pub[:])
	// Rigster the user on the Mixin network
	user, err := bot.CreateUser(ctx, sessionSecret, "fullname", appId, appSessionId, appPrivateKey)
	if err != nil {
		fmt.Println(err)
		return
	}
	userSessionKey := base64.RawURLEncoding.EncodeToString(privateKey)
	// encrypt PIN
	encryptedPIN, err := bot.EncryptEd25519PIN(pin, user.PINTokenBase64, userSessionKey, uint64(time.Now().UnixNano()))
	if err != nil {
		return err
	}
	fmt.Println(encryptedPIN)
	// Set initial code.
	err = bot.UpdatePin(ctx, "", encryptedPIN, user.UserId, user.SessionId, userSessionKey)
	if err != nil {
		fmt.Println(err)
		return
	}
	//Sign authentication token.
	authenticationToken, err := bot.SignAuthenticationToken(user.UserId, user.SessionId, userSessionKey, "GET", "/assets", "")
	if err != nil {
		fmt.Println(err)
		return
	}
	// Read asset list
	assets, err := bot.AssetList(ctx, authenticationToken)
	if err != nil {
		fmt.Println(err)
		return
	}
	for _, a := range assets {
		fmt.Println(a.AssetId)
	}
}

Fo more examples, see examples

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].