lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

current_session.v1.json (9503B)


      1 {
      2   "suite": "nip46_current_session",
      3   "contract_version": "1.0.0",
      4   "vectors": [
      5     {
      6       "id": "nip46_connect_legacy_one_parameter_001",
      7       "kind": "nip46.request.valid",
      8       "input": {
      9         "message": {
     10           "id": "connect-legacy-1",
     11           "method": "connect",
     12           "params": [
     13             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df"
     14           ]
     15         }
     16       },
     17       "expected": {
     18         "normalized_message": {
     19           "id": "connect-legacy-1",
     20           "method": "connect",
     21           "params": [
     22             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df"
     23           ]
     24         }
     25       }
     26     },
     27     {
     28       "id": "nip46_connect_legacy_two_parameters_002",
     29       "kind": "nip46.request.valid",
     30       "input": {
     31         "message": {
     32           "id": "connect-legacy-2",
     33           "method": "connect",
     34           "params": [
     35             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     36             "fixture-client-secret"
     37           ]
     38         }
     39       },
     40       "expected": {
     41         "normalized_message": {
     42           "id": "connect-legacy-2",
     43           "method": "connect",
     44           "params": [
     45             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     46             "fixture-client-secret"
     47           ]
     48         }
     49       }
     50     },
     51     {
     52       "id": "nip46_connect_legacy_three_parameters_003",
     53       "kind": "nip46.request.valid",
     54       "input": {
     55         "message": {
     56           "id": "connect-legacy-3",
     57           "method": "connect",
     58           "params": [
     59             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     60             "fixture-client-secret",
     61             "nip44_encrypt,sign_event:1"
     62           ]
     63         }
     64       },
     65       "expected": {
     66         "normalized_message": {
     67           "id": "connect-legacy-3",
     68           "method": "connect",
     69           "params": [
     70             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     71             "fixture-client-secret",
     72             "nip44_encrypt,sign_event:1"
     73           ]
     74         }
     75       }
     76     },
     77     {
     78       "id": "nip46_connect_current_metadata_004",
     79       "kind": "nip46.request.valid",
     80       "input": {
     81         "message": {
     82           "id": "connect-current",
     83           "method": "connect",
     84           "params": [
     85             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     86             "fixture-client-secret",
     87             "nip44_encrypt,sign_event:1",
     88             "{\"name\":\" Example Client \",\"url\":\"https://app.example.com\",\"image\":\"https://cdn.example.com/logo.png\"}"
     89           ]
     90         }
     91       },
     92       "expected": {
     93         "normalized_message": {
     94           "id": "connect-current",
     95           "method": "connect",
     96           "params": [
     97             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
     98             "fixture-client-secret",
     99             "nip44_encrypt,sign_event:1",
    100             "{\"name\":\"Example Client\",\"url\":\"https://app.example.com/\",\"image\":\"https://cdn.example.com/logo.png\"}"
    101           ]
    102         }
    103       }
    104     },
    105     {
    106       "id": "nip46_metadata_name_bound_005",
    107       "kind": "nip46.metadata.invalid",
    108       "input": {
    109         "field": "name",
    110         "repeat": "a",
    111         "count": 129
    112       },
    113       "expected": {
    114         "error": "invalid_client_metadata"
    115       }
    116     },
    117     {
    118       "id": "nip46_connect_malformed_metadata_006",
    119       "kind": "nip46.request.invalid",
    120       "input": {
    121         "message": {
    122           "id": "connect-invalid-metadata",
    123           "method": "connect",
    124           "params": [
    125             "585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df",
    126             "",
    127             "",
    128             "{\"name\":\"\"}"
    129           ]
    130         }
    131       },
    132       "expected": {
    133         "error": "invalid_client_metadata"
    134       }
    135     },
    136     {
    137       "id": "nip46_nostrconnect_ordered_relays_007",
    138       "kind": "nip46.uri.valid",
    139       "input": {
    140         "uri": "nostrconnect://585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df?relay=wss%3A%2F%2Frelay.example.com&relay=wss%3A%2F%2Frelay-2.example.com&secret=fixture-client-secret&perms=nip44_encrypt%2Csign_event%3A1&name=+Example+Client+&url=https%3A%2F%2Fapp.example.com&image=https%3A%2F%2Fcdn.example.com%2Flogo.png"
    141       },
    142       "expected": {
    143         "variant": "nostrconnect",
    144         "relays": [
    145           "wss://relay.example.com",
    146           "wss://relay-2.example.com"
    147         ],
    148         "secret": "fixture-client-secret",
    149         "metadata": {
    150           "name": "Example Client",
    151           "url": "https://app.example.com/",
    152           "image": "https://cdn.example.com/logo.png",
    153           "permissions": "nip44_encrypt,sign_event:1"
    154         }
    155       }
    156     },
    157     {
    158       "id": "nip46_nostrconnect_secret_required_008",
    159       "kind": "nip46.uri.invalid",
    160       "input": {
    161         "uri": "nostrconnect://585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df?relay=wss%3A%2F%2Frelay.example.com"
    162       },
    163       "expected": {
    164         "error": "missing_secret"
    165       }
    166     },
    167     {
    168       "id": "nip46_bunker_secret_optional_009",
    169       "kind": "nip46.uri.valid",
    170       "input": {
    171         "uri": "bunker://585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df?relay=wss%3A%2F%2Frelay.example.com"
    172       },
    173       "expected": {
    174         "variant": "bunker",
    175         "relays": [
    176           "wss://relay.example.com"
    177         ],
    178         "secret": null
    179       }
    180     },
    181     {
    182       "id": "nip46_bunker_secret_present_010",
    183       "kind": "nip46.uri.valid",
    184       "input": {
    185         "uri": "bunker://585591529da0bab31b3b1b1f986611cf5f435dca84f978c89ee8a40cca7103df?relay=wss%3A%2F%2Frelay.example.com&secret=fixture-bunker-secret"
    186       },
    187       "expected": {
    188         "variant": "bunker",
    189         "relays": [
    190           "wss://relay.example.com"
    191         ],
    192         "secret": "fixture-bunker-secret"
    193       }
    194     },
    195     {
    196       "id": "nip46_connect_secret_echo_011",
    197       "kind": "nip46.response.valid",
    198       "input": {
    199         "method": "connect",
    200         "envelope": {
    201           "id": "connect-current",
    202           "result": "fixture-client-secret"
    203         }
    204       },
    205       "expected": {
    206         "normalized_envelope": {
    207           "id": "connect-current",
    208           "result": "fixture-client-secret"
    209         }
    210       }
    211     },
    212     {
    213       "id": "nip46_switch_relays_ordered_012",
    214       "kind": "nip46.response.valid",
    215       "input": {
    216         "method": "switch_relays",
    217         "envelope": {
    218           "id": "switch-relays",
    219           "result": [
    220             "wss://relay-2.example.com",
    221             "wss://relay-3.example.com"
    222           ]
    223         }
    224       },
    225       "expected": {
    226         "normalized_envelope": {
    227           "id": "switch-relays",
    228           "result": [
    229             "wss://relay-2.example.com",
    230             "wss://relay-3.example.com"
    231           ]
    232         }
    233       }
    234     },
    235     {
    236       "id": "nip46_switch_relays_unchanged_013",
    237       "kind": "nip46.response.valid",
    238       "input": {
    239         "method": "switch_relays",
    240         "envelope": {
    241           "id": "switch-relays-unchanged",
    242           "result": null
    243         }
    244       },
    245       "expected": {
    246         "normalized_envelope": {
    247           "id": "switch-relays-unchanged",
    248           "result": null
    249         }
    250       }
    251     },
    252     {
    253       "id": "nip46_auth_url_continuation_014",
    254       "kind": "nip46.response.valid",
    255       "input": {
    256         "method": "sign_event",
    257         "envelope": {
    258           "id": "sign-with-auth",
    259           "result": "auth_url",
    260           "error": "https://auth.example.com/challenge"
    261         }
    262       },
    263       "expected": {
    264         "normalized_envelope": {
    265           "id": "sign-with-auth",
    266           "result": "auth_url",
    267           "error": "https://auth.example.com/challenge"
    268         }
    269       }
    270     },
    271     {
    272       "id": "nip46_logout_request_015",
    273       "kind": "nip46.request.valid",
    274       "input": {
    275         "message": {
    276           "id": "logout-current",
    277           "method": "logout",
    278           "params": []
    279         }
    280       },
    281       "expected": {
    282         "normalized_message": {
    283           "id": "logout-current",
    284           "method": "logout",
    285           "params": []
    286         }
    287       }
    288     },
    289     {
    290       "id": "nip46_logout_acknowledgement_016",
    291       "kind": "nip46.response.valid",
    292       "input": {
    293         "method": "logout",
    294         "envelope": {
    295           "id": "logout-current",
    296           "result": "ack"
    297         }
    298       },
    299       "expected": {
    300         "normalized_envelope": {
    301           "id": "logout-current",
    302           "result": "ack"
    303         }
    304       }
    305     },
    306     {
    307       "id": "nip46_logout_rejects_parameters_017",
    308       "kind": "nip46.request.invalid",
    309       "input": {
    310         "message": {
    311           "id": "logout-invalid",
    312           "method": "logout",
    313           "params": [
    314             "unexpected"
    315           ]
    316         }
    317       },
    318       "expected": {
    319         "error": "invalid_params"
    320       }
    321     },
    322     {
    323       "id": "nip46_malformed_response_result_018",
    324       "kind": "nip46.response.invalid",
    325       "input": {
    326         "method": "ping",
    327         "envelope": {
    328           "id": "ping-invalid",
    329           "result": 7
    330         }
    331       },
    332       "expected": {
    333         "error": "invalid_response_payload"
    334       }
    335     },
    336     {
    337       "id": "nip46_malformed_response_missing_result_019",
    338       "kind": "nip46.response.invalid",
    339       "input": {
    340         "method": "logout",
    341         "envelope": {
    342           "id": "logout-missing-result"
    343         }
    344       },
    345       "expected": {
    346         "error": "missing_result"
    347       }
    348     }
    349   ]
    350 }