* chore: 著作権とライセンスについての情報を各ファイルに追加する * chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * chore: Add SPDX-License-Identifier [skip ci] * add missing SPDX-License-Identifier * remove unused file --------- Co-authored-by: Shun Sakai <sorairolake@protonmail.ch> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> Co-authored-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm';
|
|
import { id } from '../id.js';
|
|
import { User } from './User.js';
|
|
|
|
@Entity()
|
|
export class AttestationChallenge {
|
|
@PrimaryColumn(id())
|
|
public id: string;
|
|
|
|
@Index()
|
|
@PrimaryColumn(id())
|
|
public userId: User['id'];
|
|
|
|
@ManyToOne(type => User, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
@JoinColumn()
|
|
public user: User | null;
|
|
|
|
@Index()
|
|
@Column('varchar', {
|
|
length: 64,
|
|
comment: 'Hex-encoded sha256 hash of the challenge.',
|
|
})
|
|
public challenge: string;
|
|
|
|
@Column('timestamp with time zone', {
|
|
comment: 'The date challenge was created for expiry purposes.',
|
|
})
|
|
public createdAt: Date;
|
|
|
|
@Column('boolean', {
|
|
comment:
|
|
'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.',
|
|
default: false,
|
|
})
|
|
public registrationChallenge: boolean;
|
|
|
|
constructor(data: Partial<AttestationChallenge>) {
|
|
if (data == null) return;
|
|
|
|
for (const [k, v] of Object.entries(data)) {
|
|
(this as any)[k] = v;
|
|
}
|
|
}
|
|
}
|