UNPKG

1.6 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import * as i18n from './i18n_ast';
9/**
10 * Return the message id or compute it using the XLIFF1 digest.
11 */
12export declare function digest(message: i18n.Message): string;
13/**
14 * Compute the message id using the XLIFF1 digest.
15 */
16export declare function computeDigest(message: i18n.Message): string;
17/**
18 * Return the message id or compute it using the XLIFF2/XMB/$localize digest.
19 */
20export declare function decimalDigest(message: i18n.Message): string;
21/**
22 * Compute the message id using the XLIFF2/XMB/$localize digest.
23 */
24export declare function computeDecimalDigest(message: i18n.Message): string;
25export declare function serializeNodes(nodes: i18n.Node[]): string[];
26/**
27 * Compute the SHA1 of the given string
28 *
29 * see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
30 *
31 * WARNING: this function has not been designed not tested with security in mind.
32 * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
33 */
34export declare function sha1(str: string): string;
35/**
36 * Compute the fingerprint of the given string
37 *
38 * The output is 64 bit number encoded as a decimal string
39 *
40 * based on:
41 * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
42 */
43export declare function fingerprint(str: string): [number, number];
44export declare function computeMsgId(msg: string, meaning?: string): string;