diff --git a/doc/api.oa3 b/doc/api.oa3 index f715f3af..43616964 100644 --- a/doc/api.oa3 +++ b/doc/api.oa3 @@ -633,7 +633,76 @@ paths: application/json: schema: type: boolean - + + /account/authentication: + post: + tags: + - account + description: Enable multi-factor authentication + operationId: add-mfa + parameters: + - name: agent + in: query + description: agent token + required: false + schema: + type: string + responses: + '201': + description: success + content: + application/json: + schema: + type: string + '401': + description: permission denied + '500': + description: internal server error + put: + tags: + - account + description: Confirm multi-factor authentication + operationId: confirm-mfa + parameters: + - name: agent + in: query + description: agent token + required: false + schema: + type: string + - name: code + in: query + description: totp code generated from secret + required: true + schema: + type: string + responses: + '200': + description: success + '401': + description: permission denied + '500': + description: internal server error + delete: + tags: + - account + description: Disable multi-factor authentication + operationId: remove-mfa + parameters: + - name: agent + in: query + description: agent token + required: false + schema: + type: string + responses: + '200': + description: success + '401': + description: permission denied + '500': + description: internal server error + /account/login: put: tags: @@ -849,6 +918,12 @@ paths: security: - basicAuth: [] parameters: + - name: code + in: query + description: totp code + required: false + schema: + type: string - name: appName in: query description: name of connecting app @@ -898,8 +973,12 @@ paths: description: invalid token '406': description: app limit reached + '409': + description: totp code required but not set '410': description: account disabled + '429': + description: temporarily locked due to too many failures '500': description: internal server error requestBody: @@ -3942,6 +4021,7 @@ components: - forwardingAddress - searchable - pushEnabled + - multiFactorAuth properties: disabled: type: boolean @@ -3965,6 +4045,8 @@ components: $ref: '#/components/schemas/Seal' enableIce: type: boolean + multiFactorAuth: + type: boolean AccountProfile: type: object diff --git a/net/server/go.mod b/net/server/go.mod index 010ae6f4..dfec0fec 100644 --- a/net/server/go.mod +++ b/net/server/go.mod @@ -17,6 +17,7 @@ require ( ) require ( + github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/jinzhu/inflection v1.0.0 // indirect @@ -24,6 +25,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pquerna/otp v1.4.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect golang.org/x/net v0.23.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/net/server/go.sum b/net/server/go.sum index 9b9b2217..de4cfefb 100644 --- a/net/server/go.sum +++ b/net/server/go.sum @@ -1,3 +1,5 @@ +github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI= +github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -27,10 +29,13 @@ github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxU github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pquerna/otp v1.4.0 h1:wZvl1TIVxKRThZIBiwOOHOGP/1+nZyWBil9Y2XNEDzg= +github.com/pquerna/otp v1.4.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/theckman/go-securerandom v0.1.1 h1:5KctSyM0D5KKFK+bsypIyLq7yik0CEaI5i2fGcUGcsQ=