Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.05 KB

File metadata and controls

50 lines (34 loc) · 1.05 KB

Cryptography

Perry natively implements password hashing, JWT tokens, and Ethereum cryptography.

bcrypt

{{#include ../../examples/stdlib/crypto/snippets.ts:bcrypt}}

Argon2

{{#include ../../examples/stdlib/crypto/snippets.ts:argon2}}

JSON Web Tokens

{{#include ../../examples/stdlib/crypto/snippets.ts:jwt}}

Node.js Crypto

{{#include ../../examples/stdlib/crypto/snippets.ts:crypto-node}}

Ethers

The ethers runtime exposes utility functions (formatEther, formatUnits, parseEther, parseUnits, getAddress) but the higher-level Wallet.createRandom() constructor flow shown below is not yet wired into the LLVM backend. Track the follow-up at issue #199.

import { ethers } from "ethers";

// Create a wallet
const wallet = ethers.Wallet.createRandom();
console.log(wallet.address);

// Sign a message
const signature = await wallet.signMessage("Hello, Ethereum!");

Next Steps