Skip to content

Commit

Permalink
Ozone signature methods (bluesky-social#2855)
Browse files Browse the repository at this point in the history
* lexicons

* fix typo & add proxy routes

* changeset
  • Loading branch information
dholms authored Oct 3, 2024
1 parent a611a5f commit df14df5
Show file tree
Hide file tree
Showing 24 changed files with 1,443 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/flat-actors-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@atproto/ozone": patch
"@atproto/api": patch
---

Add tools.ozone.signature lexicons
14 changes: 14 additions & 0 deletions lexicons/tools/ozone/signature/defs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"lexicon": 1,
"id": "tools.ozone.signature.defs",
"defs": {
"sigDetail": {
"type": "object",
"required": ["property", "value"],
"properties": {
"property": { "type": "string" },
"value": { "type": "string" }
}
}
}
}
39 changes: 39 additions & 0 deletions lexicons/tools/ozone/signature/findCorrelation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"lexicon": 1,
"id": "tools.ozone.signature.findCorrelation",
"defs": {
"main": {
"type": "query",
"description": "Find all correlated threat signatures between 2 or more accounts.",
"parameters": {
"type": "params",
"required": ["dids"],
"properties": {
"dids": {
"type": "array",
"items": {
"type": "string",
"format": "did"
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["details"],
"properties": {
"details": {
"type": "array",
"items": {
"type": "ref",
"ref": "tools.ozone.signature.defs#sigDetail"
}
}
}
}
}
}
}
}
61 changes: 61 additions & 0 deletions lexicons/tools/ozone/signature/findRelatedAccounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"lexicon": 1,
"id": "tools.ozone.signature.findRelatedAccounts",
"defs": {
"main": {
"type": "query",
"description": "Get accounts that share some matching threat signatures with the root account.",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": {
"type": "string",
"format": "did"
},
"cursor": { "type": "string" },
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 50
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["accounts"],
"properties": {
"cursor": { "type": "string" },
"accounts": {
"type": "array",
"items": {
"type": "ref",
"ref": "#relatedAccount"
}
}
}
}
}
},
"relatedAccount": {
"type": "object",
"required": ["account"],
"properties": {
"account": {
"type": "ref",
"ref": "com.atproto.admin.defs#accountView"
},
"similarities": {
"type": "array",
"items": {
"type": "ref",
"ref": "tools.ozone.signature.defs#sigDetail"
}
}
}
}
}
}
46 changes: 46 additions & 0 deletions lexicons/tools/ozone/signature/searchAccounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"lexicon": 1,
"id": "tools.ozone.signature.searchAccounts",
"defs": {
"main": {
"type": "query",
"description": "Search for accounts that match one or more threat signature values.",
"parameters": {
"type": "params",
"required": ["values"],
"properties": {
"values": {
"type": "array",
"items": {
"type": "string"
}
},
"cursor": { "type": "string" },
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 50
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["accounts"],
"properties": {
"cursor": { "type": "string" },
"accounts": {
"type": "array",
"items": {
"type": "ref",
"ref": "com.atproto.admin.defs#accountView"
}
}
}
}
}
}
}
}
54 changes: 54 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ import * as ToolsOzoneModerationQueryEvents from './types/tools/ozone/moderation
import * as ToolsOzoneModerationQueryStatuses from './types/tools/ozone/moderation/queryStatuses'
import * as ToolsOzoneModerationSearchRepos from './types/tools/ozone/moderation/searchRepos'
import * as ToolsOzoneServerGetConfig from './types/tools/ozone/server/getConfig'
import * as ToolsOzoneSignatureDefs from './types/tools/ozone/signature/defs'
import * as ToolsOzoneSignatureFindCorrelation from './types/tools/ozone/signature/findCorrelation'
import * as ToolsOzoneSignatureFindRelatedAccounts from './types/tools/ozone/signature/findRelatedAccounts'
import * as ToolsOzoneSignatureSearchAccounts from './types/tools/ozone/signature/searchAccounts'
import * as ToolsOzoneTeamAddMember from './types/tools/ozone/team/addMember'
import * as ToolsOzoneTeamDefs from './types/tools/ozone/team/defs'
import * as ToolsOzoneTeamDeleteMember from './types/tools/ozone/team/deleteMember'
Expand Down Expand Up @@ -414,6 +418,10 @@ export * as ToolsOzoneModerationQueryEvents from './types/tools/ozone/moderation
export * as ToolsOzoneModerationQueryStatuses from './types/tools/ozone/moderation/queryStatuses'
export * as ToolsOzoneModerationSearchRepos from './types/tools/ozone/moderation/searchRepos'
export * as ToolsOzoneServerGetConfig from './types/tools/ozone/server/getConfig'
export * as ToolsOzoneSignatureDefs from './types/tools/ozone/signature/defs'
export * as ToolsOzoneSignatureFindCorrelation from './types/tools/ozone/signature/findCorrelation'
export * as ToolsOzoneSignatureFindRelatedAccounts from './types/tools/ozone/signature/findRelatedAccounts'
export * as ToolsOzoneSignatureSearchAccounts from './types/tools/ozone/signature/searchAccounts'
export * as ToolsOzoneTeamAddMember from './types/tools/ozone/team/addMember'
export * as ToolsOzoneTeamDefs from './types/tools/ozone/team/defs'
export * as ToolsOzoneTeamDeleteMember from './types/tools/ozone/team/deleteMember'
Expand Down Expand Up @@ -3396,13 +3404,15 @@ export class ToolsOzoneNS {
communication: ToolsOzoneCommunicationNS
moderation: ToolsOzoneModerationNS
server: ToolsOzoneServerNS
signature: ToolsOzoneSignatureNS
team: ToolsOzoneTeamNS

constructor(client: XrpcClient) {
this._client = client
this.communication = new ToolsOzoneCommunicationNS(client)
this.moderation = new ToolsOzoneModerationNS(client)
this.server = new ToolsOzoneServerNS(client)
this.signature = new ToolsOzoneSignatureNS(client)
this.team = new ToolsOzoneTeamNS(client)
}
}
Expand Down Expand Up @@ -3594,6 +3604,50 @@ export class ToolsOzoneServerNS {
}
}

export class ToolsOzoneSignatureNS {
_client: XrpcClient

constructor(client: XrpcClient) {
this._client = client
}

findCorrelation(
params?: ToolsOzoneSignatureFindCorrelation.QueryParams,
opts?: ToolsOzoneSignatureFindCorrelation.CallOptions,
): Promise<ToolsOzoneSignatureFindCorrelation.Response> {
return this._client.call(
'tools.ozone.signature.findCorrelation',
params,
undefined,
opts,
)
}

findRelatedAccounts(
params?: ToolsOzoneSignatureFindRelatedAccounts.QueryParams,
opts?: ToolsOzoneSignatureFindRelatedAccounts.CallOptions,
): Promise<ToolsOzoneSignatureFindRelatedAccounts.Response> {
return this._client.call(
'tools.ozone.signature.findRelatedAccounts',
params,
undefined,
opts,
)
}

searchAccounts(
params?: ToolsOzoneSignatureSearchAccounts.QueryParams,
opts?: ToolsOzoneSignatureSearchAccounts.CallOptions,
): Promise<ToolsOzoneSignatureSearchAccounts.Response> {
return this._client.call(
'tools.ozone.signature.searchAccounts',
params,
undefined,
opts,
)
}
}

export class ToolsOzoneTeamNS {
_client: XrpcClient

Expand Down
Loading

0 comments on commit df14df5

Please sign in to comment.