Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
| pipeline { | |
| agent none | |
| stages { | |
| stage('Checkout') { | |
| agent { | |
| docker { image 'node:alpine' } | |
| } | |
| stages { |
| ########################################################### | |
| ## this configuration was generated by JFrog Artifactory ## | |
| ########################################################### | |
| ## server configuration | |
| server { | |
| listen 80 ; | |
| server_name ~(?<repo>.+)\.jfrog.dev.local jfrog.dev.local; |
| Jenkinsfile examples |
| var assert = require('assert') | |
| var crypto = require('crypto') | |
| var jose = require('jose') | |
| var jws = require('jws') | |
| var convert = require('jwk-to-pem') | |
| var { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { | |
| modulusLength: 4096, | |
| publicKeyEncoding: { | |
| type: 'spki', |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
| const crypto = require('crypto'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const Client = require('ssh2-sftp-client'); | |
| // Host public key e.g. /etc/ssh/ssh_host_ecdsa_key.pub | |
| const fingerprint = process.env.HOST_FINGERPRINT; | |
| const hostConfig = { | |
| host: process.env.HOST, | |
| port: process.env.PORT || 22, |
| const crypto = require('crypto'); | |
| const keyPair = crypto.generateKeyPairSync('rsa', { | |
| // Max length of plaintext = (512 / 8) - 42 = 22 bytes | |
| modulusLength: 512, | |
| publicKeyEncoding: { | |
| type: 'spki', | |
| format: 'pem' | |
| }, | |
| privateKeyEncoding: { |
| const fs = require('fs') | |
| const AWS = require('aws-sdk') | |
| const BUCKET_NAME = 'my-bucket' | |
| const ACCESS_KEY = 'AKIAXXXXXXXXXXXXXXXX' | |
| const SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
| const FILE = 'file-to-download.txt' | |
| AWS.config.update({ | |
| region: 'ap-southeast-1', |