Last active
January 22, 2025 05:29
-
-
Save lesm/ad23dcb0da05187bc4b4dc415b39bba5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create user (password) | |
| password = Services::PasswordDigester.new.digest('password') | |
| hash = Entities::User.new(id: SecureRandom.uuid, public_key: 'd3a13bdf38bec706dbf5fe45', secret_key: password, created_at: Time.now, updated_at: Time.now).to_h | |
| Services::Persistence::Repos::UserRepo.new.create(hash) | |
| Agregar logger a la aplicación | |
| #transmission_id = 'e8d9a710-7af0-11eb-b682-5329c90f1393' | |
| #timestamp = '2021-03-02T00:47:48Z' | |
| #webhook_id = 'WHPOC2017-9WY437509V4499423' | |
| #event_body = {'id' => 'iuewhfiuhfuehfwi'} | |
| #"|||234424324" | |
| #require 'openssl' | |
| # | |
| key = OpenSSL::PKey::RSA.new(4096) | |
| name = OpenSSL::X509::Name.parse('CN=Don Signore') | |
| cert = OpenSSL::X509::Certificate.new | |
| cert.not_before = Time.now | |
| cert.not_after = Time.parse('2022-03-04') | |
| cert.public_key = key.public_key | |
| cert.subject = name | |
| cert.issuer = name | |
| cert.sign key, OpenSSL::Digest::SHA256.new | |
| File.write('private_key.pem', key.to_pem) | |
| File.write('certificate', cert) | |
| repo = Services::Persistence::Repos::CertificateRepo.new | |
| repo.create(private_key: key.to_pem, content: cert.to_s) | |
| Verify | |
| cert = OpenSSL::X509::Certificate.new(File.read('test/certificate')) | |
| body = {} | |
| crc = Zlib::crc32(body.to_json) | |
| data = "#{headers["PAYPAL-TRANSMISSION-ID"]}|#{headers["PAYPAL-TRANSMISSION-TIME"]}|#{payload[:id]}|#{crc}" | |
| signature = headers["PAYPAL-TRANSMISSION-SIG"] | |
| digest = OpenSSL::Digest::SHA256.new | |
| digest.update(data) | |
| decoded_sig = Base64.strict_decode64(sig) | |
| cert.public_key.verify(digest, decoded_sig, data) | |
| repo = Services::Persistence::Repos::CertificateRepo.new | |
| repo.create(private_key: File.read('test/private_key.pem'), content: File.read('test/certificate')) | |
| // Add Financial Stripe Account | |
| phone-number = 5556781212 | |
| city = fresno | |
| zip-code = 93650 | |
| bank-routing = 110000000 | |
| bank-account = 000123456789 | |
| card-number-stripe = 4242424242424242 | |
| const client = axios.create({ | |
| baseURL, | |
| withCredentials: true, | |
| headers: { | |
| 'Access-Control-Allow-Origin': baseURL, | |
| 'Access-Control-Allow-Credentials': true, | |
| 'Content-Type': 'application/json' | |
| } | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment