civic_sip_sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0bd1376818c98094308f2fd2953cebfddc315c2d746275abc037afd40c9401a
4
- data.tar.gz: 0d75e9c2820fb3ae474c6cf134d97754235a9d2374edc06701f439ff5275baf9
3
+ metadata.gz: 6b2350a52d62754bbc492a61ad0de623918776b60a4a674ef5edc0890959dc92
4
+ data.tar.gz: 0f5739eec7f397120b709a63e990d727285347c8ee6cf9437d5897a74aa9fbce
5
5
  SHA512:
6
- metadata.gz: 24ac13f796a0f8f7fdf021b019e4706c411f7a9ed8c49c49d54036cb7e340572cadf1b9dad979425d49e4091567f5835e30ddb4eb523a94046910a5fb874ed77
7
- data.tar.gz: e41c2363ab2ce5b6cd29cda8089e3a3b2e64d91e3b7333784dc3bd411cb3a0bdf945bef69f86aa7826159b68ccb3c883448e71a2538893e6676466edd3d47941
6
+ metadata.gz: 89facb51ccee9b4fba488a774335c42109058687e9158e87a37e7745ddd9ab83a75d3bc0baa689012cd7709cc58ff0ca6dc5aa86136577d0f3ae3ad435daa656
7
+ data.tar.gz: 6f03a906b21e25f6e1b54b3c2059b5bf464e68805c3fa7249d99eb5002f6bf2b3f7197f3cd2b5b6e122df08e27f135533d0d01425942275a552d705f40caf006
@@ -11,16 +11,15 @@ module CivicSIPSdk
11
11
  { name: :secret, error: 'Civic application secret is missing!' }
12
12
  ].freeze
13
13
 
14
- # Creates a new instance of <tt>CivicSIPSdk::AppConfig</tt>.
14
+ # Creates a new instance of +CivicSIPSdk::AppConfig+.
15
15
  # This is used to configure the SDK connection parameters to the Civic SIP service.
16
16
  #
17
17
  # It raises an ArgumentError if any argument is nil.
18
18
  #
19
- # Args:
20
- # * <tt>id</tt> - The application id.
21
- # * <tt>env</tt> - The application environment. Defaults to +:prod+ if the value is incorrect.
22
- # * <tt>private_key</tt> - The application's private signing key.
23
- # * <tt>secret</tt> - The application secret
19
+ # @param id [String] The application id.
20
+ # @param env [Symbol] The application environment. Defaults to +:prod+ if the value is incorrect.
21
+ # @param private_key [String] The application's private signing key.
22
+ # @param secret [String] The application secret
24
23
  def initialize(id:, env:, private_key:, secret:)
25
24
  @id = id
26
25
  @env = VALID_ENVS.include?(env.to_sym) ? env.to_sym : VALID_ENVS.last
@@ -20,8 +20,7 @@ module CivicSIPSdk
20
20
 
21
21
  # Creates a client
22
22
  #
23
- # Args:
24
- # * <tt>config</tt> - an instance of CivicSIPSdk::AppConfig
23
+ # @param config [CivicSIPSdk::AppConfig] app_config that sets all the parameters of the client
25
24
  def initialize(config:)
26
25
  @config = config
27
26
  @test_env = ENV[ENV_VAR] == TEST_ENV
@@ -30,8 +29,8 @@ module CivicSIPSdk
30
29
  # Exchange authorization code in the form of a JWT Token for the user data
31
30
  # requested in the scope request.
32
31
  #
33
- # Args:
34
- # * <tt>jwt_token</tt> - a JWT token that contains the authorization code
32
+ # @param jwt_token [String] a JWT token that contains the authorization code
33
+ # @return [CivicSIPSdk::UserData] user data returned from SIP
35
34
  def exchange_code(jwt_token:)
36
35
  json_body_str = JSON.generate('authToken' => jwt_token)
37
36
 
@@ -16,9 +16,8 @@ module CivicSIPSdk
16
16
 
