How to use the eddsa function from elliptic

Find comprehensive JavaScript elliptic.eddsa code examples handpicked from public code repositorys.

2
3
4
5
6
7
8
9
10
11
// Organize imports
const assert = require("assert")
const brorand = require("brorand")
const BN = require("bn.js")
const elliptic = require("elliptic");
const Ed25519 = elliptic.eddsa('ed25519');
const Secp256k1 = elliptic.ec('secp256k1');
const hashjs = require("hash.js");
const Sha512 = require("ripple-keypairs/dist/Sha512")
const { codec, encodeAccountPublic, encodeNodePublic } = require("ripple-address-codec");
fork icon973
star icon414
watch icon136

40
41
42
43
44
45
46
47
48
49
                }
        };
}
else if(publicKeyCose.get(COSE_KEYS.kty) === COSE_KTY.OKP){
        const x = publicKeyCose.get(COSE_KEYS.x);
        const key = new elliptic.eddsa('ed25519');
        key.keyFromPublic(x);

        return {
                verified: true, 
fork icon4
star icon19
watch icon1

1
2
3
4
5
6
7
8
9
10
import { XummService } from '../../services/xumm.service';
import { rippleEpocheTimeToUTC } from '../../utils/normalizers';
import { createHash } from 'crypto';

const elliptic = require('elliptic');
const ed25519 = new elliptic.eddsa('ed25519')
const secp256k1 = new elliptic.ec('secp256k1')

const codec =
{
fork icon1
star icon12
watch icon2

2
3
4
5
6
7
8
9
10
11
const { getDigestFromMultihash } = require('../utils/ipfs')

class Crypto {
    constructor(chluIpfs){
        this.chluIpfs = chluIpfs;
        this.ec = new elliptic.eddsa('ed25519')
        this.rand = brorand
    }

    async storePublicKey(pubKey) {
fork icon1
star icon1
watch icon3

5
6
7
8
9
10
11
12
13
14
    'commodity_amount',
    'network',
    'sc_address',
    'sc_input_data',
];
const ellipticEdDSA = new elliptic_1.eddsa('ed25519');
const trimHexPrefix = (str) => {
    if (!str)
        return str;
    if (str.substring(0, 2) === '0x') {
fork icon1
star icon0
watch icon0

16
17
18
19
20
21
22
23
24
25
26
27
28
}


const encoder = new TextEncoder();
const signed_bytes = encoder.encode(canonicalize(certificate.certificate)); // encode the string into bytes with UTF-8 encoding


const result = elliptic.eddsa('ed25519').verify(signed_bytes, certificate.signature.value, signing_certificate.certificate.publicKey.key);


if (result) {
    console.log("The signature is valid.");
} else {
fork icon1
star icon0
watch icon0