Skip to content

Commit

Permalink
remove logs, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Sep 24, 2020
1 parent 8fbd2e2 commit 0b33fc4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# go-aip

Author Identity Protocol

Library for working with [Author Identity Protocol](https://github.com/BitcoinFiles/AUTHOR_IDENTITY_PROTOCOL) in go

## Related packages

- [go-bob](https://github.com/rohenaz/go-bob)
- [go-bmap](https://github.com/rohenaz/go-bmap)

# Validate Bob Tapes

```go
bobData := bob.New()
bobData.FromString(sampleBobTx)

tapes := bobData.Out[0].Tape
if !ValidateTapes(tapes) {
t.Error("Failed to validate AIP signature")
}
```
5 changes: 1 addition & 4 deletions aip.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package aip

import (
"log"
"strconv"
"strings"

Expand Down Expand Up @@ -98,6 +97,7 @@ func (a *Aip) FromTape(tape bob.Tape) {

a.Indicies = make([]int, len(tape.Cell)-4)

// TODO: Consider OP_RETURN is included in sig when processing a tx using indices
// Loop over remaining indicies if they exist and append to indicies slice
for x := 4; x < len(tape.Cell); x++ {
// log.Println("X IS", x)
Expand Down Expand Up @@ -126,7 +126,6 @@ func (a *Aip) Validate() (ok bool) {
}
switch a.Algorithm {
case BITCOIN_ECDSA:
log.Println("Validating", a.Signature, a.Address, a.Data)
// Validate verifies a Bitcoin signed message signature
return bitcoin.VerifyMessage(a.Address, a.Signature, strings.Join(a.Data, ""))
}
Expand All @@ -148,7 +147,5 @@ func ValidateTapes(tapes []bob.Tape) bool {
a := New()
a.FromTape(aipTape)
a.SetData(tapes)

log.Println("Data was set", a.Data)
return a.Validate()
}
Loading

0 comments on commit 0b33fc4

Please sign in to comment.