How to use the crypto-ld.Ed25519KeyPair function in crypto-ld

To help you get started, we’ve selected a few crypto-ld examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digitalbazaar / jsonld-signatures / tests / mock / Ed25519Signature2018.js View on Github external
'creator': publicKeys.carol.id,
    'jws':
      'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19' +
      '..' +
      'ANcNI6x6KDA_hHux2RLM8_i9aoZY34GwcZevOjkSh22WoNB4FcP6dNgf2nKzX' +
      'XJIr-IqUnEwMYeD36fc8jv1AA',
    'proofPurpose': NOOP_PROOF_PURPOSE_URI
  }
};

mock.parameters = {};

mock.parameters.sign = {
  creator: publicKeys.carol.id,
  date: '2018-02-13T21:26:08Z',
  key: new Ed25519KeyPair({
    privateKeyBase58: privateKeys.carol.privateKeyBase58,
    ...publicKeys.carol
  })
};

mock.parameters.verify = {
  creator: publicKeys.carol.id,
  date: '2018-02-13T21:26:08Z'
};

mock.parameters.verifyWithPassedKey = mock.parameters.sign;

mock.parameters.authenticationController = {
  '@context': constants.SECURITY_CONTEXT_URL,
  id: controllers.carol.id,
  authentication: publicKeys.carol.id
github decentralized-identity / github-did / packages / lib / src / v2 / func / verifyWithResolver.js View on Github external
const verificationMethod = signedData.proof.verificationMethod
    ? signedData.proof.verificationMethod
    : signedData.proof.creator;
  const doc = await resolver.resolve(verificationMethod);

  const didPublicKey = doc.publicKey.find(k => {
    return k.id == verificationMethod;
  });

  if (didPublicKey.type === "Ed25519VerificationKey2018") {
    const result = await jsigs.verify(signedData, {
      documentLoader: wrappedDocumentLoader({
        //args that are needed in the wrapper.. such as zcaps
      }),
      suite: new Ed25519Signature2018({
        key: new Ed25519KeyPair(didPublicKey)
      }),
      purpose: new AssertionProofPurpose({ controller: doc })
    });

    return result.verified;
  }

  return OpenPgpSignature2019.verify({
    data: signedData,
    signatureAttribute: "proof",
    publicKey: getPublicKeyFromDIDDoc(doc, verificationMethod)
  });
};

crypto-ld

A Javascript library for generating and performing common operations on Linked Data cryptographic key pairs.

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis