Skip to content

Commit

Permalink
Transfer repo to DIMO
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJoiner committed Feb 26, 2024
1 parent 479c63a commit 343f179
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ linters-settings:
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/KevinJoiner/mnemonic
local-prefixes: github.com/DIMO-Network/mnemonic
govet:
check-shadowing: true
misspell:
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Mnemonic

![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)
[![GoDoc](https://godoc.org/github.com/KevinJoiner/mnemonic?status.svg)](https://godoc.org/github.com/KevinJoiner/mnemonic)
[![Go Report Card](https://goreportcard.com/badge/github.com/KevinJoiner/mnemonic)](https://goreportcard.com/report/github.com/KevinJoiner/mnemonic)
[![GoDoc](https://godoc.org/github.com/DIMO-Network/mnemonic?status.svg)](https://godoc.org/github.com/DIMO-Network/mnemonic)
[![Go Report Card](https://goreportcard.com/badge/github.com/DIMO-Network/mnemonic)](https://goreportcard.com/report/github.com/DIMO-Network/mnemonic)
## Overview

The Mnemonic package provides a flexible and customizable way to encode data into a mnemonic word list. It implements the [BIP-0039](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) specification using [`big.Int`](https://pkg.go.dev/math/big), allowing for the use of arbitrary entropy sizes.
Expand All @@ -22,30 +22,39 @@ The Mnemonic package provides a flexible and customizable way to encode data int
To use this package in your Go project, run the following command:

```bash
go get github.com/KevinJoiner/mnemonic
go get github.com/DIMO-Network/mnemonic
```

### Example Usage
All Examples can be found in the [go docs](https://godoc.org/github.com/KevinJoiner/mnemonic) or [examples_test.go](./examples_test.go)
All Examples can be found in the [go docs](https://godoc.org/github.com/DIMO-Network/mnemonic) or [examples_test.go](./examples_test.go)

```go
package main

import (
"fmt"
"github.com/KevinJoiner/mnemonic"
"github.com/DIMO-Network/mnemonic"
)

func main() {
// Example usage with a number
number := "12345"
mnemonic := mnemonic.FromInt(number)
fmt.Println("Mnemonic Word List:", mnemonic)
id := int32(1)
words := mnemonic.FromInt(id)
obfuscatedWords := mnemonic.FromInt32WithObfuscation(id)
fmt.Println(words)
fmt.Println(obfuscatedWords)
// Output: [abandon abandon about]
// [learn island zoo]

// Example usage with a word list
words := []string{"apple", "banana", "orange"}
decodedNumber := mnemonic.ToInt(words)
fmt.Println("Int from Word List:", decodedNumber)
obfuscatedWords := []string{"learn", "island", "zoo"}
deobfuscatedUint, err := mnemonic.ToUint32WithDeobfuscation(obfuscatedWords)
if err != nil {
panic(err)
}

fmt.Println(deobfuscatedUint)
// Output: 1
}
```

2 changes: 1 addition & 1 deletion bip39_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

"github.com/KevinJoiner/mnemonic"
"github.com/DIMO-Network/mnemonic"
)

//go:embed trezorTestVectors.json
Expand Down
2 changes: 1 addition & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mnemonic_test
import (
"fmt"

"github.com/KevinJoiner/mnemonic"
"github.com/DIMO-Network/mnemonic"
)

func ExampleFromInt() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/KevinJoiner/mnemonic
module github.com/DIMO-Network/mnemonic

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion mnemonic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/KevinJoiner/mnemonic"
"github.com/DIMO-Network/mnemonic"
)

var testVectors = trezorVectors{}
Expand Down

0 comments on commit 343f179

Please sign in to comment.