darrrr 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/darrrr/account_provider.rb +3 -2
- data/lib/darrrr/recovery_provider.rb +6 -2
- data/lib/darrrr/recovery_token.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d14b89df09e2c495a699508b7b1c10e29f6d416c
|
4
|
+
data.tar.gz: d1cebf97f5b69c963e663eaaeeee8c5f54b2c4a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf71fdd96d941b63711292e1f981f73b13da91b40c2a099ef626cf2ef9eceaafbdeb7972a114c6ada198a3998b7f0330f9e21893ef3f54767f28fca7047bb740
|
7
|
+
data.tar.gz: a3b111b878a06733ef88e58c1ed5c8c2161ffb6ffc265f80eb7af1c39711c74396b44b1a3182587db2b08692639b1aadbf9acc937765ce246d661c5a07cdcae0
|
@@ -53,10 +53,11 @@ module Darrrr
|
|
53
53
|
# data: value to encrypt in the token
|
54
54
|
# provider: the recovery provider/audience of the token
|
55
55
|
# context: arbitrary data passed on to underlying crypto operations
|
56
|
+
# options: the value to set for the options byte
|
56
57
|
#
|
57
58
|
# returns a [RecoveryToken, b64 encoded sealed_token] tuple
|
58
|
-
def generate_recovery_token(data:, audience:, context: nil)
|
59
|
-
token = RecoveryToken.build(issuer: self, audience: audience, type: RECOVERY_TOKEN_TYPE)
|
59
|
+
def generate_recovery_token(data:, audience:, context: nil, options: 0x00)
|
60
|
+
token = RecoveryToken.build(issuer: self, audience: audience, type: RECOVERY_TOKEN_TYPE, options: options)
|
60
61
|
token.data = self.encryptor.encrypt(data, self, context)
|
61
62
|
|
62
63
|
[token, seal(token, context)]
|
@@ -66,10 +66,13 @@ module Darrrr
|
|
66
66
|
# data structure is identical to the structure it's wrapping in format.
|
67
67
|
#
|
68
68
|
# token: the to_binary_s or binary representation of the recovery token
|
69
|
+
# context: an arbitrary object that is passed to lower level crypto operations
|
70
|
+
# options: the value to set in the options byte field of the recovery
|
71
|
+
# token (defaults to 0x00)
|
69
72
|
#
|
70
73
|
# returns a Base64 encoded representation of the countersigned token
|
71
74
|
# and the signature over the token.
|
72
|
-
def countersign_token(token
|
75
|
+
def countersign_token(token:, context: nil, options: 0x00)
|
73
76
|
begin
|
74
77
|
account_provider = RecoveryToken.account_provider_issuer(token)
|
75
78
|
rescue RecoveryTokenSerializationError, UnknownProviderError
|
@@ -79,7 +82,8 @@ module Darrrr
|
|
79
82
|
counter_recovery_token = RecoveryToken.build(
|
80
83
|
issuer: self,
|
81
84
|
audience: account_provider,
|
82
|
-
type: COUNTERSIGNED_RECOVERY_TOKEN_TYPE
|
85
|
+
type: COUNTERSIGNED_RECOVERY_TOKEN_TYPE,
|
86
|
+
options: options,
|
83
87
|
)
|
84
88
|
|
85
89
|
counter_recovery_token.data = token
|
@@ -35,17 +35,17 @@ module Darrrr
|
|
35
35
|
|
36
36
|
class << self
|
37
37
|
# data: the value that will be encrypted by EncryptedData.
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
38
|
+
# audience: the provider for which we are building the token.
|
39
|
+
# type: Either 0 (recovery token) or 1 (countersigned recovery token)
|
40
|
+
# options: the value to set for the options byte
|
41
41
|
#
|
42
42
|
# returns a RecoveryToken.
|
43
|
-
def build(issuer:, audience:, type:)
|
43
|
+
def build(issuer:, audience:, type:, options: 0x00)
|
44
44
|
token = RecoveryTokenWriter.new.tap do |token|
|
45
45
|
token.token_id = token_id
|
46
46
|
token.issuer = issuer.origin
|
47
47
|
token.issued_time = Time.now.utc.iso8601
|
48
|
-
token.options =
|
48
|
+
token.options = options
|
49
49
|
token.audience = audience.origin
|
50
50
|
token.version = Darrrr::PROTOCOL_VERSION
|
51
51
|
token.token_type = type
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darrrr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Matatall
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|