Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Implement and test the holder functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar committed Feb 26, 2020
1 parent 6fbd078 commit 3276707
Show file tree
Hide file tree
Showing 82 changed files with 672 additions and 2,523 deletions.
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
vendor/
.vscode
####### tmp
flutter/
android/
helper-scripts/
####### mockup server
go/mockupServer/main/main
####### gomobile
go/mobile/config.yml
go/mobile/iden3-mobile-sources.jar
#go/mobile/iden3mobile
go/mobile/iden3mobile
# uncompressed jar
go/mobile/go
go/mobile/META-INF
Expand Down Expand Up @@ -114,7 +120,7 @@ unlinked_spec.ds
# Built application files
*.apk
*.aar
!flutter/android/app/src/main/libs/iden3-mobile.aar
# !flutter/android/app/src/main/libs/iden3-mobile.aar
*.ap_
*.aab

Expand Down Expand Up @@ -166,8 +172,8 @@ captures/

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks
*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
Expand Down
76 changes: 10 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,13 @@
# go-iden3-client
**go iden3 client** is a library implementation for an iden3 identity client in go that also offers gomobile-friendly wrappers.
# iden3-mobile
**iden3 mobile** is a set of libraries that implement iden3 protocol in mobile platforms. This repository contain a set of components o do so:
* go: go code that implements all the logic, and have gomobile friendly wrappers
* [To do] android: android library that wrapper the binded go code
* [To do] iOS: iOS library that wrapper the binded go code
* [To do] flutter: flutter plugin that calls the native iOS and android libraries


## Test
- this library connects with the [IdenityServer](https://github.com/iden3/go-iden3-servers), so it will need a running IdentityServer.

```
go test ./...
```

## Usage

```go
// define a provider
providerParams := make(map[string]string)
providerParams["url"] = "http://127.0.0.1:25000/api/unstable"
provider := Provider{
Type: "remote",
Params: providerParams,
}

// new BabyJubJub public key
kOpStr := "0x117f0a278b32db7380b078cdb451b509a2ed591664d1bac464e8c35a90646796"
var kOpComp babyjub.PublicKeyComp
err := kOpComp.UnmarshalText([]byte(kOpStr))
assert.Nil(t, err)
kOpPub, err := kOpComp.Decompress()

// create new keystore
ks := NewKeyStore()

// import key to keystore
err = ks.ImportKeyBabyJub(kOpPub)

// create new identity
id, proofKOp, err = provider.CreateIdentity(keyStore, kOp, nil)

// load identity
identity, err = provider.LoadIdentity(id, kOp, proofKOp, keyStore)

// add claims
err := identity.AddClaims([]*merkletree.Entry{c0, c1})

// get emitted claims
claims, err := identity.EmittedClaims()

// get received claims
claims, err := identity.ReceivedClaims()

// [WIP]
```

## Gomobile

Using go1.12.7 linux/amd64

### First time

```
go mod vendor
gomobile init
GO111MODULE=off go get github.com/ethereum/go-ethereum
ln -s $PWD ~/go/src/
cp -r \
"${GOPATH}/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1" \
"vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/"
GO111MODULE=off gomobile bind -target=android go-iden3-light-wallet/identityprovider
```
### Go
1. Rename go/mobile/config-example.yml to go/mobile/config.yml, and change the value of `web3Url` for a valid web3 provider.
2. `cd` into `go/mockupServer/main` and run `go run . -ip 127.0.0.1 -verifytime 1 -aprovetime 1`
3. In a new terminal, `cd` into `go/mobile` and run `go test ./...`
16 changes: 0 additions & 16 deletions flutter/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions flutter/android/.gitignore

This file was deleted.

68 changes: 0 additions & 68 deletions flutter/android/app/build.gradle

This file was deleted.

7 changes: 0 additions & 7 deletions flutter/android/app/src/debug/AndroidManifest.xml

This file was deleted.

30 changes: 0 additions & 30 deletions flutter/android/app/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3276707

Please sign in to comment.