
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
newfang-did-resolver
Advanced tools
Initialize the Resolver
const Resolver = require('newfang-did-resolver');
let resolver = new Resolver();
//resolver.resolve('did:newfang:<newfang_specific_id>');
(async() => {
console.log(await resolver.resolve('did:newfang:0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066'))
})();
Output:
{ '@context': ['https://w3id.org/did/v1', 'https://newfang.io/did/v1'],
id:
'did:newfang:0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066',
publicKey:
[ { id:
'did:newfang:0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066#owner',
type: 'Secp256k1VerificationKey2018',
owner: '0x5089E1c3742Ab4fD0e25837637488D74FFEB58e2',
newfangSpecificId:
'0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066' } ],
access:
{ read: [ '0xC8e1F3B9a0CdFceF9fFd2343B943989A22517b26' ],
reshare: [],
delete: [] },
authentication:
[ { type: 'Secp256k1SignatureAuthentication2018',
publicKey:
'did:newfang:0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066#owner' } ] }
To generate Newfang Specific Id from storage Index
let file_id = resolver.generateFileId('<storage index>');
To call the contract functions, private key must be provided. There are two ways to achieve this.
//Resolver('<private Key>');
let privateKey = "0x637b316da08aa597df18f7f91b4da5d7cf0d7af777984284fb3fe755f3346284";
let resolver = new Resolver({privateKey: privateKey});
resolver.setPrivateKey(privateKey);
Contract Functions:
(async() => {
let tx = await resolver.contract.nonce('0x5089E1c3742Ab4fD0e25837637488D74FFEB58e2');
await tx.wait();
console.log(tx.hash);
})();
Signed Functions:
(async() => {
let file_id = "0x4de0e96b0a8886e42a2c35b57df8a9d58a93b5bff655bc37a30e2ab8e29dc066";
let client_resolver = new Resolver({privateKey: "24C4FE6063E62710EAD956611B71825B778B041B18ED53118CE5DA5F02E494BA"});
let sig = await client_resolver.getKeyHashRawTransaction(file_id, "read");
console.log(await resolver.getKeyHashSigned(file_id, "read", sig));
})();
Output:
{ encrypted_key:
'0x39867be5f9b67a02f1f9cad5784e28557c614c8024b351e6cad5f9119e268309',
validity: 1576581590 }
Update ACK Signed
let client_resolver = new Resolver({privateKey: "24C4FE6063E62710EAD956611B71825B778B041B18ED53118CE5DA5F02E494BA"});
let sig = await client_resolver.updateRawTransaction(fileId, wallet.address, AccessTypes["read"], ethers.utils.hashMessage("<access-key>"), 0);
let tx = await resolver.updateACKSigned(fileId, wallet.address, AccessTypes["read"], ethers.utils.hashMessage("<access-key>"), 0, sig);
await tx.wait();
console.log(tx.hash);
FAQs
Resolve newfang DID documents
We found that newfang-did-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.