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.
30 lines (24 loc) • 998 B
text/typescript
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {createKeyset} from '../testing/internal/test_utils';
import {CleartextKeysetHandle} from './cleartext_keyset_handle';
import {KeysetHandle} from './keyset_handle';
describe('cleartext keyset handle test', function() {
it('deserialize from binary', function() {
const keyset1 = createKeyset();
const keysetHandle =
CleartextKeysetHandle.deserializeFromBinary(keyset1.serializeBinary());
const keyset2 = keysetHandle.getKeyset();
expect(keyset2.getPrimaryKeyId()).toBe(keyset1.getPrimaryKeyId());
expect(keyset2.getKeyList()).toEqual(keyset2.getKeyList());
});
it('serialize to binary', function() {
const keyset = createKeyset();
const keysetHandle = new KeysetHandle(keyset);
const keysetBinary = CleartextKeysetHandle.serializeToBinary(keysetHandle);
expect(keyset.serializeBinary()).toEqual(keysetBinary);
});
});