Skip to content

Instantly share code, notes, and snippets.

@xk4r00t
xk4r00t / auth.controller.ts
Created April 4, 2022 09:59 — forked from raress96/auth.controller.ts
Elrond generate jwt
import { BadRequestException, Body, Controller, Post, UseGuards } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { CachingService } from '../../common/caching/caching.service';
import { randomBytes } from 'crypto';
import { Constants } from '../../utils/constants';
import { JwtService } from '@nestjs/jwt';
import { LoginDto } from './dto/login.dto';
import { Address, SignableMessage, UserPublicKey } from '@elrondnetwork/erdjs/out';
import { ThrottlerBehindProxyGuard } from '../../common/throttle/throttle.guard';
@xk4r00t
xk4r00t / index.js
Created March 26, 2022 19:48 — forked from kwrooijen/index.js
Elrond serialization
// Import from erdjs SDK
import { AbiRegistry, BinaryCodec } from "@elrondnetwork/erdjs";
// Our base64 response buffer that was queries
let buffer = Buffer.from("AAAACFNvbWUgaGF0AAAAClNvbWUgc2hpcnQAACMp", "base64");
// Load the main.abi.json into our program
let registry = await AbiRegistry.load({ files: ["main.abi.json"] });
// Get MyNFT struct from the registry
@xk4r00t
xk4r00t / README.md
Created May 19, 2019 23:23 — forked from twolfson/README.md
Setting up SOPS

I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.

PGP

It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)

This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.

Web of trust

Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.

This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.