• Public
  • Public/Protected
  • All



  • identityFromSeed(seedPhrasePath: string): Promise<Secp256k1KeyIdentity>
  • Returns an identity in JavaScript that matches a dfx identity. This identity is produced from a quill generated seed phrase

    import { homedir } from 'os';

    let identity = await identityFromSeed(`${homedir}/.config/dfx/identity/local-testing/seed.txt`);

    Note: This function is meant to be run locally in a NodeJS context

    Implementation follows from https://forum.dfinity.org/t/using-dfinity-agent-in-node-js/6169/49

    Steps (Before using)

    1. Navigate to my .dfx identities → ~/.config/.dfx/identity
    2. Create a new identity → mkdir local-testing; cd local-testing
    3. Download quill since keysmith is now deprecated.
    4. Test that quill is installed correctly → quill
    5. Look up how to generate a key → quill generate --help
    6. Generate a key and seed file → quill generate --pem-file identity.pem --seed-file seed.txt
    7. Now running the identityFromSeed() function and dfx identity get-principal should return the same identity! Yay!

    Note: If you run this an have NodeJS version 17+, you will receive the following error coming from the hdkey library import → Error: error:0308010C:digital envelope routines::unsupported. The possible solutions for getting around this are here, the easiest of which is downgrading to node 16. (@kpeacock/sdk team can you provide a node 17+ solution? :slightly_smiling_face: ) Now running the above node script and dfx identity get-principal should return the same identity! Yay!


    • seedPhrasePath: string

      path to the identity seedphrase

    Returns Promise<Secp256k1KeyIdentity>

    Returns the identity of the seed phrase

  • loadWasm(wasmPath: string): number[]
  • Loads wasm as a Blob from a .wasm file path so that it can be passed to an install_code method


    • wasmPath: string

      path to the wasm file

    Returns number[]

    the Uint8Array "Blob-ified" wasm, ready to go for canister upgrades!

Generated using TypeDoc