示例#1
0
    def post(self):

        parser_ = CoverRequestParser()
        parser_.add_argument("encryption_parameters", type=str, required=True)

        params = parser_.parse_args()
        encryption_parameters = params['encryption_parameters']

        # 整体参数解密
        try:
            params = json.loads(rsa_params_decrypt(encryption_parameters))
        except:
            return create_response(CodeMsg.CM(1022, '参数无效'))

        # 参数提取,验证完整性
        encrypt_seed = params.get('encrypt_seed')
        if not encrypt_seed or encrypt_seed == '':
            return create_response(CodeMsg.CM(1022, '参数不完整'))

        # stellar account
        result = digiccy_base.bind_compulsory(encrypt_seed)
        if isinstance(result, CodeMsg.CM):
            return create_response(result)
        stellar_address = result

        # digiccy account
        bind_secret, bind_address = eos_wallet.create_account()
        bind_secret = rsaEncryptToken(str(bind_secret))  # 加密

        # instert db
        is_success = digiccy_base.bind_insert(stellar_address, bind_address,
                                              bind_secret)
        if not is_success:
            return create_response(CodeMsg.BIND_ERROR)
        return create_response(CodeMsg.SUCCESS)
示例#2
0
    def post(self):
        parser_ = CoverRequestParser()
        parser_.add_argument("encrypt_seed", type=str, required=True)
        params = parser_.parse_args()
        encrypt_seed = params['encrypt_seed']

        # stellar account
        result = digiccy_base.bind_compulsory(encrypt_seed)
        if isinstance(result, CodeMsg.CM):
            return create_response(result)
        stellar_address = result

        # digiccy account
        bind_address, bind_secret = btc_wallet.create_account(stellar_address)
        bind_secret = rsaEncryptToken(str(bind_secret))  # 加密

        # instert db
        is_success = digiccy_base.bind_insert(stellar_address, bind_address,
                                              bind_secret)
        if not is_success:
            return create_response(CodeMsg.BIND_ERROR)
        return create_response(CodeMsg.SUCCESS)