How to use the js-sha256.sha256.create function in js-sha256

To help you get started, we’ve selected a few js-sha256 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 apollographql / apollo-server / packages / apollo-server-integration-testsuite / src / index.ts View on Github external
describe('Persisted Queries', () => {
      const query = '{testString}';
      const query2 = '{ testString }';

      const hash = sha256
        .create()
        .update(query)
        .hex();
      const extensions = {
        persistedQuery: {
          version: VERSION,
          sha256Hash: hash,
        },
      };

      const extensions2 = {
        persistedQuery: {
          version: VERSION,
          sha256Hash: sha256
            .create()
            .update(query2)
github apollographql / apollo-server / packages / apollo-server-integration-testsuite / src / index.ts View on Github external
const hash = sha256
        .create()
        .update(query)
        .hex();
      const extensions = {
        persistedQuery: {
          version: VERSION,
          sha256Hash: hash,
        },
      };

      const extensions2 = {
        persistedQuery: {
          version: VERSION,
          sha256Hash: sha256
            .create()
            .update(query2)
            .hex(),
        },
      };

      beforeEach(async () => {
        const map = new Map();
        const cache = {
          set: async (key, val) => {
            await map.set(key, val);
          },
          get: async key => map.get(key),
        };
        app = await createApp({
          graphqlOptions: {
github apollographql / apollo-server / packages / apollo-server-integration-testsuite / src / ApolloServer.ts View on Github external
describe('Persisted Queries', () => {
      let uri: string;
      const query = gql`
        ${TEST_STRING_QUERY}
      `;
      const hash = sha256
        .create()
        .update(TEST_STRING_QUERY)
        .hex();
      const extensions = {
        persistedQuery: {
          version: VERSION,
          sha256Hash: hash,
        },
      };

      beforeEach(async () => {
        const serverInfo = await createApolloServer({
          schema,
          introspection: false,
          persistedQueries: {
            cache: new Map() as any,