diff --git a/packages/anoncreds/src/utils/__tests__/credential.test.ts b/packages/anoncreds/src/utils/__tests__/credential.test.ts index f0fb30d943..c33e90a4a0 100644 --- a/packages/anoncreds/src/utils/__tests__/credential.test.ts +++ b/packages/anoncreds/src/utils/__tests__/credential.test.ts @@ -89,7 +89,7 @@ const testEncodings: { [key: string]: { raw: string | number | boolean | null; e }, 'leading zero number string': { raw: '012345', - encoded: '012345', + encoded: '15442803653501515687133735982599955909858317553820932727345025407787217899333', }, 'chr 0': { raw: String.fromCharCode(0), @@ -132,7 +132,7 @@ describe('Utils | Credentials', () => { encoded: '68086943237164982734333428280784300550565381723532936263016368251445461241953', }, age: { raw: '1234', encoded: '1234' }, - id: { raw: '0678', encoded: '0678' }, + id: { raw: '0678', encoded: '77028439388269848458807170800403172154093562860161099407497319717275846030012' }, }) }) }) diff --git a/packages/anoncreds/src/utils/credential.ts b/packages/anoncreds/src/utils/credential.ts index d82aec27ed..3fa064c662 100644 --- a/packages/anoncreds/src/utils/credential.ts +++ b/packages/anoncreds/src/utils/credential.ts @@ -15,7 +15,6 @@ const isString = (value: unknown): value is string => typeof value === 'string' const isNumber = (value: unknown): value is number => typeof value === 'number' const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean' const isNumeric = (value: string) => /^-?\d+$/.test(value) -const isDecimal = (value: string): boolean => /\d+\.\d+/.test(value) const hasLeadingZero = (value: string) => value.length > 1 && value.startsWith('0') const isInt32 = (number: number) => { @@ -51,11 +50,6 @@ export function encodeCredentialValue(value: unknown) { return value.toString() } - // If value is a number string with leading zero and not a decimal return as number string - if (isString(value) && !isNaN(Number(value)) && !isDecimal(value) && hasLeadingZero(value)) { - return value.toString() - } - // If value is an int32 number string return as number string if ( isString(value) &&