1. ed25519キーペアを発行・Personとして公開鍵を送受信

This commit is contained in:
tamaina 2024-02-26 20:49:40 +00:00
parent 0fb7b98f96
commit 02dfe0a3d5
13 changed files with 274 additions and 36 deletions

View file

@ -18,16 +18,56 @@ export class MiUserKeypair {
@JoinColumn()
public user: MiUser | null;
/**
* RSA public key
*/
@Column('varchar', {
length: 4096,
})
public publicKey: string;
/**
* RSA private key
*/
@Column('varchar', {
length: 4096,
})
public privateKey: string;
@Column('varchar', {
length: 128,
nullable: true,
default: null,
})
public ed25519PublicKey: string | null;
@Column('varchar', {
length: 128,
nullable: true,
default: null,
})
public ed25519PrivateKey: string | null;
/**
* Signature of ed25519PublicKey, signed by privateKey. (base64)
*/
@Column('varchar', {
length: 720,
nullable: true,
default: null,
})
public ed25519PublicKeySignature: string | null;
/**
* Signature algorithm of ed25519PublicKeySignature.
*/
@Column('varchar', {
length: 32,
nullable: true,
default: null,
})
public ed25519SignatureAlgorithm: string | null;
constructor(data: Partial<MiUserKeypair>) {
if (data == null) return;

View file

@ -9,7 +9,13 @@ import { MiUser } from './User.js';
@Entity('user_publickey')
export class MiUserPublickey {
@PrimaryColumn(id())
@PrimaryColumn('varchar', {
length: 256,
})
public keyId: string;
@Index()
@Column(id())
public userId: MiUser['id'];
@OneToOne(type => MiUser, {
@ -18,12 +24,6 @@ export class MiUserPublickey {
@JoinColumn()
public user: MiUser | null;
@Index({ unique: true })
@Column('varchar', {
length: 256,
})
public keyId: string;
@Column('varchar', {
length: 4096,
})