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
import 'dart:isolate'; | |
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/scheduler.dart'; | |
import 'package:webcrypto/webcrypto.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} |
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
const x25519_key = await crypto.subtle.generateKey( | |
{ name: "X25519" }, | |
true, // Extractable | |
["deriveKey", "deriveBits"] | |
); | |
// Export the keys | |
const privateKeyJwk = await crypto.subtle.exportKey("pkcs8", x25519_key.privateKey); | |
const publicKeyJwk = await crypto.subtle.exportKey("spki", x25519_key.publicKey); |
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
import 'dart:convert'; | |
import 'dart:typed_data'; | |
import 'package:pem/pem.dart'; | |
import 'package:test/test.dart'; | |
import 'package:webcrypto/webcrypto.dart'; | |
void main() { | |
group('RsaOaepPrivateKey Tests', () { | |
final modulusLength = 2048; | |
final publicExponent = BigInt.from(65537); |
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
package main | |
import ( | |
"crypto/rand" | |
"crypto/sha256" | |
"fmt" | |
"github.com/cloudflare/circl/ecc/bls12381" | |
) | |
type KDF struct { |
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
PS C:\Users\Hamdaan\Desktop\downloads\webcrypto.dart> flutter test --coverage | |
00:17 +1425: All tests passed! |
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
import 'package:webcrypto/webcrypto.dart'; | |
import 'dart:convert'; | |
Future<void> main() async { | |
// Generate a new key using SHA-256 and an optional length parameter. | |
final key = await HmacSecretKey.generateKey(Hash.sha256, length: 256); | |
// Sign the message. | |
final signature = await key.signBytes(utf8.encode('Hello World!')); | |
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
PS E:\kanidm> cargo test | |
warning: unused variable: `path` | |
--> libs\file_permissions\src\windows.rs:21:22 | |
| | |
21 | pub fn diagnose_path(path: &Path) -> Diagnosis { | |
| ^^^^ help: if this is intentional, prefix it with an underscore: `_path` | |
| | |
= note: `#[warn(unused_variables)]` on by default | |
warning: `kanidm_lib_file_permissions` (lib) generated 1 warning (run `cargo fix --lib -p kanidm_lib_file_permissions` to apply 1 suggestion) |
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
root@LAPTOP-B88S065R:/mnt/c/Users/Hamdaan/Desktop/kanidm# cargo test | |
Updating git repository `https://github.com/kanidm/webauthn-rs.git` | |
Updating crates.io index | |
Updating git repository `https://github.com/dnaeon/rust-sshkeys.git` | |
Downloaded pin-project v1.1.4 | |
Downloaded password-hash v0.5.0 | |
Downloaded prokio v0.1.0 | |
Downloaded overload v0.1.1 | |
Downloaded asn1-rs-derive v0.1.0 | |
Downloaded async-stream-impl v0.3.5 |
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
import { generateKeyPair, generateSharedSecret, generateHMAC, KeyPair } from '../utils/crypto.utils'; | |
import axios from 'axios'; | |
let sharedSecret: Buffer; | |
export async function sendAAPublicKey(): Promise<Buffer> { | |
try { | |
const response = await axios.get('http://localhost:3000/init'); | |
const boostPublicKey: Buffer = Buffer.from(response.data.boostPublicKey, 'hex'); |
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
const express = require("express"); | |
const axios = require("axios"); | |
const fs = require("fs").promises; | |
const path = require("path"); | |
const app = express(); | |
const port = 3000; | |
// Function to fetch private resource | |
const fetchPrivateResource = async () => { |
NewerOlder