(tokenHash: string, record: PersistedRefreshTokenRecord)
| 120 | } |
| 121 | |
| 122 | saveRefreshToken(tokenHash: string, record: PersistedRefreshTokenRecord): void { |
| 123 | this.database.sqlite |
| 124 | .prepare( |
| 125 | `insert into oauth_refresh_tokens (token_hash, client_id, scopes_json, expires_at, resource) |
| 126 | values (?, ?, ?, ?, ?) |
| 127 | on conflict(token_hash) do update set |
| 128 | client_id = excluded.client_id, |
| 129 | scopes_json = excluded.scopes_json, |
| 130 | expires_at = excluded.expires_at, |
| 131 | resource = excluded.resource`, |
| 132 | ) |
| 133 | .run( |
| 134 | tokenHash, |
| 135 | record.clientId, |
| 136 | JSON.stringify(record.scopes), |
| 137 | record.expiresAt, |
| 138 | record.resource ?? null, |
| 139 | ); |
| 140 | } |
| 141 | |
| 142 | saveTokenPair(pair: PersistedTokenPair, consumedRefreshTokenHash?: string): boolean { |
| 143 | const save = this.database.sqlite.transaction(() => { |
no outgoing calls