UNPKG

pooja-docucomb-tink-crypto

Version:

A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

26 lines (20 loc) 710 B
/** * @license * Copyright 2022 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import * as random from '../subtle/random'; import {PbKeyData} from './proto'; import {bytesAsU8, bytesLength} from './proto_shims'; describe('proto shims test', () => { it('transforms bytes to uint8array and returns byte length', () => { const rawKey = random.randBytes(32); const keyData = new PbKeyData() .setTypeUrl('key_type_url') .setValue(rawKey) .setKeyMaterialType(PbKeyData.KeyMaterialType.SYMMETRIC); expect(bytesAsU8(keyData.getValue())).toEqual(rawKey); expect(bytesLength(keyData.getValue())).toEqual(32); }); });