Skip to content

Commit

Permalink
adding the missing from on signTypedData
Browse files Browse the repository at this point in the history
  • Loading branch information
julien51 committed Sep 23, 2019
1 parent 08fd2d6 commit e4867bd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 36 deletions.
6 changes: 6 additions & 0 deletions locksmith/__tests__/controllers/eventController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ describe('Event Controller', () => {
let typedData = generateTypedData(message)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand All @@ -174,6 +175,7 @@ describe('Event Controller', () => {
let typedData = generateTypedData(message)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down Expand Up @@ -206,6 +208,7 @@ describe('Event Controller', () => {
let typedData = generateTypedData(message)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand All @@ -223,6 +226,7 @@ describe('Event Controller', () => {
let typedData = generateTypedData(badOwnerMessage)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down Expand Up @@ -253,6 +257,7 @@ describe('adding event links', () => {
let typedData = generateTypedData2(newLinks)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand All @@ -272,6 +277,7 @@ describe('overwritting event links', () => {
let typedData = generateTypedData(overWritingLinks)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down
5 changes: 5 additions & 0 deletions locksmith/__tests__/controllers/metadataController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ describe('Metadata Controller', () => {
expect.assertions(1)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand All @@ -237,6 +238,7 @@ describe('Metadata Controller', () => {
expect.assertions(1)
const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand All @@ -253,6 +255,7 @@ describe('Metadata Controller', () => {
expect.assertions(1)
const sig = sigUtil.signTypedData(privateKey2, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down Expand Up @@ -290,6 +293,7 @@ describe('Metadata Controller', () => {

const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down Expand Up @@ -337,6 +341,7 @@ describe('Metadata Controller', () => {

const sig = sigUtil.signTypedData(privateKey, {
data: typedData,
from: '',
})

let response = await request(app)
Expand Down
3 changes: 3 additions & 0 deletions locksmith/__tests__/controllers/purchaseController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe('Purchase Controller', () => {
let typedData = generateTypedData(message)

const sig = sigUtil.signTypedData(privateKey, {
from: '',
data: typedData,
})

Expand Down Expand Up @@ -111,6 +112,7 @@ describe('Purchase Controller', () => {
let typedData = generateTypedData(message)

const sig = sigUtil.signTypedData(privateKey, {
from: '',
data: typedData,
})
it('responds with a 412', async () => {
Expand All @@ -135,6 +137,7 @@ describe('Purchase Controller', () => {

let typedData = generateTypedData(message)
const sig = sigUtil.signTypedData(privateKey, {
from: '',
data: typedData,
})
it('rejects the purchase', async () => {
Expand Down
92 changes: 58 additions & 34 deletions locksmith/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion locksmith/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"cors": "2.8.5",
"cross-env": "6.0.0",
"dotenv": "8.1.0",
"eth-sig-util": "2.2.0",
"eth-sig-util": "2.4.4",
"ethereumjs-util": "6.1.0",
"ethers": "4.0.36",
"express": "4.17.1",
Expand Down
3 changes: 2 additions & 1 deletion locksmith/scripts/metadataUpload/metadata_upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ function generateSignature(privateKey: string, data: any) {
let pk = ethJsUtil.toBuffer(privateKey)

return sigUtil.signTypedData(pk, {
data: data,
from: '',
data,
})
}

Expand Down

0 comments on commit e4867bd

Please sign in to comment.