branca-ruby 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis-libsodium.sh +8 -0
- data/.travis.yml +15 -0
- data/README.md +2 -0
- data/lib/branca.rb +5 -5
- data/lib/branca/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 22cc1fffd0d86f0f04a164da3d0df44e79c1313a7469cd460a6f7c1da571be11
|
4
|
+
data.tar.gz: 5e65160787f9928edc64d5d339c04cce7ab1326fd7b7c7b33d3a473728505364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04a6f68d9f135afb7c1701edf1ddf8d0503f26e378ac9243e8f96a8dc8c39b5416c3cc2a9046bacbb1fff228dd76183000c15e946cdb8e942d06de140613410
|
7
|
+
data.tar.gz: c070da07296c597cf1570c3e5e7aa6d273952cb0f75330dd2a119eaf8cf8af799d5d88d2e75c281a75a4eaae9cb53eafd22c5517eed1794f3a60707ce0430169
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Authenticated and encrypted API tokens using modern crypto.
|
4
4
|
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/branca-ruby.svg)](https://badge.fury.io/rb/branca-ruby)
|
6
|
+
[![Build Status](https://travis-ci.com/thadeu/branca-ruby.svg?branch=main)](https://travis-ci.com/thadeu/branca-ruby)
|
5
7
|
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
|
6
8
|
|
7
9
|
## What?
|
data/lib/branca.rb
CHANGED
@@ -8,10 +8,10 @@ require 'branca/exceptions'
|
|
8
8
|
require 'branca/decoder'
|
9
9
|
|
10
10
|
module Branca
|
11
|
-
VERSION = 0xBA
|
12
|
-
|
13
11
|
class << self
|
14
|
-
|
12
|
+
VERSION = 0xBA
|
13
|
+
|
14
|
+
attr_accessor :secret_key, :ttl
|
15
15
|
|
16
16
|
def encode(message, timestamp = Time.now.utc)
|
17
17
|
nonce = RbNaCl::Random.random_bytes(cipher.nonce_bytes)
|
@@ -39,7 +39,7 @@ module Branca
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def secret_key
|
42
|
-
@secret_key
|
42
|
+
@secret_key&.b || RbNaCl::Random.random_bytes(32)
|
43
43
|
end
|
44
44
|
|
45
45
|
def configure
|
@@ -49,7 +49,7 @@ module Branca
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def cipher
|
52
|
-
@cipher ||= RbNaCl::AEAD::XChaCha20Poly1305IETF.new(
|
52
|
+
@cipher ||= RbNaCl::AEAD::XChaCha20Poly1305IETF.new(secret_key)
|
53
53
|
end
|
54
54
|
|
55
55
|
def token_explode(token)
|
data/lib/branca/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branca-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thadeu Esteves
|
@@ -104,6 +104,8 @@ files:
|
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
106
|
- ".rubocop.yml"
|
107
|
+
- ".travis-libsodium.sh"
|
108
|
+
- ".travis.yml"
|
107
109
|
- Gemfile
|
108
110
|
- LICENSE
|
109
111
|
- README.md
|
@@ -134,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
136
|
- !ruby/object:Gem::Version
|
135
137
|
version: '0'
|
136
138
|
requirements: []
|
137
|
-
|
138
|
-
rubygems_version: 2.5.2.2
|
139
|
+
rubygems_version: 3.0.3
|
139
140
|
signing_key:
|
140
141
|
specification_version: 4
|
141
142
|
summary: Authenticated and encrypted API tokens using modern crypto
|