Module: ClaimToken

Defined in:
lib/claim_token.rb,
lib/claim_token/signer.rb,
lib/claim_token/version.rb,
lib/claim_token/decryptor.rb,
lib/claim_token/encryptor.rb,
lib/claim_token/configuration.rb

Defined Under Namespace

Modules: Decryptor, Encryptor, Signer Classes: Configuration

Constant Summary collapse

VERSION =
"0.0.1"
DEFAULT_CIPHER_TYPE =
"aes-256-cbc"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



16
17
18
# File 'lib/claim_token/configuration.rb', line 16

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



19
20
21
22
# File 'lib/claim_token/configuration.rb', line 19

def self.configure
  self.configuration ||= Configuration.new
  yield configuration
end

.decrypt(encrypted_token) ⇒ Object



21
22
23
# File 'lib/claim_token.rb', line 21

def self.decrypt encrypted_token
  ClaimToken::Decryptor.decrypt(encrypted_token)
end

.encrypt(message) ⇒ Object



17
18
19
# File 'lib/claim_token.rb', line 17

def self.encrypt message
  ClaimToken::Encryptor.encrypt(message)
end

.extract(encoded_token) ⇒ Object



9
10
11
# File 'lib/claim_token.rb', line 9

def self.extract encoded_token
  decrypt(JSON.parse( Base64.urlsafe_decode64(encoded_token)))
end

.pack(message) ⇒ Object



13
14
15
# File 'lib/claim_token.rb', line 13

def self.pack message
  Base64.urlsafe_encode64(JSON.dump(encrypt(message)))
end