17
17
  # Create encrypted text using AES-128-CBC with a IV of 16 bytes
18
18
  #
19
- # Args:
20
- # * <tt>text</tt> - the plain text to be encrypted
21
- # * <tt>secret</tt> - the Civic application secret in HEX format
19
+ # @param text [String] the plain text to be encrypted
20
+ # @param secret [String] the Civic application secret in HEX format
22
21
  def self.encrypt(text:, secret:)
23
22
  cipher = OpenSSL::Cipher.new(CIPHER_ALGO)
24
23
  cipher.encrypt
@@ -32,9 +31,8 @@ module CivicSIPSdk
32
31
 
33
32
  # Decrypt the encrypted text using AES-128-CBC with a IV of 32 bytes
34
33
  #
35
- # Args:
36
- # * <tt>text</tt> - the encrypted text to be decrypted
37
- # * <tt>secret</tt> - the Civic application secret in HEX format
34
+ # @param text [String] the encrypted text to be decrypted
35
+ # @param secret [String] the Civic application secret in HEX format
38
36
  def self.decrypt(text:, secret:)
39
37
  cipher = OpenSSL::Cipher.new(CIPHER_ALGO)
40
38
  cipher.decrypt
@@ -9,10 +9,9 @@ module CivicSIPSdk
9
9
  # Creates a UserData insteance, which creates a list of UserDataItem instances from
10
10
  # +data_items+.
11
11
  #
12
- # Args:
13
- # * <tt>user_id</tt> - user id
14
- # * <tt>data_items</tt> - a list of Hash that contains the key-value pairs for
15
- # instantiating CivicSIPSdk::UserDataItem instances
12
+ # @param user_id [String] user id
13
+ # @param data_items [List] a list of Hash that contains the key-value pairs
14
+ # for instantiating CivicSIPSdk::UserDataItem instances
16
15
  def initialize(user_id:, data_items:)
17
16
  @user_id = user_id
18
17
  @data_items = data_items
@@ -6,12 +6,11 @@ module CivicSIPSdk
6
6
 
7
7
  # Creates an instance of UserDataItem.
8
8
  #
9
- # Args:
10
- # * <tt>label</tt> - Descriptive value identifier.
11
- # * <tt>value</tt> - Item value of requested user data.
12
- # * <tt>is_valid</tt> - Indicates whether or not the data is still considered valid on the blockchain.
13
- # * <tt>is_owner</tt> - Civic SIP service challenges the user during scope request approval to ensure
14
- # the user is in control of the private key originally used in the issuance of the data attestation.
9
+ # @param label [String] Descriptive value identifier.
10
+ # @param value [String] Item value of requested user data.
11
+ # @param is_valid [String] Indicates whether or not the data is still considered valid on the blockchain.
12
+ # @param is_owner [String] Civic SIP service challenges the user during scope request approval to ensure
13
+ # the user is in control of the private key originally used in the issuance of the data attestation.
15
14
  def initialize(label:, value:, is_valid:, is_owner:)
16
15
  @label = label
17
16
  @value = value
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CivicSIPSdk
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
data/lib/civic_sip_sdk.rb CHANGED
@@ -8,6 +8,13 @@ require 'civic_sip_sdk/client'
8
8
  module CivicSIPSdk
9
9
  module_function
10
10
 
11
+ # Creates an instance of +CivicSIPSdk::Client+
12
+ #
13
+ # @param id [String] the Civic application id
14
+ # @param env [Symbol] the Civic application environment
15
+ # @param private_key [String] the Civic private signing key
16
+ # @param secret [String] the Civic application secret
17
+ # @return [CivicSIPSdk::Client] the client to exchange the JWT code for user data
11
18
  def new_client(id, env, private_key, secret)
12
19
  app_config = AppConfig.new(
13
20
  id: id,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civic_sip_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Han Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.16
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.16
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: httparty
85
99
  requirement: !ruby/object:Gem::Requirement