Module: TencentTrustsql::Api::Tpki

Included in:
Client
Defined in:
lib/tencent_trustsql/api.rb,
lib/tencent_trustsql/api/tpki.rb

Constant Summary collapse

URL_BASE =
"https://baas.qq.com/tpki/tpki.TpkiSrv."

Instance Method Summary collapse

Instance Method Details

#account_apply(private_key_out, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/tencent_trustsql/api/tpki.rb', line 21

def (private_key_out, options={})
  url = URL_BASE + 'AccountApply'
  public_key_out = TencentTrustsql.encoded_public_key private_key_out
  # params = tpki_base_params.merge!({ acc_pub_key: public_key_out })
  params = {acc_pub_key: public_key_out, **tpki_base_params, **options}

  http_post url, params
end

#account_get_list(private_key_out, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/tencent_trustsql/api/tpki.rb', line 30

def (private_key_out, options={})
  url = URL_BASE + 'AccountGetList'
  public_key_out = TencentTrustsql.encoded_public_key private_key_out
  # params = tpki_base_params.merge!({ acc_pub_key: public_key_out })
  params = {acc_pub_key: public_key_out, **tpki_base_params, **options}

  http_post url, params
end

#tpki_base_paramsObject



33
34
35
36
37
38
39
40
# File 'lib/tencent_trustsql/api.rb', line 33

def tpki_base_params
  {
    version: '1.0',
    sign_type: 'ECDSA',
    mch_id: mch_id,
    timestamp: Time.now.to_i
  }
end

#user_apply(private_key_out, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/tencent_trustsql/api/tpki.rb', line 5

def user_apply(private_key_out, options={})
  url = URL_BASE + 'UserApply'
  public_key_out = TencentTrustsql.encoded_public_key private_key_out

  params = {user_pub_key: public_key_out, **tpki_base_params, **options}

  http_post url, params
end

#user_get(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/tencent_trustsql/api/tpki.rb', line 14

def user_get(options={})
  url = URL_BASE + 'UserGet'
  params = tpki_base_params.merge(options)

  http_post url, params
end