bpjs-signature 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/signature.rb +14 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 65cae710b88b96630dae8cd79a90967e7be8e30efb4155ee8f65ddbbff93e1d5
|
4
|
+
data.tar.gz: 59503719d7541656c0fc5cbba059b9bb276e884da23408968c366109dd14c4fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eb140d2d91e7020903b6adbc74056857d06504fed17207c053de0e4362eca9c217830482b20f112614314bf55b8c400e2e9d0f177cbf8aa46a3488a1fb805d19
|
7
|
+
data.tar.gz: f62a0cccc75344cb33feb0bcbc3ad84b3726be5d1bee5cf4a8fdecb767965c3f9b4f892796cb7a28353718895e0ae4f8df3e2ad4ef762ee119256e941ec3ba96
|
data/lib/signature.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
class Signature
|
5
|
+
|
6
|
+
def self.generate(cons_id, secretkey)
|
7
|
+
data = "#{cons_id}&#{Time.now.to_i}"
|
8
|
+
|
9
|
+
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secretkey, data)).strip()
|
10
|
+
|
11
|
+
{signature: signature, timestamp: Time.now.to_i}
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bpjs-signature
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tendy Rivaldo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple for genarete signatur with HMAC SHA256 gem
|
14
|
+
email: pattidef@icloud.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/signature.rb
|
20
|
+
homepage: https://rubygems.org/gems/bpjs-signature
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.2.3
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Yeay!
|
43
|
+
test_files: []
|