Skip to content

Instantly share code, notes, and snippets.

@Firehed
Last active February 5, 2024 20:45
Show Gist options
  • Save Firehed/6420f188b8494151e549b2fdeec93dd2 to your computer and use it in GitHub Desktop.
Save Firehed/6420f188b8494151e549b2fdeec93dd2 to your computer and use it in GitHub Desktop.
API POC
{
"openapi": "3.0.0",
"components": {
"examples": {},
"headers": {},
"parameters": {},
"requestBodies": {},
"responses": {},
"schemas": {
"Base64URLString": {
"type": "string"
},
"Milliseconds": {
"type": "number",
"format": "double"
},
"DOMString": {
"type": "string"
},
"Transport": {
"type": "string",
"enum": [
"usb",
"nfc",
"ble",
"smart-card",
"hybrid",
"internal"
]
},
"PublicKeyCredentialDescriptorJSON": {
"properties": {
"id": {
"$ref": "#/components/schemas/Base64URLString"
},
"type": {
"$ref": "#/components/schemas/DOMString"
},
"transports": {
"items": {
"$ref": "#/components/schemas/Transport"
},
"type": "array"
}
},
"required": [
"id",
"type"
],
"type": "object",
"additionalProperties": false
},
"ResidentKeyRequirement": {
"type": "string",
"enum": [
"discouraged",
"preferred",
"required"
]
},
"PublicKeyCredentialHint": {
"type": "string",
"enum": [
"security-key",
"client-device",
"hybrid"
]
},
"AttestationConveyancePreference": {
"type": "string",
"enum": [
"none",
"indirect",
"direct",
"enterprise"
]
},
"AuthenticationExtensionsClientInputsJSON": {
"properties": {},
"type": "object",
"additionalProperties": false
},
"PublicKeyCredentialRequestOptionsJSON": {
"properties": {
"challenge": {
"$ref": "#/components/schemas/Base64URLString"
},
"timeout": {
"$ref": "#/components/schemas/Milliseconds"
},
"rpId": {
"$ref": "#/components/schemas/DOMString"
},
"allowCredentials": {
"items": {
"$ref": "#/components/schemas/PublicKeyCredentialDescriptorJSON"
},
"type": "array"
},
"userVerification": {
"$ref": "#/components/schemas/ResidentKeyRequirement"
},
"hints": {
"items": {
"$ref": "#/components/schemas/PublicKeyCredentialHint"
},
"type": "array"
},
"attestation": {
"$ref": "#/components/schemas/AttestationConveyancePreference"
},
"extensions": {
"$ref": "#/components/schemas/AuthenticationExtensionsClientInputsJSON"
}
},
"required": [
"challenge",
"rpId",
"extensions"
],
"type": "object",
"additionalProperties": false
},
"Wrapped_PublicKeyCredentialRequestOptionsJSON_": {
"properties": {
"data": {
"$ref": "#/components/schemas/PublicKeyCredentialRequestOptionsJSON"
}
},
"required": [
"data"
],
"type": "object"
},
"UserIdOrHandle": {
"anyOf": [
{
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
},
{
"properties": {
"handle": {
"type": "string"
}
},
"required": [
"handle"
],
"type": "object"
}
]
},
"AuthCreateOptions": {
"properties": {
"user": {
"$ref": "#/components/schemas/UserIdOrHandle"
}
},
"type": "object",
"additionalProperties": false
},
"UnixTimestamp": {
"type": "number",
"format": "double"
},
"AuthToken": {
"properties": {
"token": {
"type": "string"
},
"expiresAt": {
"$ref": "#/components/schemas/UnixTimestamp"
}
},
"required": [
"token",
"expiresAt"
],
"type": "object",
"additionalProperties": false
},
"Wrapped_AuthToken_": {
"properties": {
"data": {
"$ref": "#/components/schemas/AuthToken"
}
},
"required": [
"data"
],
"type": "object"
},
"AuthenticatorAssertionResponseJSON": {
"properties": {
"clientDataJSON": {
"$ref": "#/components/schemas/Base64URLString"
},
"authenticatorData": {
"$ref": "#/components/schemas/Base64URLString"
},
"signature": {
"$ref": "#/components/schemas/Base64URLString"
},
"userHandle": {
"$ref": "#/components/schemas/Base64URLString"
},
"attestationObject": {
"$ref": "#/components/schemas/Base64URLString"
}
},
"required": [
"clientDataJSON",
"authenticatorData",
"signature"
],
"type": "object",
"additionalProperties": false
},
"AuthenticationResponseJSON": {
"properties": {
"id": {
"$ref": "#/components/schemas/Base64URLString"
},
"rawId": {
"$ref": "#/components/schemas/Base64URLString"
},
"response": {
"$ref": "#/components/schemas/AuthenticatorAssertionResponseJSON"
},
"authenticatorAttachment": {
"$ref": "#/components/schemas/DOMString"
},
"type": {
"$ref": "#/components/schemas/DOMString"
}
},
"required": [
"id",
"rawId",
"response",
"type"
],
"type": "object",
"additionalProperties": false
},
"Auth": {
"properties": {
"id": {
"type": "string"
},
"user": {
"properties": {
"handle": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"handle",
"id"
],
"type": "object"
}
},
"required": [
"id",
"user"
],
"type": "object",
"additionalProperties": false
},
"Wrapped_Auth_": {
"properties": {
"data": {
"$ref": "#/components/schemas/Auth"
}
},
"required": [
"data"
],
"type": "object"
},
"VerifyParams": {
"properties": {
"token": {
"type": "string"
}
},
"required": [
"token"
],
"type": "object",
"additionalProperties": false
},
"Credential": {
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"additionalProperties": false
},
"AttachParams": {
"properties": {
"token": {
"type": "string"
},
"user": {
"properties": {
"handle": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"handle",
"id"
],
"type": "object"
}
},
"required": [
"token",
"user"
],
"type": "object",
"additionalProperties": false
}
},
"securitySchemes": {}
},
"info": {
"title": "apidocs",
"version": "1.0.0",
"license": {
"name": "MIT"
},
"contact": {
"name": "Eric Stern ",
"email": "[email protected]"
}
},
"paths": {
"/auth/createOptions": {
"post": {
"operationId": "Generate options for navigator.credentials.create",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Wrapped_PublicKeyCredentialRequestOptionsJSON_"
}
}
}
}
},
"tags": [
"Authentication"
],
"security": [
{
"publishable_key": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthCreateOptions"
}
}
}
}
}
},
"/auth/process": {
"post": {
"operationId": "Process raw auth credential",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Wrapped_AuthToken_"
}
}
}
}
},
"tags": [
"Authentication"
],
"security": [
{
"publishable_key": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthenticationResponseJSON"
}
}
}
}
}
},
"/auth/verify": {
"post": {
"operationId": "Verify auth token",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Wrapped_Auth_"
}
}
}
}
},
"tags": [
"Authentication"
],
"security": [
{
"secret_key": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VerifyParams"
}
}
}
}
}
},
"/registration/attach": {
"post": {
"operationId": "Handle",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Credential"
}
}
}
}
},
"security": [
{
"secret_key": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AttachParams"
}
}
}
}
}
}
},
"servers": [
{
"url": "/"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment