src/main/java/cc/mrbird/febs/common/interceptor/DappInterceptor.java
@@ -75,4 +75,11 @@ response.setContentType("application/json; charset=utf-8"); response.getWriter().write(new ObjectMapper().writeValueAsString(new FebsResponse().code(HttpStatus.UNAUTHORIZED))); } public static void main(String[] args) { String headAddress = "0x971c09aa9735eb98459b17ec8b48932d24cbb931"; String path = "/member/walletInfo"; String sign = "0x1fd3f82895ca4615daa10ec245d628ca230358e08423df71c8f6c8d3d4163520"; System.out.println(Hash.sha3(sign + path + headAddress)); } } src/main/java/cc/mrbird/febs/common/utils/LoginUserUtil.java
@@ -1,6 +1,7 @@ package cc.mrbird.febs.common.utils; import cc.mrbird.febs.dapp.entity.DappMemberEntity; import lombok.extern.slf4j.Slf4j; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.web3j.crypto.Hash; @@ -11,6 +12,7 @@ * @author * @date 2022-03-18 **/ @Slf4j public class LoginUserUtil { public static DappMemberEntity getAppUser() { @@ -19,6 +21,7 @@ } public static String getLoginKey(String address, String nonce, String sign) { log.info("address:{}, nonce:{}, sign:{}", address, nonce, sign); StringBuilder sb = new StringBuilder(); StringBuilder append = sb.append(address).append(":").append(nonce).append(":").append(sign);