![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@dfinity/utils
Advanced tools
A collection of utilities and constants for NNS/SNS projects.
A collection of utilities and constants for NNS/SNS projects.
You can use utils-js
by installing it in your project.
npm i @dfinity/utils
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
npm i @dfinity/agent @dfinity/candid @dfinity/principal
utils-js
implements following features:
Get a default agent that connects to mainnet with the anonymous identity.
Function | Type |
---|---|
defaultAgent | () => Agent |
Create an agent for a given identity
Function | Type |
---|---|
createAgent | ({ identity, host, fetchRootKey, }: { identity: Identity; host?: string; fetchRootKey?: boolean; }) => Promise<HttpAgent> |
Parameters:
identity
: A mandatory identity to use for the agenthost
: An optional host to connect tofetchRootKey
: Fetch root key for certificate validation during local development or on testnetFunction | Type |
---|---|
createServices | <T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, }, idlFactory, certifiedIdlFactory, }: { options: RequiredCanisterOptions<T>; idlFactory: InterfaceFactory; certifiedIdlFactory: InterfaceFactory; }) => { ...; } |
Function | Type |
---|---|
uint8ArrayToBigInt | (array: Uint8Array) => bigint |
Function | Type |
---|---|
arrayBufferToUint8Array | (buffer: ArrayBuffer) => Uint8Array |
Function | Type |
---|---|
uint8ArrayToArrayOfNumber | (array: Uint8Array) => number[] |
Function | Type |
---|---|
arrayOfNumberToUint8Array | (numbers: number[]) => Uint8Array |
Function | Type |
---|---|
asciiStringToByteArray | (text: string) => number[] |
Function | Type |
---|---|
assertNonNullish | <T>(value: T, message?: string) => asserts value is NonNullable<T> |
Function | Type |
---|---|
toNullable | <T>(value?: T) => [] or [T] |
Function | Type |
---|---|
fromNullable | <T>(value: [] or [T]) => T |
Function | Type |
---|---|
fromDefinedNullable | <T>(value: [] or [T]) => T |
Convert a principal to a Uint8Array 32 length. e.g. Useful to convert a canister ID when topping up cycles with the Cmc canister
Function | Type |
---|---|
principalToSubAccount | (principal: Principal) => Uint8Array |
Parameters:
principal
: The principal that needs to be converted to Subaccountpublic
Parameters:
message
FAQs
A collection of utilities and constants for NNS/SNS projects.
The npm package @dfinity/utils receives a total of 42 weekly downloads. As such, @dfinity/utils popularity was classified as not popular.
We found that @dfinity/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.