
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@ethsign/sp-sdk
Advanced tools
import {
SignProtocolClient,
SpMode,
EvmChains,
delegateSignAttestation,
delegateSignRevokeAttestation,
delegateSignSchema,
} from '@ethsign/sp-sdk';
import { privateKeyToAccount } from 'viem/accounts';
const privateKey = '0xabc'; // optional
const client = new SignProtocolClient(SpMode.OnChain, {
chain: EvmChains.sepolia,
account: privateKeyToAccount(privateKey), // optional
apiKey: 'xxx', //optional,from https://developer.sign.global/
});
//create schema
const createSchemaRes = await client.createSchema({
name: 'xxx',
data: [{ name: 'name', type: 'string' }],
});
// delegation create schema
const delegationPrivateKey = '0xaaaaa';
const info = await delegateSignSchema(
{
name: 'xxx',
data: [{ name: 'name', type: 'string' }],
},
{
chain: EvmChains.sepolia,
delegationAccount: privateKeyToAccount(delegationPrivateKey),
}
);
const delegateCreateSchemaRes = await client.createSchema(info.schema, {
delegationSignature: info.delegationSignature,
});
// create attestation
const createAttestationRes = await client.createAttestation({
schemaId: '0x3',
data: { name: 'a' },
indexingValue: 'xxx',
});
// delegation create attestation
const delegationPrivateKey = '0xaaaaa';
const info = await delegateSignAttestation(
{
schemaId: '0x1',
data: { name: 'a' },
indexingValue: 'xxx',
},
{
chain: EvmChains.sepolia,
delegationAccount: privateKeyToAccount(delegationPrivateKey),
}
);
const delegationCreateAttestationRes = await client.createAttestation(
info.attestation,
{
delegationSignature: info.delegationSignature,
}
);
//revoke attestation
const revokeAttestationRes = await client.revokeAttestation('0x3', {
reason: 'test',
});
//delegation revoke attestation
const delegationPrivateKey = '0xaaaaa';
const info = await delegateSignRevokeAttestation(attestationId, {
chain: EvmChains.sepolia,
reason: 'test',
delegationAccount: privateKeyToAccount(delegationPrivateKey),
});
const delegationRevokeAttestationRes = await client.revokeAttestation(
info.attestationId,
{
reason: info.reason,
delegationSignature: info.delegationSignature,
}
);
import {
SignProtocolClient,
SpMode,
EvmChains,
OffChainSignType,
} from '@ethsign/sp-sdk';
import { privateKeyToAccount } from 'viem/accounts';
const privateKey = '0xabc'; // optional
const client = new SignProtocolClient(SpMode.OffChain, {
signType: OffChainSignType.EvmEip712,
account: privateKeyToAccount(privateKey), // optional
apiKey: 'xxx', //optional,from https://developer.sign.global/
});
//create schema
const schemaInfo = await client.createSchema({
name: 'xxx',
data: [{ name: 'name', type: 'string' }],
});
//create attestation
const attestationInfo = await client.createAttestation({
schemaId: 'xxxx', //schemaInfo.schemaId or other schemaId
data: { name: 'a' },
indexingValue: 'xxx',
});
//revoke attestation
const attestationId = 'xxx';
const revokeAttestationRes = await client.revokeAttestation(attestationId, {
reason: 'test',
});
import { IndexService } from '@ethsign/sp-sdk';
async function getSchemaListFromIndexService() {
const indexService = new IndexService('testnet');
const res = await indexService.querySchemaList({ page: 1 });
}
async function getSchemaFromIndexService() {
const indexService = new IndexService('testnet');
const res = await indexService.querySchema('onchain_evm_80001_0x1');
}
async function getAttestationListFromIndexService() {
const indexService = new IndexService('testnet');
const res = await indexService.queryAttestationList({ page: 1 });
}
async function getAttestationFromIndexService() {
const indexService = new IndexService('testnet');
const res = await indexService.queryAttestation('onchain_evm_80001_0x1');
}
FAQs
### demo
The npm package @ethsign/sp-sdk receives a total of 236 weekly downloads. As such, @ethsign/sp-sdk popularity was classified as not popular.
We found that @ethsign/sp-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.