Skip to content

Commit

Permalink
support discoverable signin
Browse files Browse the repository at this point in the history
  • Loading branch information
fanhousanbu committed Sep 9, 2024
1 parent 73eee2d commit eaaf43b
Show file tree
Hide file tree
Showing 11 changed files with 266 additions and 196 deletions.
123 changes: 82 additions & 41 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/seedworks.Registration"
"$ref": "#/definitions/seedworks.RegistrationByEmail"
}
}
],
Expand Down Expand Up @@ -267,7 +267,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/seedworks.RegistrationPrepare"
"$ref": "#/definitions/seedworks.RegistrationByEmail"
}
}
],
Expand All @@ -287,7 +287,7 @@ const docTemplate = `{
"tags": [
"Plugins Passkey"
],
"summary": "Finish SignUp",
"summary": "Finish SignUp By Email",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -396,14 +396,6 @@ const docTemplate = `{
],
"summary": "Finish SingIn",
"parameters": [
{
"type": "string",
"format": "email",
"description": "user email",
"name": "email",
"in": "query",
"required": true
},
{
"type": "string",
"description": "origin",
Expand Down Expand Up @@ -513,8 +505,8 @@ const docTemplate = `{
},
{
"type": "string",
"description": "nonce",
"name": "nonce",
"description": "ticket",
"name": "ticket",
"in": "query",
"required": true
}
Expand Down Expand Up @@ -604,13 +596,34 @@ const docTemplate = `{
}
}
},
"protocol.AttestationFormat": {
"type": "string",
"enum": [
"packed",
"tpm",
"android-key",
"android-safetynet",
"fido-u2f",
"apple",
"none"
],
"x-enum-varnames": [
"AttestationFormatPacked",
"AttestationFormatTPM",
"AttestationFormatAndroidKey",
"AttestationFormatAndroidSafetyNet",
"AttestationFormatFIDOUniversalSecondFactor",
"AttestationFormatApple",
"AttestationFormatNone"
]
},
"protocol.AuthenticationExtensions": {
"type": "object",
"additionalProperties": true
"additionalProperties": {}
},
"protocol.AuthenticationExtensionsClientOutputs": {
"type": "object",
"additionalProperties": true
"additionalProperties": {}
},
"protocol.AuthenticatorAssertionResponse": {
"type": "object",
Expand Down Expand Up @@ -663,13 +676,28 @@ const docTemplate = `{
"type": "integer"
}
},
"authenticatorData": {
"type": "array",
"items": {
"type": "integer"
}
},
"clientDataJSON": {
"description": "From the spec https://www.w3.org/TR/webauthn/#dom-authenticatorresponse-clientdatajson\nThis attribute contains a JSON serialization of the client data passed to the authenticator\nby the client in its call to either create() or get().",
"type": "array",
"items": {
"type": "integer"
}
},
"publicKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"publicKeyAlgorithm": {
"type": "integer"
},
"transports": {
"type": "array",
"items": {
Expand Down Expand Up @@ -717,13 +745,15 @@ const docTemplate = `{
"usb",
"nfc",
"ble",
"smart-card",
"hybrid",
"internal"
],
"x-enum-varnames": [
"USB",
"NFC",
"BLE",
"SmartCard",
"Hybrid",
"Internal"
]
Expand Down Expand Up @@ -793,13 +823,6 @@ const docTemplate = `{
"response": {
"$ref": "#/definitions/protocol.AuthenticatorAttestationResponse"
},
"transports": {
"description": "Deprecated: Transports is deprecated due to upstream changes to the API.\nUse the Transports field of AuthenticatorAttestationResponse\ninstead. Transports is kept for backward compatibility, and should not\nbe used by new clients.",
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"description": "Type is the value of the object’s interface object's [[type]] slot,\nwhich specifies the credential type represented by this object.\nThis should be type \"public-key\" for Webauthn credentials.",
"type": "string"
Expand Down Expand Up @@ -859,6 +882,12 @@ const docTemplate = `{
"attestation": {
"$ref": "#/definitions/protocol.ConveyancePreference"
},
"attestationFormats": {
"type": "array",
"items": {
"$ref": "#/definitions/protocol.AttestationFormat"
}
},
"authenticatorSelection": {
"$ref": "#/definitions/protocol.AuthenticatorSelection"
},
Expand All @@ -877,6 +906,12 @@ const docTemplate = `{
"extensions": {
"$ref": "#/definitions/protocol.AuthenticationExtensions"
},
"hints": {
"type": "array",
"items": {
"$ref": "#/definitions/protocol.PublicKeyCredentialHints"
}
},
"pubKeyCredParams": {
"type": "array",
"items": {
Expand All @@ -894,6 +929,19 @@ const docTemplate = `{
}
}
},
"protocol.PublicKeyCredentialHints": {
"type": "string",
"enum": [
"security-key",
"client-device",
"hybrid"
],
"x-enum-varnames": [
"PublicKeyCredentialHintSecurityKey",
"PublicKeyCredentialHintClientDevice",
"PublicKeyCredentialHintHybrid"
]
},
"protocol.PublicKeyCredentialRequestOptions": {
"type": "object",
"properties": {
Expand All @@ -912,6 +960,12 @@ const docTemplate = `{
"extensions": {
"$ref": "#/definitions/protocol.AuthenticationExtensions"
},
"hints": {
"type": "array",
"items": {
"$ref": "#/definitions/protocol.PublicKeyCredentialHints"
}
},
"rpId": {
"type": "string"
},
Expand All @@ -926,10 +980,6 @@ const docTemplate = `{
"protocol.RelyingPartyEntity": {
"type": "object",
"properties": {
"icon": {
"description": "A serialized URL which resolves to an image associated with the entity. For example,\nthis could be a user’s avatar or a Relying Party's logo. This URL MUST be an a priori\nauthenticated URL. Authenticators MUST accept and store a 128-byte minimum length for\nan icon member’s value. Authenticators MAY ignore an icon member’s value if its length\nis greater than 128 bytes. The URL’s scheme MAY be \"data\" to avoid fetches of the URL,\nat the cost of needing more storage.\n\nDeprecated: this has been removed from the specification recommendations.",
"type": "string"
},
"id": {
"description": "A unique identifier for the Relying Party entity, which sets the RP ID.",
"type": "string"
Expand Down Expand Up @@ -960,10 +1010,6 @@ const docTemplate = `{
"description": "A human-palatable name for the user account, intended only for display.\nFor example, \"Alex P. Müller\" or \"田中 倫\". The Relying Party SHOULD let\nthe user choose this, and SHOULD NOT restrict the choice more than necessary.",
"type": "string"
},
"icon": {
"description": "A serialized URL which resolves to an image associated with the entity. For example,\nthis could be a user’s avatar or a Relying Party's logo. This URL MUST be an a priori\nauthenticated URL. Authenticators MUST accept and store a 128-byte minimum length for\nan icon member’s value. Authenticators MAY ignore an icon member’s value if its length\nis greater than 128 bytes. The URL’s scheme MAY be \"data\" to avoid fetches of the URL,\nat the cost of needing more storage.\n\nDeprecated: this has been removed from the specification recommendations.",
"type": "string"
},
"id": {
"description": "ID is the user handle of the user account entity. To ensure secure operation,\nauthentication and authorization decisions MUST be made on the basis of this id\nmember, not the displayName nor name members. See Section 6.1 of\n[RFC8266](https://www.w3.org/TR/webauthn/#biblio-rfc8266)."
},
Expand Down Expand Up @@ -1043,7 +1089,7 @@ const docTemplate = `{
}
}
},
"seedworks.Registration": {
"seedworks.RegistrationByEmail": {
"type": "object",
"properties": {
"captcha": {
Expand All @@ -1057,14 +1103,6 @@ const docTemplate = `{
}
}
},
"seedworks.RegistrationPrepare": {
"type": "object",
"properties": {
"email": {
"type": "string"
}
}
},
"seedworks.SiginIn": {
"type": "object",
"properties": {
Expand All @@ -1082,10 +1120,10 @@ const docTemplate = `{
"seedworks.TxSignature": {
"type": "object",
"properties": {
"nonce": {
"origin": {
"type": "string"
},
"origin": {
"ticket": {
"type": "string"
},
"txdata": {
Expand All @@ -1096,6 +1134,9 @@ const docTemplate = `{
"seedworks.TxSignatureResult": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"code": {
"type": "integer"
},
Expand Down
Loading

0 comments on commit eaaf43b

Please sign in to comment.