Skip to content

Latest commit

 

History

History
217 lines (127 loc) · 4.27 KB

03.api.md

File metadata and controls

217 lines (127 loc) · 4.27 KB

shambhala API


Current implementation: shambhala.client.js

Example usage: shambhala.testing.js


constructor

  • Class definition.

    interface Options: {
        token?: string;
    }
    
    class Shambhala {
        constructor (url: string, opts?: Options)
    }
  • Invocation.

    let shambhala = new Shambhala("https://secrets.example.com/", {
        token: "jwt.io.token"
    })

onboarding method calls

  • Generate account. Returns a string with an account id (G_PUBLIC).

    async function generateAddress (): Promise<string>
  • Associate account. Returns a string with an account id (G_PUBLIC).

    async function associateAddress (accountId: string): Promise<string>
  • Generate set of signing keys for a given account id. Returns object with C_PUBLIC and S_PUBLIC.

    async function generateSigningKeys (accountId: string): Promise<object>
  • Generate signed key association transaction, ready to be submitted to the stellar network. If such transaction can't be generated an exception is thrown. This operation can be invoked maximum once.

    async function generateSignedKeyAssocTX (
        accountId: string,
        sequence: string,
        networkPassphrase: string
    ): Promise<string>  // b64-encoded TransactionEnvelope XDR
  • Generate key association transaction. This transaction has to be signed with an appropriate SECRET before it can be sent to the stellar network.

    async function generateKeyAssocTX (
        accountId: string,
        sequence: string,
        networkPassphrase: string
    ): Promise<string>  // b64-encoded TransactionEnvelope XDR

signing method calls

  • Returns true if transaction can be signed on behalf of an account id, false otherwise.

    async function canSignFor (accountId: string): Promise<boolean>
  • On behalf of an account id sign a given transaction (provided as StellarSDK.xdr.TransactionSignaturePayload). Returns array of base64-encoded StellarSDK.xdr.Signature.

    async function signTransaction (
        accountId: string,
        tspXDR: Uint8Array
    ): Promise<Array>

backup / restore calls

  • Asks for an encrypted backup for a given account id. Returns base64-encoded, encrypted contents of the shambhala-web-storage structures.

    async function backup (accountId: string): Promise<string>
  • Request restoring of shambhala-web-storage structures contents from a given payload for a given account id.

    async function restore (
        accountId: string,
        backup: string
    ): Promise<object>

administrative method calls

  • Get shambhala library version.

    async function getLibVersion (): Promise<string>
  • Get shambhala instance version.

    async function getVersion (): Promise<string>
  • Get associated public keys for a given account id. Returns object with fields G_PUBLIC, C_PUBLIC, S_PUBLIC or throws an error.

    async function getPublicKeys (accountId: string): Promise<object>

lifecycle calls

  • Open shambhala window.

    async function open (): Promise<object>
  • Close shambhala window. Also destroy shambhala instance. After this call no operation can be performed on a current instance - in such case constructor call is necessary.

    async function close (): Promise<boolean>
  • Cancel current operation.

    async function cancel (): Promise<boolean>
  • Check if shambhala is up-and-running. Open its window if necessary.

    async function ping (): Promise<boolean>