How to use the @tanker/core/src/Blocks/payloads.serializeBlock function in @tanker/core

To help you get started, we’ve selected a few @tanker/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TankerHQ / sdk-js / packages / functional-tests / src / Helpers.js View on Github external
static async newApp(): Promise {
    const appKeyPair = tcrypto.makeSignKeyPair();
    const rootBlock = makeRootBlock(appKeyPair);
    const message = {
      root_block: utils.toBase64(serializeBlock(rootBlock)),
      name: `functest-${uuid.v4()}`,
      is_test: true,
      private_signature_key: utils.toBase64(appKeyPair.privateKey),
    };
    const requester = await AuthenticatedRequester.open();
    const createResponse = await requester.send('create trustchain', message);
    const authToken = createResponse.auth_token;

    const appId = rootBlock.trustchain_id;

    await requester.send('update trustchain', {
      id: utils.toBase64(appId),
      oidc_client_id: oidcSettings.googleAuth.clientId,
      oidc_provider: 'google',
    });