Skip to content

Commit

Permalink
fix: leading zeros in credential value encoding (#632)
Browse files Browse the repository at this point in the history
Signed-off-by: James Ebert <[email protected]>
  • Loading branch information
JamesKEbert authored Feb 9, 2022
1 parent f64a9da commit 0d478a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/modules/credentials/CredentialUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class CredentialUtils {

// If value is an int32 number string return as number string
if (isString(value) && !isEmpty(value) && !isNaN(Number(value)) && this.isInt32(Number(value))) {
return value
return Number(value).toString()
}

if (isNumber(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const testEncodings: { [key: string]: { raw: string | number | boolean | null; e
raw: '0.1',
encoded: '9382477430624249591204401974786823110077201914483282671737639310288175260432',
},
'leading zero number string': {
raw: '012345',
encoded: '12345',
},
'chr 0': {
raw: String.fromCharCode(0),
encoded: '49846369543417741186729467304575255505141344055555831574636310663216789168157',
Expand Down

0 comments on commit 0d478a7

Please sign in to comment.