Skip to content

Commit

Permalink
[render preview][FEAT] support for signature 1 & 2 (#32)
Browse files Browse the repository at this point in the history
* wip

* nonce rename to ticket

* doc

* WIP

* update DDL for airaccount_chains

* precisely reg by email; for supporting other ways

* refactor passkey

* sigin refactor

* bugfix: restore wallet to user

* support customer challenge

* bugfix: txdata empty

* bugfix: duplicated response

* support discoverable login

* demo support discoverable login

* support discoverable signin

* update swagger

* update swagger

* support one user multiple passkeys

* update passkey

* WIP

* bugfix: txSigRlt address

* WIP

* one chain support multip aa by alias

* update pkg

* bugfix: signup in different PASSKEY for each User

* bugfix: creat_aa with alias

* WIP: more hd wallets for one email

* support more hdwallets for one account

* update unit tests

* WIP: 1:N wallets and account

* Fix wallet usage check for specific network

* bugfix: re-use wallet if network is different

* bugfix and code clean

* changelog add

* update demo

* specify -7 and -257 only in registration session

* Update dependencies in go.mod file; fix critical vul

* replace http 404 to biz code 404 but http code 200
  • Loading branch information
fanhousanbu authored Oct 3, 2024
1 parent 9224d41 commit 38d1520
Show file tree
Hide file tree
Showing 66 changed files with 5,335 additions and 978 deletions.
88 changes: 88 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Change Logs

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

[TOC]

> Unrelease
## [变更逻辑]

1. 注册成功后,不会自动创建AA钱包,需要调用新增接口 [POST /api/passkey/v1/account/chain](#post-apipasskeyv1accountchain)
2. 同一个邮件,在不同设备允许再次注册(本质是注册该账户的Passkey),注册成功后依然是原用户
3. 登录不再需要输入邮箱,现在会自动发现当前设备在该origin下的Passkeys

## [变更接口]

### GET /api/passkey/v1/account/info

1. query增加参数:alias, 默认为空

### POST /api/passkey/v1/reg/verify

1. query增加参数:alias, 默认为空

### POST /api/passkey/v1/sign

1. body移除email,只保留origin

### POST /api/passkey/v1/sign/verify

1. query参数只保留origin

### POST /api/passkey/v1/tx/sign

1. body参数中nonce改名为ticket
2. body参数中增加network,表示链名称,必填
3. body参数中增加network_alias,表示链别名,非必填参数

### POST /api/passkey/v1/tx/sign/verify

1. query参数中nonce改名为ticket
2. query参数中增加network,表示链名称,必填
3. query参数中增加network_alias,表示链别名,非必填参数

## [新增接口]

### GET /api/passkey/v1/chains/support

> 获取支持的链名称
入参:无

*data*对象里的key表示链名称,在其他接口参数中的network需符合该键名,value为true时表示支持,*data*中没有列出的链表示不支持

出参:

```json
{
"code": 200,
"message": "",
"data": {
"base-sepolia": true,
"ethereum-sepolia": true,
"optimism-sepolia": true
},
"cost": "2562047h47m16.854775807s"
}
```

### POST /api/passkey/v1/account/chain

> 创建指定链的AA钱包
入参:

body:

```json
{
"alias": "string",
"network": "ethereum-mainnet"
}
```

alias: 别名,允许为空,同一个链支持不同别名的钱包,目前上限为10个
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## build
FROM golang:1.23.0-alpine3.20 AS build-env
FROM golang:1.23.1-alpine3.20 AS build-env

RUN apk add build-base

Expand All @@ -12,7 +12,7 @@ RUN go env -w GO111MODULE=on \
&& go build -o cnode

## run
FROM alpine:3.20.2
FROM alpine:3.20

RUN mkdir -p /aa && mkdir -p /aa/log

Expand Down
6 changes: 5 additions & 1 deletion conf/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

var (
dbClient *gorm.DB
dbOnce = sync.Once{}
dbOnce = sync.Once{}
)

func GetDbClient() *gorm.DB {
Expand All @@ -20,6 +20,10 @@ func GetDbClient() *gorm.DB {
panic(err)
}
dbClient = configDBVar

if Environment.IsDevelopment() {
dbClient = dbClient.Debug()
}
})
return dbClient
}
Loading

0 comments on commit 38d1520

Please sign in to comment.