Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@transmute/did-key-secp256k1
Advanced tools
``` npm i @transmute/did-key-secp256k1@latest --save ```
npm i @transmute/did-key-secp256k1@latest --save
import crypto from 'crypto';
import * as secp256k1 from '@transmute/did-key-secp256k1';
const { didDocument, keys } = await secp256k1.generate(
{
secureRandom: () => {
return crypto.randomBytes(32);
},
},
{ accept: 'application/did+json' }
);
import { Secp256k1KeyPair } from '@transmute/did-key-secp256k1';
const k = await Secp256k1KeyPair.generate({
secureRandom: () => {
return Buffer.from(
'9085d2bef69286a6cbb51623c8fa258629945cd55ca705cc4e66700396894e0c',
'hex'
);
},
});
const exportedKeyPair = await k.export({
type: 'JsonWebKey2020',
privateKey: true,
});
import * as secp256k1 from '@transmute/did-key-secp256k1';
const {
didDocument,
} = await secp256k1.resolve(
'did:key:z6LScNhBGJJHGPgx9AMCHjxFew9qfbAZhsi1KyJYcfdcFQ9k',
{ accept: 'application/did+json' }
);
This suite was created after https://www.w3.org/2018/credentials/v1
so it must be added to the credential context.
import { ld as vcjs } from '@transmute/vc.js';
import { Secp256k1KeyPair } from '@transmute/did-key-secp256k1';
import { JsonWebSignature, JsonWebKey } from '@transmute/json-web-signature';
const k = await Secp256k1KeyPair.generate({
secureRandom: () => {
return Buffer.from(
'4e61bc1918ea6a47ae3307331be7798196a1a8e7cfe4b6e8f7c9a5f36017d929',
'hex'
);
},
});
const suite = new JsonWebSignature({
key: await JsonWebKey.from(
await k.export({
type: 'JsonWebSignature2020',
privateKey: true,
})
),
date: '2020-03-10T04:24:12Z',
});
const vc = await vcjs.issue({
credential: {
'@context': [
'https://www.w3.org/2018/credentials/v1',
// 🧙♂️ This extension context is required.
'https://w3id.org/security/suites/jws-2020/v1',
],
id: 'http://example.gov/credentials/3732',
type: ['VerifiableCredential'],
issuer: {
id: k.controller,
},
issuanceDate: '2020-03-10T04:24:12.164Z',
credentialSubject: {
id: 'did:example:ebfeb1f712ebc6f1c276e12ec21',
},
},
suite,
documentLoader,
});
import { Secp256k1KeyPair } from '@transmute/did-key-secp256k1';
import { JWS } from '@transmute/jose-ld';
const k = await Secp256k1KeyPair.generate({
secureRandom: () => {
return Buffer.from(
'4e61bc1918ea6a47ae3307331be7798196a1a8e7cfe4b6e8f7c9a5f36017d929',
'hex'
);
},
});
const JWA_ALG = 'ES256K';
const signer = JWS.createSigner(k.signer('Ecdsa'), JWA_ALG);
const verifier = JWS.createVerifier(k.verifier('Ecdsa'), JWA_ALG);
const message = Uint8Array.from(Buffer.from('hello'));
const signature = await signer.sign({ data: message });
const verified = await verifier.verify({
signature,
});
import { Secp256k1KeyPair } from '@transmute/did-key-secp256k1';
import { JWE } from '@transmute/jose-ld';
const k = await Secp256k1KeyPair.generate({
secureRandom: () => {
return Buffer.from(
'9085d2bef69286a6cbb51623c8fa258629945cd55ca705cc4e66700396894e0c',
'hex'
);
},
});
const cipher = new JWE.Cipher(Secp256k1KeyPair);
const document = { key1: 'value1', key2: 'value2' };
const recipients = [
{
header: {
kid: k.id,
alg: 'ECDH-ES+A256KW',
},
},
];
const jwe = await cipher.encryptObject({
obj: document,
recipients,
publicKeyResolver: async (id: string) => {
if (id === k.id) {
return k.export({ type: 'JsonWebKey2020' });
}
throw new Error(
'publicKeyResolver does not suppport IRI ' + JSON.stringify(id)
);
},
});
const plaintext = await cipher.decrypt({ jwe, keyAgreementKey: k });
console.log(JSON.parse(Buffer.from(plaintext).toString('utf-8')));
0.3.0-unstable.10 (2022-12-12)
Note: Version bump only for package root
FAQs
``` npm i @transmute/did-key-secp256k1@latest --save ```
The npm package @transmute/did-key-secp256k1 receives a total of 1,024 weekly downloads. As such, @transmute/did-key-secp256k1 popularity was classified as popular.
We found that @transmute/did-key-secp256k1 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.