cztop 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -32
- data/lib/cztop/certificate.rb +11 -5
- data/lib/cztop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1797c227b1864ce06f37506793448b449d067778
|
4
|
+
data.tar.gz: 79c7e8d0ac13492a4255edad4e28edf6a06c12b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9cfb68026997aaeec79b3f09aebb94070586411e0a79440705637ec2e0f9e91625f82f98d7a8eaf47ad3fd76700197670c3da663ff35b82bd3748733d63095
|
7
|
+
data.tar.gz: 10f4e7752dba82961a22ca38c0e21745581ec48fde1b55f2918ecab4a70e040e24a876dc99b0ee987d34543e5235f5876590746309e3592c28074ac24db9c9fd
|
data/README.md
CHANGED
@@ -13,38 +13,6 @@ mechanisms (like CURVE).
|
|
13
13
|
[![Coverage Status](https://coveralls.io/repos/paddor/cztop/badge.svg?branch=master&service=github)](https://coveralls.io/github/paddor/cztop?branch=master)
|
14
14
|
[![ISC License](https://img.shields.io/badge/license-ISC_License-blue.svg)](LICENSE)
|
15
15
|
|
16
|
-
## Reasons
|
17
|
-
|
18
|
-
Why another CZMQ Ruby binding? Here is a list of existing projects I found and
|
19
|
-
the issues with them, from my point of view:
|
20
|
-
|
21
|
-
* [Asmod4n/ruby-ffi-czmq](https://github.com/Asmod4n/ruby-ffi-czmq)
|
22
|
-
* outdated
|
23
|
-
* according to its author, it's an "abomination"
|
24
|
-
* [methodmissing/rbczmq](https://github.com/methodmissing/rbczmq)
|
25
|
-
* no support for security features (see [methodmissing/rbczmq#28](https://github.com/methodmissing/rbczmq/issues/28))
|
26
|
-
* no JRuby support (see [methodmissing/rbczmq#48](https://github.com/methodmissing/rbczmq/issues/48))
|
27
|
-
* doesn't feel like Ruby
|
28
|
-
* [mtortonesi/ruby-czmq](https://github.com/mtortonesi/ruby-czmq)
|
29
|
-
* no tests
|
30
|
-
* no documentation
|
31
|
-
* outdated
|
32
|
-
* doesn't feel like Ruby
|
33
|
-
* [chuckremes/ffi-rzmq](https://github.com/chuckremes/ffi-rzmq)
|
34
|
-
* support discontinued
|
35
|
-
* low level ZMQ gem, not CZMQ
|
36
|
-
|
37
|
-
Furthermore, I knew about the generated low-level Ruby FFI binding in the
|
38
|
-
[zeromq/czmq](https://github.com/zeromq/czmq) repository. I wanted to make use
|
39
|
-
of it because I love that it's generated (and thus, most likely correct
|
40
|
-
and up-to-date). Unfortunately, it was in pretty bad shape and missing a few
|
41
|
-
CZMQ classes.
|
42
|
-
|
43
|
-
So I decided to improve the quality and usability of the binding and add the
|
44
|
-
missing classes. The result is
|
45
|
-
[czmq-ffi-gen](https://github.com/paddor/czmq-ffi-gen) which provides a solid
|
46
|
-
foundation for CZTop.
|
47
|
-
|
48
16
|
## Goals
|
49
17
|
|
50
18
|
Here are some some of the goals I have/had in mind for this library:
|
@@ -371,6 +339,38 @@ $
|
|
371
339
|
* can be used in a pipeline (limited memory usage)
|
372
340
|
* reusable interface: `Z85::Pipe`
|
373
341
|
|
342
|
+
## Reasons
|
343
|
+
|
344
|
+
Why another CZMQ Ruby binding? Here is a list of existing projects I found and
|
345
|
+
the issues with them, from my point of view:
|
346
|
+
|
347
|
+
* [Asmod4n/ruby-ffi-czmq](https://github.com/Asmod4n/ruby-ffi-czmq)
|
348
|
+
* outdated
|
349
|
+
* according to its author, it's an "abomination"
|
350
|
+
* [methodmissing/rbczmq](https://github.com/methodmissing/rbczmq)
|
351
|
+
* no support for security features (see [methodmissing/rbczmq#28](https://github.com/methodmissing/rbczmq/issues/28))
|
352
|
+
* no JRuby support (see [methodmissing/rbczmq#48](https://github.com/methodmissing/rbczmq/issues/48))
|
353
|
+
* doesn't feel like Ruby
|
354
|
+
* [mtortonesi/ruby-czmq](https://github.com/mtortonesi/ruby-czmq)
|
355
|
+
* no tests
|
356
|
+
* no documentation
|
357
|
+
* outdated
|
358
|
+
* doesn't feel like Ruby
|
359
|
+
* [chuckremes/ffi-rzmq](https://github.com/chuckremes/ffi-rzmq)
|
360
|
+
* support discontinued
|
361
|
+
* low level ZMQ gem, not CZMQ
|
362
|
+
|
363
|
+
Furthermore, I knew about the generated low-level Ruby FFI binding in the
|
364
|
+
[zeromq/czmq](https://github.com/zeromq/czmq) repository. I wanted to make use
|
365
|
+
of it because I love that it's generated (and thus, most likely correct
|
366
|
+
and up-to-date). Unfortunately, it was in pretty bad shape and missing a few
|
367
|
+
CZMQ classes.
|
368
|
+
|
369
|
+
So I decided to improve the quality and usability of the binding and add the
|
370
|
+
missing classes. The result is
|
371
|
+
[czmq-ffi-gen](https://github.com/paddor/czmq-ffi-gen) which provides a solid
|
372
|
+
foundation for CZTop.
|
373
|
+
|
374
374
|
|
375
375
|
## Contributing
|
376
376
|
|
data/lib/cztop/certificate.rb
CHANGED
@@ -20,15 +20,21 @@ module CZTop
|
|
20
20
|
from_ffi_delegate(ptr)
|
21
21
|
end
|
22
22
|
|
23
|
-
# Creates a new certificate from the given keys
|
24
|
-
#
|
25
|
-
# @param
|
23
|
+
# Creates a new certificate from the given keys (either binary or in Z85
|
24
|
+
# format).
|
25
|
+
# @param public_key [String] binary public key (32 or 40 bytes)
|
26
|
+
# @param secret_key [String, nil] binary secret key (32 or 40 bytes), or
|
27
|
+
# nil to initialize a public key only certificate
|
26
28
|
# @return [Certificate] the fresh certificate
|
27
29
|
# @raise [ArgumentError] if keys passed are invalid
|
28
30
|
# @raise [SystemCallError] if this fails
|
29
|
-
def self.new_from(public_key, secret_key)
|
31
|
+
def self.new_from(public_key, secret_key = nil)
|
30
32
|
raise ArgumentError, "no public key given" unless public_key
|
31
|
-
|
33
|
+
secret_key ||= "\x00" * 32 # no secret key given, provide 32 null bytes
|
34
|
+
|
35
|
+
# convert Z85 => binary
|
36
|
+
public_key = Z85.decode(public_key) if public_key.bytesize == 40
|
37
|
+
secret_key = Z85.decode(secret_key) if secret_key.bytesize == 40
|
32
38
|
|
33
39
|
raise ArgumentError, "invalid public key size" if public_key.bytesize != 32
|
34
40
|
raise ArgumentError, "invalid secret key size" if secret_key.bytesize != 32
|
data/lib/cztop/version.rb
CHANGED